Skip to content

Commit 9d4ba7d

Browse files
committed
feat: add visual indicator for resources pending deletion
1 parent d36a68d commit 9d4ba7d

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

frontend/src/components/common/Resource/ResourceTable.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { Icon } from '@iconify/react';
1718
import Box from '@mui/material/Box';
1819
import MenuItem from '@mui/material/MenuItem';
1920
import { useTheme } from '@mui/material/styles';
@@ -51,6 +52,7 @@ import { useLocalStorageState } from '../../globalSearch/useLocalStorageState';
5152
import { DateLabel } from '../Label';
5253
import Link from '../Link';
5354
import Table, { TableColumn } from '../Table';
55+
import { LightTooltip } from '../Tooltip';
5456
import DeleteButton from './DeleteButton';
5557
import EditButton from './EditButton';
5658
import ResourceTableMultiActions from './ResourceTableMultiActions';
@@ -443,8 +445,31 @@ function ResourceTableContent<RowItem extends KubeObject>(props: ResourceTablePr
443445
header: t('translation|Name'),
444446
gridTemplate: 'auto',
445447
accessorFn: (item: RowItem) => item.metadata.name,
446-
Cell: ({ row }: { row: MRT_Row<RowItem> }) =>
447-
row.original && <Link kubeObject={row.original} />,
448+
Cell: ({ row }: { row: MRT_Row<RowItem> }) => {
449+
if (!row.original) {
450+
return null;
451+
}
452+
453+
const isDeleting = !!row.original.metadata?.deletionTimestamp;
454+
455+
return (
456+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
457+
{isDeleting && (
458+
<LightTooltip title={t('translation|Deleting')}>
459+
<Box component="span" sx={{ display: 'flex', color: 'text.secondary' }}>
460+
<Icon
461+
icon="mdi:trash-can-outline"
462+
width="1rem"
463+
height="1rem"
464+
color={theme.palette.error.main}
465+
/>
466+
</Box>
467+
</LightTooltip>
468+
)}
469+
<Link kubeObject={row.original} />
470+
</Box>
471+
);
472+
},
448473
};
449474
case 'age':
450475
return {

0 commit comments

Comments
 (0)