diff --git a/workspaces/frontend/src/app/components/WorkspaceTable.tsx b/workspaces/frontend/src/app/components/WorkspaceTable.tsx index a29bf1bb..44c86006 100644 --- a/workspaces/frontend/src/app/components/WorkspaceTable.tsx +++ b/workspaces/frontend/src/app/components/WorkspaceTable.tsx @@ -548,128 +548,130 @@ const WorkspaceTable = React.forwardRef( {sortedWorkspaces.length > 0 && - sortedWorkspaces.map((workspace, rowIndex) => ( - - ( + - {canExpandRows && ( - - setWorkspaceExpanded(workspace, !isWorkspaceExpanded(workspace)), - }} + + {canExpandRows && ( + + setWorkspaceExpanded(workspace, !isWorkspaceExpanded(workspace)), + }} + /> + )} + {visibleColumnKeys.map((columnKey) => { + if (columnKey === 'connect') { + return ( + + + + ); + } + + if (columnKey === 'actions') { + return ( + + ({ + ...action, + 'data-testid': `action-${action.id || ''}`, + }))} + /> + + ); + } + + return ( + + {columnKey === 'name' && workspace.name} + {columnKey === 'image' && ( + + {workspace.podTemplate.options.imageConfig.current.displayName}{' '} + {workspaceRedirectStatus[workspace.workspaceKind.name] + ? getRedirectStatusIcon( + workspaceRedirectStatus[workspace.workspaceKind.name]?.message + ?.level, + workspaceRedirectStatus[workspace.workspaceKind.name]?.message + ?.text || 'No API response available', + ) + : getRedirectStatusIcon(undefined, 'No API response available')} + + )} + {columnKey === 'kind' && ( + + } + > + {(validSrc) => ( + + {workspace.workspaceKind.name} + + )} + + )} + {columnKey === 'namespace' && workspace.namespace} + {columnKey === 'state' && ( + + )} + {columnKey === 'gpu' && formatResourceFromWorkspace(workspace, 'gpu')} + {columnKey === 'idleGpu' && formatWorkspaceIdleState(workspace)} + {columnKey === 'lastActivity' && ( + + {formatDistanceToNow(new Date(workspace.activity.lastActivity), { + addSuffix: true, + })} + + )} + + ); + })} + + {isWorkspaceExpanded(workspace) && ( + )} - {visibleColumnKeys.map((columnKey) => { - if (columnKey === 'connect') { - return ( - - - - ); - } - - if (columnKey === 'actions') { - return ( - - ({ - ...action, - 'data-testid': `action-${action.id || ''}`, - }))} - /> - - ); - } - - return ( - - {columnKey === 'name' && workspace.name} - {columnKey === 'image' && ( - - {workspace.podTemplate.options.imageConfig.current.displayName}{' '} - {workspaceRedirectStatus[workspace.workspaceKind.name] - ? getRedirectStatusIcon( - workspaceRedirectStatus[workspace.workspaceKind.name]?.message - ?.level, - workspaceRedirectStatus[workspace.workspaceKind.name]?.message - ?.text || 'No API response available', - ) - : getRedirectStatusIcon(undefined, 'No API response available')} - - )} - {columnKey === 'kind' && ( - - } - > - {(validSrc) => ( - - {workspace.workspaceKind.name} - - )} - - )} - {columnKey === 'namespace' && workspace.namespace} - {columnKey === 'state' && ( - - )} - {columnKey === 'gpu' && formatResourceFromWorkspace(workspace, 'gpu')} - {columnKey === 'idleGpu' && formatWorkspaceIdleState(workspace)} - {columnKey === 'lastActivity' && ( - - {formatDistanceToNow(new Date(workspace.activity.lastActivity), { - addSuffix: true, - })} - - )} - - ); - })} - - {isWorkspaceExpanded(workspace) && ( - - )} - - ))} + + ))} {sortedWorkspaces.length === 0 && ( @@ -679,7 +681,7 @@ const WorkspaceTable = React.forwardRef( )}