mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
feat(app): migrate app containers to react [EE-5353] (#9992)
This commit is contained in:
parent
6290e9facc
commit
23295d2736
22 changed files with 312 additions and 297 deletions
|
@ -0,0 +1,29 @@
|
|||
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';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue