mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
b8eaa657a2
commit
a305b04292
14 files changed
+91
-81
No files matched your search
@@ -160,11 +160,11 @@ export class ClusterManager {
|
||||
|
||||
static ipcListen(clusterManager: ClusterManager) {
|
||||
const handlers = {
|
||||
[ClusterIpcMessage.CLUSTER_ADD]: clusterManager.addCluster,
|
||||
[ClusterIpcMessage.CLUSTER_STOP]: clusterManager.stopCluster,
|
||||
[ClusterIpcMessage.CLUSTER_REMOVE]: clusterManager.removeCluster,
|
||||
[ClusterIpcMessage.CLUSTER_REMOVE_WORKSPACE]: clusterManager.removeAllByWorkspace,
|
||||
[ClusterIpcMessage.CLUSTER_REFRESH]: clusterManager.refreshCluster,
|
||||
[ClusterIpcMessage.ADD]: clusterManager.addCluster,
|
||||
[ClusterIpcMessage.STOP]: clusterManager.stopCluster,
|
||||
[ClusterIpcMessage.REMOVE]: clusterManager.removeCluster,
|
||||
[ClusterIpcMessage.REMOVE_WORKSPACE]: clusterManager.removeAllByWorkspace,
|
||||
[ClusterIpcMessage.REFRESH]: clusterManager.refreshCluster,
|
||||
[ClusterIpcMessage.FEATURE_INSTALL]: clusterManager.installFeature,
|
||||
[ClusterIpcMessage.FEATURE_UPGRADE]: clusterManager.upgradeFeature,
|
||||
[ClusterIpcMessage.FEATURE_REMOVE]: clusterManager.uninstallFeature,
|
||||
|
||||
+2
-2
@@ -62,14 +62,14 @@ export class Cluster implements ClusterModel {
|
||||
this.kubeProxyUrl = `http://localhost:${port}${apiKubePrefix}`;
|
||||
this.webContentUrl = `http://${this.id}.localhost:${port}`;
|
||||
this.initialized = true;
|
||||
logger.info(`✅ ️Cluster init success`, {
|
||||
logger.info(`[CLUSTER]: init success`, {
|
||||
id: this.id,
|
||||
serverUrl: this.apiUrl,
|
||||
webContentUrl: this.webContentUrl,
|
||||
kubeProxyUrl: this.kubeProxyUrl,
|
||||
});
|
||||
} catch (err) {
|
||||
logger.error(`💣 Cluster init failed: ${err}`, {
|
||||
logger.error(`[CLUSTER]: init failed: ${err}`, {
|
||||
id: this.id,
|
||||
error: err,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ChildProcess, spawn } from "child_process"
|
||||
import { waitUntilUsed } from "tcp-port-used";
|
||||
import { sendMessage } from "../common/ipc-helpers";
|
||||
import { broadcastMessage } from "../common/ipc-helpers";
|
||||
import type { Cluster } from "./cluster"
|
||||
import { bundledKubectl, Kubectl } from "./kubectl"
|
||||
import logger from "./logger"
|
||||
@@ -84,7 +84,7 @@ export class KubeAuthProxy {
|
||||
const channel = `kube-auth:${this.cluster.id}`
|
||||
const message = { data, stream };
|
||||
logger.debug(channel, message);
|
||||
sendMessage(channel, message);
|
||||
broadcastMessage(channel, message);
|
||||
}
|
||||
|
||||
public exit() {
|
||||
|
||||
@@ -42,13 +42,8 @@ export class WindowManager {
|
||||
});
|
||||
}),
|
||||
// auto-show active cluster view
|
||||
reaction(() => clusterStore.activeCluster, activeCluster => {
|
||||
if (activeCluster) {
|
||||
this.activateView(activeCluster.id);
|
||||
}
|
||||
}, {
|
||||
reaction(() => clusterStore.activeClusterId, clusterId => this.activateView(clusterId), {
|
||||
fireImmediately: true,
|
||||
delay: 250,
|
||||
})
|
||||
)
|
||||
}
|
||||
@@ -71,10 +66,14 @@ export class WindowManager {
|
||||
if (!cluster) return;
|
||||
try {
|
||||
const activeView = this.activeView;
|
||||
const isFresh = !this.getView(clusterId);
|
||||
const isLoadedBefore = !!this.getView(clusterId);
|
||||
const view = this.initView(clusterId);
|
||||
logger.info(`Activating cluster(${cluster.id}) view`, {
|
||||
contextName: cluster.contextName,
|
||||
isLoadedBefore: isLoadedBefore,
|
||||
});
|
||||
if (view !== activeView) {
|
||||
if (isFresh) {
|
||||
if (!isLoadedBefore) {
|
||||
await cluster.whenReady;
|
||||
await view.loadURL(cluster.webContentUrl);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user