1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

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 2020-11-19 13:48:43 +02:00 committed by Lauri Nevala
parent 5d077b0bb4
commit e68132d37e

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;