@@ -33,7 +33,6 @@ import {
3333 QuestionCircleIcon ,
3434 CodeIcon ,
3535} from '@patternfly/react-icons' ;
36- import { useState } from 'react' ;
3736import { Workspace , WorkspacesColumnNames , WorkspaceState } from '~/shared/types' ;
3837import { WorkspaceDetails } from '~/app/pages/Workspaces/Details/WorkspaceDetails' ;
3938import { ExpandedWorkspaceRow } from '~/app/pages/Workspaces/ExpandedWorkspaceRow' ;
@@ -44,7 +43,7 @@ import {
4443} from '~/app/actions/WorkspaceKindsActions' ;
4544import useWorkspaces from '~/app/hooks/useWorkspaces' ;
4645import { useNamespaceContext } from '~/app/context/NamespaceContextProvider' ;
47- import { buildKindLogoDictionary } from '~/app/actions/WorkspaceKindsActions' ;
46+
4847import useWorkspaceKinds from '~/app/hooks/useWorkspaceKinds' ;
4948import { WorkspaceConnectAction } from '~/app/pages/Workspaces/WorkspaceConnectAction' ;
5049import { WorkspaceStartActionModal } from '~/app/pages/Workspaces/workspaceActions/WorkspaceStartActionModal' ;
@@ -188,7 +187,19 @@ export const Workspaces: React.FunctionComponent = () => {
188187 const [ activeSortDirection , setActiveSortDirection ] = React . useState < 'asc' | 'desc' | null > ( null ) ;
189188
190189 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+ } ;
192203 redirectStatus: '' ,
193204 name : workspace . name ,
194205 kind : workspace . workspace_kind . name ,
@@ -281,17 +292,14 @@ export const Workspaces: React.FunctionComponent = () => {
281292 const workspaceState = workspace . state ;
282293 const workspaceActions = [
283294 {
284- id : 'view-details' ,
285295 title : 'View Details' ,
286296 onClick : ( ) => viewDetailsClick ( workspace ) ,
287297 } ,
288298 {
289- id : 'edit' ,
290299 title : 'Edit' ,
291300 onClick : ( ) => editAction ( workspace ) ,
292301 } ,
293302 {
294- id : 'delete' ,
295303 title : 'Delete' ,
296304 onClick : ( ) => handleDeleteClick ( workspace ) ,
297305 } ,
@@ -300,20 +308,17 @@ export const Workspaces: React.FunctionComponent = () => {
300308 } ,
301309 workspaceState !== WorkspaceState . Running
302310 ? {
303- id : 'start' ,
304311 title : 'Start' ,
305312 onClick : ( ) => startRestartAction ( workspace , ActionType . Start ) ,
306313 }
307314 : {
308- id : 'restart' ,
309315 title : 'Restart' ,
310316 onClick : ( ) => startRestartAction ( workspace , ActionType . Restart ) ,
311317 } ,
312318 ] as IActions ;
313319
314320 if ( workspaceState === WorkspaceState . Running ) {
315321 workspaceActions . push ( {
316- id : 'stop' ,
317322 title : 'Stop' ,
318323 onClick : ( ) => stopAction ( workspace ) ,
319324 } ) ;
@@ -514,6 +519,27 @@ export const Workspaces: React.FunctionComponent = () => {
514519 )
515520 : getRedirectStatusIcon ( undefined , 'No API response available' ) }
516521 </ 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 >
517543 < Td data-testid = "workspace-name" dataLabel = { columnNames . name } >
518544 { workspace . name }
519545 </ Td >
0 commit comments