@@ -6,7 +6,7 @@ import TableHead from "@material-ui/core/TableHead"
6
6
import TableRow from "@material-ui/core/TableRow"
7
7
import useTheme from "@material-ui/styles/useTheme"
8
8
import { FC } from "react"
9
- import { Workspace , WorkspaceResource } from "../../api/typesGenerated"
9
+ import { User , Workspace , WorkspaceResource } from "../../api/typesGenerated"
10
10
import { getDisplayAgentStatus } from "../../util/workspace"
11
11
import { AppLink } from "../AppLink/AppLink"
12
12
import { Stack } from "../Stack/Stack"
@@ -27,9 +27,10 @@ interface ResourcesProps {
27
27
resources ?: WorkspaceResource [ ]
28
28
getResourcesError ?: Error
29
29
workspace : Workspace
30
+ user ?: User
30
31
}
31
32
32
- export const Resources : FC < ResourcesProps > = ( { resources, getResourcesError, workspace } ) => {
33
+ export const Resources : FC < ResourcesProps > = ( { resources, getResourcesError, workspace, user } ) => {
33
34
const styles = useStyles ( )
34
35
const theme : Theme = useTheme ( )
35
36
@@ -43,7 +44,7 @@ export const Resources: FC<ResourcesProps> = ({ resources, getResourcesError, wo
43
44
< TableHeaderRow >
44
45
< TableCell > { Language . resourceLabel } </ TableCell >
45
46
< TableCell className = { styles . agentColumn } > { Language . agentLabel } </ TableCell >
46
- < TableCell > { Language . accessLabel } </ TableCell >
47
+ { user ?. username === workspace . owner_name && < TableCell > { Language . accessLabel } </ TableCell > }
47
48
< TableCell > { Language . statusLabel } </ TableCell >
48
49
</ TableHeaderRow >
49
50
</ TableHead >
@@ -84,28 +85,30 @@ export const Resources: FC<ResourcesProps> = ({ resources, getResourcesError, wo
84
85
{ agent . name }
85
86
< span className = { styles . operatingSystem } > { agent . operating_system } </ span >
86
87
</ TableCell >
87
- < TableCell >
88
- < Stack >
89
- { agent . status === "connected" && (
90
- < TerminalLink
91
- className = { styles . accessLink }
92
- workspaceName = { workspace . name }
93
- agentName = { agent . name }
94
- userName = { workspace . owner_name }
95
- />
96
- ) }
97
- { agent . status === "connected" &&
98
- agent . apps . map ( ( app ) => (
99
- < AppLink
100
- key = { app . name }
101
- appIcon = { app . icon }
102
- appName = { app . name }
103
- userName = { workspace . owner_name }
88
+ { user ?. username === workspace . owner_name && (
89
+ < TableCell >
90
+ < Stack >
91
+ { agent . status === "connected" && (
92
+ < TerminalLink
93
+ className = { styles . accessLink }
104
94
workspaceName = { workspace . name }
95
+ agentName = { agent . name }
96
+ userName = { workspace . owner_name }
105
97
/>
106
- ) ) }
107
- </ Stack >
108
- </ TableCell >
98
+ ) }
99
+ { agent . status === "connected" &&
100
+ agent . apps . map ( ( app ) => (
101
+ < AppLink
102
+ key = { app . name }
103
+ appIcon = { app . icon }
104
+ appName = { app . name }
105
+ userName = { workspace . owner_name }
106
+ workspaceName = { workspace . name }
107
+ />
108
+ ) ) }
109
+ </ Stack >
110
+ </ TableCell >
111
+ ) }
109
112
< TableCell >
110
113
< span style = { { color : getDisplayAgentStatus ( theme , agent ) . color } } >
111
114
{ getDisplayAgentStatus ( theme , agent ) . status }
0 commit comments