2023-05-02 06:42:16 +00:00
|
|
|
import { CellContext } from '@tanstack/react-table';
|
2022-11-28 02:00:28 +00:00
|
|
|
import { Check, X } from 'lucide-react';
|
2022-09-26 19:43:24 +00:00
|
|
|
|
|
|
|
import { Badge } from '@@/Badge';
|
|
|
|
import { Icon } from '@@/Icon';
|
|
|
|
|
|
|
|
import type { IngressControllerClassMap } from '../../types';
|
|
|
|
|
2023-05-02 06:42:16 +00:00
|
|
|
import { columnHelper } from './helper';
|
|
|
|
|
|
|
|
export const availability = columnHelper.accessor('Availability', {
|
|
|
|
header: 'Availability',
|
|
|
|
cell: Cell,
|
2022-09-26 19:43:24 +00:00
|
|
|
id: 'availability',
|
2023-05-02 06:42:16 +00:00
|
|
|
invertSorting: true,
|
|
|
|
sortingFn: 'basic',
|
|
|
|
});
|
|
|
|
|
|
|
|
function Cell({ getValue }: CellContext<IngressControllerClassMap, boolean>) {
|
|
|
|
const availability = getValue();
|
2022-09-26 19:43:24 +00:00
|
|
|
|
|
|
|
return (
|
2023-05-02 06:42:16 +00:00
|
|
|
<Badge type={availability ? 'success' : 'danger'}>
|
|
|
|
<Icon icon={availability ? Check : X} className="!mr-1" />
|
|
|
|
{availability ? 'Allowed' : 'Disallowed'}
|
2022-09-26 19:43:24 +00:00
|
|
|
</Badge>
|
|
|
|
);
|
|
|
|
}
|