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 (#1467)

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Lauri Nevala 2020-11-20 13:03:48 +02:00 committed by GitHub
parent c92d1e614a
commit a50fb348b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;