You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/kubernetes/applications/DetailsView/ApplicationContainersDatatable/columns/status.tsx

30 lines
713 B

import { CellContext } from '@tanstack/react-table';
import { Badge, BadgeType } from '@@/Badge';
import { ContainerRowData } from '../types';
import { columnHelper } from './helper';
export const status = columnHelper.accessor('status', {
header: 'Status',
cell: StatusCell,
});
function StatusCell({ getValue }: CellContext<ContainerRowData, string>) {
return <Badge type={getContainerStatusType(getValue())}>{getValue()}</Badge>;
}
function getContainerStatusType(status: string): BadgeType {
switch (status.toLowerCase()) {
case 'running':
return 'success';
case 'waiting':
return 'warn';
case 'terminated':
return 'info';
default:
return 'danger';
}
}