import clsx from 'clsx'; import { Fragment } from 'react'; import { Taint } from 'kubernetes-types/core/v1'; import { nodeAffinityValues } from '@/kubernetes/filters/application'; import { useAuthorizations } from '@/react/hooks/useUser'; import { Affinity, Label, NodePlacementRowData } from '../types'; interface SubRowProps { node: NodePlacementRowData; cellCount: number; } export function SubRow({ node, cellCount }: SubRowProps) { const authorized = useAuthorizations( 'K8sApplicationErrorDetailsR', undefined, true ); if (!authorized) { <> {isDefined(node.unmetTaints) && ( Placement constraint not respected for that node. )} {(isDefined(node.unmatchedNodeSelectorLabels) || isDefined(node.unmatchedNodeAffinities)) && ( Placement label not respected for that node. )} ; } return ( <> {isDefined(node.unmetTaints) && ( )} {isDefined(node.unmatchedNodeSelectorLabels) && ( )} {isDefined(node.unmatchedNodeAffinities) && ( )} ); } function isDefined(arr?: Array): arr is Array { return !!arr && arr.length > 0; } function UnmetTaintsInfo({ taints, isHighlighted, cellCount, }: { taints: Array; isHighlighted: boolean; cellCount: number; }) { return ( <> {taints.map((taint) => ( This application is missing a toleration for the taint {taint.key} {taint.value ? `=${taint.value}` : ''}:{taint.effect} ))} ); } function UnmatchedLabelsInfo({ labels, isHighlighted, cellCount, }: { labels: Array