Skip to content

Commit 0ef7cfb

Browse files
committed
feat(FR-1660): add action buttons column to SessionNodes table
1 parent d6ecc7a commit 0ef7cfb

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

packages/backend.ai-ui/src/components/Table/BAITable.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ const BAITable = <RecordType extends object = any>({
326326
styles.neoHeader,
327327
tableProps.rowSelection?.columnWidth === 0 &&
328328
styles.zeroWithSelectionColumn,
329+
styles.adjustZIndex,
329330
)}
330331
style={{
331332
opacity: loading ? 0.7 : 1,
@@ -472,6 +473,11 @@ const useStyles = createStyles(({ token, css }) => ({
472473
padding: 0 !important;
473474
}
474475
`,
476+
adjustZIndex: css`
477+
td.ant-table-cell.ant-table-cell-fix-left {
478+
z-index: 4;
479+
}
480+
`,
475481
}));
476482

477483
const ResizableTitle = (

react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ interface SessionActionButtonsProps {
4747
hiddenButtonKeys?: SessionActionButtonKey[];
4848
onAction?: (action: SessionActionButtonKey) => void;
4949
primaryAppOption?: PrimaryAppOption;
50+
noPrimaryButton?: boolean;
5051
}
5152

5253
const isActive = (session: SessionActionButtonsFragment$data) => {
@@ -76,6 +77,7 @@ const SessionActionButtons: React.FC<SessionActionButtonsProps> = ({
7677
hiddenButtonKeys,
7778
primaryAppOption,
7879
onAction,
80+
noPrimaryButton: noPrimaryColor,
7981
}) => {
8082
const { t } = useTranslation();
8183
const { token } = theme.useToken();
@@ -158,7 +160,7 @@ const SessionActionButtons: React.FC<SessionActionButtonsProps> = ({
158160
>
159161
<Button
160162
size={size}
161-
type={'primary'}
163+
type={noPrimaryColor ? undefined : 'primary'}
162164
disabled={
163165
!isAppSupported(session) || !isActive(session) || !isOwner
164166
}
@@ -192,7 +194,9 @@ const SessionActionButtons: React.FC<SessionActionButtonsProps> = ({
192194
>
193195
<Button
194196
size={size}
195-
type={primaryAppOption ? undefined : 'primary'}
197+
type={
198+
primaryAppOption || noPrimaryColor ? undefined : 'primary'
199+
}
196200
disabled={
197201
!isAppSupported(session) || !isActive(session) || !isOwner
198202
}

react/src/components/SessionNodes.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
} from '../__generated__/SessionNodesFragment.graphql';
55
import { useSuspendedBackendaiClient } from '../hooks';
66
import { useCurrentUserRole } from '../hooks/backendai';
7+
import SessionActionButtons from './ComputeSessionNodeItems/SessionActionButtons';
78
import SessionReservation from './ComputeSessionNodeItems/SessionReservation';
89
import SessionSlotCell from './ComputeSessionNodeItems/SessionSlotCell';
910
import SessionStatusTag from './ComputeSessionNodeItems/SessionStatusTag';
@@ -60,6 +61,7 @@ const SessionNodes: React.FC<SessionNodesProps> = ({
6061
...BAISessionAgentIdsFragment
6162
...BAISessionTypeTagFragment
6263
...BAISessionClusterModeFragment
64+
...SessionActionButtonsFragment
6365
kernel_nodes {
6466
edges {
6567
node {
@@ -114,6 +116,20 @@ const SessionNodes: React.FC<SessionNodesProps> = ({
114116
return <SessionStatusTag sessionFrgmt={session} />;
115117
},
116118
},
119+
{
120+
key: 'actionButtons',
121+
title: t('general.Control'),
122+
defaultHidden: true,
123+
sorter: false,
124+
render: (__, session) => (
125+
<SessionActionButtons
126+
size="small"
127+
sessionFrgmt={session}
128+
compact
129+
noPrimaryButton
130+
/>
131+
),
132+
},
117133
// This column will be added back when the session list column setting ui is ready
118134
// {
119135
// key: 'utils',

0 commit comments

Comments
 (0)