mirror of
https://github.com/portainer/portainer.git
synced 2025-07-31 03:09:44 +02:00
refactor(docker/swarm): migrate nodes table to react [EE-4672] (#10184)
This commit is contained in:
parent
fbdbd277f7
commit
bf85a8861d
18 changed files with 210 additions and 255 deletions
|
@ -0,0 +1,29 @@
|
|||
import clsx from 'clsx';
|
||||
|
||||
import { NodeViewModel } from '@/docker/models/node';
|
||||
|
||||
import { columnHelper } from './column-helper';
|
||||
|
||||
export const availability = columnHelper.accessor('Availability', {
|
||||
header: 'Availability',
|
||||
cell({ getValue }) {
|
||||
const value = getValue();
|
||||
return (
|
||||
<span className={clsx('label', `label-${badgeClass(value)}`)}>
|
||||
{value}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
export function badgeClass(text: NodeViewModel['Availability']) {
|
||||
if (text === 'pause') {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
if (text === 'drain') {
|
||||
return 'danger';
|
||||
}
|
||||
|
||||
return 'success';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue