import "./pod-tolerations.scss"; import React from "react"; import uniqueId from "lodash/uniqueId"; import { IToleration } from "../../api/workload-kube-object"; import { Table, TableCell, TableHead, TableRow } from "../table"; interface Props { tolerations: IToleration[]; } enum sortBy { Key = "key", Operator = "operator", Effect = "effect", Seconds = "seconds", } const sortingCallbacks = { [sortBy.Key]: (toleration: IToleration) => toleration.key, [sortBy.Operator]: (toleration: IToleration) => toleration.operator, [sortBy.Effect]: (toleration: IToleration) => toleration.effect, [sortBy.Seconds]: (toleration: IToleration) => toleration.tolerationSeconds, }; const getTableRow = (toleration: IToleration) => { const { key, operator, effect, tolerationSeconds } = toleration; return ( {key} {operator} {effect} {tolerationSeconds} ); }; export function PodTolerations({ tolerations }: Props) { return ( Key Operator Effect Seconds { tolerations.map(getTableRow) }
); }