mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
remove unnecessary global watches in cluster view (#4073)
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
8072b44b3d
commit
755c75008a
@ -22,7 +22,7 @@
|
|||||||
import "./cluster-issues.scss";
|
import "./cluster-issues.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { computed, makeObservable } from "mobx";
|
import { computed, makeObservable } from "mobx";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { SubHeader } from "../layout/sub-header";
|
import { SubHeader } from "../layout/sub-header";
|
||||||
@ -34,7 +34,6 @@ import type { ItemObject } from "../../../common/item.store";
|
|||||||
import { Spinner } from "../spinner";
|
import { Spinner } from "../spinner";
|
||||||
import { ThemeStore } from "../../theme.store";
|
import { ThemeStore } from "../../theme.store";
|
||||||
import { kubeSelectedUrlParam, toggleDetails } from "../kube-detail-params";
|
import { kubeSelectedUrlParam, toggleDetails } from "../kube-detail-params";
|
||||||
import { kubeWatchApi } from "../../../common/k8s-api/kube-watch-api";
|
|
||||||
import { apiManager } from "../../../common/k8s-api/api-manager";
|
import { apiManager } from "../../../common/k8s-api/api-manager";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -66,10 +65,6 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
makeObservable(this);
|
makeObservable(this);
|
||||||
|
|
||||||
disposeOnUnmount(this, [
|
|
||||||
kubeWatchApi.subscribeStores([eventStore, nodesStore])
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get warnings() {
|
@computed get warnings() {
|
||||||
|
|||||||
@ -36,6 +36,8 @@ import { ClusterPieCharts } from "./cluster-pie-charts";
|
|||||||
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
import { getActiveClusterEntity } from "../../api/catalog-entity-registry";
|
||||||
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
import { ClusterMetricsResourceType } from "../../../common/cluster-types";
|
||||||
import { ClusterStore } from "../../../common/cluster-store";
|
import { ClusterStore } from "../../../common/cluster-store";
|
||||||
|
import { kubeWatchApi } from "../../../common/k8s-api/kube-watch-api";
|
||||||
|
import { eventStore } from "../+events/event.store";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class ClusterOverview extends React.Component {
|
export class ClusterOverview extends React.Component {
|
||||||
@ -53,6 +55,9 @@ export class ClusterOverview extends React.Component {
|
|||||||
this.metricPoller.start(true);
|
this.metricPoller.start(true);
|
||||||
|
|
||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
|
kubeWatchApi.subscribeStores([podsStore, eventStore, nodesStore], {
|
||||||
|
preload: true,
|
||||||
|
}),
|
||||||
reaction(
|
reaction(
|
||||||
() => clusterOverviewStore.metricNodeRole, // Toggle Master/Worker node switcher
|
() => clusterOverviewStore.metricNodeRole, // Toggle Master/Worker node switcher
|
||||||
() => this.metricPoller.restart(true)
|
() => this.metricPoller.restart(true)
|
||||||
@ -91,7 +96,7 @@ export class ClusterOverview extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const isLoaded = nodesStore.isLoaded && podsStore.isLoaded;
|
const isLoaded = nodesStore.isLoaded && eventStore.isLoaded;
|
||||||
const isMetricHidden = getActiveClusterEntity()?.isMetricHidden(ClusterMetricsResourceType.Cluster);
|
const isMetricHidden = getActiveClusterEntity()?.isMetricHidden(ClusterMetricsResourceType.Cluster);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -42,9 +42,6 @@ import whatInput from "what-input";
|
|||||||
import { clusterSetFrameIdHandler } from "../../common/cluster-ipc";
|
import { clusterSetFrameIdHandler } from "../../common/cluster-ipc";
|
||||||
import { ClusterPageMenuRegistration, ClusterPageMenuRegistry } from "../../extensions/registries";
|
import { ClusterPageMenuRegistration, ClusterPageMenuRegistry } from "../../extensions/registries";
|
||||||
import { StatefulSetScaleDialog } from "./+workloads-statefulsets/statefulset-scale-dialog";
|
import { StatefulSetScaleDialog } from "./+workloads-statefulsets/statefulset-scale-dialog";
|
||||||
import { eventStore } from "./+events/event.store";
|
|
||||||
import { nodesStore } from "./+nodes/nodes.store";
|
|
||||||
import { podsStore } from "./+workloads-pods/pods.store";
|
|
||||||
import { kubeWatchApi } from "../../common/k8s-api/kube-watch-api";
|
import { kubeWatchApi } from "../../common/k8s-api/kube-watch-api";
|
||||||
import { ReplicaSetScaleDialog } from "./+workloads-replicasets/replicaset-scale-dialog";
|
import { ReplicaSetScaleDialog } from "./+workloads-replicasets/replicaset-scale-dialog";
|
||||||
import { CommandContainer } from "./command-palette/command-container";
|
import { CommandContainer } from "./command-palette/command-container";
|
||||||
@ -137,7 +134,7 @@ export class App extends React.Component {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
kubeWatchApi.subscribeStores([podsStore, nodesStore, eventStore, namespaceStore], {
|
kubeWatchApi.subscribeStores([namespaceStore], {
|
||||||
preload: true,
|
preload: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user