mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Disconnect cluster in onbeforeunload()
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
e59cb04d5a
commit
09eee81797
@ -10,10 +10,9 @@ import { Notifications } from "../../../components/notifications";
|
|||||||
import type { AppEvent } from "../../../../common/app-event-bus/event-bus";
|
import type { AppEvent } from "../../../../common/app-event-bus/event-bus";
|
||||||
import type { CatalogEntity } from "../../../../common/catalog";
|
import type { CatalogEntity } from "../../../../common/catalog";
|
||||||
import { when } from "mobx";
|
import { when } from "mobx";
|
||||||
import { unmountComponentAtNode } from "react-dom";
|
|
||||||
import type { ClusterFrameContext } from "../../../cluster-frame-context/cluster-frame-context";
|
import type { ClusterFrameContext } from "../../../cluster-frame-context/cluster-frame-context";
|
||||||
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
import { KubeObjectStore } from "../../../../common/k8s-api/kube-object.store";
|
||||||
import { requestSetClusterFrameId } from "../../../ipc";
|
import { requestClusterDisconnection, requestSetClusterFrameId } from "../../../ipc";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
hostedCluster: Cluster;
|
hostedCluster: Cluster;
|
||||||
@ -30,7 +29,7 @@ const logPrefix = "[CLUSTER-FRAME]:";
|
|||||||
|
|
||||||
export const initClusterFrame =
|
export const initClusterFrame =
|
||||||
({ hostedCluster, loadExtensions, catalogEntityRegistry, frameRoutingId, emitEvent, clusterFrameContext }: Dependencies) =>
|
({ hostedCluster, loadExtensions, catalogEntityRegistry, frameRoutingId, emitEvent, clusterFrameContext }: Dependencies) =>
|
||||||
async (rootElem: HTMLElement) => {
|
async () => {
|
||||||
|
|
||||||
// TODO: Make catalogEntityRegistry already initialized when passed as dependency
|
// TODO: Make catalogEntityRegistry already initialized when passed as dependency
|
||||||
catalogEntityRegistry.init();
|
catalogEntityRegistry.init();
|
||||||
@ -84,7 +83,7 @@ export const initClusterFrame =
|
|||||||
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
|
`${logPrefix} Unload dashboard, clusterId=${(hostedCluster.id)}, frameId=${frameRoutingId}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
unmountComponentAtNode(rootElem);
|
requestClusterDisconnection(hostedCluster.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Make context dependency of KubeObjectStore
|
// TODO: Make context dependency of KubeObjectStore
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user