From 97f501e6ea164669ef58eac9c741d3c223e1fa6a Mon Sep 17 00:00:00 2001 From: salvadorac Date: Tue, 20 Jul 2021 14:30:37 -0700 Subject: [PATCH] using Prometheus to add time axis for node count Signed-off-by: salvadorac --- client/src/components/nodeStatusChart.tsx | 25 ++++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/client/src/components/nodeStatusChart.tsx b/client/src/components/nodeStatusChart.tsx index c45346b..93663f1 100644 --- a/client/src/components/nodeStatusChart.tsx +++ b/client/src/components/nodeStatusChart.tsx @@ -1,16 +1,24 @@ -import _ from 'lodash'; import React from 'react'; -import Chart from './chart'; import LoadingChart from './loadingChart'; import {Node} from '../utils/types'; +import PrometheusGraph from '../views/prometheusgraph'; export default function NodeStatusChart({items}: {items?: Node[]}) { - const readyCount = _.sumBy(items, x => getReadyStatus(x) === 'True' ? 1 : 0); // eslint-disable-line no-confusing-arrow - + const query = { + queryString: 'sum(kube_node_info)', + title: 'Node Count', + yAxisMin: 0, + yAxisUnit: 'Nodes', + }; return (
{items ? ( - + ) : ( )} @@ -19,10 +27,3 @@ export default function NodeStatusChart({items}: {items?: Node[]}) {
); } - -function getReadyStatus({status}: Node) { - if (!status.conditions) return null; - - const ready = status.conditions.find(y => y.type === 'Ready'); - return ready && ready.status; -}