import { NodeCondition } from 'kubernetes-types/core/v1'; import { CellContext } from '@tanstack/react-table'; import { Badge } from '@@/Badge'; import { Tooltip } from '@@/Tip/Tooltip'; import { NodeRowData } from '../types'; import { columnHelper } from './helper'; export const conditions = columnHelper.accessor((row) => getConditions(row), { header: () => ( <> Conditions ), id: 'conditions', cell: ConditionsCell, }); function ConditionsCell({ row: { original: node }, }: CellContext) { const conditions = getConditions(node); return (
{conditions.length > 0 ? conditions.map((condition) => ( {condition.type} )) : '-'}
); } function getConditions(node: NodeRowData) { return ( // exclude the Ready condition and search for unhealthy conditions node.status?.conditions?.filter( (condition) => condition.type !== 'Ready' && condition.status === 'True' ) ?? [] ); }