mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-08-24 04:16:18 +00:00
Merge pull request #251 from salvadorac/issue224
using Prometheus to add time axis
This commit is contained in:
@@ -1,17 +1,25 @@
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import Chart from './chart';
|
||||
import LoadingChart from './loadingChart';
|
||||
import {Pod} from '../utils/types';
|
||||
import PrometheusGraph from '../views/prometheusgraph';
|
||||
|
||||
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
|
||||
|
||||
const query = {
|
||||
queryString: 'sum(kube_pod_info)',
|
||||
title: 'Pod Count',
|
||||
yAxisMin: 0,
|
||||
yAxisUnit: 'Pods',
|
||||
};
|
||||
return (
|
||||
<div className='charts_item'>
|
||||
{items && available ? (
|
||||
<Chart used={count} pending={available - count} available={available} />
|
||||
<PrometheusGraph
|
||||
queryString={query.queryString}
|
||||
title={query.title}
|
||||
yAxisMin={query.yAxisMin}
|
||||
yAxisUnit={query.yAxisUnit}
|
||||
/>
|
||||
) : (
|
||||
<LoadingChart />
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user