diff --git a/integration/specs/app_spec.ts b/integration/specs/app_spec.ts index 9aae5fe88b..e15c17ead5 100644 --- a/integration/specs/app_spec.ts +++ b/integration/specs/app_spec.ts @@ -17,10 +17,6 @@ describe("app start", () => { const addMinikubeCluster = async (app: Application) => { await app.client.click("div.add-cluster") await app.client.waitUntilTextExists("div", "Select kubeconfig file") - await app.client.click("div.Select__control") - await app.client.waitUntilTextExists("div", "minikube") - await app.client.click("div.minikube") - await app.client.click("div.Select__control") await app.client.click("button.primary") } diff --git a/package.json b/package.json index 1cfb3b2247..70230c3268 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "kontena-lens", "productName": "Lens", "description": "Lens - The Kubernetes IDE", - "version": "3.6.3", + "version": "3.6.4", "main": "static/build/main.js", "copyright": "© 2020, Mirantis, Inc.", "license": "MIT", diff --git a/src/common/cluster-ipc.ts b/src/common/cluster-ipc.ts index b8f9f5f84b..f48ce0f9c4 100644 --- a/src/common/cluster-ipc.ts +++ b/src/common/cluster-ipc.ts @@ -14,6 +14,14 @@ export const clusterIpc = { }, }), + refresh: createIpcChannel({ + channel: "cluster:refresh", + handle: (clusterId: ClusterId) => { + const cluster = clusterStore.getById(clusterId); + if (cluster) return cluster.refresh(); + }, + }), + disconnect: createIpcChannel({ channel: "cluster:disconnect", handle: (clusterId: ClusterId) => { diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 48bf01ee02..9fc9172296 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -133,7 +133,13 @@ export class Cluster implements ClusterModel { if (this.disconnected || (!init && !this.accessible)) { await this.reconnect(); } - await this.refresh(); + await this.refreshConnectionStatus() + if (this.accessible) { + await this.refreshAllowedResources() + this.ready = true + this.kubeCtl = new Kubectl(this.version) + this.kubeCtl.ensureKubectl() // download kubectl in background, so it's not blocking dashboard + } return this.pushState(); } @@ -159,15 +165,14 @@ export class Cluster implements ClusterModel { @action async refresh() { logger.info(`[CLUSTER]: refresh`, this.getMeta()); - await this.refreshConnectionStatus(); // refresh "version", "online", etc. + await this.whenInitialized; + await this.refreshConnectionStatus(); if (this.accessible) { - this.kubeCtl = new Kubectl(this.version) this.distribution = this.detectKubernetesDistribution(this.version) const [features, isAdmin, nodesCount] = await Promise.all([ getFeatures(this), this.isClusterAdmin(), this.getNodeCount(), - this.kubeCtl.ensureKubectl() ]); this.features = features; this.isAdmin = isAdmin; @@ -176,8 +181,8 @@ export class Cluster implements ClusterModel { this.refreshEvents(), this.refreshAllowedResources(), ]); - this.ready = true } + this.pushState(); } @action diff --git a/src/main/shell-session.ts b/src/main/shell-session.ts index 704d97382a..1d9d722f57 100644 --- a/src/main/shell-session.ts +++ b/src/main/shell-session.ts @@ -39,7 +39,7 @@ export class ShellSession extends EventEmitter { public async open() { this.kubectlBinDir = await this.kubectl.binDir() const pathFromPreferences = userStore.preferences.kubectlBinariesPath || Kubectl.bundledKubectlPath - this.kubectlPathDir = userStore.preferences.downloadKubectlBinaries ? await this.kubectl.binDir() : path.dirname(pathFromPreferences) + this.kubectlPathDir = userStore.preferences.downloadKubectlBinaries ? this.kubectlBinDir : path.dirname(pathFromPreferences) this.helmBinDir = helmCli.getBinaryDir() const env = await this.getCachedShellEnv() const shell = env.PTYSHELL diff --git a/src/renderer/components/+404/not-found.tsx b/src/renderer/components/+404/not-found.tsx index e585abe326..a158e6f124 100644 --- a/src/renderer/components/+404/not-found.tsx +++ b/src/renderer/components/+404/not-found.tsx @@ -1,15 +1,15 @@ import React from "react"; import { Trans } from "@lingui/macro"; -import { MainLayout } from "../layout/main-layout"; +import { TabLayout } from "../layout/tab-layout"; export class NotFound extends React.Component { render() { return ( - +

Page not found

-
- ) + + ); } -} \ No newline at end of file +} diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index 0350cdcd6b..624df4c1bf 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -80,7 +80,6 @@ export class AddCluster extends React.Component { const contexts = this.getContexts(this.kubeConfigLocal); this.kubeContexts.replace(contexts); break; - case KubeConfigSourceTab.TEXT: try { this.error = "" @@ -91,6 +90,10 @@ export class AddCluster extends React.Component { } break; } + + if (this.kubeContexts.size === 1) { + this.selectedContexts.push(this.kubeContexts.keys().next().value) + } } getContexts(config: KubeConfig): Map { @@ -206,7 +209,7 @@ export class AddCluster extends React.Component { Select kubeconfig file} - active={this.sourceTab == KubeConfigSourceTab.FILE}/> + active={this.sourceTab == KubeConfigSourceTab.FILE} /> Paste as text} @@ -320,13 +323,15 @@ export class AddCluster extends React.Component { return (
{context} - {isNew && } - {isSelected && } + {isNew && } + {isSelected && }
) }; render() { + const addDisabled = this.selectedContexts.length === 0 + return (