mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Improve how kubernetes cluster status is resolved (#2909)
This commit is contained in:
1 parent
0ad44d6f40
commit
39149eedfd
4 files changed
+36
-6
No files matched your search
@@ -25,9 +25,12 @@ import { appEventBus } from "./event-bus";
|
||||
import { ResourceApplier } from "../main/resource-applier";
|
||||
import { ipcMain, IpcMainInvokeEvent } from "electron";
|
||||
import { clusterFrameMap } from "./cluster-frames";
|
||||
import { catalogEntityRegistry } from "../main/catalog";
|
||||
import type { KubernetesCluster } from "./catalog-entities";
|
||||
|
||||
export const clusterActivateHandler = "cluster:activate";
|
||||
export const clusterSetFrameIdHandler = "cluster:set-frame-id";
|
||||
export const clusterVisibilityHandler = "cluster:visibility";
|
||||
export const clusterRefreshHandler = "cluster:refresh";
|
||||
export const clusterDisconnectHandler = "cluster:disconnect";
|
||||
export const clusterKubectlApplyAllHandler = "cluster:kubectl-apply-all";
|
||||
@@ -49,6 +52,18 @@ if (ipcMain) {
|
||||
}
|
||||
});
|
||||
|
||||
handleRequest(clusterVisibilityHandler, (event: IpcMainInvokeEvent, clusterId: ClusterId, visible: boolean) => {
|
||||
const entity = catalogEntityRegistry.getById<KubernetesCluster>(clusterId);
|
||||
|
||||
for (const kubeEntity of catalogEntityRegistry.getItemsForApiKind(entity.apiVersion, entity.kind)) {
|
||||
kubeEntity.status.active = false;
|
||||
}
|
||||
|
||||
if (entity) {
|
||||
entity.status.active = visible;
|
||||
}
|
||||
});
|
||||
|
||||
handleRequest(clusterRefreshHandler, (event, clusterId: ClusterId) => {
|
||||
return ClusterStore.getInstance()
|
||||
.getById(clusterId)
|
||||
|
||||
Reference in new issue
Block a user