ClusterOverview page refactorings (#1696)

* ClusterOverview page refactorings

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Minor test fix for MainLayoutHeader

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Replacing class name in tests

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Remove unnecessary parenthesis

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2020-12-11 07:36:47 +02:00
1 parent 961a38d52f
commit a61e20965d
11 files changed
+106 -124

No files matched your search

@@ -6,10 +6,10 @@ import { observer } from "mobx-react";
import { nodesStore } from "../+nodes/nodes.store";
import { cssNames } from "../../utils";
import { Radio, RadioGroup } from "../radio";
import { clusterStore, MetricNodeRole, MetricType } from "./cluster.store";
import { clusterOverviewStore, MetricNodeRole, MetricType } from "./cluster-overview.store";
export const ClusterMetricSwitchers = observer(() => {
const { metricType, metricNodeRole, getMetricsValues, metrics } = clusterStore;
const { metricType, metricNodeRole, getMetricsValues, metrics } = clusterOverviewStore;
const { masterNodes, workerNodes } = nodesStore;
const metricsValues = getMetricsValues(metrics);
const disableRoles = !masterNodes.length || !workerNodes.length;
@@ -22,7 +22,7 @@ export const ClusterMetricSwitchers = observer(() => {
asButtons
className={cssNames("RadioGroup flex gaps", { disabled: disableRoles })}
value={metricNodeRole}
onChange={(metric: MetricNodeRole) => clusterStore.metricNodeRole = metric}
onChange={(metric: MetricNodeRole) => clusterOverviewStore.metricNodeRole = metric}
>
<Radio label={<Trans>Master</Trans>} value={MetricNodeRole.MASTER}/>
<Radio label={<Trans>Worker</Trans>} value={MetricNodeRole.WORKER}/>
@@ -33,7 +33,7 @@ export const ClusterMetricSwitchers = observer(() => {
asButtons
className={cssNames("RadioGroup flex gaps", { disabled: disableMetrics })}
value={metricType}
onChange={(value: MetricType) => clusterStore.metricType = value}
onChange={(value: MetricType) => clusterOverviewStore.metricType = value}
>
<Radio label={<Trans>CPU</Trans>} value={MetricType.CPU}/>
<Radio label={<Trans>Memory</Trans>} value={MetricType.MEMORY}/>