Fix TypeError: Cannot read property 'stopServer' of undefined (#1440)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and Lauri Nevala committed 2020-11-20 11:47:44 +02:00
1 parent 5d077b0bb4
commit e68132d37e
1 file changed
+9 -5
+9 -5
View File
@@ -144,18 +144,22 @@ export class Cluster implements ClusterModel {
await this.refreshAllowedResources() await this.refreshAllowedResources()
this.isAdmin = await this.isClusterAdmin() this.isAdmin = await this.isClusterAdmin()
this.ready = true this.ready = true
this.kubeCtl = new Kubectl(this.version) this.ensureKubectl()
this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard
} }
this.activated = true this.activated = true
return this.pushState(); return this.pushState();
} }
protected async ensureKubectl() {
this.kubeCtl = new Kubectl(this.version)
return this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard
}
@action @action
async reconnect() { async reconnect() {
logger.info(`[CLUSTER]: reconnect`, this.getMeta()); logger.info(`[CLUSTER]: reconnect`, this.getMeta());
this.contextHandler.stopServer(); this.contextHandler?.stopServer();
await this.contextHandler.ensureServer(); await this.contextHandler?.ensureServer();
this.disconnected = false; this.disconnected = false;
} }
@@ -163,7 +167,7 @@ export class Cluster implements ClusterModel {
disconnect() { disconnect() {
logger.info(`[CLUSTER]: disconnect`, this.getMeta()); logger.info(`[CLUSTER]: disconnect`, this.getMeta());
this.unbindEvents(); this.unbindEvents();
this.contextHandler.stopServer(); this.contextHandler?.stopServer();
this.disconnected = true; this.disconnected = true;
this.online = false; this.online = false;
this.accessible = false; this.accessible = false;