From 18d5d378b3acb741bdfd4ea84b53c650ab71cef7 Mon Sep 17 00:00:00 2001 From: atu Date: Sun, 9 Aug 2020 20:56:25 -0700 Subject: [PATCH] fix some types --- client/src/components/nodeStatusChart.tsx | 4 ++-- client/src/components/podStatusChart.tsx | 6 +++--- client/src/components/podsPanel.tsx | 10 +++++----- client/src/utils/types.ts | 3 +++ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/client/src/components/nodeStatusChart.tsx b/client/src/components/nodeStatusChart.tsx index a1fa005..90f8fad 100644 --- a/client/src/components/nodeStatusChart.tsx +++ b/client/src/components/nodeStatusChart.tsx @@ -2,9 +2,9 @@ import _ from 'lodash'; import React from 'react'; import Chart from './chart'; import LoadingChart from './loadingChart'; -import {TODO} from "../utils/types"; +import {TODO, Node} from "../utils/types"; -export default function NodeStatusChart({items}: {items: TODO[]}) { +export default function NodeStatusChart({items}: {items: Node[]}) { const readyCount = _.sumBy(items, x => getReadyStatus(x) === 'True' ? 1 : 0); // eslint-disable-line no-confusing-arrow return ( diff --git a/client/src/components/podStatusChart.tsx b/client/src/components/podStatusChart.tsx index 572b5e5..7cf5a43 100644 --- a/client/src/components/podStatusChart.tsx +++ b/client/src/components/podStatusChart.tsx @@ -2,15 +2,15 @@ import _ from 'lodash'; import React from 'react'; import Chart from './chart'; import LoadingChart from './loadingChart'; -import {TODO} from "../utils/types"; +import {Pod} from "../utils/types"; -export default function PodStatusChart({items}: {items: TODO[]}) { +export default function PodStatusChart({items}: {items?: Pod[]}) { const available = items && items.length; const count = _.sumBy(items, x => x.status.phase === 'Running' ? 1 : 0); // eslint-disable-line no-confusing-arrow return (
- {items ? ( + {items && available ? ( ) : ( diff --git a/client/src/components/podsPanel.tsx b/client/src/components/podsPanel.tsx index 56d3e99..de8d10c 100644 --- a/client/src/components/podsPanel.tsx +++ b/client/src/components/podsPanel.tsx @@ -6,14 +6,14 @@ import LoadingEllipsis from './loadingEllipsis'; import {MetadataHeaders, MetadataColumns, TableBody} from './listViewHelpers'; import {unparseRam, unparseCpu} from '../utils/unitHelpers'; import {getPodResourcePercent, getPodUsage, getPodResourceValue} from '../utils/metricsHelpers'; -import {TODO} from "../utils/types"; +import {Pod, TODO} from "../utils/types"; interface PodsPanelProps { metrics: TODO; - pods: TODO[]; - items: TODO[]; - sort: TODO; - filter: TODO; + pods?: TODO[]; + items?: Pod[]; + sort?: TODO; + filter?: TODO; skipNamespace: boolean; } diff --git a/client/src/utils/types.ts b/client/src/utils/types.ts index 2175963..ae97b1d 100644 --- a/client/src/utils/types.ts +++ b/client/src/utils/types.ts @@ -14,6 +14,9 @@ interface Metadata { } interface Container { + name?: string; + image?: string; + args?: string[]; resources?: { requests?: { cpu?: string;