mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove cluster view when removed from store (#758)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
4b3570a190
commit
4196576e99
@ -1,4 +1,4 @@
|
||||
import { observable } from "mobx";
|
||||
import { observable, when } from "mobx";
|
||||
import { ClusterId, clusterStore } from "../../../common/cluster-store";
|
||||
import { getMatchedCluster } from "./cluster-view.route"
|
||||
import logger from "../../../main/logger";
|
||||
@ -32,6 +32,12 @@ export async function initView(clusterId: ClusterId) {
|
||||
})
|
||||
lensViews.set(clusterId, { clusterId, view: iframe });
|
||||
parentElem.appendChild(iframe);
|
||||
// auto-clean when cluster removed
|
||||
await when(() => !clusterStore.getById(clusterId));
|
||||
logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`)
|
||||
parentElem.removeChild(iframe)
|
||||
lensViews.delete(clusterId)
|
||||
|
||||
}
|
||||
|
||||
export function refreshViews() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user