diff --git a/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/conditions.tsx b/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/conditions.tsx new file mode 100644 index 000000000..7d6e70735 --- /dev/null +++ b/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/conditions.tsx @@ -0,0 +1,53 @@ +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 as it is already being utilised in the Status column + node.status?.conditions?.filter( + (condition) => condition.type !== 'Ready' + ) ?? [] + ); +} diff --git a/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/index.ts b/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/index.ts index e8cb8c8b1..7f3579363 100644 --- a/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/index.ts +++ b/app/react/kubernetes/cluster/HomeView/NodesDatatable/columns/index.ts @@ -1,6 +1,7 @@ import { name } from './name'; import { role } from './role'; import { status } from './status'; +import { conditions } from './conditions'; import { cpu } from './cpu'; import { memory } from './memory'; import { version } from './version'; @@ -9,13 +10,14 @@ import { getActions } from './actions'; export function getColumns(isServerMetricsEnabled: boolean) { if (!isServerMetricsEnabled) { - return [name, role, status, cpu, memory, version, ip]; + return [name, role, status, conditions, cpu, memory, version, ip]; } return [ name, role, status, + conditions, cpu, memory, version,