@@ -2,6 +2,7 @@ import { makeStyles } from "@material-ui/core/styles"
2
2
import Table from "@material-ui/core/Table"
3
3
import TableBody from "@material-ui/core/TableBody"
4
4
import TableCell from "@material-ui/core/TableCell"
5
+ import TableContainer from "@material-ui/core/TableContainer"
5
6
import TableHead from "@material-ui/core/TableHead"
6
7
import TableRow from "@material-ui/core/TableRow"
7
8
import { AvatarData } from "components/AvatarData/AvatarData"
@@ -26,70 +27,72 @@ export const TemplateResourcesTable: FC<TemplateResourcesProps> = ({ resources }
26
27
const styles = useStyles ( )
27
28
28
29
return (
29
- < Table className = { styles . table } >
30
- < TableHead >
31
- < TableHeaderRow >
32
- < TableCell >
33
- < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
34
- { Language . resourceLabel }
35
- < ResourcesHelpTooltip />
36
- </ Stack >
37
- </ TableCell >
38
- < TableCell className = { styles . agentColumn } >
39
- < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
40
- { Language . agentLabel }
41
- < AgentHelpTooltip />
42
- </ Stack >
43
- </ TableCell >
44
- </ TableHeaderRow >
45
- </ TableHead >
46
- < TableBody >
47
- { resources . map ( ( resource ) => {
48
- // We need to initialize the agents to display the resource
49
- const agents = resource . agents ?? [ null ]
50
- return agents . map ( ( agent , agentIndex ) => {
51
- // If there is no agent, just display the resource name
52
- if ( ! agent ) {
30
+ < TableContainer className = { styles . tableContainer } >
31
+ < Table >
32
+ < TableHead >
33
+ < TableHeaderRow >
34
+ < TableCell >
35
+ < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
36
+ { Language . resourceLabel }
37
+ < ResourcesHelpTooltip />
38
+ </ Stack >
39
+ </ TableCell >
40
+ < TableCell className = { styles . agentColumn } >
41
+ < Stack direction = "row" spacing = { 0.5 } alignItems = "center" >
42
+ { Language . agentLabel }
43
+ < AgentHelpTooltip />
44
+ </ Stack >
45
+ </ TableCell >
46
+ </ TableHeaderRow >
47
+ </ TableHead >
48
+ < TableBody >
49
+ { resources . map ( ( resource ) => {
50
+ // We need to initialize the agents to display the resource
51
+ const agents = resource . agents ?? [ null ]
52
+ return agents . map ( ( agent , agentIndex ) => {
53
+ // If there is no agent, just display the resource name
54
+ if ( ! agent ) {
55
+ return (
56
+ < TableRow >
57
+ < TableCell className = { styles . resourceNameCell } >
58
+ < AvatarData
59
+ title = { resource . name }
60
+ subtitle = { resource . type }
61
+ highlightTitle
62
+ avatar = { < ResourceAvatar type = { resource . type } /> }
63
+ />
64
+ </ TableCell >
65
+ < TableCell colSpan = { 3 } > </ TableCell >
66
+ </ TableRow >
67
+ )
68
+ }
69
+
53
70
return (
54
- < TableRow >
55
- < TableCell className = { styles . resourceNameCell } >
56
- < AvatarData
57
- title = { resource . name }
58
- subtitle = { resource . type }
59
- highlightTitle
60
- avatar = { < ResourceAvatar type = { resource . type } /> }
61
- />
71
+ < TableRow key = { `${ resource . id } -${ agent . id } ` } >
72
+ { /* We only want to display the name in the first row because we are using rowSpan */ }
73
+ { /* The rowspan should be the same than the number of agents */ }
74
+ { agentIndex === 0 && (
75
+ < TableCell className = { styles . resourceNameCell } rowSpan = { agents . length } >
76
+ < AvatarData
77
+ title = { resource . name }
78
+ subtitle = { resource . type }
79
+ highlightTitle
80
+ avatar = { < ResourceAvatar type = { resource . type } /> }
81
+ />
82
+ </ TableCell >
83
+ ) }
84
+
85
+ < TableCell className = { styles . agentColumn } >
86
+ { agent . name }
87
+ < span className = { styles . operatingSystem } > { agent . operating_system } </ span >
62
88
</ TableCell >
63
- < TableCell colSpan = { 3 } > </ TableCell >
64
89
</ TableRow >
65
90
)
66
- }
67
-
68
- return (
69
- < TableRow key = { `${ resource . id } -${ agent . id } ` } >
70
- { /* We only want to display the name in the first row because we are using rowSpan */ }
71
- { /* The rowspan should be the same than the number of agents */ }
72
- { agentIndex === 0 && (
73
- < TableCell className = { styles . resourceNameCell } rowSpan = { agents . length } >
74
- < AvatarData
75
- title = { resource . name }
76
- subtitle = { resource . type }
77
- highlightTitle
78
- avatar = { < ResourceAvatar type = { resource . type } /> }
79
- />
80
- </ TableCell >
81
- ) }
82
-
83
- < TableCell className = { styles . agentColumn } >
84
- { agent . name }
85
- < span className = { styles . operatingSystem } > { agent . operating_system } </ span >
86
- </ TableCell >
87
- </ TableRow >
88
- )
89
- } )
90
- } ) }
91
- </ TableBody >
92
- </ Table >
91
+ } )
92
+ } ) }
93
+ </ TableBody >
94
+ </ Table >
95
+ </ TableContainer >
93
96
)
94
97
}
95
98
@@ -98,7 +101,7 @@ const useStyles = makeStyles((theme) => ({
98
101
margin : 0 ,
99
102
} ,
100
103
101
- table : {
104
+ tableContainer : {
102
105
border : 0 ,
103
106
} ,
104
107
0 commit comments