@@ -33,7 +33,6 @@ import {
33
33
QuestionCircleIcon ,
34
34
CodeIcon ,
35
35
} from '@patternfly/react-icons' ;
36
- import { useState } from 'react' ;
37
36
import { Workspace , WorkspacesColumnNames , WorkspaceState } from '~/shared/types' ;
38
37
import { WorkspaceDetails } from '~/app/pages/Workspaces/Details/WorkspaceDetails' ;
39
38
import { ExpandedWorkspaceRow } from '~/app/pages/Workspaces/ExpandedWorkspaceRow' ;
@@ -44,7 +43,7 @@ import {
44
43
} from '~/app/actions/WorkspaceKindsActions' ;
45
44
import useWorkspaces from '~/app/hooks/useWorkspaces' ;
46
45
import { useNamespaceContext } from '~/app/context/NamespaceContextProvider' ;
47
- import { buildKindLogoDictionary } from '~/app/actions/WorkspaceKindsActions' ;
46
+
48
47
import useWorkspaceKinds from '~/app/hooks/useWorkspaceKinds' ;
49
48
import { WorkspaceConnectAction } from '~/app/pages/Workspaces/WorkspaceConnectAction' ;
50
49
import { WorkspaceStartActionModal } from '~/app/pages/Workspaces/workspaceActions/WorkspaceStartActionModal' ;
@@ -188,7 +187,19 @@ export const Workspaces: React.FunctionComponent = () => {
188
187
const [ activeSortDirection , setActiveSortDirection ] = React . useState < 'asc' | 'desc' | null > ( null ) ;
189
188
190
189
const getSortableRowValues = ( workspace : Workspace ) : ( string | number | undefined ) [ ] => {
191
- const { name, kind, image, podConfig, state, homeVol, cpu, ram, lastActivity } = {
190
+ const { redirectStatus, name, kind, image, podConfig, state, homeVol, cpu, ram, lastActivity } =
191
+ {
192
+ redirectStatus : '' ,
193
+ name : workspace . name ,
194
+ kind : workspace . workspace_kind . name ,
195
+ image : workspace . pod_template . options . image_config . current . display_name ,
196
+ podConfig : workspace . pod_template . pod_config . current ,
197
+ state : workspace . state ,
198
+ homeVol : workspace . pod_template . volumes . home . pvc_name ,
199
+ cpu : getCpuValue ( workspace ) ,
200
+ ram : getRamValue ( workspace ) ,
201
+ lastActivity : workspace . activity . last_activity ,
202
+ } ;
192
203
redirectStatus: '' ,
193
204
name : workspace . name ,
194
205
kind : workspace . workspace_kind . name ,
@@ -281,17 +292,14 @@ export const Workspaces: React.FunctionComponent = () => {
281
292
const workspaceState = workspace . state ;
282
293
const workspaceActions = [
283
294
{
284
- id : 'view-details' ,
285
295
title : 'View Details' ,
286
296
onClick : ( ) => viewDetailsClick ( workspace ) ,
287
297
} ,
288
298
{
289
- id : 'edit' ,
290
299
title : 'Edit' ,
291
300
onClick : ( ) => editAction ( workspace ) ,
292
301
} ,
293
302
{
294
- id : 'delete' ,
295
303
title : 'Delete' ,
296
304
onClick : ( ) => handleDeleteClick ( workspace ) ,
297
305
} ,
@@ -300,20 +308,17 @@ export const Workspaces: React.FunctionComponent = () => {
300
308
} ,
301
309
workspaceState !== WorkspaceState . Running
302
310
? {
303
- id : 'start' ,
304
311
title : 'Start' ,
305
312
onClick : ( ) => startRestartAction ( workspace , ActionType . Start ) ,
306
313
}
307
314
: {
308
- id : 'restart' ,
309
315
title : 'Restart' ,
310
316
onClick : ( ) => startRestartAction ( workspace , ActionType . Restart ) ,
311
317
} ,
312
318
] as IActions ;
313
319
314
320
if ( workspaceState === WorkspaceState . Running ) {
315
321
workspaceActions . push ( {
316
- id : 'stop' ,
317
322
title : 'Stop' ,
318
323
onClick : ( ) => stopAction ( workspace ) ,
319
324
} ) ;
@@ -514,6 +519,27 @@ export const Workspaces: React.FunctionComponent = () => {
514
519
)
515
520
: getRedirectStatusIcon ( undefined , 'No API response available' ) }
516
521
</ Td >
522
+ id: 'view-details',
523
+ id: 'edit',
524
+ id: 'delete',
525
+ id: 'start',
526
+ id: 'restart',
527
+ id: 'stop',
528
+ < Th
529
+ key = { `${ columnName } -col-name` }
530
+ sort = { columnName !== 'Redirect Status' ? getSortParams ( index ) : undefined }
531
+ >
532
+ { columnName }
533
+ </ Th >
534
+ < Td dataLabel = { columnNames . redirectStatus } >
535
+ { workspaceRedirectStatus [ workspace . workspace_kind . name ]
536
+ ? getRedirectStatusIcon (
537
+ workspaceRedirectStatus [ workspace . workspace_kind . name ] ?. level ,
538
+ workspaceRedirectStatus [ workspace . workspace_kind . name ] ?. message ||
539
+ 'No API response available' ,
540
+ )
541
+ : getRedirectStatusIcon ( undefined , 'No API response available' ) }
542
+ </ Td >
517
543
< Td data-testid = "workspace-name" dataLabel = { columnNames . name } >
518
544
{ workspace . name }
519
545
</ Td >
0 commit comments