@@ -4,6 +4,9 @@ import Link from "@material-ui/core/Link"
4
4
import { makeStyles } from "@material-ui/core/styles"
5
5
import Tooltip from "@material-ui/core/Tooltip"
6
6
import ComputerIcon from "@material-ui/icons/Computer"
7
+ import PublicOutlinedIcon from "@material-ui/icons/PublicOutlined"
8
+ import LockOutlinedIcon from "@material-ui/icons/LockOutlined"
9
+ import GroupOutlinedIcon from "@material-ui/icons/GroupOutlined"
7
10
import ErrorOutlineIcon from "@material-ui/icons/ErrorOutline"
8
11
import { FC , PropsWithChildren } from "react"
9
12
import * as TypesGen from "../../api/typesGenerated"
@@ -23,6 +26,7 @@ export interface AppLinkProps {
23
26
appIcon ?: TypesGen . WorkspaceApp [ "icon" ]
24
27
appCommand ?: TypesGen . WorkspaceApp [ "command" ]
25
28
appSubdomain : TypesGen . WorkspaceApp [ "subdomain" ]
29
+ appSharingLevel : TypesGen . WorkspaceApp [ "sharing_level" ]
26
30
health : TypesGen . WorkspaceApp [ "health" ]
27
31
}
28
32
@@ -35,6 +39,7 @@ export const AppLink: FC<PropsWithChildren<AppLinkProps>> = ({
35
39
appIcon,
36
40
appCommand,
37
41
appSubdomain,
42
+ appSharingLevel,
38
43
health,
39
44
} ) => {
40
45
const styles = useStyles ( )
@@ -60,36 +65,50 @@ export const AppLink: FC<PropsWithChildren<AppLinkProps>> = ({
60
65
) : (
61
66
< ComputerIcon />
62
67
)
63
- let tooltip = ""
68
+
69
+ let shareIcon = < LockOutlinedIcon />
70
+ let shareTooltip = "Private, only accessible by you"
71
+ if ( appSharingLevel === "authenticated" ) {
72
+ shareIcon = < GroupOutlinedIcon />
73
+ shareTooltip = "Shared with all authenticated users"
74
+ }
75
+ if ( appSharingLevel === "public" ) {
76
+ shareIcon = < PublicOutlinedIcon />
77
+ shareTooltip = "Shared publicly"
78
+ }
79
+
80
+ let primaryTooltip = ""
64
81
if ( health === "initializing" ) {
65
82
canClick = false
66
83
icon = < CircularProgress size = { 16 } />
67
- tooltip = "Initializing..."
84
+ primaryTooltip = "Initializing..."
68
85
}
69
86
if ( health === "unhealthy" ) {
70
87
canClick = false
71
88
icon = < ErrorOutlineIcon className = { styles . unhealthyIcon } />
72
- tooltip = "Unhealthy"
89
+ primaryTooltip = "Unhealthy"
73
90
}
74
91
if ( ! appsHost && appSubdomain ) {
75
92
canClick = false
76
93
icon = < ErrorOutlineIcon className = { styles . notConfiguredIcon } />
77
- tooltip = "Your admin has not configured subdomain application access"
94
+ primaryTooltip =
95
+ "Your admin has not configured subdomain application access"
78
96
}
79
97
80
98
const button = (
81
99
< Button
82
100
size = "small"
83
101
startIcon = { icon }
102
+ endIcon = { < Tooltip title = { shareTooltip } > { shareIcon } </ Tooltip > }
84
103
className = { styles . button }
85
104
disabled = { ! canClick }
86
105
>
87
- { appName }
106
+ < span className = { styles . appName } > { appName } </ span >
88
107
</ Button >
89
108
)
90
109
91
110
return (
92
- < Tooltip title = { tooltip } >
111
+ < Tooltip title = { primaryTooltip } >
93
112
< span >
94
113
< Link
95
114
href = { href }
@@ -136,4 +155,8 @@ const useStyles = makeStyles((theme) => ({
136
155
notConfiguredIcon : {
137
156
color : theme . palette . grey [ 300 ] ,
138
157
} ,
158
+
159
+ appName : {
160
+ marginRight : theme . spacing ( 1 ) ,
161
+ } ,
139
162
} ) )
0 commit comments