From 589cdc8a3d8a939b2d15c8e27c03e7d5d74ec794 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Thu, 14 Jan 2021 09:12:10 +0200 Subject: [PATCH] Convert initializing to observable and ensure it is set to false after init Signed-off-by: Lauri Nevala --- src/main/cluster.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 9a9c1adab4..c6c14f6406 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -76,7 +76,6 @@ export class Cluster implements ClusterModel, ClusterState { * If extension sets this it needs to also mark cluster as enabled on activate (or when added to a store) */ public ownerRef: string; - public initializing = false; protected kubeconfigManager: KubeconfigManager; protected eventDisposers: Function[] = []; protected activated = false; @@ -85,6 +84,14 @@ export class Cluster implements ClusterModel, ClusterState { whenInitialized = when(() => this.initialized); whenReady = when(() => this.ready); + /** + * Is cluster object initializinng on-going + * + * @observable + */ + @observable initializing = false; + + /** * Is cluster object initialized * @@ -279,7 +286,6 @@ export class Cluster implements ClusterModel, ClusterState { this.kubeconfigManager = await KubeconfigManager.create(this, this.contextHandler, port); this.kubeProxyUrl = `http://localhost:${port}${apiKubePrefix}`; this.initialized = true; - this.initializing = false; logger.info(`[CLUSTER]: "${this.contextName}" init success`, { id: this.id, context: this.contextName, @@ -290,6 +296,8 @@ export class Cluster implements ClusterModel, ClusterState { id: this.id, error: err, }); + } finally { + this.initializing = false; } }