mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix doughnut graphs on workload overview sometimes not showing (#5727)
This commit is contained in:
1 parent
7767216167
commit
4b1c9fb5fd
36 files changed
+868
-184
No files matched your search
@@ -10,27 +10,28 @@ import { BarChart } from "../chart";
|
||||
import { isMetricsEmpty, normalizeMetrics } from "../../../common/k8s-api/endpoints/metrics.api";
|
||||
import { NoMetrics } from "../resource-metrics/no-metrics";
|
||||
import { ResourceMetricsContext } from "../resource-metrics";
|
||||
import type { ThemeStore } from "../../themes/store";
|
||||
import type { LensTheme } from "../../themes/store";
|
||||
import { mapValues } from "lodash";
|
||||
import { type MetricsTab, metricTabOptions } from "../chart/options";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import themeStoreInjectable from "../../themes/store.injectable";
|
||||
import activeThemeInjectable from "../../themes/active.injectable";
|
||||
import type { IComputedValue } from "mobx";
|
||||
|
||||
export interface ContainerChartsProps {}
|
||||
|
||||
interface Dependencies {
|
||||
themeStore: ThemeStore;
|
||||
activeTheme: IComputedValue<LensTheme>;
|
||||
}
|
||||
|
||||
const NonInjectedContainerCharts = observer(({
|
||||
themeStore,
|
||||
activeTheme,
|
||||
}: Dependencies & ContainerChartsProps) => {
|
||||
const { metrics, tab, object } = useContext(ResourceMetricsContext) ?? {};
|
||||
|
||||
if (!metrics || !object || !tab) return null;
|
||||
if (isMetricsEmpty(metrics)) return <NoMetrics/>;
|
||||
|
||||
const { chartCapacityColor } = themeStore.activeTheme.colors;
|
||||
const { chartCapacityColor } = activeTheme.get().colors;
|
||||
const {
|
||||
cpuUsage,
|
||||
cpuRequests,
|
||||
@@ -127,6 +128,6 @@ const NonInjectedContainerCharts = observer(({
|
||||
export const ContainerCharts = withInjectables<Dependencies, ContainerChartsProps>(NonInjectedContainerCharts, {
|
||||
getProps: (di, props) => ({
|
||||
...props,
|
||||
themeStore: di.inject(themeStoreInjectable),
|
||||
activeTheme: di.inject(activeThemeInjectable),
|
||||
}),
|
||||
});
|
||||
Reference in new issue
Block a user