@@ -35,7 +35,8 @@ import {
35
35
IActions ,
36
36
} from '@patternfly/react-table' ;
37
37
import { FilterIcon } from '@patternfly/react-icons' ;
38
- import { Workspace , WorkspaceState } from '~/shared/types' ;
38
+ import { Workspace , WorkspaceState } from 'shared/types' ;
39
+ import { formatRam } from 'shared/utilities/WorkspaceResources' ;
39
40
40
41
export const Workspaces : React . FunctionComponent = ( ) => {
41
42
/* Mocked workspaces, to be removed after fetching info from backend */
@@ -46,6 +47,8 @@ export const Workspaces: React.FunctionComponent = () => {
46
47
paused : true ,
47
48
deferUpdates : true ,
48
49
kind : 'jupyter-lab' ,
50
+ cpu : 3 ,
51
+ ram : 500 ,
49
52
podTemplate : {
50
53
volumes : {
51
54
home : '/home' ,
@@ -85,6 +88,8 @@ export const Workspaces: React.FunctionComponent = () => {
85
88
paused : false ,
86
89
deferUpdates : false ,
87
90
kind : 'jupyter-lab' ,
91
+ cpu : 1 ,
92
+ ram : 12540 ,
88
93
podTemplate : {
89
94
volumes : {
90
95
home : '/home' ,
@@ -129,6 +134,8 @@ export const Workspaces: React.FunctionComponent = () => {
129
134
state : 'State' ,
130
135
homeVol : 'Home Vol' ,
131
136
dataVol : 'Data Vol' ,
137
+ cpu : 'CPU' ,
138
+ ram : 'Memory' ,
132
139
lastActivity : 'Last Activity' ,
133
140
} ;
134
141
@@ -315,17 +322,19 @@ export const Workspaces: React.FunctionComponent = () => {
315
322
const [ activeSortDirection , setActiveSortDirection ] = React . useState < 'asc' | 'desc' | null > ( null ) ;
316
323
317
324
const getSortableRowValues = ( workspace : Workspace ) : ( string | number ) [ ] => {
318
- const { name, kind, image, podConfig, state, homeVol, dataVol, lastActivity } = {
325
+ const { name, kind, image, podConfig, state, homeVol, dataVol, cpu , ram , lastActivity } = {
319
326
name : workspace . name ,
320
327
kind : workspace . kind ,
321
328
image : workspace . options . imageConfig ,
322
329
podConfig : workspace . options . podConfig ,
323
330
state : WorkspaceState [ workspace . status . state ] ,
324
331
homeVol : workspace . podTemplate . volumes . home ,
325
332
dataVol : workspace . podTemplate . volumes . data [ 0 ] . pvcName || '' ,
333
+ cpu : workspace . cpu ,
334
+ ram : workspace . ram ,
326
335
lastActivity : workspace . status . activity . lastActivity ,
327
336
} ;
328
- return [ name , kind , image , podConfig , state , homeVol , dataVol , lastActivity ] ;
337
+ return [ name , kind , image , podConfig , state , homeVol , dataVol , cpu , ram , lastActivity ] ;
329
338
} ;
330
339
331
340
let sortedWorkspaces = filteredWorkspaces ;
@@ -436,7 +445,13 @@ export const Workspaces: React.FunctionComponent = () => {
436
445
< Th sort = { getSortParams ( 4 ) } > { columnNames . state } </ Th >
437
446
< Th sort = { getSortParams ( 5 ) } > { columnNames . homeVol } </ Th >
438
447
< Th sort = { getSortParams ( 6 ) } > { columnNames . dataVol } </ Th >
439
- < Th sort = { getSortParams ( 7 ) } > { columnNames . lastActivity } </ Th >
448
+ < Th sort = { getSortParams ( 7 ) } info = { { tooltip : 'Workspace CPU usage' } } >
449
+ { columnNames . cpu }
450
+ </ Th >
451
+ < Th sort = { getSortParams ( 8 ) } info = { { tooltip : 'Workspace memory usage' } } >
452
+ { columnNames . ram }
453
+ </ Th >
454
+ < Th sort = { getSortParams ( 9 ) } > { columnNames . lastActivity } </ Th >
440
455
< Th screenReaderText = "Primary action" />
441
456
</ Tr >
442
457
</ Thead >
@@ -456,6 +471,8 @@ export const Workspaces: React.FunctionComponent = () => {
456
471
< Td dataLabel = { columnNames . dataVol } >
457
472
{ workspace . podTemplate . volumes . data [ 0 ] . pvcName || '' }
458
473
</ Td >
474
+ < Td dataLabel = { columnNames . cpu } > { `${ workspace . cpu } %` } </ Td >
475
+ < Td dataLabel = { columnNames . ram } > { formatRam ( workspace . ram ) } </ Td >
459
476
< Td dataLabel = { columnNames . lastActivity } >
460
477
< Timestamp
461
478
date = { new Date ( workspace . status . activity . lastActivity ) }
0 commit comments