@@ -2,6 +2,7 @@ import { makeStyles, Theme } from "@material-ui/core/styles"
22import Table from "@material-ui/core/Table"
33import TableBody from "@material-ui/core/TableBody"
44import TableCell from "@material-ui/core/TableCell"
5+ import TableContainer from "@material-ui/core/TableContainer"
56import TableHead from "@material-ui/core/TableHead"
67import TableRow from "@material-ui/core/TableRow"
78import useTheme from "@material-ui/styles/useTheme"
@@ -46,101 +47,103 @@ export const Resources: FC<ResourcesProps> = ({
4647 { getResourcesError ? (
4748 { getResourcesError }
4849 ) : (
49- < Table className = { styles . table } >
50- < TableHead >
51- < TableHeaderRow >
52- < TableCell >
53- < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
54- { Language . resourceLabel }
55- < ResourcesHelpTooltip />
56- </ Stack >
57- </ TableCell >
58- < TableCell className = { styles . agentColumn } >
59- < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
60- { Language . agentLabel }
61- < AgentHelpTooltip />
62- </ Stack >
63- </ TableCell >
64- { canUpdateWorkspace && < TableCell > </ TableCell > }
65- </ TableHeaderRow >
66- </ TableHead >
67- < TableBody >
68- { resources ?. map ( ( resource ) => {
69- {
70- /* We need to initialize the agents to display the resource */
71- }
72- const agents = resource . agents ?? [ null ]
73- const resourceName = (
74- < AvatarData
75- avatar = { < ResourceAvatar type = { resource . type } /> }
76- title = { resource . name }
77- subtitle = { resource . type }
78- highlightTitle
79- />
80- )
81-
82- return agents . map ( ( agent , agentIndex ) => {
50+ < TableContainer className = { styles . tableContainer } >
51+ < Table >
52+ < TableHead >
53+ < TableHeaderRow >
54+ < TableCell >
55+ < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
56+ { Language . resourceLabel }
57+ < ResourcesHelpTooltip />
58+ </ Stack >
59+ </ TableCell >
60+ < TableCell className = { styles . agentColumn } >
61+ < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
62+ { Language . agentLabel }
63+ < AgentHelpTooltip />
64+ </ Stack >
65+ </ TableCell >
66+ { canUpdateWorkspace && < TableCell > </ TableCell > }
67+ </ TableHeaderRow >
68+ </ TableHead >
69+ < TableBody >
70+ { resources ?. map ( ( resource ) => {
8371 {
84- /* If there is no agent, just display the resource name */
85- }
86- if ( ! agent ) {
87- return (
88- < TableRow key = { `${ resource . id } -${ agentIndex } ` } >
89- < TableCell > { resourceName } </ TableCell >
90- < TableCell colSpan = { 3 } > </ TableCell >
91- </ TableRow >
92- )
72+ /* We need to initialize the agents to display the resource */
9373 }
74+ const agents = resource . agents ?? [ null ]
75+ const resourceName = (
76+ < AvatarData
77+ avatar = { < ResourceAvatar type = { resource . type } /> }
78+ title = { resource . name }
79+ subtitle = { resource . type }
80+ highlightTitle
81+ />
82+ )
9483
95- const agentStatus = getDisplayAgentStatus ( theme , agent )
96- return (
97- < TableRow key = { `${ resource . id } -${ agent . id } ` } >
98- { /* We only want to display the name in the first row because we are using rowSpan */ }
99- { /* The rowspan should be the same than the number of agents */ }
100- { agentIndex === 0 && (
101- < TableCell className = { styles . resourceNameCell } rowSpan = { agents . length } >
102- { resourceName }
84+ return agents . map ( ( agent , agentIndex ) => {
85+ {
86+ /* If there is no agent, just display the resource name */
87+ }
88+ if ( ! agent ) {
89+ return (
90+ < TableRow key = { `${ resource . id } -${ agentIndex } ` } >
91+ < TableCell > { resourceName } </ TableCell >
92+ < TableCell colSpan = { 3 } > </ TableCell >
93+ </ TableRow >
94+ )
95+ }
96+
97+ const agentStatus = getDisplayAgentStatus ( theme , agent )
98+ return (
99+ < TableRow key = { `${ resource . id } -${ agent . id } ` } >
100+ { /* We only want to display the name in the first row because we are using rowSpan */ }
101+ { /* The rowspan should be the same than the number of agents */ }
102+ { agentIndex === 0 && (
103+ < TableCell className = { styles . resourceNameCell } rowSpan = { agents . length } >
104+ { resourceName }
105+ </ TableCell >
106+ ) }
107+
108+ < TableCell className = { styles . agentColumn } >
109+ { agent . name }
110+ < div className = { styles . agentInfo } >
111+ < span className = { styles . operatingSystem } > { agent . operating_system } </ span >
112+ < span style = { { color : agentStatus . color } } className = { styles . status } >
113+ { agentStatus . status }
114+ </ span >
115+ </ div >
103116 </ TableCell >
104- ) }
105-
106- < TableCell className = { styles . agentColumn } >
107- { agent . name }
108- < div className = { styles . agentInfo } >
109- < span className = { styles . operatingSystem } > { agent . operating_system } </ span >
110- < span style = { { color : agentStatus . color } } className = { styles . status } >
111- { agentStatus . status }
112- </ span >
113- </ div >
114- </ TableCell >
115- < TableCell >
116- < >
117- { canUpdateWorkspace && agent . status === "connected" && (
118- < div className = { styles . accessLinks } >
119- < SSHButton workspaceName = { workspace . name } agentName = { agent . name } />
120- < TerminalLink
121- workspaceName = { workspace . name }
122- agentName = { agent . name }
123- userName = { workspace . owner_name }
124- />
125- { agent . apps . map ( ( app ) => (
126- < AppLink
127- key = { app . name }
128- appIcon = { app . icon }
129- appName = { app . name }
130- userName = { workspace . owner_name }
117+ < TableCell >
118+ < >
119+ { canUpdateWorkspace && agent . status === "connected" && (
120+ < div className = { styles . accessLinks } >
121+ < SSHButton workspaceName = { workspace . name } agentName = { agent . name } />
122+ < TerminalLink
131123 workspaceName = { workspace . name }
124+ agentName = { agent . name }
125+ userName = { workspace . owner_name }
132126 />
133- ) ) }
134- </ div >
135- ) }
136- </ >
137- </ TableCell >
138- </ TableRow >
139- )
140- } )
141- } ) }
142- </ TableBody >
143- </ Table >
127+ { agent . apps . map ( ( app ) => (
128+ < AppLink
129+ key = { app . name }
130+ appIcon = { app . icon }
131+ appName = { app . name }
132+ userName = { workspace . owner_name }
133+ workspaceName = { workspace . name }
134+ />
135+ ) ) }
136+ </ div >
137+ ) }
138+ </ >
139+ </ TableCell >
140+ </ TableRow >
141+ )
142+ } )
143+ } ) }
144+ </ TableBody >
145+ </ Table >
146+ </ TableContainer >
144147 ) }
145148 </ div >
146149 )
@@ -152,7 +155,7 @@ const useStyles = makeStyles((theme) => ({
152155 border : `1px solid ${ theme . palette . divider } ` ,
153156 } ,
154157
155- table : {
158+ tableContainer : {
156159 border : 0 ,
157160 } ,
158161
0 commit comments