From 74f3826235799f3bf9b73abc5ea56cda2119881a Mon Sep 17 00:00:00 2001 From: Juho Heikka Date: Wed, 15 Sep 2021 15:48:12 +0300 Subject: [PATCH 01/30] Second click on list item closes the details view (#3809) Signed-off-by: Juho Heikka --- .../components/+apps-helm-charts/helm-charts.tsx | 10 +++++++++- src/renderer/components/+apps-releases/releases.tsx | 10 +++++++++- src/renderer/components/+catalog/catalog.tsx | 6 +++++- src/renderer/components/+cluster/cluster-issues.tsx | 4 ++-- src/renderer/components/kube-detail-params/params.ts | 10 ++++++++++ .../kube-object-list-layout.tsx | 4 ++-- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/+apps-helm-charts/helm-charts.tsx b/src/renderer/components/+apps-helm-charts/helm-charts.tsx index 8a47654adc..da5f9f8c5a 100644 --- a/src/renderer/components/+apps-helm-charts/helm-charts.tsx +++ b/src/renderer/components/+apps-helm-charts/helm-charts.tsx @@ -55,6 +55,14 @@ export class HelmCharts extends Component { return helmChartStore.getByName(chartName, repo); } + onDetails = (chart: HelmChart) => { + if (chart === this.selectedChart) { + this.hideDetails(); + } else { + this.showDetails(chart); + } + }; + showDetails = (chart: HelmChart) => { if (!chart) { navigation.push(helmChartsURL()); @@ -121,7 +129,7 @@ export class HelmCharts extends Component { { className: "menu" } ]} detailsItem={this.selectedChart} - onDetails={this.showDetails} + onDetails={this.onDetails} /> {this.selectedChart && ( { }); } + onDetails = (item: HelmRelease) => { + if (item === this.selectedRelease) { + this.hideDetails(); + } else { + this.showDetails(item); + } + }; + showDetails = (item: HelmRelease) => { navigation.push(releaseURL({ params: { @@ -169,7 +177,7 @@ export class HelmReleases extends Component { message: this.renderRemoveDialogMessage(selectedItems) })} detailsItem={this.selectedRelease} - onDetails={this.showDetails} + onDetails={this.onDetails} /> { } onDetails = (item: CatalogEntityItem) => { - this.catalogEntityStore.selectedItemId = item.getId(); + if (this.catalogEntityStore.selectedItemId === item.getId()) { + this.catalogEntityStore.selectedItemId = null; + } else { + this.catalogEntityStore.selectedItemId = item.getId(); + } }; onMenuItemClick(menuItem: CatalogEntityContextMenu) { diff --git a/src/renderer/components/+cluster/cluster-issues.tsx b/src/renderer/components/+cluster/cluster-issues.tsx index 9b5f73b9a6..fb5b98bc28 100644 --- a/src/renderer/components/+cluster/cluster-issues.tsx +++ b/src/renderer/components/+cluster/cluster-issues.tsx @@ -33,7 +33,7 @@ import { boundMethod, cssNames, prevDefault } from "../../utils"; import type { ItemObject } from "../../../common/item.store"; import { Spinner } from "../spinner"; import { ThemeStore } from "../../theme.store"; -import { kubeSelectedUrlParam, showDetails } from "../kube-detail-params"; +import { kubeSelectedUrlParam, toggleDetails } from "../kube-detail-params"; import { kubeWatchApi } from "../../../common/k8s-api/kube-watch-api"; import { apiManager } from "../../../common/k8s-api/api-manager"; @@ -124,7 +124,7 @@ export class ClusterIssues extends React.Component { key={getId()} sortItem={warning} selected={selfLink === kubeSelectedUrlParam.get()} - onClick={prevDefault(() => showDetails(selfLink))} + onClick={prevDefault(() => toggleDetails(selfLink))} > {message} diff --git a/src/renderer/components/kube-detail-params/params.ts b/src/renderer/components/kube-detail-params/params.ts index 09256077d0..856f4968a6 100644 --- a/src/renderer/components/kube-detail-params/params.ts +++ b/src/renderer/components/kube-detail-params/params.ts @@ -41,6 +41,16 @@ export const kubeSelectedUrlParam = createPageParam({ } }); +export function toggleDetails(selfLink: string, resetSelected = true) { + const current = kubeSelectedUrlParam.get() === selfLink; + + if (current) { + hideDetails(); + } else { + showDetails(selfLink, resetSelected); + } +} + export function showDetails(selfLink = "", resetSelected = true) { const detailsUrl = getDetailsUrl(selfLink, resetSelected); diff --git a/src/renderer/components/kube-object-list-layout/kube-object-list-layout.tsx b/src/renderer/components/kube-object-list-layout/kube-object-list-layout.tsx index d55e30b28f..cefcc4b0f2 100644 --- a/src/renderer/components/kube-object-list-layout/kube-object-list-layout.tsx +++ b/src/renderer/components/kube-object-list-layout/kube-object-list-layout.tsx @@ -31,7 +31,7 @@ import { kubeWatchApi } from "../../../common/k8s-api/kube-watch-api"; import { clusterContext } from "../context"; import { NamespaceSelectFilter } from "../+namespaces/namespace-select-filter"; import { ResourceKindMap, ResourceNames } from "../../utils/rbac"; -import { kubeSelectedUrlParam, showDetails } from "../kube-detail-params"; +import { kubeSelectedUrlParam, toggleDetails } from "../kube-detail-params"; export interface KubeObjectListLayoutProps extends ItemListLayoutProps { store: KubeObjectStore; @@ -39,7 +39,7 @@ export interface KubeObjectListLayoutProps extends ItemLis } const defaultProps: Partial> = { - onDetails: (item: KubeObject) => showDetails(item.selfLink), + onDetails: (item: KubeObject) => toggleDetails(item.selfLink), }; @observer From e0a2cea27d1c8123f6cf656da6d544b5c52642f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Sep 2021 16:02:41 +0300 Subject: [PATCH 02/30] Bump mobx-react from 7.1.0 to 7.2.0 (#3727) Bumps [mobx-react](https://github.com/mobxjs/mobx) from 7.1.0 to 7.2.0. - [Release notes](https://github.com/mobxjs/mobx/releases) - [Commits](https://github.com/mobxjs/mobx/compare/mobx-react@7.1.0...mobx-react@7.2.0) --- updated-dependencies: - dependency-name: mobx-react dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ef59d10728..dd1923142c 100644 --- a/package.json +++ b/package.json @@ -216,7 +216,7 @@ "md5-file": "^5.0.0", "mobx": "^6.3.0", "mobx-observable-history": "^2.0.1", - "mobx-react": "^7.1.0", + "mobx-react": "^7.2.0", "mock-fs": "^4.14.0", "moment": "^2.29.1", "moment-timezone": "^0.5.33", diff --git a/yarn.lock b/yarn.lock index 3f24e65868..24fa440087 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9715,10 +9715,10 @@ mobx-react-lite@^3.2.0: resolved "https://registry.yarnpkg.com/mobx-react-lite/-/mobx-react-lite-3.2.0.tgz#331d7365a6b053378dfe9c087315b4e41c5df69f" integrity sha512-q5+UHIqYCOpBoFm/PElDuOhbcatvTllgRp3M1s+Hp5j0Z6XNgDbgqxawJ0ZAUEyKM8X1zs70PCuhAIzX1f4Q/g== -mobx-react@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/mobx-react/-/mobx-react-7.1.0.tgz#d947cada3cfad294b4b6f692e969c242b9c16eaf" - integrity sha512-DxvA6VXmnZ+N9f/UTtolWtdRnAAQY2iHWTSPLktfpj8NKlXUe4dabBAjuXrBcZUM8GjLWnxD1ZEjssXq1M0RAw== +mobx-react@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/mobx-react/-/mobx-react-7.2.0.tgz#241e925e963bb83a31d269f65f9f379e37ecbaeb" + integrity sha512-KHUjZ3HBmZlNnPd1M82jcdVsQRDlfym38zJhZEs33VxyVQTvL77hODCArq6+C1P1k/6erEeo2R7rpE7ZeOL7dg== dependencies: mobx-react-lite "^3.2.0" From 07d8d567deb1dd1383a1e59a0af2a9be998b7883 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Wed, 15 Sep 2021 16:36:19 +0300 Subject: [PATCH 03/30] Fix fallback to bundled kubectl (#3812) --- src/main/kubectl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kubectl.ts b/src/main/kubectl.ts index fbfd044dab..4695e8272e 100644 --- a/src/main/kubectl.ts +++ b/src/main/kubectl.ts @@ -275,7 +275,7 @@ export class Kubectl { return false; }); - isValid = !await this.checkBinary(this.path, false); + isValid = await this.checkBinary(this.path, false); } if (!isValid) { From f68cbabbc904df3a0431ade4d2d6a1c34fa63b50 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Sep 2021 12:19:15 -0400 Subject: [PATCH 04/30] Fix cluster's accessibleNamespaces being reset on restarting Lens (#3817) Signed-off-by: Sebastian Malton --- src/common/catalog-entities/kubernetes-cluster.ts | 1 + src/main/cluster-manager.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/catalog-entities/kubernetes-cluster.ts b/src/common/catalog-entities/kubernetes-cluster.ts index b2ff284069..3335d3803d 100644 --- a/src/common/catalog-entities/kubernetes-cluster.ts +++ b/src/common/catalog-entities/kubernetes-cluster.ts @@ -51,6 +51,7 @@ export interface KubernetesClusterSpec extends CatalogEntitySpec { material?: string; background?: string; }; + accessibleNamespaces?: string[]; } export interface KubernetesClusterMetadata extends CatalogEntityMetadata { diff --git a/src/main/cluster-manager.ts b/src/main/cluster-manager.ts index fdc3bf3e1a..307b4592f1 100644 --- a/src/main/cluster-manager.ts +++ b/src/main/cluster-manager.ts @@ -193,7 +193,10 @@ export class ClusterManager extends Singleton { } else { cluster.kubeConfigPath = entity.spec.kubeconfigPath; cluster.contextName = entity.spec.kubeconfigContext; - cluster.accessibleNamespaces = entity.spec.accessibleNamespaces ?? []; + + if (entity.spec.accessibleNamespace) { + cluster.accessibleNamespaces = entity.spec.accessibleNamespaces; + } this.updateEntityFromCluster(cluster); } From b43086a386bae9bd52a35c8df37ca930931f3e9d Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Sep 2021 12:27:48 -0400 Subject: [PATCH 05/30] Don't change permissions when deleting a cluster (#3798) Signed-off-by: Sebastian Malton --- package.json | 1 - .../delete-cluster-dialog/save-config.ts | 15 ++++----------- yarn.lock | 18 ------------------ 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index dd1923142c..141ec3a5a0 100644 --- a/package.json +++ b/package.json @@ -348,7 +348,6 @@ "jest-canvas-mock": "^2.3.1", "jest-fetch-mock": "^3.0.3", "jest-mock-extended": "^1.0.16", - "json-to-pretty-yaml": "^1.2.2", "make-plural": "^6.2.2", "mini-css-extract-plugin": "^1.6.0", "node-gyp": "7.1.2", diff --git a/src/renderer/components/delete-cluster-dialog/save-config.ts b/src/renderer/components/delete-cluster-dialog/save-config.ts index d9aa03e2a5..536926a6b1 100644 --- a/src/renderer/components/delete-cluster-dialog/save-config.ts +++ b/src/renderer/components/delete-cluster-dialog/save-config.ts @@ -19,25 +19,18 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import type { KubeConfig } from "@kubernetes/client-node"; +import { dumpYaml, KubeConfig } from "@kubernetes/client-node"; import fs from "fs"; -import tempy from "tempy"; import * as lockFile from "proper-lockfile"; -import YAML from "json-to-pretty-yaml"; -import { noop } from "../../utils"; export async function saveKubeconfig(config: KubeConfig, path: string) { - const tmpFilePath = tempy.file(); - try { const release = await lockFile.lock(path); - const contents = YAML.stringify(JSON.parse(config.exportConfig())); + const contents = dumpYaml(JSON.parse(config.exportConfig())); - await fs.promises.writeFile(tmpFilePath, contents); - await fs.promises.rename(tmpFilePath, path); - release(); + await fs.promises.writeFile(path, contents); + await release(); } catch (e) { - await fs.unlink(tmpFilePath, noop); throw new Error(`Failed to acquire lock file.\n${e}`); } } diff --git a/yarn.lock b/yarn.lock index 24fa440087..87a86e853b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8628,14 +8628,6 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= -json-to-pretty-yaml@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b" - integrity sha1-9M0L0KXo/h3yWq9boRiwmf2ZLVs= - dependencies: - remedial "^1.0.7" - remove-trailing-spaces "^1.0.6" - json3@^3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" @@ -12101,21 +12093,11 @@ relateurl@^0.2.7: resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= -remedial@^1.0.7: - version "1.0.8" - resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" - integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== - remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= -remove-trailing-spaces@^1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/remove-trailing-spaces/-/remove-trailing-spaces-1.0.8.tgz#4354d22f3236374702f58ee373168f6d6887ada7" - integrity sha512-O3vsMYfWighyFbTd8hk8VaSj9UAGENxAtX+//ugIst2RMk5e03h6RoIS+0ylsFxY1gvmPuAY/PO4It+gPEeySA== - renderkid@^2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.3.tgz#380179c2ff5ae1365c522bf2fcfcff01c5b74149" From 068c78d48d2f35883bdc08ff090bf69bc0a897f2 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Sep 2021 12:28:06 -0400 Subject: [PATCH 06/30] Draggable region on macOS should be the same as the main header (#3800) Signed-off-by: Sebastian Malton --- src/renderer/components/app.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/renderer/components/app.scss b/src/renderer/components/app.scss index 8490f986c8..9d4946cd9f 100755 --- a/src/renderer/components/app.scss +++ b/src/renderer/components/app.scss @@ -39,7 +39,6 @@ --font-weight-normal: 400; --font-weight-bold: 500; --main-layout-header: 40px; - --drag-region-height: 22px; } *, *:before, *:after { @@ -105,7 +104,7 @@ html, body { left: 0; top: 0; width: 100%; - height: var(--drag-region-height); + height: var(--main-layout-header); z-index: 1000; pointer-events: none; } From 056b818cebe42adf997c820803e764e6d01d6b58 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Sep 2021 13:09:57 -0400 Subject: [PATCH 07/30] Fix check for user exec command (#3664) --- package.json | 3 +- src/common/custom-errors.ts | 11 +++--- src/common/kube-helpers.ts | 18 ++++++---- .../components/+add-cluster/add-cluster.scss | 7 ++++ .../components/+add-cluster/add-cluster.tsx | 36 +++++++++++++++---- yarn.lock | 10 +++--- 6 files changed, 62 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 141ec3a5a0..9da0f23cac 100644 --- a/package.json +++ b/package.json @@ -185,6 +185,7 @@ "@kubernetes/client-node": "^0.15.1", "@sentry/electron": "^2.5.0", "@sentry/integrations": "^6.10.0", + "@types/which": "^2.0.1", "abort-controller": "^3.0.0", "array-move": "^3.0.1", "auto-bind": "^4.0.0", @@ -193,7 +194,6 @@ "byline": "^5.0.0", "chalk": "^4.1.0", "chokidar": "^3.4.3", - "command-exists": "1.2.9", "conf": "^7.0.1", "crypto-js": "^4.1.1", "electron-devtools-installer": "^3.2.0", @@ -246,6 +246,7 @@ "tempy": "^0.5.0", "url-parse": "^1.5.1", "uuid": "^8.3.2", + "which": "^2.0.2", "win-ca": "^3.2.0", "winston": "^3.3.3", "winston-console-format": "^1.0.8", diff --git a/src/common/custom-errors.ts b/src/common/custom-errors.ts index 2cbc75ccf0..0016af87ca 100644 --- a/src/common/custom-errors.ts +++ b/src/common/custom-errors.ts @@ -19,15 +19,18 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +import path from "path"; + export class ExecValidationNotFoundError extends Error { - constructor(execPath: string, isAbsolute: boolean) { - super(`User Exec command "${execPath}" not found on host.`); + constructor(execPath: string) { let message = `User Exec command "${execPath}" not found on host.`; - if (!isAbsolute) { + if (!path.isAbsolute(execPath)) { message += ` Please ensure binary is found in PATH or use absolute path to binary in Kubeconfig`; } - this.message = message; + + super(message); + this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } diff --git a/src/common/kube-helpers.ts b/src/common/kube-helpers.ts index aff05e68c6..4bd420e7b2 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -25,11 +25,11 @@ import path from "path"; import os from "os"; import yaml from "js-yaml"; import logger from "../main/logger"; -import commandExists from "command-exists"; import { ExecValidationNotFoundError } from "./custom-errors"; import { Cluster, Context, newClusters, newContexts, newUsers, User } from "@kubernetes/client-node/dist/config_types"; import { resolvePath } from "./utils"; import Joi from "joi"; +import which from "which"; export type KubeConfigValidationOpts = { validateCluster?: boolean; @@ -295,13 +295,17 @@ export function validateKubeConfig(config: KubeConfig, contextName: string, vali // Validate exec command if present if (validateExec && user?.exec) { - const execCommand = user.exec["command"]; - // check if the command is absolute or not - const isAbsolute = path.isAbsolute(execCommand); + try { + which.sync(user.exec.command); - // validate the exec struct in the user object, start with the command field - if (!commandExists.sync(execCommand)) { - return new ExecValidationNotFoundError(execCommand, isAbsolute); + // If this doesn't throw an error it also means that it has found the executable. + } catch (error) { + switch (error?.code) { + case "ENOENT": + return new ExecValidationNotFoundError(user.exec.command); + default: + return error; + } } } diff --git a/src/renderer/components/+add-cluster/add-cluster.scss b/src/renderer/components/+add-cluster/add-cluster.scss index faac757c40..8abb38e9d0 100644 --- a/src/renderer/components/+add-cluster/add-cluster.scss +++ b/src/renderer/components/+add-cluster/add-cluster.scss @@ -50,4 +50,11 @@ display: block; padding-top: 6px; } + + .actions-panel { + .Spinner { + vertical-align: middle; + margin-left: $spacing; + } + } } diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index e987c1d4bb..16a6dec19e 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -24,7 +24,7 @@ import "./add-cluster.scss"; import type { KubeConfig } from "@kubernetes/client-node"; import fse from "fs-extra"; import { debounce } from "lodash"; -import { action, computed, observable, makeObservable } from "mobx"; +import { action, computed, observable, makeObservable, runInAction } from "mobx"; import { observer } from "mobx-react"; import path from "path"; import React from "react"; @@ -41,6 +41,7 @@ import { SettingLayout } from "../layout/setting-layout"; import MonacoEditor from "react-monaco-editor"; import { ThemeStore } from "../../theme.store"; import { UserStore } from "../../../common/user-store"; +import { Spinner } from "../spinner"; interface Option { config: KubeConfig; @@ -62,6 +63,7 @@ export class AddCluster extends React.Component { @observable kubeContexts = observable.map(); @observable customConfig = ""; @observable isWaiting = false; + @observable isCheckingInput = false; @observable errorText: string; constructor(props: {}) { @@ -80,14 +82,35 @@ export class AddCluster extends React.Component { ].filter(Boolean); } - @action - refreshContexts = debounce(() => { - const { config, error } = loadConfigFromString(this.customConfig.trim() || "{}"); + _refreshContexts = debounce(() => { + runInAction(() => { + try { + const text = this.customConfig.trim(); - this.kubeContexts.replace(getContexts(config)); - this.errorText = error?.toString(); + if (!text) { + return this.kubeContexts.clear(); + } + + const { config, error } = loadConfigFromString(text); + + this.kubeContexts.replace(getContexts(config)); + this.errorText = error?.toString(); + } catch (error) { + this.kubeContexts.clear(); + this.errorText = error?.toString() || "An error occured"; + } finally { + this.isCheckingInput = false; + } + }); }, 500); + refreshContexts = () => { + // Clear the kubeContexts immediately + this.isCheckingInput = true; + this.kubeContexts.clear(); + this._refreshContexts(); + }; + @action addClusters = async () => { this.isWaiting = true; @@ -145,6 +168,7 @@ export class AddCluster extends React.Component { tooltip={this.kubeContexts.size === 0 || "Paste in at least one cluster to add."} tooltipOverrideDisabled /> + {this.isCheckingInput && } ); diff --git a/yarn.lock b/yarn.lock index 87a86e853b..ce76e9ac72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2184,6 +2184,11 @@ anymatch "^3.0.0" source-map "^0.6.0" +"@types/which@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@types/which/-/which-2.0.1.tgz#27ecd67f915b7c3d6ba552135bb1eecd66e63501" + integrity sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ== + "@types/ws@^6.0.1": version "6.0.4" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-6.0.4.tgz#7797707c8acce8f76d8c34b370d4645b70421ff1" @@ -4110,11 +4115,6 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -command-exists@1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" - integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== - commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" From be1a2ebe591cd027321ce8942a38e173046c672a Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 15 Sep 2021 17:40:36 -0400 Subject: [PATCH 08/30] Fix shell connection readiness heuristic (#3795) --- src/renderer/api/terminal-api.ts | 20 ------------------- .../components/dock/terminal.store.ts | 15 ++++++++------ 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/renderer/api/terminal-api.ts b/src/renderer/api/terminal-api.ts index 347dfac224..59e248fba5 100644 --- a/src/renderer/api/terminal-api.ts +++ b/src/renderer/api/terminal-api.ts @@ -58,7 +58,6 @@ export class TerminalApi extends WebSocketApi { public onReady = new EventEmitter<[]>(); @observable public isReady = false; - @observable public shellRunCommandsFinished = false; public readonly url: string; constructor(protected options: TerminalApiQuery) { @@ -92,7 +91,6 @@ export class TerminalApi extends WebSocketApi { connect() { this.emitStatus("Connecting ..."); this.onData.addListener(this._onReady, { prepend: true }); - this.onData.addListener(this._onShellRunCommandsFinished); super.connect(this.url); } @@ -109,24 +107,6 @@ export class TerminalApi extends WebSocketApi { this.onReady.removeAllListeners(); } - _onShellRunCommandsFinished = (data: string) => { - if (!data) { - return; - } - - /** - * This is a heuistic for ditermining when a shell has finished executing - * its own rc file (or RunCommands file) such as `.bashrc` or `.zshrc`. - * - * This heuistic assumes that the prompt line of a terminal is a single line - * and ends with a whitespace character. - */ - if (data.match(/\r?\n/) === null && data.match(/\s$/)) { - this.shellRunCommandsFinished = true; - this.onData.removeListener(this._onShellRunCommandsFinished); - } - }; - @boundMethod protected _onReady(data: string) { if (!data) return true; diff --git a/src/renderer/components/dock/terminal.store.ts b/src/renderer/components/dock/terminal.store.ts index dd5251bac2..b5116a94e8 100644 --- a/src/renderer/components/dock/terminal.store.ts +++ b/src/renderer/components/dock/terminal.store.ts @@ -117,15 +117,18 @@ export class TerminalStore extends Singleton { await when(() => this.connections.has(tab.id)); - const rcIsFinished = when(() => this.connections.get(tab.id).shellRunCommandsFinished); + const shellIsReady = when(() => this.connections.get(tab.id).isReady); const notifyVeryLong = setTimeout(() => { - rcIsFinished.cancel(); - Notifications.info("Terminal shell is taking a long time to complete startup. Please check your .rc file. Bypassing shell completion check.", { - timeout: 4_000, - }); + shellIsReady.cancel(); + Notifications.info( + "If terminal shell is not ready please check your shell init files, if applicable.", + { + timeout: 4_000, + }, + ); }, 10_000); - await rcIsFinished.catch(noop); + await shellIsReady.catch(noop); clearTimeout(notifyVeryLong); } From 1ebb8eedf769ddcd73144a553201730275d7d5cc Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 16 Sep 2021 09:02:43 -0400 Subject: [PATCH 09/30] Upgrade all testing linux CI machines to Ubuntu-20.04 (#3799) --- .azure-pipelines-k8s-matrix.yml | 4 ++-- .azure-pipelines.yml | 2 +- .github/workflows/test.yml | 14 ++++---------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.azure-pipelines-k8s-matrix.yml b/.azure-pipelines-k8s-matrix.yml index 77129460a3..9f1f38ec67 100644 --- a/.azure-pipelines-k8s-matrix.yml +++ b/.azure-pipelines-k8s-matrix.yml @@ -15,7 +15,7 @@ trigger: none jobs: - job: Linux pool: - vmImage: ubuntu-16.04 + vmImage: ubuntu-20.04 strategy: matrix: kube_1.16: @@ -46,7 +46,7 @@ jobs: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube sudo minikube start --driver=none --kubernetes-version $(kubernetes_version) - # Although the kube and minikube config files are in placed $HOME they are owned by root + sudo mv /root/.kube /root/.minikube $HOME sudo chown -R $USER $HOME/.kube $HOME/.minikube displayName: Install integration test dependencies - script: make node_modules diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 3e1b43f875..e360a818e6 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -109,7 +109,7 @@ jobs: - job: Linux pool: - vmImage: ubuntu-16.04 + vmImage: ubuntu-20.04 strategy: matrix: node_14.x: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b319c97770..25b3327ac0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-16.04, macos-11, windows-2019] + os: [ubuntu-20.04, macos-11, windows-2019] node-version: [14.x] steps: - name: Checkout Release from lens @@ -67,15 +67,9 @@ jobs: - run: make test-extensions name: Run In-tree Extension tests - - run: | - sudo apt-get update - sudo apt-get install libgconf-2-4 conntrack -y - curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 - sudo install minikube-linux-amd64 /usr/local/bin/minikube - sudo minikube start --driver=none - # Although the kube and minikube config files are in placed $HOME they are owned by root - sudo chown -R $USER $HOME/.kube $HOME/.minikube - name: Install integration test dependencies + - name: Install integration test dependencies + id: minikube + uses: medyagh/setup-minikube@5a9a7104d7322fa40424de8855c84685e89cefd7 if: runner.os == 'Linux' - run: xvfb-run --auto-servernum --server-args='-screen 0, 1600x900x24' make integration From e5c9c9a4b5e33369a000df3d3fe0a182bca557ff Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 16 Sep 2021 10:38:31 -0400 Subject: [PATCH 10/30] Fix test GH action to run on all branches (#3822) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25b3327ac0..4bc748d235 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: pull_request: branches: - - "*" + - "**" push: branches: - master From 53ce818589f394dc131b8787f183b71f98165b13 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Fri, 17 Sep 2021 11:13:04 +0300 Subject: [PATCH 11/30] Revert "Fix check for user exec command (#3664)" (#3827) This reverts commit 056b818cebe42adf997c820803e764e6d01d6b58. Signed-off-by: Lauri Nevala --- package.json | 3 +- src/common/custom-errors.ts | 11 +++--- src/common/kube-helpers.ts | 18 ++++------ .../components/+add-cluster/add-cluster.scss | 7 ---- .../components/+add-cluster/add-cluster.tsx | 36 ++++--------------- yarn.lock | 10 +++--- 6 files changed, 23 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index 9da0f23cac..141ec3a5a0 100644 --- a/package.json +++ b/package.json @@ -185,7 +185,6 @@ "@kubernetes/client-node": "^0.15.1", "@sentry/electron": "^2.5.0", "@sentry/integrations": "^6.10.0", - "@types/which": "^2.0.1", "abort-controller": "^3.0.0", "array-move": "^3.0.1", "auto-bind": "^4.0.0", @@ -194,6 +193,7 @@ "byline": "^5.0.0", "chalk": "^4.1.0", "chokidar": "^3.4.3", + "command-exists": "1.2.9", "conf": "^7.0.1", "crypto-js": "^4.1.1", "electron-devtools-installer": "^3.2.0", @@ -246,7 +246,6 @@ "tempy": "^0.5.0", "url-parse": "^1.5.1", "uuid": "^8.3.2", - "which": "^2.0.2", "win-ca": "^3.2.0", "winston": "^3.3.3", "winston-console-format": "^1.0.8", diff --git a/src/common/custom-errors.ts b/src/common/custom-errors.ts index 0016af87ca..2cbc75ccf0 100644 --- a/src/common/custom-errors.ts +++ b/src/common/custom-errors.ts @@ -19,18 +19,15 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import path from "path"; - export class ExecValidationNotFoundError extends Error { - constructor(execPath: string) { + constructor(execPath: string, isAbsolute: boolean) { + super(`User Exec command "${execPath}" not found on host.`); let message = `User Exec command "${execPath}" not found on host.`; - if (!path.isAbsolute(execPath)) { + if (!isAbsolute) { message += ` Please ensure binary is found in PATH or use absolute path to binary in Kubeconfig`; } - - super(message); - + this.message = message; this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } diff --git a/src/common/kube-helpers.ts b/src/common/kube-helpers.ts index 4bd420e7b2..aff05e68c6 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -25,11 +25,11 @@ import path from "path"; import os from "os"; import yaml from "js-yaml"; import logger from "../main/logger"; +import commandExists from "command-exists"; import { ExecValidationNotFoundError } from "./custom-errors"; import { Cluster, Context, newClusters, newContexts, newUsers, User } from "@kubernetes/client-node/dist/config_types"; import { resolvePath } from "./utils"; import Joi from "joi"; -import which from "which"; export type KubeConfigValidationOpts = { validateCluster?: boolean; @@ -295,17 +295,13 @@ export function validateKubeConfig(config: KubeConfig, contextName: string, vali // Validate exec command if present if (validateExec && user?.exec) { - try { - which.sync(user.exec.command); + const execCommand = user.exec["command"]; + // check if the command is absolute or not + const isAbsolute = path.isAbsolute(execCommand); - // If this doesn't throw an error it also means that it has found the executable. - } catch (error) { - switch (error?.code) { - case "ENOENT": - return new ExecValidationNotFoundError(user.exec.command); - default: - return error; - } + // validate the exec struct in the user object, start with the command field + if (!commandExists.sync(execCommand)) { + return new ExecValidationNotFoundError(execCommand, isAbsolute); } } diff --git a/src/renderer/components/+add-cluster/add-cluster.scss b/src/renderer/components/+add-cluster/add-cluster.scss index 8abb38e9d0..faac757c40 100644 --- a/src/renderer/components/+add-cluster/add-cluster.scss +++ b/src/renderer/components/+add-cluster/add-cluster.scss @@ -50,11 +50,4 @@ display: block; padding-top: 6px; } - - .actions-panel { - .Spinner { - vertical-align: middle; - margin-left: $spacing; - } - } } diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index 16a6dec19e..e987c1d4bb 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -24,7 +24,7 @@ import "./add-cluster.scss"; import type { KubeConfig } from "@kubernetes/client-node"; import fse from "fs-extra"; import { debounce } from "lodash"; -import { action, computed, observable, makeObservable, runInAction } from "mobx"; +import { action, computed, observable, makeObservable } from "mobx"; import { observer } from "mobx-react"; import path from "path"; import React from "react"; @@ -41,7 +41,6 @@ import { SettingLayout } from "../layout/setting-layout"; import MonacoEditor from "react-monaco-editor"; import { ThemeStore } from "../../theme.store"; import { UserStore } from "../../../common/user-store"; -import { Spinner } from "../spinner"; interface Option { config: KubeConfig; @@ -63,7 +62,6 @@ export class AddCluster extends React.Component { @observable kubeContexts = observable.map(); @observable customConfig = ""; @observable isWaiting = false; - @observable isCheckingInput = false; @observable errorText: string; constructor(props: {}) { @@ -82,35 +80,14 @@ export class AddCluster extends React.Component { ].filter(Boolean); } - _refreshContexts = debounce(() => { - runInAction(() => { - try { - const text = this.customConfig.trim(); + @action + refreshContexts = debounce(() => { + const { config, error } = loadConfigFromString(this.customConfig.trim() || "{}"); - if (!text) { - return this.kubeContexts.clear(); - } - - const { config, error } = loadConfigFromString(text); - - this.kubeContexts.replace(getContexts(config)); - this.errorText = error?.toString(); - } catch (error) { - this.kubeContexts.clear(); - this.errorText = error?.toString() || "An error occured"; - } finally { - this.isCheckingInput = false; - } - }); + this.kubeContexts.replace(getContexts(config)); + this.errorText = error?.toString(); }, 500); - refreshContexts = () => { - // Clear the kubeContexts immediately - this.isCheckingInput = true; - this.kubeContexts.clear(); - this._refreshContexts(); - }; - @action addClusters = async () => { this.isWaiting = true; @@ -168,7 +145,6 @@ export class AddCluster extends React.Component { tooltip={this.kubeContexts.size === 0 || "Paste in at least one cluster to add."} tooltipOverrideDisabled /> - {this.isCheckingInput && } ); diff --git a/yarn.lock b/yarn.lock index ce76e9ac72..87a86e853b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2184,11 +2184,6 @@ anymatch "^3.0.0" source-map "^0.6.0" -"@types/which@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@types/which/-/which-2.0.1.tgz#27ecd67f915b7c3d6ba552135bb1eecd66e63501" - integrity sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ== - "@types/ws@^6.0.1": version "6.0.4" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-6.0.4.tgz#7797707c8acce8f76d8c34b370d4645b70421ff1" @@ -4115,6 +4110,11 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" +command-exists@1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" + integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== + commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" From 8b3d237f3b50f07509e6d1d7eaeb4d42bb670c88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 11:41:10 +0300 Subject: [PATCH 12/30] Bump sass from 1.39.0 to 1.41.1 (#3825) Bumps [sass](https://github.com/sass/dart-sass) from 1.39.0 to 1.41.1. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.39.0...1.41.1) --- updated-dependencies: - dependency-name: sass dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 141ec3a5a0..f9652a5cac 100644 --- a/package.json +++ b/package.json @@ -367,7 +367,7 @@ "react-select-event": "^5.1.0", "react-table": "^7.7.0", "react-window": "^1.8.5", - "sass": "^1.39.0", + "sass": "^1.41.1", "sass-loader": "^8.0.2", "sharp": "^0.29.0", "style-loader": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 87a86e853b..46af019646 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12418,17 +12418,10 @@ sass-loader@^8.0.2: schema-utils "^2.6.1" semver "^6.3.0" -sass@^1.32.13: - version "1.35.2" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.35.2.tgz#b732314fcdaf7ef8d0f1698698adc378043cb821" - integrity sha512-jhO5KAR+AMxCEwIH3v+4zbB2WB0z67V1X0jbapfVwQQdjHZUGUyukpnoM6+iCMfsIUC016w9OPKQ5jrNOS9uXw== - dependencies: - chokidar ">=3.0.0 <4.0.0" - -sass@^1.39.0: - version "1.39.0" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.39.0.tgz#6c64695d1c437767c8f1a4e471288e831f81d035" - integrity sha512-F4o+RhJkNOIG0b6QudYU8c78ZADKZjKDk5cyrf8XTKWfrgbtyVVXImFstJrc+1pkQDCggyidIOytq6gS4gCCZg== +sass@^1.32.13, sass@^1.41.1: + version "1.41.1" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.41.1.tgz#bca5bed2154192779c29f48fca9c644c60c38d98" + integrity sha512-vIjX7izRxw3Wsiez7SX7D+j76v7tenfO18P59nonjr/nzCkZuoHuF7I/Fo0ZRZPKr88v29ivIdE9BqGDgQD/Nw== dependencies: chokidar ">=3.0.0 <4.0.0" From e251194cb511685371dba026c410e1273b3ad28a Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 20 Sep 2021 06:01:05 -0400 Subject: [PATCH 13/30] Fix reference error when opening cluster view (#3824) Signed-off-by: Sebastian Malton --- src/renderer/api/catalog-entity-registry.ts | 18 +++++++++++++++++- src/renderer/components/app.tsx | 10 ++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/renderer/api/catalog-entity-registry.ts b/src/renderer/api/catalog-entity-registry.ts index 7b09ff273b..d731e2562a 100644 --- a/src/renderer/api/catalog-entity-registry.ts +++ b/src/renderer/api/catalog-entity-registry.ts @@ -31,7 +31,7 @@ import { once } from "lodash"; export type EntityFilter = (entity: CatalogEntity) => any; export class CatalogEntityRegistry { - @observable.ref activeEntity: CatalogEntity; + @observable protected activeEntityId: string | undefined = undefined; protected _entities = observable.map([], { deep: true }); protected filters = observable.set([], { deep: false, @@ -46,6 +46,22 @@ export class CatalogEntityRegistry { makeObservable(this); } + get activeEntity(): CatalogEntity | null { + return this._entities.get(this.activeEntityId) || null; + } + + set activeEntity(raw: CatalogEntity | string | null) { + if (raw) { + const id = typeof raw === "string" + ? raw + : raw.getId(); + + this.activeEntityId = id; + } else { + this.activeEntityId = undefined; + } + } + init() { ipcRendererOn("catalog:items", (event, items: (CatalogEntityData & CatalogEntityKindData)[]) => { this.updateItems(items); diff --git a/src/renderer/components/app.tsx b/src/renderer/components/app.tsx index 3f8dbf7d8b..c7d60f3b4f 100755 --- a/src/renderer/components/app.tsx +++ b/src/renderer/components/app.tsx @@ -19,7 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import React from "react"; -import { observable, makeObservable, reaction } from "mobx"; +import { observable, makeObservable } from "mobx"; import { disposeOnUnmount, observer } from "mobx-react"; import { Redirect, Route, Router, Switch } from "react-router"; import { history } from "../navigation"; @@ -97,13 +97,7 @@ export class App extends React.Component { await cluster.whenReady; // cluster.activate() is done at this point - const activeEntityDisposer = reaction(() => catalogEntityRegistry.getById(App.clusterId), (entity) => { - if (!entity) { - return; - } - catalogEntityRegistry.activeEntity = entity; - activeEntityDisposer(); - }, {fireImmediately: true}); + catalogEntityRegistry.activeEntity = App.clusterId; ExtensionLoader.getInstance().loadOnClusterRenderer(); setTimeout(() => { From d448017f334a39b0ee9d974d867e236b4e0104e2 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Mon, 20 Sep 2021 15:15:26 +0300 Subject: [PATCH 14/30] Fix node-fetch load on renderer (#3836) * fix node-fetch load on renderer Signed-off-by: Jari Kolehmainen * cleanup Signed-off-by: Jari Kolehmainen * cleanup Signed-off-by: Jari Kolehmainen --- src/main/window-manager.ts | 2 -- webpack.main.ts | 39 +------------------------------------- webpack.renderer.ts | 3 +++ 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/main/window-manager.ts b/src/main/window-manager.ts index be6d71498e..80e3224fd4 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -31,7 +31,6 @@ import { IpcRendererNavigationEvents } from "../renderer/navigation/events"; import logger from "./logger"; import { productName } from "../common/vars"; import { LensProxy } from "./lens-proxy"; -import * as path from "path"; function isHideable(window: BrowserWindow | null): boolean { return Boolean(window && !window.isDestroyed()); @@ -85,7 +84,6 @@ export class WindowManager extends Singleton { titleBarStyle: "hiddenInset", backgroundColor: "#1e2124", webPreferences: { - preload: path.join(__static, "build", "preload.js"), nodeIntegration: true, nodeIntegrationInSubFrames: true, enableRemoteModule: true, diff --git a/webpack.main.ts b/webpack.main.ts index 33d9daf6af..62e51bf4a2 100755 --- a/webpack.main.ts +++ b/webpack.main.ts @@ -22,7 +22,7 @@ import path from "path"; import type webpack from "webpack"; import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin"; -import { isProduction, mainDir, buildDir, isDevelopment, preloadEntrypoint } from "./src/common/vars"; +import { isProduction, mainDir, buildDir, isDevelopment } from "./src/common/vars"; import nodeExternals from "webpack-node-externals"; import ProgressBarPlugin from "progress-bar-webpack-plugin"; import * as vars from "./src/common/vars"; @@ -68,41 +68,4 @@ configs.push((): webpack.Configuration => { }; }); -configs.push((): webpack.Configuration => { - console.info("WEBPACK:preload", vars); - - return { - context: __dirname, - target: "electron-main", - mode: isProduction ? "production" : "development", - devtool: isProduction ? "source-map" : "cheap-eval-source-map", - cache: isDevelopment, - entry: { - main: path.resolve(preloadEntrypoint), - }, - output: { - libraryTarget: "global", - path: buildDir, - filename: "preload.js" - }, - resolve: { - extensions: [".json", ".js", ".ts"], - mainFields: ["main"] - }, - module: { - rules: [ - { - test: /\.node$/, - use: "node-loader" - }, - getTSLoader(/\.ts$/) - ] - }, - plugins: [ - new ProgressBarPlugin(), - new ForkTsCheckerPlugin(), - ].filter(Boolean) - }; -}); - export default configs; diff --git a/webpack.renderer.ts b/webpack.renderer.ts index 5be6ba09dc..5e43213bd0 100755 --- a/webpack.renderer.ts +++ b/webpack.renderer.ts @@ -79,6 +79,9 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura ".ts", ".tsx", ] }, + externals: { + "node-fetch": "commonjs node-fetch" + }, optimization: { minimize: false }, From dfa0a35695d09c9fffc2e291550d65bec8ba4c31 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 20 Sep 2021 09:54:12 -0400 Subject: [PATCH 15/30] Fix error due to async validators for (#3823) Signed-off-by: Sebastian Malton --- src/renderer/components/input/input.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/input/input.tsx b/src/renderer/components/input/input.tsx index e5276ffcb5..f9054ceeb8 100644 --- a/src/renderer/components/input/input.tsx +++ b/src/renderer/components/input/input.tsx @@ -91,7 +91,7 @@ const defaultProps: Partial = { export class Input extends React.Component { static defaultProps = defaultProps as object; - public input: InputElement; + public input: InputElement | null = null; public validators: InputValidator[] = []; public state: State = { @@ -191,7 +191,7 @@ export class Input extends React.Component { } } - this.input.setCustomValidity(errors.length ? errors[0].toString() : ""); + this.input?.setCustomValidity(errors.length ? errors[0].toString() : ""); } setValidation(errors: React.ReactNode[]) { From 429418a1e2b4f17d50bef4140560e1566abdda6e Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Mon, 20 Sep 2021 17:09:51 +0300 Subject: [PATCH 16/30] Emit contextMenuOpen for WebLink CatalogEntity (#3842) Signed-off-by: Panu Horsmalahti --- src/common/catalog-entities/web-link.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/catalog-entities/web-link.ts b/src/common/catalog-entities/web-link.ts index d54aa8533a..8309945f24 100644 --- a/src/common/catalog-entities/web-link.ts +++ b/src/common/catalog-entities/web-link.ts @@ -57,6 +57,10 @@ export class WebLink extends CatalogEntity(this) + ?.emit("contextMenuOpen", this, context); } } From 070fc1bb443d5b0e3eee02989b98549d0b91e647 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 22 Sep 2021 07:42:05 +0300 Subject: [PATCH 17/30] Fix long name layout in Cluster Settings (#3854) * Fix long name layout in Cluster Settings Signed-off-by: Alex Andreev * Clean up Signed-off-by: Alex Andreev --- ...ttings.scss => entity-settings.module.css} | 32 ++++++------------- .../+entity-settings/entity-settings.tsx | 7 ++-- 2 files changed, 13 insertions(+), 26 deletions(-) rename src/renderer/components/+entity-settings/{entity-settings.scss => entity-settings.module.css} (76%) diff --git a/src/renderer/components/+entity-settings/entity-settings.scss b/src/renderer/components/+entity-settings/entity-settings.module.css similarity index 76% rename from src/renderer/components/+entity-settings/entity-settings.scss rename to src/renderer/components/+entity-settings/entity-settings.module.css index 30c01b8a67..604ecd5c5b 100644 --- a/src/renderer/components/+entity-settings/entity-settings.scss +++ b/src/renderer/components/+entity-settings/entity-settings.module.css @@ -19,26 +19,12 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -.EntitySettings { - $spacing: $padding * 3; - - - // TODO: move sub-component styles to separate files - .admin-note { - font-size: small; - opacity: 0.5; - margin-left: $margin; - } - - .button-area { - margin-top: $margin * 2; - } - - .file-loader { - margin-top: $margin * 2; - } - - .Input, .Select { - margin-top: $padding; - } -} +.entityName { + @apply font-bold overflow-hidden; + word-break: break-word; + color: var(--textColorAccent); + display: -webkit-box; + /* Simulate text-overflow:ellipsis styles but for multiple text lines */ + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; +} \ No newline at end of file diff --git a/src/renderer/components/+entity-settings/entity-settings.tsx b/src/renderer/components/+entity-settings/entity-settings.tsx index f656b6fa9d..bcb5895413 100644 --- a/src/renderer/components/+entity-settings/entity-settings.tsx +++ b/src/renderer/components/+entity-settings/entity-settings.tsx @@ -19,7 +19,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import "./entity-settings.scss"; +import styles from "./entity-settings.module.css"; import React from "react"; import { observable, makeObservable } from "mobx"; @@ -98,7 +98,9 @@ export class EntitySettings extends React.Component { source={this.entity.metadata.source} src={this.entity.spec.icon?.src} /> -

{this.entity.metadata.name}

+
+ {this.entity.metadata.name} +
{ groups.map((group, groupIndex) => ( @@ -138,7 +140,6 @@ export class EntitySettings extends React.Component { return ( From e2a9d5213e2201cb6a00a51ec5481a5464916a1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 08:50:38 -0400 Subject: [PATCH 18/30] Bump tmpl from 1.0.4 to 1.0.5 in /extensions/pod-menu (#3862) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- extensions/pod-menu/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/pod-menu/package-lock.json b/extensions/pod-menu/package-lock.json index 3abe5a107f..b2c2e736fe 100644 --- a/extensions/pod-menu/package-lock.json +++ b/extensions/pod-menu/package-lock.json @@ -6561,9 +6561,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, "to-arraybuffer": { From 963d801cf75bd0a08947c46149db40ab5e100cdf Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 22 Sep 2021 16:42:16 +0300 Subject: [PATCH 19/30] [UX]: navigation to cluster overview from sidebar's top icon (#3867) * UX: navigate to "/cluster" overview page from sidebar's top icon * highlight hotbar-icon border on click --- .../components/hotbar/hotbar-icon.scss | 35 +++++++------------ src/renderer/components/layout/sidebar.tsx | 5 +-- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/renderer/components/hotbar/hotbar-icon.scss b/src/renderer/components/hotbar/hotbar-icon.scss index 2f9ad6a696..e713b20432 100644 --- a/src/renderer/components/hotbar/hotbar-icon.scss +++ b/src/renderer/components/hotbar/hotbar-icon.scss @@ -31,12 +31,20 @@ } .HotbarIcon { + --iconActiveShadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px var(--textColorAccent); + --iconHoverShadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px #ffffff50; + border-radius: 6px; user-select: none; cursor: pointer; transition: none; text-shadow: 0 0 4px #0000008f; position: relative; + z-index: 0; // allows to catch state of :active pseudo-selector + + &:active .MuiAvatar-root { + box-shadow: var(--iconActiveShadow) !important; + } div.MuiAvatar-colorDefault { font-weight:500; @@ -64,20 +72,17 @@ box-shadow: none; } - div.MuiAvatar-root { + .MuiAvatar-root { width: var(--size); height: var(--size); + border-radius: 6px; &.active { - box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px var(--textColorAccent); + box-shadow: var(--iconActiveShadow); } - &.interactive { - &:hover { - &:not(.active) { - box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px #ffffff50; - } - } + &.interactive:not(.active):hover { + box-shadow: var(--iconHoverShadow); } } @@ -117,20 +122,6 @@ } } - img { - border-radius: 6px; - - &.active { - box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px var(--textColorAccent); - } - - &:hover { - &:not(.active) { - box-shadow: 0 0 0px 3px var(--clusterMenuBackground), 0 0 0px 6px #ffffff50; - } - } - } - .materialIcon { margin-left: 1px; margin-top: 1px; diff --git a/src/renderer/components/layout/sidebar.tsx b/src/renderer/components/layout/sidebar.tsx index 92dd03f311..66860fa399 100644 --- a/src/renderer/components/layout/sidebar.tsx +++ b/src/renderer/components/layout/sidebar.tsx @@ -32,7 +32,7 @@ import { Storage } from "../+storage"; import { Network } from "../+network"; import { crdStore } from "../+custom-resources/crd.store"; import { CustomResources } from "../+custom-resources/custom-resources"; -import { isActiveRoute } from "../../navigation"; +import { isActiveRoute, navigate } from "../../navigation"; import { isAllowedResource } from "../../../common/utils/allowed-resource"; import { Spinner } from "../spinner"; import { ClusterPageMenuRegistration, ClusterPageMenuRegistry, ClusterPageRegistry, getExtensionPageUrl } from "../../../extensions/registries"; @@ -110,7 +110,7 @@ export class Sidebar extends React.Component { const routes: TabLayoutRoute[] = []; const subMenus = ClusterPageMenuRegistry.getInstance().getSubItems(menu); - const clusterPageRegistry= ClusterPageRegistry.getInstance(); + const clusterPageRegistry = ClusterPageRegistry.getInstance(); for (const subMenu of subMenus) { const page = clusterPageRegistry.getByPageTarget(subMenu.target); @@ -193,6 +193,7 @@ export class Sidebar extends React.Component { source={metadata.source} src={spec.icon?.src} className="mr-5" + onClick={() => navigate(routes.clusterURL())} />
{metadata.name} From e2a85031b60c8b5c059bddbaeaf90e326e1625cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 09:43:20 -0400 Subject: [PATCH 20/30] Bump tmpl from 1.0.4 to 1.0.5 in /extensions/metrics-cluster-feature (#3863) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- extensions/metrics-cluster-feature/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/metrics-cluster-feature/package-lock.json b/extensions/metrics-cluster-feature/package-lock.json index 981cb43dff..1d2e2217cb 100644 --- a/extensions/metrics-cluster-feature/package-lock.json +++ b/extensions/metrics-cluster-feature/package-lock.json @@ -6645,9 +6645,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, "to-arraybuffer": { From 39e2fce47350a4328417a8ec9a5b598a89b9f434 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 09:43:27 -0400 Subject: [PATCH 21/30] Bump tmpl from 1.0.4 to 1.0.5 in /extensions/node-menu (#3864) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- extensions/node-menu/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/node-menu/package-lock.json b/extensions/node-menu/package-lock.json index 02d953b830..88ada2da7e 100644 --- a/extensions/node-menu/package-lock.json +++ b/extensions/node-menu/package-lock.json @@ -6608,9 +6608,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, "to-arraybuffer": { From 3a989bbb364ef9cf7cec9fbaf8f00ababcff49c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 09:43:33 -0400 Subject: [PATCH 22/30] Bump tmpl from 1.0.4 to 1.0.5 (#3860) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 46af019646..d132c386e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13680,9 +13680,9 @@ tmp@^0.2.0, tmp@^0.2.1: rimraf "^3.0.0" tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-arraybuffer@^1.0.0: version "1.0.1" From 49e8b9cc0a46047be470ac500d9d9c9fab78a5b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 09:43:49 -0400 Subject: [PATCH 23/30] Bump npm from 6.14.13 to 6.14.15 (#3838) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 95 +++++++++++++++++++++++++++++++++++----------------- 2 files changed, 66 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index f9652a5cac..64f4476423 100644 --- a/package.json +++ b/package.json @@ -223,7 +223,7 @@ "monaco-editor": "^0.26.1", "node-fetch": "^2.6.1", "node-pty": "^0.10.1", - "npm": "^6.14.8", + "npm": "^6.14.15", "openid-client": "^3.15.2", "p-limit": "^3.1.0", "path-to-regexp": "^6.1.0", diff --git a/yarn.lock b/yarn.lock index d132c386e8..e5ea295dd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4683,7 +4683,7 @@ debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6: dependencies: ms "^2.1.1" -debuglog@^1.0.1: +debuglog@*, debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -6411,7 +6411,7 @@ fs-extra@^9.0.0, fs-extra@^9.0.1: jsonfile "^6.0.1" universalify "^2.0.0" -fs-minipass@^1.2.5: +fs-minipass@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7" integrity sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA== @@ -6823,12 +6823,7 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.2.2, graceful-fs@^4.2.4: - version "4.2.6" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" - integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== - -graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.3: +graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.3, graceful-fs@^4.2.4: version "4.2.8" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== @@ -7397,7 +7392,7 @@ import-local@^3.0.2: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" -imurmurhash@^0.1.4: +imurmurhash@*, imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -9165,6 +9160,11 @@ lodash-es@^4.17.20: resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== +lodash._baseindexof@*: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" + integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= + lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -9173,11 +9173,33 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" +lodash._bindcallback@*: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" + integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= + +lodash._cacheindexof@*: + version "3.0.2" + resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" + integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= + +lodash._createcache@*: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" + integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= + dependencies: + lodash._getnative "^3.0.0" + lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= +lodash._getnative@*, lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= + lodash._root@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" @@ -9203,6 +9225,11 @@ lodash.isequal@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= +lodash.restparam@*: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" + integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= + lodash.toarray@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" @@ -9622,7 +9649,7 @@ minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -minipass@^2.3.5, minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: +minipass@^2.3.5, minipass@^2.6.0, minipass@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" integrity sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg== @@ -9637,7 +9664,7 @@ minipass@^3.0.0: dependencies: yallist "^4.0.0" -minizlib@^1.2.1: +minizlib@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" integrity sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q== @@ -9686,7 +9713,7 @@ mkdirp@1.x, mkdirp@^1.0.3, mkdirp@~1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.4, mkdirp@^0.5.5, mkdirp@~0.5.0: +mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.4, mkdirp@^0.5.5, mkdirp@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== @@ -10214,10 +10241,10 @@ npm-user-validate@^1.0.1: resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-1.0.1.tgz#31428fc5475fe8416023f178c0ab47935ad8c561" integrity sha512-uQwcd/tY+h1jnEaze6cdX/LrhWhoBxfSknxentoqmIuStxUExxjWd3ULMLFPiFUrZKbOVMowH6Jq2FRWfmhcEw== -npm@^6.14.8: - version "6.14.13" - resolved "https://registry.yarnpkg.com/npm/-/npm-6.14.13.tgz#e88bcb6c48209869c40b5cedad8a1508e58e6f30" - integrity sha512-SRl4jJi0EBHY2xKuu98FLRMo3VhYQSA6otyLnjSEiHoSG/9shXCFNJy9tivpUJvtkN9s6VDdItHa5Rn+fNBzag== +npm@^6.14.15: + version "6.14.15" + resolved "https://registry.yarnpkg.com/npm/-/npm-6.14.15.tgz#97dd51af5b5d6225b611b40c5cb4d31da1d467fe" + integrity sha512-dkcQc4n+DiJAMYG2haNAMyJbmuvevjXz+WC9dCUzodw8EovwTIc6CATSsTEplCY6c0jG4OshxFGFJsrnKJguWA== dependencies: JSONStream "^1.3.5" abbrev "~1.1.1" @@ -10237,6 +10264,7 @@ npm@^6.14.8: cmd-shim "^3.0.3" columnify "~1.5.4" config-chain "^1.1.12" + debuglog "*" detect-indent "~5.0.0" detect-newline "^2.1.0" dezalgo "~1.0.3" @@ -10251,6 +10279,7 @@ npm@^6.14.8: has-unicode "~2.0.1" hosted-git-info "^2.8.9" iferr "^1.0.2" + imurmurhash "*" infer-owner "^1.0.4" inflight "~1.0.6" inherits "^2.0.4" @@ -10269,8 +10298,14 @@ npm@^6.14.8: libnpx "^10.2.4" lock-verify "^2.1.0" lockfile "^1.0.4" + lodash._baseindexof "*" lodash._baseuniq "~4.6.0" + lodash._bindcallback "*" + lodash._cacheindexof "*" + lodash._createcache "*" + lodash._getnative "*" lodash.clonedeep "~4.5.0" + lodash.restparam "*" lodash.union "~4.6.0" lodash.uniq "~4.5.0" lodash.without "~4.4.0" @@ -10320,7 +10355,7 @@ npm@^6.14.8: sorted-union-stream "~2.1.3" ssri "^6.0.2" stringify-package "^1.0.1" - tar "^4.4.13" + tar "^4.4.19" text-table "~0.2.0" tiny-relative-date "^1.3.0" uid-number "0.0.6" @@ -12363,7 +12398,7 @@ rxjs@^6.5.2: dependencies: tslib "^1.9.0" -safe-buffer@*, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@*, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -13496,18 +13531,18 @@ tar-stream@^2.1.4: inherits "^2.0.3" readable-stream "^3.1.1" -tar@^4.4.10, tar@^4.4.12, tar@^4.4.13: - version "4.4.13" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525" - integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA== +tar@^4.4.10, tar@^4.4.12, tar@^4.4.19: + version "4.4.19" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" + integrity sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA== dependencies: - chownr "^1.1.1" - fs-minipass "^1.2.5" - minipass "^2.8.6" - minizlib "^1.2.1" - mkdirp "^0.5.0" - safe-buffer "^5.1.2" - yallist "^3.0.3" + chownr "^1.1.4" + fs-minipass "^1.2.7" + minipass "^2.9.0" + minizlib "^1.3.3" + mkdirp "^0.5.5" + safe-buffer "^5.2.1" + yallist "^3.1.1" tar@^6.0.2, tar@^6.1.10: version "6.1.10" @@ -14899,7 +14934,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: +yallist@^3.0.0, yallist@^3.0.2, yallist@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== From 3fc5b83461d3dcf94eccc055c63954e6b842ba8e Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 22 Sep 2021 07:25:48 -0700 Subject: [PATCH 24/30] Add error message for no contexts in add cluster page (#3868) --- .../components/+add-cluster/add-cluster.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index e987c1d4bb..81a75019fa 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -62,7 +62,7 @@ export class AddCluster extends React.Component { @observable kubeContexts = observable.map(); @observable customConfig = ""; @observable isWaiting = false; - @observable errorText: string; + @observable errors: string[] = []; constructor(props: {}) { super(props); @@ -75,7 +75,7 @@ export class AddCluster extends React.Component { @computed get allErrors(): string[] { return [ - this.errorText, + ...this.errors, ...iter.map(this.kubeContexts.values(), ({ error }) => error) ].filter(Boolean); } @@ -85,7 +85,14 @@ export class AddCluster extends React.Component { const { config, error } = loadConfigFromString(this.customConfig.trim() || "{}"); this.kubeContexts.replace(getContexts(config)); - this.errorText = error?.toString(); + + if (error) { + this.errors.push(error.toString()); + } + + if (config.contexts.length === 0) { + this.errors.push('No contexts defined, either missing the "contexts" field, or it is empty.'); + } }, 500); @action @@ -124,7 +131,7 @@ export class AddCluster extends React.Component { value={this.customConfig} onChange={value => { this.customConfig = value; - this.errorText = ""; + this.errors.length = 0; this.refreshContexts(); }} /> From 02c90c760d667a085f9b82664324a0c07ecde329 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 23 Sep 2021 12:23:00 +0300 Subject: [PATCH 25/30] fix missing query parameter (#3875) Signed-off-by: Jari Kolehmainen --- src/common/k8s-api/kube-object.store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/k8s-api/kube-object.store.ts b/src/common/k8s-api/kube-object.store.ts index dc428eb08b..f90eaab8e5 100644 --- a/src/common/k8s-api/kube-object.store.ts +++ b/src/common/k8s-api/kube-object.store.ts @@ -159,7 +159,7 @@ export abstract class KubeObjectStore extends ItemStore this.loadedNamespaces = namespaces; return Promise // load resources per namespace - .all(namespaces.map(namespace => api.list({ namespace, reqInit }))) + .all(namespaces.map(namespace => api.list({ namespace, reqInit }, this.query))) .then(items => items.flat().filter(Boolean)); } } From 06854b4cac2b54b41099c4795db497088df0322d Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 23 Sep 2021 12:36:53 +0300 Subject: [PATCH 26/30] Disable log file writing on renderer (#3874) Signed-off-by: Jari Kolehmainen --- src/common/logger.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common/logger.ts b/src/common/logger.ts index 825fa2493b..ca975871b8 100644 --- a/src/common/logger.ts +++ b/src/common/logger.ts @@ -59,24 +59,24 @@ if (ipcMain) { ), }) ); + + if (!isTestEnv) { + transports.push( + new winston.transports.File({ + handleExceptions: false, + level: logLevel, + filename: "lens.log", + dirname: getPath("logs"), + maxsize: 16 * 1024, + maxFiles: 16, + tailable: true, + }) + ); + } } else { transports.push(new BrowserConsole()); } -if (!isTestEnv) { - transports.push( - new winston.transports.File({ - handleExceptions: false, - level: logLevel, - filename: "lens.log", - dirname: getPath("logs"), - maxsize: 16 * 1024, - maxFiles: 16, - tailable: true, - }) - ); -} - export default winston.createLogger({ format: format.simple(), transports, From 3c55cba40db33c975f3f704c48294588229f9148 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 23 Sep 2021 15:14:24 +0300 Subject: [PATCH 27/30] use ubuntu 18.04 for builds (#3877) Signed-off-by: Jari Kolehmainen --- .azure-pipelines-k8s-matrix.yml | 2 +- .azure-pipelines.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines-k8s-matrix.yml b/.azure-pipelines-k8s-matrix.yml index 9f1f38ec67..cdcc18b740 100644 --- a/.azure-pipelines-k8s-matrix.yml +++ b/.azure-pipelines-k8s-matrix.yml @@ -15,7 +15,7 @@ trigger: none jobs: - job: Linux pool: - vmImage: ubuntu-20.04 + vmImage: ubuntu-18.04 strategy: matrix: kube_1.16: diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index e360a818e6..3c928430ed 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -109,7 +109,7 @@ jobs: - job: Linux pool: - vmImage: ubuntu-20.04 + vmImage: ubuntu-18.04 strategy: matrix: node_14.x: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4bc748d235..7590f42289 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, macos-11, windows-2019] + os: [ubuntu-18.04, macos-11, windows-2019] node-version: [14.x] steps: - name: Checkout Release from lens From 3c77c06519c2d9b72eb23946d2f2f7ddd1eaf938 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 23 Sep 2021 13:18:31 -0400 Subject: [PATCH 28/30] Add ability to search and activate entities via the command dialog (#3692) --- src/extensions/registries/base-registry.ts | 2 +- src/extensions/registries/command-registry.ts | 4 +- .../activate-entity-command.tsx | 58 +++++++++++++++++++ .../activate-entity-command/index.ts | 22 +++++++ .../initializers/command-registry.tsx | 7 +++ 5 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/renderer/components/activate-entity-command/activate-entity-command.tsx create mode 100644 src/renderer/components/activate-entity-command/index.ts diff --git a/src/extensions/registries/base-registry.ts b/src/extensions/registries/base-registry.ts index af00fb48fd..9b596172c9 100644 --- a/src/extensions/registries/base-registry.ts +++ b/src/extensions/registries/base-registry.ts @@ -25,7 +25,7 @@ import { Singleton } from "../../common/utils"; import { LensExtension } from "../lens-extension"; export class BaseRegistry extends Singleton { - private items = observable.map([], {deep: false}); + private items = observable.map([], { deep: false }); constructor() { super(); diff --git a/src/extensions/registries/command-registry.ts b/src/extensions/registries/command-registry.ts index 5c38e32c71..3916b0f721 100644 --- a/src/extensions/registries/command-registry.ts +++ b/src/extensions/registries/command-registry.ts @@ -25,9 +25,9 @@ import { BaseRegistry } from "./base-registry"; import type { LensExtension } from "../lens-extension"; import type { CatalogEntity } from "../../common/catalog"; -export type CommandContext = { +export interface CommandContext { entity?: CatalogEntity; -}; +} export interface CommandRegistration { id: string; diff --git a/src/renderer/components/activate-entity-command/activate-entity-command.tsx b/src/renderer/components/activate-entity-command/activate-entity-command.tsx new file mode 100644 index 0000000000..110afd6b3c --- /dev/null +++ b/src/renderer/components/activate-entity-command/activate-entity-command.tsx @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +import { computed } from "mobx"; +import { observer } from "mobx-react"; +import React from "react"; +import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity"; +import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; +import { CommandOverlay } from "../command-palette"; +import { Select } from "../select"; + +@observer +export class ActivateEntityCommand extends React.Component { + @computed get options() { + return catalogEntityRegistry.items.map(entity => ({ + label: `${entity.kind}: ${entity.getName()}`, + value: entity, + })); + } + + onSelect(entity: CatalogEntity): void { + entity.onRun?.(catalogEntityRunContext); + CommandOverlay.close(); + } + + render() { + return ( +