mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
remove array desctructor of Object.values, which is brittle (#1854)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
9be17582f7
commit
3fc552a466
@ -7,6 +7,7 @@ import { IResourceMetricsValue, ResourceMetricsContext } from "../resource-metri
|
|||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { ChartOptions, ChartPoint } from "chart.js";
|
import { ChartOptions, ChartPoint } from "chart.js";
|
||||||
import { themeStore } from "../../theme.store";
|
import { themeStore } from "../../theme.store";
|
||||||
|
import { mapValues } from "lodash";
|
||||||
|
|
||||||
type IContext = IResourceMetricsValue<Node, { metrics: IClusterMetrics }>;
|
type IContext = IResourceMetricsValue<Node, { metrics: IClusterMetrics }>;
|
||||||
|
|
||||||
@ -15,26 +16,26 @@ export const NodeCharts = observer(() => {
|
|||||||
const id = object.getId();
|
const id = object.getId();
|
||||||
const { chartCapacityColor } = themeStore.activeTheme.colors;
|
const { chartCapacityColor } = themeStore.activeTheme.colors;
|
||||||
|
|
||||||
if (!metrics) return null;
|
if (!metrics) {
|
||||||
if (isMetricsEmpty(metrics)) return <NoMetrics/>;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const values = Object.values(metrics).map(metric =>
|
if (isMetricsEmpty(metrics)) {
|
||||||
normalizeMetrics(metric).data.result[0].values
|
return <NoMetrics />;
|
||||||
);
|
}
|
||||||
const [
|
|
||||||
|
const {
|
||||||
memoryUsage,
|
memoryUsage,
|
||||||
memoryRequests,
|
memoryRequests,
|
||||||
_memoryLimits, // eslint-disable-line unused-imports/no-unused-vars-ts
|
|
||||||
memoryCapacity,
|
memoryCapacity,
|
||||||
cpuUsage,
|
cpuUsage,
|
||||||
cpuRequests,
|
cpuRequests,
|
||||||
_cpuLimits, // eslint-disable-line unused-imports/no-unused-vars-ts
|
|
||||||
cpuCapacity,
|
cpuCapacity,
|
||||||
podUsage,
|
podUsage,
|
||||||
podCapacity,
|
podCapacity,
|
||||||
fsSize,
|
fsSize,
|
||||||
fsUsage
|
fsUsage
|
||||||
] = values;
|
} = mapValues(metrics, metric => normalizeMetrics(metric).data.result[0].values);
|
||||||
|
|
||||||
const datasets = [
|
const datasets = [
|
||||||
// CPU
|
// CPU
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user