From b2b3c44695bfd51930e47a06c78ab2d6531675a5 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Mon, 11 Oct 2021 10:06:43 +0300 Subject: [PATCH 01/31] Closing dock tabs with cmd+w on mac (#3849) * Change Close menu item accelerator Signed-off-by: Alex Andreev * Listening global keydown event in Signed-off-by: Alex Andreev * Prevent terminal to fire custom event Signed-off-by: Alex Andreev * Refresh tooltip hint Signed-off-by: Alex Andreev * Make Tab line gray if Dock isn't focused Signed-off-by: Alex Andreev --- src/main/menu.ts | 15 ++++++++---- src/renderer/components/dock/dock-tab.tsx | 3 ++- src/renderer/components/dock/dock.scss | 10 ++++++++ src/renderer/components/dock/dock.tsx | 29 ++++++++++++++++------- src/renderer/components/dock/terminal.ts | 7 +----- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/main/menu.ts b/src/main/menu.ts index 088f06e06e..8073f7e47c 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -147,13 +147,18 @@ export function buildMenu(windowManager: WindowManager) { } } ]), + { type: "separator" }, - { - role: "close", - label: "Close Window" - }, + + ...(isMac ? [ + { + role: "close", + label: "Close Window", + accelerator: "Shift+Cmd+W" + } + ] as MenuItemConstructorOptions[] : []), + ...ignoreOnMac([ - { type: "separator" }, { label: "Exit", accelerator: "Alt+F4", diff --git a/src/renderer/components/dock/dock-tab.tsx b/src/renderer/components/dock/dock-tab.tsx index a42a2dd64b..6bd186579a 100644 --- a/src/renderer/components/dock/dock-tab.tsx +++ b/src/renderer/components/dock/dock-tab.tsx @@ -29,6 +29,7 @@ import { Tab, TabProps } from "../tabs"; import { Icon } from "../icon"; import { Menu, MenuItem } from "../menu"; import { observable, makeObservable } from "mobx"; +import { isMac } from "../../../common/vars"; export interface DockTabProps extends TabProps { moreActions?: React.ReactNode; @@ -94,7 +95,7 @@ export class DockTab extends React.Component { {!pinned && ( )} diff --git a/src/renderer/components/dock/dock.scss b/src/renderer/components/dock/dock.scss index e1cf52e116..ed7dbcdc18 100644 --- a/src/renderer/components/dock/dock.scss +++ b/src/renderer/components/dock/dock.scss @@ -27,6 +27,16 @@ display: flex; flex-direction: column; + &:not(:focus-within) .DockTab.active { + &::after { + color: var(--halfGray); + } + + &:hover::after { + color: var(--line-color-active); + } + } + &.isOpen { &.fullSize { position: fixed; diff --git a/src/renderer/components/dock/dock.tsx b/src/renderer/components/dock/dock.tsx index a8cea06d7b..747fd37a5c 100644 --- a/src/renderer/components/dock/dock.tsx +++ b/src/renderer/components/dock/dock.tsx @@ -46,19 +46,31 @@ interface Props { @observer export class Dock extends React.Component { - onKeydown = (evt: React.KeyboardEvent) => { - const { close, closeTab, selectedTab } = dockStore; + private element = React.createRef(); - if (!selectedTab) return; - const { code, ctrlKey, shiftKey } = evt.nativeEvent; + componentDidMount() { + document.addEventListener("keydown", this.onKeyDown); + } + + componentWillUnmount() { + document.removeEventListener("keydown", this.onKeyDown); + } + + onKeyDown = (evt: KeyboardEvent) => { + const { close, selectedTab, closeTab } = dockStore; + const { code, ctrlKey, metaKey, shiftKey } = evt; + // Determine if user working inside or using any other areas in app + const dockIsFocused = this.element?.current.contains(document.activeElement); + + if (!selectedTab || !dockIsFocused) return; if (shiftKey && code === "Escape") { close(); } - if (ctrlKey && code === "KeyW") { - if (selectedTab.pinned) close(); - else closeTab(selectedTab.id); + if ((ctrlKey && code === "KeyW") || (metaKey && code === "KeyW")) { + closeTab(selectedTab.id); + this.element?.current.focus(); // Avoid loosing focus when closing tab } }; @@ -67,6 +79,7 @@ export class Dock extends React.Component { open(); selectTab(tab.id); + this.element?.current.focus(); }; renderTab(tab: DockTab) { @@ -105,7 +118,7 @@ export class Dock extends React.Component { return (
{ - const { code, ctrlKey, type, metaKey } = evt; + const { code, ctrlKey, metaKey } = evt; // Handle custom hotkey bindings if (ctrlKey) { @@ -248,11 +248,6 @@ export class Terminal { } } - // Pass the event above in DOM for to handle common actions - if (!evt.defaultPrevented) { - this.elem.dispatchEvent(new KeyboardEvent(type, evt)); - } - return true; }; } From 58ac856c898ffa28e019d73595e94b02d0939cfb Mon Sep 17 00:00:00 2001 From: chh <1474479+chenhunghan@users.noreply.github.com> Date: Tue, 12 Oct 2021 08:07:39 +0300 Subject: [PATCH 02/31] Use entity.status.phase when updating cluster state (#4009) Signed-off-by: Hung-Han (Henry) Chen --- src/main/cluster-manager.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/cluster-manager.ts b/src/main/cluster-manager.ts index a5c9179499..e72cbd59cc 100644 --- a/src/main/cluster-manager.ts +++ b/src/main/cluster-manager.ts @@ -160,6 +160,10 @@ export class ClusterManager extends Singleton { return "connecting"; } + if (entity?.status?.phase) { + return entity.status.phase; + } + return "disconnected"; })(); From 329f4706c04e679ed97138b7b0f898c3985b67f3 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Oct 2021 07:31:11 -0400 Subject: [PATCH 03/31] Use the served and storage version of a CRD instead of the first (#3999) --- src/common/k8s-api/__tests__/crd.test.ts | 144 +++++++++++++---------- src/common/k8s-api/endpoints/crd.api.ts | 86 +++++++++++--- src/common/k8s-api/json-api.ts | 3 +- src/renderer/utils/createStorage.ts | 5 +- 4 files changed, 152 insertions(+), 86 deletions(-) diff --git a/src/common/k8s-api/__tests__/crd.test.ts b/src/common/k8s-api/__tests__/crd.test.ts index 459a7f67d9..a981cdda12 100644 --- a/src/common/k8s-api/__tests__/crd.test.ts +++ b/src/common/k8s-api/__tests__/crd.test.ts @@ -20,92 +20,108 @@ */ import { CustomResourceDefinition } from "../endpoints"; -import type { KubeObjectMetadata } from "../kube-object"; describe("Crds", () => { describe("getVersion", () => { - it("should get the first version name from the list of versions", () => { + it("should throw if none of the versions are served", () => { const crd = new CustomResourceDefinition({ - apiVersion: "foo", + apiVersion: "apiextensions.k8s.io/v1", kind: "CustomResourceDefinition", - metadata: {} as KubeObjectMetadata, + metadata: { + name: "foo", + resourceVersion: "12345", + uid: "12345", + }, + spec: { + versions: [ + { + name: "123", + served: false, + storage: false, + }, + { + name: "1234", + served: false, + storage: false, + }, + ], + }, }); - crd.spec = { - versions: [ - { - name: "123", - served: false, - storage: false, - } - ] - } as any; + expect(() => crd.getVersion()).toThrowError("Failed to find a version for CustomResourceDefinition foo"); + }); + + it("should should get the version that is both served and stored", () => { + const crd = new CustomResourceDefinition({ + apiVersion: "apiextensions.k8s.io/v1", + kind: "CustomResourceDefinition", + metadata: { + name: "foo", + resourceVersion: "12345", + uid: "12345", + }, + spec: { + versions: [ + { + name: "123", + served: true, + storage: true, + }, + { + name: "1234", + served: false, + storage: false, + }, + ], + }, + }); expect(crd.getVersion()).toBe("123"); }); - it("should get the first version name from the list of versions (length 2)", () => { + it("should should get the version that is both served and stored even with version field", () => { const crd = new CustomResourceDefinition({ - apiVersion: "foo", + apiVersion: "apiextensions.k8s.io/v1", kind: "CustomResourceDefinition", - metadata: {} as KubeObjectMetadata, + metadata: { + name: "foo", + resourceVersion: "12345", + uid: "12345", + }, + spec: { + version: "abc", + versions: [ + { + name: "123", + served: true, + storage: true, + }, + { + name: "1234", + served: false, + storage: false, + }, + ], + }, }); - crd.spec = { - versions: [ - { - name: "123", - served: false, - storage: false, - }, - { - name: "1234", - served: false, - storage: false, - } - ] - } as any; - expect(crd.getVersion()).toBe("123"); }); - it("should get the first version name from the list of versions (length 2) even with version field", () => { + it("should get the version name from the version field", () => { const crd = new CustomResourceDefinition({ - apiVersion: "foo", + apiVersion: "apiextensions.k8s.io/v1beta1", kind: "CustomResourceDefinition", - metadata: {} as KubeObjectMetadata, + metadata: { + name: "foo", + resourceVersion: "12345", + uid: "12345", + }, + spec: { + version: "abc", + } }); - crd.spec = { - version: "abc", - versions: [ - { - name: "123", - served: false, - storage: false, - }, - { - name: "1234", - served: false, - storage: false, - } - ] - } as any; - - expect(crd.getVersion()).toBe("123"); - }); - - it("should get the first version name from the version field", () => { - const crd = new CustomResourceDefinition({ - apiVersion: "foo", - kind: "CustomResourceDefinition", - metadata: {} as KubeObjectMetadata, - }); - - crd.spec = { - version: "abc" - } as any; - expect(crd.getVersion()).toBe("abc"); }); }); diff --git a/src/common/k8s-api/endpoints/crd.api.ts b/src/common/k8s-api/endpoints/crd.api.ts index b1ab179cc4..98c8d38df0 100644 --- a/src/common/k8s-api/endpoints/crd.api.ts +++ b/src/common/k8s-api/endpoints/crd.api.ts @@ -19,10 +19,11 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { KubeObject } from "../kube-object"; +import { KubeCreationError, KubeObject } from "../kube-object"; import { KubeApi } from "../kube-api"; import { crdResourcesURL } from "../../routes"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; +import type { KubeJsonApiData } from "../kube-json-api"; type AdditionalPrinterColumnsCommon = { name: string; @@ -39,10 +40,21 @@ type AdditionalPrinterColumnsV1Beta = AdditionalPrinterColumnsCommon & { JSONPath: string; }; +export interface CRDVersion { + name: string; + served: boolean; + storage: boolean; + schema?: object; // required in v1 but not present in v1beta + additionalPrinterColumns?: AdditionalPrinterColumnsV1[]; +} + export interface CustomResourceDefinition { spec: { group: string; - version?: string; // deprecated in v1 api + /** + * @deprecated for apiextensions.k8s.io/v1 but used previously + */ + version?: string; names: { plural: string; singular: string; @@ -50,19 +62,19 @@ export interface CustomResourceDefinition { listKind: string; }; scope: "Namespaced" | "Cluster" | string; - validation?: any; - versions?: { - name: string; - served: boolean; - storage: boolean; - schema?: unknown; // required in v1 but not present in v1beta - additionalPrinterColumns?: AdditionalPrinterColumnsV1[] - }[]; + /** + * @deprecated for apiextensions.k8s.io/v1 but used previously + */ + validation?: object; + versions?: CRDVersion[]; conversion: { strategy?: string; webhook?: any; }; - additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; // removed in v1 + /** + * @deprecated for apiextensions.k8s.io/v1 but used previously + */ + additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; }; status: { conditions: { @@ -83,11 +95,23 @@ export interface CustomResourceDefinition { }; } +export interface CRDApiData extends KubeJsonApiData { + spec: object; // TODO: make better +} + export class CustomResourceDefinition extends KubeObject { static kind = "CustomResourceDefinition"; static namespaced = false; static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"; + constructor(data: CRDApiData) { + super(data); + + if (!data.spec || typeof data.spec !== "object") { + throw new KubeCreationError("Cannot create a CustomResourceDefinition from an object without spec", data); + } + } + getResourceUrl() { return crdResourcesURL({ params: { @@ -125,9 +149,36 @@ export class CustomResourceDefinition extends KubeObject { return this.spec.scope; } + getPreferedVersion(): CRDVersion { + // Prefer the modern `versions` over the legacy `version` + if (this.spec.versions) { + for (const version of this.spec.versions) { + /** + * If the version is not served then 404 errors will occur + * We should also prefer the storage version + */ + if (version.served && version.storage) { + return version; + } + } + } else if (this.spec.version) { + const { additionalPrinterColumns: apc } = this.spec; + const additionalPrinterColumns = apc?.map(({ JSONPath, ...apc}) => ({ ...apc, jsonPath: JSONPath })); + + return { + name: this.spec.version, + served: true, + storage: true, + schema: this.spec.validation, + additionalPrinterColumns, + }; + } + + throw new Error(`Failed to find a version for CustomResourceDefinition ${this.metadata.name}`); + } + getVersion() { - // v1 has removed the spec.version property, if it is present it must match the first version - return this.spec.versions?.[0]?.name ?? this.spec.version; + return this.getPreferedVersion().name; } isNamespaced() { @@ -147,17 +198,14 @@ export class CustomResourceDefinition extends KubeObject { } getPrinterColumns(ignorePriority = true): AdditionalPrinterColumnsV1[] { - const columns = this.spec.versions?.find(a => this.getVersion() == a.name)?.additionalPrinterColumns - ?? this.spec.additionalPrinterColumns?.map(({ JSONPath, ...rest }) => ({ ...rest, jsonPath: JSONPath })) // map to V1 shape - ?? []; + const columns = this.getPreferedVersion().additionalPrinterColumns ?? []; return columns - .filter(column => column.name != "Age") - .filter(column => ignorePriority ? true : !column.priority); + .filter(column => column.name != "Age" && (ignorePriority || !column.priority)); } getValidation() { - return JSON.stringify(this.spec.validation ?? this.spec.versions?.[0]?.schema, null, 2); + return JSON.stringify(this.getPreferedVersion().schema, null, 2); } getConditions() { diff --git a/src/common/k8s-api/json-api.ts b/src/common/k8s-api/json-api.ts index 8690521099..dde8f5f5a2 100644 --- a/src/common/k8s-api/json-api.ts +++ b/src/common/k8s-api/json-api.ts @@ -27,8 +27,7 @@ import { stringify } from "querystring"; import { EventEmitter } from "../../common/event-emitter"; import logger from "../../common/logger"; -export interface JsonApiData { -} +export interface JsonApiData {} export interface JsonApiError { code?: number; diff --git a/src/renderer/utils/createStorage.ts b/src/renderer/utils/createStorage.ts index 854a7aef2f..2e79e35209 100755 --- a/src/renderer/utils/createStorage.ts +++ b/src/renderer/utils/createStorage.ts @@ -28,6 +28,7 @@ import { StorageHelper } from "./storageHelper"; import { ClusterStore } from "../../common/cluster-store"; import logger from "../../main/logger"; import { getHostedClusterId, getPath } from "../../common/utils"; +import { isTestEnv } from "../../common/vars"; const storage = observable({ initialized: false, @@ -62,7 +63,9 @@ export function createAppStorage(key: string, defaultValue: T, clusterId?: st .then(data => storage.data = data) .catch(() => null) // ignore empty / non-existing / invalid json files .finally(() => { - logger.info(`${logPrefix} loading finished for ${filePath}`); + if (!isTestEnv) { + logger.info(`${logPrefix} loading finished for ${filePath}`); + } storage.loaded = true; }); From 5a25c44de60c154af400443902c7ddc842ce90be Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Oct 2021 08:28:32 -0400 Subject: [PATCH 04/31] Catch and display errors for release details (#3905) --- src/main/helm/helm-release-manager.ts | 32 +++++++++---------- src/main/routes/helm-route.ts | 20 ++++++------ .../+apps-releases/release-details.scss | 5 +++ .../+apps-releases/release-details.tsx | 24 ++++++++++---- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/main/helm/helm-release-manager.ts b/src/main/helm/helm-release-manager.ts index b8a18a1021..571628789e 100644 --- a/src/main/helm/helm-release-manager.ts +++ b/src/main/helm/helm-release-manager.ts @@ -43,8 +43,8 @@ export async function listReleases(pathToKubeconfig: string, namespace?: string) }); return output; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } @@ -72,8 +72,8 @@ export async function installChart(chart: string, values: any, name: string | un namespace } }; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } finally { await fse.unlink(fileName); } @@ -93,8 +93,8 @@ export async function upgradeRelease(name: string, chart: string, values: any, n log: stdout, release: getRelease(name, namespace, cluster) }; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } finally { await fse.unlink(fileName); } @@ -111,8 +111,8 @@ export async function getRelease(name: string, namespace: string, cluster: Clust release.resources = await getResources(name, namespace, cluster); return release; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } @@ -122,8 +122,8 @@ export async function deleteRelease(name: string, namespace: string, pathToKubec const { stdout } = await promiseExec(`"${helm}" delete ${name} --namespace ${namespace} --kubeconfig ${pathToKubeconfig}`); return stdout; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } @@ -139,8 +139,8 @@ export async function getValues(name: string, { namespace, all = false, pathToKu const { stdout } = await promiseExec(`"${helm}" get values ${name} ${all ? "--all" : ""} --output yaml --namespace ${namespace} --kubeconfig ${pathToKubeconfig}`); return stdout; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } @@ -150,8 +150,8 @@ export async function getHistory(name: string, namespace: string, pathToKubeconf const { stdout } = await promiseExec(`"${helm}" history ${name} --output json --namespace ${namespace} --kubeconfig ${pathToKubeconfig}`); return JSON.parse(stdout); - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } @@ -161,8 +161,8 @@ export async function rollback(name: string, namespace: string, revision: number const { stdout } = await promiseExec(`"${helm}" rollback ${name} ${revision} --namespace ${namespace} --kubeconfig ${pathToKubeconfig}`); return stdout; - } catch ({ stderr }) { - throw stderr; + } catch (error) { + throw error?.stderr || error; } } diff --git a/src/main/routes/helm-route.ts b/src/main/routes/helm-route.ts index 2f217a3193..46112d7111 100644 --- a/src/main/routes/helm-route.ts +++ b/src/main/routes/helm-route.ts @@ -41,7 +41,7 @@ export class HelmApiRoute { respondJson(response, chart); } catch (error) { - respondText(response, error, 422); + respondText(response, error?.toString() || "Error getting chart", 422); } } @@ -53,7 +53,7 @@ export class HelmApiRoute { respondJson(response, values); } catch (error) { - respondText(response, error, 422); + respondText(response, error?.toString() || "Error getting chart values", 422); } } @@ -66,7 +66,7 @@ export class HelmApiRoute { respondJson(response, result, 201); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error installing chart", 422); } } @@ -79,7 +79,7 @@ export class HelmApiRoute { respondJson(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error updating chart", 422); } } @@ -92,7 +92,7 @@ export class HelmApiRoute { respondJson(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error rolling back chart", 422); } } @@ -105,7 +105,7 @@ export class HelmApiRoute { respondJson(response, result); } catch(error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error listing release", 422); } } @@ -118,7 +118,7 @@ export class HelmApiRoute { respondJson(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error getting release", 422); } } @@ -132,7 +132,7 @@ export class HelmApiRoute { respondText(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error getting release values", 422); } } @@ -145,7 +145,7 @@ export class HelmApiRoute { respondJson(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error getting release history", 422); } } @@ -158,7 +158,7 @@ export class HelmApiRoute { respondJson(response, result); } catch (error) { logger.debug(error); - respondText(response, error, 422); + respondText(response, error?.toString() || "Error deleting release", 422); } } } diff --git a/src/renderer/components/+apps-releases/release-details.scss b/src/renderer/components/+apps-releases/release-details.scss index 112ee6b578..759bd5cec4 100644 --- a/src/renderer/components/+apps-releases/release-details.scss +++ b/src/renderer/components/+apps-releases/release-details.scss @@ -26,6 +26,11 @@ align-items: center; } + .loading-error { + color: red; + text-align: center; + } + .status { @include release-status-bgs; } diff --git a/src/renderer/components/+apps-releases/release-details.tsx b/src/renderer/components/+apps-releases/release-details.tsx index 4af4af4b0f..aa04d895c1 100644 --- a/src/renderer/components/+apps-releases/release-details.tsx +++ b/src/renderer/components/+apps-releases/release-details.tsx @@ -56,12 +56,13 @@ interface Props { @observer export class ReleaseDetails extends Component { - @observable details: IReleaseDetails; + @observable details: IReleaseDetails | null = null; @observable values = ""; @observable valuesLoading = false; @observable showOnlyUserSuppliedValues = true; @observable saving = false; @observable releaseSecret: Secret; + @observable error?: string = undefined; componentDidMount() { disposeOnUnmount(this, [ @@ -96,9 +97,13 @@ export class ReleaseDetails extends Component { async loadDetails() { const { release } = this.props; - - this.details = null; - this.details = await getRelease(release.getName(), release.getNs()); + + try { + this.details = null; + this.details = await getRelease(release.getName(), release.getNs()); + } catch (error) { + this.error = `Failed to get release details: ${error}`; + } } async loadValues() { @@ -237,11 +242,18 @@ export class ReleaseDetails extends Component { renderContent() { const { release } = this.props; - const { details } = this; if (!release) return null; - if (!details) { + if (this.error) { + return ( +
+ {this.error} +
+ ); + } + + if (!this.details) { return ; } From d9794050235141e576233d78c5c8912f1bb44762 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Oct 2021 08:30:27 -0400 Subject: [PATCH 05/31] Fix make clean to actually remove *.tgz files (#3997) --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cf6f988af1..c39b42468f 100644 --- a/Makefile +++ b/Makefile @@ -113,15 +113,11 @@ docs: .PHONY: clean-extensions clean-extensions: - $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm -rf $(dir)/dist) - $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm -rf $(dir)/node_modules) - $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm $(dir)/*.tgz || true) + rm -rf $(EXTENSIONS_DIR)/*/{dist,node_modules,*.tgz} .PHONY: clean-npm clean-npm: - rm -rf src/extensions/npm/extensions/dist - rm -rf src/extensions/npm/extensions/__mocks__ - rm -rf src/extensions/npm/extensions/node_modules + rm -rf src/extensions/npm/extensions/{dist,__mocks__,node_modules} .PHONY: clean clean: clean-npm clean-extensions From b9cee0cbc7a34332af4c208f40d92bdb0f948a70 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Oct 2021 08:30:46 -0400 Subject: [PATCH 06/31] Fix HelmChartDetails and HelmReleaseDetails Menu (#3986) --- .../+apps-helm-charts/helm-chart-details.tsx | 44 ++++++++++--------- .../+apps-releases/release-menu.tsx | 1 + 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/renderer/components/+apps-helm-charts/helm-chart-details.tsx b/src/renderer/components/+apps-helm-charts/helm-chart-details.tsx index 041f7b1cbd..72a6f1ea34 100644 --- a/src/renderer/components/+apps-helm-charts/helm-chart-details.tsx +++ b/src/renderer/components/+apps-helm-charts/helm-chart-details.tsx @@ -23,8 +23,8 @@ import "./helm-chart-details.scss"; import React, { Component } from "react"; import { getChartDetails, HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.api"; -import { observable, autorun, makeObservable } from "mobx"; -import { observer } from "mobx-react"; +import { observable, makeObservable, reaction } from "mobx"; +import { disposeOnUnmount, observer } from "mobx-react"; import { Drawer, DrawerItem } from "../drawer"; import { boundMethod, stopPropagation } from "../../utils"; import { MarkdownViewer } from "../markdown-viewer"; @@ -64,20 +64,24 @@ export class HelmChartDetails extends Component { this.abortController?.abort(); } - chartUpdater = autorun(() => { - this.selectedChart = null; - const { chart: { name, repo, version } } = this.props; + componentDidMount() { + disposeOnUnmount(this, [ + reaction(() => this.props.chart, async ({ name, repo, version }) => { + try { + const { readme, versions } = await getChartDetails(repo, name, { version }); - getChartDetails(repo, name, { version }) - .then(result => { - this.readme = result.readme; - this.chartVersions = result.versions; - this.selectedChart = result.versions[0]; - }) - .catch(error => { - this.error = error; - }); - }); + this.readme = readme; + this.chartVersions = versions; + this.selectedChart = versions[0]; + } catch (error) { + this.error = error; + this.selectedChart = null; + } + }, { + fireImmediately: true, + }), + ]); + } @boundMethod async onVersionChange({ value: chart }: SelectOption) { @@ -135,7 +139,7 @@ export class HelmChartDetails extends Component { value: chart, }))} isOptionDisabled={({ value: chart }) => chart.deprecated} - value={selectedChart.getVersion()} + value={selectedChart} onChange={onVersionChange} /> @@ -170,10 +174,6 @@ export class HelmChartDetails extends Component { } renderContent() { - if (!this.selectedChart) { - return ; - } - if (this.error) { return (
@@ -182,6 +182,10 @@ export class HelmChartDetails extends Component { ); } + if (!this.selectedChart) { + return ; + } + return (
{this.renderIntroduction()} diff --git a/src/renderer/components/+apps-releases/release-menu.tsx b/src/renderer/components/+apps-releases/release-menu.tsx index 0b8d4b8c91..a53298460f 100644 --- a/src/renderer/components/+apps-releases/release-menu.tsx +++ b/src/renderer/components/+apps-releases/release-menu.tsx @@ -79,6 +79,7 @@ export class HelmReleaseMenu extends React.Component { {...menuProps} className={cssNames("HelmReleaseMenu", className)} removeAction={this.remove} + removeConfirmationMessage={() =>

Remove Helm Release {release.name}?

} > {this.renderContent()} From 9c94c19a4f758c3a4f6031664ba47993bd104bd8 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Tue, 12 Oct 2021 08:32:06 -0400 Subject: [PATCH 07/31] Add ability to configure lens release channel (#3971) --- src/common/user-store/preferences-helpers.ts | 32 +++++++++++++++++++ src/common/user-store/user-store.ts | 9 +++++- src/main/app-updater.ts | 5 +++ .../components/+preferences/application.tsx | 17 ++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/src/common/user-store/preferences-helpers.ts b/src/common/user-store/preferences-helpers.ts index d981049d01..2320d8ed7b 100644 --- a/src/common/user-store/preferences-helpers.ts +++ b/src/common/user-store/preferences-helpers.ts @@ -260,6 +260,32 @@ const editorConfiguration: PreferenceDescription = { + fromStore(val) { + return updateChannels.has(val) ? val : defaultUpdateChannel; + }, + toStore(val) { + if (!updateChannels.has(val) || val === defaultUpdateChannel) { + return undefined; + } + + return val; + } +}; + type PreferencesModelType = typeof DESCRIPTORS[field] extends PreferenceDescription ? T : never; type UserStoreModelType = typeof DESCRIPTORS[field] extends PreferenceDescription ? T : never; @@ -288,4 +314,10 @@ export const DESCRIPTORS = { syncKubeconfigEntries, editorConfiguration, terminalCopyOnSelect, + updateChannel, +}; + +export const CONSTANTS = { + defaultUpdateChannel, + updateChannels, }; diff --git a/src/common/user-store/user-store.ts b/src/common/user-store/user-store.ts index 1bd18e06e8..68e7ece0d6 100644 --- a/src/common/user-store/user-store.ts +++ b/src/common/user-store/user-store.ts @@ -30,7 +30,7 @@ import { appEventBus } from "../event-bus"; import path from "path"; import { fileNameMigration } from "../../migrations/user-store"; import { ObservableToggleSet, toJS } from "../../renderer/utils"; -import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration } from "./preferences-helpers"; +import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration, CONSTANTS } from "./preferences-helpers"; import logger from "../../main/logger"; import type { monaco } from "react-monaco-editor"; import { getPath } from "../utils/getPath"; @@ -75,6 +75,7 @@ export class UserStore extends BaseStore /* implements UserStore @observable downloadBinariesPath?: string; @observable kubectlBinariesPath?: string; @observable terminalCopyOnSelect: boolean; + @observable updateChannel?: string; /** * Download kubectl binaries matching cluster version @@ -106,6 +107,10 @@ export class UserStore extends BaseStore /* implements UserStore return this.shell || process.env.SHELL || process.env.PTYSHELL; } + @computed get isAllowedToDowngrade(): boolean { + return this.updateChannel !== CONSTANTS.defaultUpdateChannel; + } + startMainReactions() { // track telemetry availability reaction(() => this.allowTelemetry, allowed => { @@ -218,6 +223,7 @@ export class UserStore extends BaseStore /* implements UserStore this.syncKubeconfigEntries.replace(DESCRIPTORS.syncKubeconfigEntries.fromStore(preferences?.syncKubeconfigEntries)); this.editorConfiguration = DESCRIPTORS.editorConfiguration.fromStore(preferences?.editorConfiguration); this.terminalCopyOnSelect = DESCRIPTORS.terminalCopyOnSelect.fromStore(preferences?.terminalCopyOnSelect); + this.updateChannel = DESCRIPTORS.updateChannel.fromStore(preferences?.updateChannel); } toJSON(): UserStoreModel { @@ -240,6 +246,7 @@ export class UserStore extends BaseStore /* implements UserStore syncKubeconfigEntries: DESCRIPTORS.syncKubeconfigEntries.toStore(this.syncKubeconfigEntries), editorConfiguration: DESCRIPTORS.editorConfiguration.toStore(this.editorConfiguration), terminalCopyOnSelect: DESCRIPTORS.terminalCopyOnSelect.toStore(this.terminalCopyOnSelect), + updateChannel: DESCRIPTORS.updateChannel.toStore(this.updateChannel), }, }; diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index ab8a4c509b..d22f96d65d 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -27,6 +27,7 @@ import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMess import { once } from "lodash"; import { ipcMain } from "electron"; import { nextUpdateChannel } from "./utils/update-channel"; +import { UserStore } from "../common/user-store"; const updateChannel = autoUpdater.channel; let installVersion: null | string = null; @@ -58,9 +59,13 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24 return; } + const us = UserStore.getInstance(); + autoUpdater.logger = logger; autoUpdater.autoDownload = false; autoUpdater.autoInstallOnAppQuit = false; + autoUpdater.channel = us.updateChannel; + autoUpdater.allowDowngrade = us.isAllowedToDowngrade; autoUpdater .on("update-available", (info: UpdateInfo) => { diff --git a/src/renderer/components/+preferences/application.tsx b/src/renderer/components/+preferences/application.tsx index ba86dc2ea8..f99b65f306 100644 --- a/src/renderer/components/+preferences/application.tsx +++ b/src/renderer/components/+preferences/application.tsx @@ -29,11 +29,16 @@ import { Input } from "../input"; import { isWindows } from "../../../common/vars"; import { FormSwitch, Switcher } from "../switch"; import moment from "moment-timezone"; +import { CONSTANTS } from "../../../common/user-store/preferences-helpers"; const timezoneOptions: SelectOption[] = moment.tz.names().map(zone => ({ label: zone, value: zone, })); +const updateChannelOptions: SelectOption[] = Array.from( + CONSTANTS.updateChannels.entries(), + ([value, { label }]) => ({ value, label }), +); export const Application = observer(() => { const defaultShell = process.env.SHELL @@ -104,6 +109,18 @@ export const Application = observer(() => {
+
+ + Date: Tue, 12 Oct 2021 08:33:56 -0400 Subject: [PATCH 08/31] Bump conf from 7.0.1 to 7.1.2 (#4005) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index e8288fde7b..b9fc77f0e3 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ "chalk": "^4.1.0", "chokidar": "^3.4.3", "command-exists": "1.2.9", - "conf": "^7.0.1", + "conf": "^7.1.2", "crypto-js": "^4.1.1", "electron-devtools-installer": "^3.2.0", "electron-updater": "^4.6.0", diff --git a/yarn.lock b/yarn.lock index 02d9b55fff..39c49ff53e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2557,7 +2557,7 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" -aggregate-error@^3.1.0: +aggregate-error@^3.0.0, aggregate-error@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== @@ -2966,6 +2966,11 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +atomically@^1.3.1: + version "1.7.0" + resolved "https://registry.yarnpkg.com/atomically/-/atomically-1.7.0.tgz#c07a0458432ea6dbc9a3506fffa424b48bccaafe" + integrity sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w== + auto-bind@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-2.1.1.tgz#8ae509671ecdfbd5009fc99b0f19ae9c3a2abf50" @@ -4176,12 +4181,13 @@ concurrently@^5.2.0: tree-kill "^1.2.2" yargs "^13.3.0" -conf@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/conf/-/conf-7.0.1.tgz#a3ddd860db0357219b9ccdf92fd618e161fe6848" - integrity sha512-UFA9EPFKK+tedCjz4JKQSxAN0/0r0rjURdq9N805JXWOhFzmr7fTLmG1cnsHCvyYYd65wRjf0KB8zg+WPelkvA== +conf@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/conf/-/conf-7.1.2.tgz#d9678a9d8f04de8bf5cd475105da8fdae49c2ec4" + integrity sha512-r8/HEoWPFn4CztjhMJaWNAe5n+gPUCSaJ0oufbqDLFKsA1V8JjAG7G+p0pgoDFAws9Bpk2VtVLLXqOBA7WxLeg== dependencies: ajv "^6.12.2" + atomically "^1.3.1" debounce-fn "^4.0.0" dot-prop "^5.2.0" env-paths "^2.2.0" @@ -4190,7 +4196,6 @@ conf@^7.0.1: onetime "^5.1.0" pkg-up "^3.1.0" semver "^7.3.2" - write-file-atomic "^3.0.3" config-chain@^1.1.11, config-chain@^1.1.12: version "1.1.12" @@ -10449,14 +10454,7 @@ one-time@^1.0.0: dependencies: fn.name "1.x.x" -onetime@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" - integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== - dependencies: - mimic-fn "^2.1.0" - -onetime@^5.1.2: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -14692,7 +14690,7 @@ write-file-atomic@^2.0.0, write-file-atomic@^2.3.0, write-file-atomic@^2.4.3: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-file-atomic@^3.0.0, write-file-atomic@^3.0.3: +write-file-atomic@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== From a859289b87f815c73b24270f863d453f7875873f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 08:35:26 -0400 Subject: [PATCH 09/31] Bump @sentry/react from 6.8.0 to 6.13.3 (#4008) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 116 +++++++++++++++++++++++++-------------------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/package.json b/package.json index b9fc77f0e3..901cdd4407 100644 --- a/package.json +++ b/package.json @@ -259,7 +259,7 @@ "@material-ui/icons": "^4.11.2", "@material-ui/lab": "^4.0.0-alpha.60", "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", - "@sentry/react": "^6.8.0", + "@sentry/react": "^6.13.3", "@sentry/types": "^6.8.0", "@testing-library/dom": "^8.2.0", "@testing-library/jest-dom": "^5.14.1", diff --git a/yarn.lock b/yarn.lock index 39c49ff53e..4259fb3fd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -985,6 +985,16 @@ schema-utils "^2.6.5" source-map "^0.7.3" +"@sentry/browser@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e" + integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ== + dependencies: + "@sentry/core" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/browser@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.7.1.tgz#e01144a08984a486ecc91d7922cc457e9c9bd6b7" @@ -995,14 +1005,15 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/browser@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.8.0.tgz#023707cd2302f6818014e9a7e124856b2d064178" - integrity sha512-nxa71csHlG5sMHUxI4e4xxuCWtbCv/QbBfMsYw7ncJSfCKG3yNlCVh8NJ7NS0rZW/MJUT6S6+r93zw0HetNDOA== +"@sentry/core@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221" + integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA== dependencies: - "@sentry/core" "6.8.0" - "@sentry/types" "6.8.0" - "@sentry/utils" "6.8.0" + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" tslib "^1.9.3" "@sentry/core@6.7.1": @@ -1016,17 +1027,6 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/core@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.8.0.tgz#bfac76844deee9126460c18dc6166015992efdc3" - integrity sha512-vJzWt/znEB+JqVwtwfjkRrAYRN+ep+l070Ti8GhJnvwU4IDtVlV3T/jVNrj6rl6UChcczaJQMxVxtG5x0crlAA== - dependencies: - "@sentry/hub" "6.8.0" - "@sentry/minimal" "6.8.0" - "@sentry/types" "6.8.0" - "@sentry/utils" "6.8.0" - tslib "^1.9.3" - "@sentry/electron@^2.5.0": version "2.5.0" resolved "https://registry.yarnpkg.com/@sentry/electron/-/electron-2.5.0.tgz#4168ff04ee01cb5a99ce042f3435660a510c634d" @@ -1040,6 +1040,15 @@ "@sentry/utils" "6.7.1" tslib "^2.2.0" +"@sentry/hub@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f" + integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw== + dependencies: + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" + tslib "^1.9.3" + "@sentry/hub@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.7.1.tgz#d46d24deec67f0731a808ca16796e6765b371bc1" @@ -1049,15 +1058,6 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/hub@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.8.0.tgz#cb0f8509093919ed3c1ef98ef8cf63dc102a6524" - integrity sha512-hFrI2Ss1fTov7CH64FJpigqRxH7YvSnGeqxT9Jc1BL7nzW/vgCK+Oh2mOZbosTcrzoDv+lE8ViOnSN3w/fo+rg== - dependencies: - "@sentry/types" "6.8.0" - "@sentry/utils" "6.8.0" - tslib "^1.9.3" - "@sentry/integrations@^6.10.0": version "6.10.0" resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.10.0.tgz#f8f9e7efd55ec44d0408bd4493df1c9ceabaaa63" @@ -1068,6 +1068,15 @@ localforage "^1.8.1" tslib "^1.9.3" +"@sentry/minimal@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e" + integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw== + dependencies: + "@sentry/hub" "6.13.3" + "@sentry/types" "6.13.3" + tslib "^1.9.3" + "@sentry/minimal@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.7.1.tgz#babf85ee2f167e9dcf150d750d7a0b250c98449c" @@ -1077,15 +1086,6 @@ "@sentry/types" "6.7.1" tslib "^1.9.3" -"@sentry/minimal@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.8.0.tgz#d6c3e4c96f231367aeb2b8a87a83b53d28e7c6db" - integrity sha512-MRxUKXiiYwKjp8mOQMpTpEuIby1Jh3zRTU0cmGZtfsZ38BC1JOle8xlwC4FdtOH+VvjSYnPBMya5lgNHNPUJDQ== - dependencies: - "@sentry/hub" "6.8.0" - "@sentry/types" "6.8.0" - tslib "^1.9.3" - "@sentry/node@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.7.1.tgz#b09e2eca8e187168feba7bd865a23935bf0f5cc0" @@ -1101,15 +1101,15 @@ lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/react@^6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.8.0.tgz#3cf4a2e1ef042ee227836e268e702e9cb3b67e41" - integrity sha512-yXNnDaVw8kIacbwQjA27w8DA74WxmDVw4RlUTJGtq35SDmWsaGN1mwvU+mE1u3zEg927QTCBYig2Zqk8Tdt/fQ== +"@sentry/react@^6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a" + integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw== dependencies: - "@sentry/browser" "6.8.0" - "@sentry/minimal" "6.8.0" - "@sentry/types" "6.8.0" - "@sentry/utils" "6.8.0" + "@sentry/browser" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" hoist-non-react-statics "^3.3.2" tslib "^1.9.3" @@ -1124,21 +1124,21 @@ "@sentry/utils" "6.7.1" tslib "^1.9.3" -"@sentry/types@6.10.0", "@sentry/types@^6.8.0": +"@sentry/types@6.10.0": version "6.10.0" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.10.0.tgz#6b1f44e5ed4dbc2710bead24d1b32fb08daf04e1" integrity sha512-M7s0JFgG7/6/yNVYoPUbxzaXDhnzyIQYRRJJKRaTD77YO4MHvi4Ke8alBWqD5fer0cPIfcSkBqa9BLdqRqcMWw== +"@sentry/types@6.13.3", "@sentry/types@^6.8.0": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2" + integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A== + "@sentry/types@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.7.1.tgz#c8263e1886df5e815570c4668eb40a1cfaa1c88b" integrity sha512-9AO7HKoip2MBMNQJEd6+AKtjj2+q9Ze4ooWUdEvdOVSt5drg7BGpK221/p9JEOyJAZwEPEXdcMd3VAIMiOb4MA== -"@sentry/types@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.8.0.tgz#97fd531a0ed1e75e65b4a24b26509fb7c15eb7b8" - integrity sha512-PbSxqlh6Fd5thNU5f8EVYBVvX+G7XdPA+ThNb2QvSK8yv3rIf0McHTyF6sIebgJ38OYN7ZFK7vvhC/RgSAfYTA== - "@sentry/utils@6.10.0": version "6.10.0" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.10.0.tgz#839a099fa0a1f0ca0893c7ce8c55ba0608c1d80f" @@ -1147,6 +1147,14 @@ "@sentry/types" "6.10.0" tslib "^1.9.3" +"@sentry/utils@6.13.3": + version "6.13.3" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926" + integrity sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag== + dependencies: + "@sentry/types" "6.13.3" + tslib "^1.9.3" + "@sentry/utils@6.7.1": version "6.7.1" resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.7.1.tgz#909184ad580f0f6375e1e4d4a6ffd33dfe64a4d1" @@ -1155,14 +1163,6 @@ "@sentry/types" "6.7.1" tslib "^1.9.3" -"@sentry/utils@6.8.0": - version "6.8.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.8.0.tgz#0ffafa5b69fe0cdeabad5c4a6cc68a426eaa6b37" - integrity sha512-OYlI2JNrcWKMdvYbWNdQwR4QBVv2V0y5wK0U6f53nArv6RsyO5TzwRu5rMVSIZofUUqjoE5hl27jqnR+vpUrsA== - dependencies: - "@sentry/types" "6.8.0" - tslib "^1.9.3" - "@sideway/address@^4.1.0": version "4.1.0" resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.0.tgz#0b301ada10ac4e0e3fa525c90615e0b61a72b78d" From a6ffdddb0450e1c4ba99c8232c5d0affa4934146 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 13:46:35 -0400 Subject: [PATCH 10/31] Bump @types/jsdom from 16.2.4 to 16.2.13 (#4007) 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 901cdd4407..36426321b4 100644 --- a/package.json +++ b/package.json @@ -279,7 +279,7 @@ "@types/http-proxy": "^1.17.7", "@types/jest": "^26.0.24", "@types/js-yaml": "^3.12.4", - "@types/jsdom": "^16.2.4", + "@types/jsdom": "^16.2.13", "@types/jsonpath": "^0.2.0", "@types/lodash": "^4.14.155", "@types/marked": "^2.0.4", diff --git a/yarn.lock b/yarn.lock index 4259fb3fd5..96b9efe559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1628,10 +1628,10 @@ resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.2.tgz#4117a7a378593a218e9d6f0ef44ce6d5d9edf7fa" integrity sha512-KbeHS/Y4R+k+5sWXEYzAZKuB1yQlZtEghuhRxrVRLaqhtoG5+26JwQsa4HyS3AWX8v1Uwukma5HheduUDskasA== -"@types/jsdom@^16.2.4": - version "16.2.4" - resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.4.tgz#527ca99943e00561ca4056b1904fd5f4facebc3b" - integrity sha512-RssgLa5ptjVKRkHho/Ex0+DJWkVsYuV8oh2PSG3gKxFp8n/VNyB7kOrZGQkk2zgPlcBkIKOItUc/T5BXit9uhg== +"@types/jsdom@^16.2.13": + version "16.2.13" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f" + integrity sha512-8JQCjdeAidptSsOcRWk2iTm9wCcwn9l+kRG6k5bzUacrnm1ezV4forq0kWjUih/tumAeoG+OspOvQEbbRucBTw== dependencies: "@types/node" "*" "@types/parse5" "*" From 498837d8fbfcc23af06ca597bcf469718880c3ae Mon Sep 17 00:00:00 2001 From: Jim Ehrismann <40840436+jim-docker@users.noreply.github.com> Date: Tue, 12 Oct 2021 14:08:27 -0400 Subject: [PATCH 11/31] release v5.3.0-alpha.1 (#4015) Signed-off-by: Jim Ehrismann --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36426321b4..d1aa028a85 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "OpenLens", "description": "OpenLens - Open Source IDE for Kubernetes", "homepage": "https://github.com/lensapp/lens", - "version": "5.3.0-alpha.0", + "version": "5.3.0-alpha.1", "main": "static/build/main.js", "copyright": "© 2021 OpenLens Authors", "license": "MIT", From a40ffd99f6114c41dd8e37a792a6338f07e968e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 14:09:39 -0400 Subject: [PATCH 12/31] Bump @electron/remote from 1.2.1 to 1.2.2 (#4012) 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 d1aa028a85..bc15e677e0 100644 --- a/package.json +++ b/package.json @@ -179,7 +179,7 @@ } }, "dependencies": { - "@electron/remote": "^1.2.1", + "@electron/remote": "^1.2.2", "@hapi/call": "^8.0.1", "@hapi/subtext": "^7.0.3", "@kubernetes/client-node": "^0.15.1", diff --git a/yarn.lock b/yarn.lock index 96b9efe559..f4742270cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -370,10 +370,10 @@ global-agent "^2.0.2" global-tunnel-ng "^2.7.1" -"@electron/remote@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@electron/remote/-/remote-1.2.1.tgz#665b9fc2c6a60f9e5039bf235e2c60ccd0242c32" - integrity sha512-yKh60I8KjezQkZqeuN5Nu2O/Z72+tgNgzvAa8QQPLtQbsrCOaeIWdXZQqierz4jQ5jzTNUk6KIcK3V2kFeaxaQ== +"@electron/remote@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@electron/remote/-/remote-1.2.2.tgz#4c390a2e669df47af973c09eec106162a296c323" + integrity sha512-PfnXpQGWh4vpX866NNucJRnNOzDRZcsLcLaT32fUth9k0hccsohfxprqEDYLzRg+ZK2xRrtyUN5wYYoHimMCJg== "@electron/universal@1.0.5": version "1.0.5" From 16cc8a93b7315290d2e66f08f2e629290192b3a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 15:34:58 -0400 Subject: [PATCH 13/31] Bump dompurify from 2.3.1 to 2.3.3 (#4014) 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 bc15e677e0..d532e30e8d 100644 --- a/package.json +++ b/package.json @@ -327,7 +327,7 @@ "concurrently": "^5.2.0", "css-loader": "^5.2.7", "deepdash": "^5.3.9", - "dompurify": "^2.3.1", + "dompurify": "^2.3.3", "electron": "^13.5.1", "electron-builder": "^22.11.11", "electron-notarize": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index f4742270cd..a2aaefd21a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5065,10 +5065,10 @@ domhandler@^2.3.0: dependencies: domelementtype "1" -dompurify@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.1.tgz#a47059ca21fd1212d3c8f71fdea6943b8bfbdf6a" - integrity sha512-xGWt+NHAQS+4tpgbOAI08yxW0Pr256Gu/FNE2frZVTbgrBUn8M7tz7/ktS/LZ2MHeGqz6topj0/xY+y8R5FBFw== +dompurify@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.3.tgz#c1af3eb88be47324432964d8abc75cf4b98d634c" + integrity sha512-dqnqRkPMAjOZE0FogZ+ceJNM2dZ3V/yNOuFB7+39qpO93hHhfRpHw3heYQC7DPK9FqbQTfBKUJhiSfz4MvXYwg== domutils@1.5.1: version "1.5.1" From 4526b322afb946d88fb652f977e77d48672c227a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 15:35:13 -0400 Subject: [PATCH 14/31] Bump @types/react from 17.0.0 to 17.0.29 (#4019) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d532e30e8d..879171098e 100644 --- a/package.json +++ b/package.json @@ -293,7 +293,7 @@ "@types/progress-bar-webpack-plugin": "^2.1.2", "@types/proper-lockfile": "^4.1.2", "@types/randomcolor": "^0.5.6", - "@types/react": "^17.0.0", + "@types/react": "^17.0.29", "@types/react-beautiful-dnd": "^13.1.1", "@types/react-dom": "^17.0.9", "@types/react-router-dom": "^5.3.1", diff --git a/yarn.lock b/yarn.lock index a2aaefd21a..45390ed7e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1910,12 +1910,13 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^17.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.0.tgz#5af3eb7fad2807092f0046a1302b7823e27919b8" - integrity sha512-aj/L7RIMsRlWML3YB6KZiXB3fV2t41+5RBGYF8z+tAKU43Px8C3cYUZsDvf1/+Bm4FK21QWBrDutu8ZJ/70qOw== +"@types/react@*", "@types/react@^17.0.29": + version "17.0.29" + resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.29.tgz#9535f3fc01a4981ce9cadcf0daa2593c0c2f2251" + integrity sha512-HSenIfBEBZ70BLrrVhtEtHpqaP79waauPtA8XKlczTxL3hXrW/ElGNLTpD1TmqkykgGlOAK55+D3SmUHEirpFw== dependencies: "@types/prop-types" "*" + "@types/scheduler" "*" csstype "^3.0.2" "@types/react@^16.8.12": From 140a8591e0ee428cdfdfe6bc2d73203286325d33 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 13 Oct 2021 15:32:51 +0300 Subject: [PATCH 15/31] Increase topbar z-index number (#4028) Signed-off-by: Alex Andreev --- src/renderer/components/layout/topbar.module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/layout/topbar.module.css b/src/renderer/components/layout/topbar.module.css index 83772a9d14..d94d1bf59a 100644 --- a/src/renderer/components/layout/topbar.module.css +++ b/src/renderer/components/layout/topbar.module.css @@ -25,7 +25,7 @@ grid-template-rows: var(--main-layout-header); grid-template-areas: "title controls"; background-color: var(--layoutBackground); - z-index: 1; + z-index: 2; width: 100%; grid-area: topbar; } From f51ce1e34b3a352f608018e898959dca32256a25 Mon Sep 17 00:00:00 2001 From: Jim Ehrismann <40840436+jim-docker@users.noreply.github.com> Date: Wed, 13 Oct 2021 10:02:06 -0400 Subject: [PATCH 16/31] release v5.3.0-alpha.2 (#4029) Signed-off-by: Jim Ehrismann --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 879171098e..41b9fde267 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "OpenLens", "description": "OpenLens - Open Source IDE for Kubernetes", "homepage": "https://github.com/lensapp/lens", - "version": "5.3.0-alpha.1", + "version": "5.3.0-alpha.2", "main": "static/build/main.js", "copyright": "© 2021 OpenLens Authors", "license": "MIT", From e64060cc69bd782fe086e63a683dd983a19cacd7 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 13 Oct 2021 10:34:28 -0400 Subject: [PATCH 17/31] Conditionally render node taints upon value existance (#3989) --- .../__tests__/app-preferences.tests.ts | 4 +- integration/helpers/utils.ts | 2 +- src/common/k8s-api/endpoints/nodes.api.ts | 22 +++++++--- .../components/+nodes/node-details.tsx | 8 +--- src/renderer/components/+nodes/nodes.tsx | 7 ++-- .../components/__tests__/nodes.api.test.ts | 41 +++++++++++++++++++ 6 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 src/renderer/components/__tests__/nodes.api.test.ts diff --git a/integration/__tests__/app-preferences.tests.ts b/integration/__tests__/app-preferences.tests.ts index 4939686e41..47dffd6a90 100644 --- a/integration/__tests__/app-preferences.tests.ts +++ b/integration/__tests__/app-preferences.tests.ts @@ -33,7 +33,7 @@ describe("preferences page tests", () => { beforeEach(async () => { let app: ElectronApplication; - + ({ window, cleanup, app } = await utils.start()); await utils.clickWelcomeButton(window); @@ -74,7 +74,7 @@ describe("preferences page tests", () => { utils.itIf(process.platform !== "win32")("ensures helm repos", async () => { await window.click("[data-testid=kubernetes-tab]"); await window.waitForSelector("[data-testid=repository-name]", { - timeout: 100_000, + timeout: 140_000, }); await window.click("#HelmRepoSelect"); await window.waitForSelector("div.Select__option"); diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index e52ae1d87f..359332f0d4 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -93,7 +93,7 @@ export async function start() { } export async function clickWelcomeButton(window: Page) { - await window.click("#hotbarIcon-catalog-entity .Icon"); + await window.click("[data-testid=welcome-menu-container] li a"); } function minikubeEntityId() { diff --git a/src/common/k8s-api/endpoints/nodes.api.ts b/src/common/k8s-api/endpoints/nodes.api.ts index 2705eeb1dd..01571a7d16 100644 --- a/src/common/k8s-api/endpoints/nodes.api.ts +++ b/src/common/k8s-api/endpoints/nodes.api.ts @@ -56,6 +56,21 @@ export interface INodeMetrics { fsSize: T; } +export interface NodeTaint { + key: string; + value?: string; + effect: string; + timeAdded: string; +} + +export function formatNodeTaint(taint: NodeTaint): string { + if (taint.value) { + return `${taint.key}=${taint.value}:${taint.effect}`; + } + + return `${taint.key}:${taint.effect}`; +} + export interface Node { spec: { podCIDR?: string; @@ -65,12 +80,7 @@ export interface Node { * @deprecated see https://issues.k8s.io/61966 */ externalID?: string; - taints?: { - key: string; - value: string; - effect: string; - timeAdded: string; - }[]; + taints?: NodeTaint[]; unschedulable?: boolean; }; status: { diff --git a/src/renderer/components/+nodes/node-details.tsx b/src/renderer/components/+nodes/node-details.tsx index cc858cba46..5ae6a30f51 100644 --- a/src/renderer/components/+nodes/node-details.tsx +++ b/src/renderer/components/+nodes/node-details.tsx @@ -30,7 +30,7 @@ import { Badge } from "../badge"; import { ResourceMetrics } from "../resource-metrics"; import { podsStore } from "../+workloads-pods/pods.store"; import type { KubeObjectDetailsProps } from "../kube-object-details"; -import { getMetricsByNodeNames, IClusterMetrics, Node } from "../../../common/k8s-api/endpoints"; +import { formatNodeTaint, getMetricsByNodeNames, IClusterMetrics, Node } from "../../../common/k8s-api/endpoints"; import { NodeCharts } from "./node-charts"; import { makeObservable, observable, reaction } from "mobx"; import { PodDetailsList } from "../+workloads-pods/pod-details-list"; @@ -132,11 +132,7 @@ export class NodeDetails extends React.Component { /> {taints.length > 0 && ( - { - taints.map(({ key, effect, value }) => ( - - )) - } + {taints.map(taint => )} )} {conditions && diff --git a/src/renderer/components/+nodes/nodes.tsx b/src/renderer/components/+nodes/nodes.tsx index 0d701e4ee7..73a6977a2d 100644 --- a/src/renderer/components/+nodes/nodes.tsx +++ b/src/renderer/components/+nodes/nodes.tsx @@ -27,7 +27,7 @@ import { cssNames, interval } from "../../utils"; import { TabLayout } from "../layout/tab-layout"; import { nodesStore } from "./nodes.store"; import { KubeObjectListLayout } from "../kube-object-list-layout"; -import { getMetricsForAllNodes, INodeMetrics, Node } from "../../../common/k8s-api/endpoints/nodes.api"; +import { formatNodeTaint, getMetricsForAllNodes, INodeMetrics, Node } from "../../../common/k8s-api/endpoints/nodes.api"; import { LineProgress } from "../line-progress"; import { bytesToUnits } from "../../../common/utils/convertMemory"; import { Tooltip, TooltipPosition } from "../tooltip"; @@ -227,6 +227,7 @@ export class Nodes extends React.Component { ]} renderTableContents={node => { const tooltipId = `node-taints-${node.getId()}`; + const taints = node.getTaints(); return [ , @@ -235,9 +236,9 @@ export class Nodes extends React.Component { this.renderMemoryUsage(node), this.renderDiskUsage(node), <> - {node.getTaints().length} + {taints.length} - {node.getTaints().map(({ key, value, effect }) => `${key}=${value}:${effect}`).join("\n")} + {taints.map(formatNodeTaint).join("\n")} , node.getRoleLabels(), diff --git a/src/renderer/components/__tests__/nodes.api.test.ts b/src/renderer/components/__tests__/nodes.api.test.ts new file mode 100644 index 0000000000..ba91169336 --- /dev/null +++ b/src/renderer/components/__tests__/nodes.api.test.ts @@ -0,0 +1,41 @@ +/** + * 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 { formatNodeTaint } from "../../../common/k8s-api/endpoints"; + +describe("formatNodeTaint tests", () => { + it("should use value if defined", () => { + expect(formatNodeTaint({ + effect: "Foo", + key: "hello", + timeAdded: "pre", + value: "a" + })).toBe("hello=a:Foo"); + }); + + it("should not use value if not defined", () => { + expect(formatNodeTaint({ + effect: "Foo", + key: "hello", + timeAdded: "pre", + })).toBe("hello:Foo"); + }); +}); From 52052b534fd77b35ea6d0ff33e54ab230ecb8677 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Oct 2021 10:34:36 -0400 Subject: [PATCH 18/31] Bump eslint-plugin-react from 7.24.0 to 7.26.1 (#4024) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 105 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 95 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 41b9fde267..c0593cd0e8 100644 --- a/package.json +++ b/package.json @@ -335,7 +335,7 @@ "esbuild-loader": "^2.15.1", "eslint": "^7.32.0", "eslint-plugin-header": "^3.1.1", - "eslint-plugin-react": "^7.24.0", + "eslint-plugin-react": "^7.26.1", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-unused-imports": "^1.0.1", "file-loader": "^6.2.0", diff --git a/yarn.lock b/yarn.lock index 45390ed7e8..b5b2b5e496 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5444,6 +5444,32 @@ es-abstract@^1.18.0-next.2, es-abstract@^1.18.2: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" + has "^1.0.3" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.1" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" + object-inspect "^1.11.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -5552,22 +5578,24 @@ eslint-plugin-react-hooks@^4.2.0: resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556" integrity sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ== -eslint-plugin-react@^7.24.0: - version "7.24.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.24.0.tgz#eadedfa351a6f36b490aa17f4fa9b14e842b9eb4" - integrity sha512-KJJIx2SYx7PBx3ONe/mEeMz4YE0Lcr7feJTCMyyKb/341NcjuAgim3Acgan89GfPv7nxXK2+0slu0CWXYM4x+Q== +eslint-plugin-react@^7.26.1: + version "7.26.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.26.1.tgz#41bcfe3e39e6a5ac040971c1af94437c80daa40e" + integrity sha512-Lug0+NOFXeOE+ORZ5pbsh6mSKjBKXDXItUD2sQoT+5Yl0eoT82DqnXeTMfUare4QVCn9QwXbfzO/dBLjLXwVjQ== dependencies: array-includes "^3.1.3" array.prototype.flatmap "^1.2.4" doctrine "^2.1.0" - has "^1.0.3" + estraverse "^5.2.0" jsx-ast-utils "^2.4.1 || ^3.0.0" minimatch "^3.0.4" object.entries "^1.1.4" object.fromentries "^2.0.4" + object.hasown "^1.0.0" object.values "^1.1.4" prop-types "^15.7.2" resolve "^2.0.0-next.3" + semver "^6.3.0" string.prototype.matchall "^4.0.5" eslint-plugin-unused-imports@^1.0.1: @@ -5717,12 +5745,7 @@ estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.1.0.tgz#374309d39fd935ae500e7b92e8a6b4c720e59642" - integrity sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw== - -estraverse@^5.2.0: +estraverse@^5.1.0, estraverse@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== @@ -6526,6 +6549,14 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -6835,6 +6866,13 @@ has-symbols@^1.0.2: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + has-unicode@^2.0.0, has-unicode@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -7525,6 +7563,11 @@ is-callable@^1.2.3: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== +is-callable@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== + is-ci@^1.0.10: version "1.2.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" @@ -7821,11 +7864,24 @@ is-regex@^1.1.3: call-bind "^1.0.2" has-symbols "^1.0.2" +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-retry-allowed@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg== +is-shared-array-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" + integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== + is-stream@^1.0.0, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -7846,6 +7902,13 @@ is-string@^1.0.6: resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.6.tgz#3fe5d5992fb0d93404f32584d4b0179a71b54a5f" integrity sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w== +is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + is-symbol@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" @@ -7870,6 +7933,13 @@ is-url@^1.2.4: resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52" integrity sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww== +is-weakref@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" + integrity sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ== + dependencies: + call-bind "^1.0.0" + is-what@^3.12.0: version "3.14.1" resolved "https://registry.yarnpkg.com/is-what/-/is-what-3.14.1.tgz#e1222f46ddda85dead0fd1c9df131760e77755c1" @@ -10326,6 +10396,11 @@ object-inspect@^1.10.3, object-inspect@^1.9.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== +object-inspect@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" + integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== + object-inspect@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" @@ -10403,6 +10478,14 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" +object.hasown@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.0.tgz#7232ed266f34d197d15cac5880232f7a4790afe5" + integrity sha512-MhjYRfj3GBlhSkDHo6QmvgjRLXQ2zndabdf3nX0yTyZK9rPfxb6uRpAac8HXNLy1GpqWtZ81Qh4v3uOls2sRAg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.19.1" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" From 91f7661f4691c0a712843b2d7a9d1c1105332a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Oct 2021 10:34:43 -0400 Subject: [PATCH 19/31] Bump @types/byline from 4.2.32 to 4.2.33 (#4022) 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 c0593cd0e8..e58380f14c 100644 --- a/package.json +++ b/package.json @@ -265,7 +265,7 @@ "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^13.2.1", - "@types/byline": "^4.2.32", + "@types/byline": "^4.2.33", "@types/chart.js": "^2.9.34", "@types/color": "^3.0.2", "@types/crypto-js": "^3.1.47", diff --git a/yarn.lock b/yarn.lock index b5b2b5e496..1acaf2e21a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1370,10 +1370,10 @@ resolved "https://registry.yarnpkg.com/@types/boom/-/boom-7.3.0.tgz#33280c5552d4cfabc21b8b7e0f6d29292decd985" integrity sha512-PH7bfkt1nu4pnlxz+Ws+wwJJF1HE12W3ia+Iace2JT7q56DLH3hbyjOJyNHJYRxk3PkKaC36fHfHKyeG1rMgCA== -"@types/byline@^4.2.32": - version "4.2.32" - resolved "https://registry.yarnpkg.com/@types/byline/-/byline-4.2.32.tgz#9d35ec15968056118548412ee24c2c3026c997dc" - integrity sha512-qtlm/J6XOO9p+Ep/ZB5+mCFEDhzWDDHWU4a1eReN7lkPZXW9rkloq2jcAhvKKmlO5tL2GSvKROb+PTsNVhBiyQ== +"@types/byline@^4.2.33": + version "4.2.33" + resolved "https://registry.yarnpkg.com/@types/byline/-/byline-4.2.33.tgz#001f504f4353b84c503e74da0ed9bdf291484af2" + integrity sha512-LJYez7wrWcJQQDknqZtrZuExMGP0IXmPl1rOOGDqLbu+H7UNNRfKNuSxCBcQMLH1EfjeWidLedC/hCc5dDfBog== dependencies: "@types/node" "*" From 277184c5726594c4f88bd27cb9d6ec97ba3b6cd1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Oct 2021 10:34:49 -0400 Subject: [PATCH 20/31] Bump @types/readable-stream from 2.3.9 to 2.3.11 (#4023) 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 e58380f14c..9ba0d4a39b 100644 --- a/package.json +++ b/package.json @@ -301,7 +301,7 @@ "@types/react-table": "^7.7.6", "@types/react-virtualized-auto-sizer": "^1.0.1", "@types/react-window": "^1.8.5", - "@types/readable-stream": "^2.3.9", + "@types/readable-stream": "^2.3.11", "@types/request": "^2.48.7", "@types/request-promise-native": "^1.0.18", "@types/semver": "^7.2.0", diff --git a/yarn.lock b/yarn.lock index 1acaf2e21a..fd43e56c96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1928,10 +1928,10 @@ "@types/scheduler" "*" csstype "^3.0.2" -"@types/readable-stream@^2.3.9": - version "2.3.9" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.9.tgz#40a8349e6ace3afd2dd1b6d8e9b02945de4566a9" - integrity sha512-sqsgQqFT7HmQz/V5jH1O0fvQQnXAJO46Gg9LRO/JPfjmVmGUlcx831TZZO3Y3HtWhIkzf3kTsNT0Z0kzIhIvZw== +"@types/readable-stream@^2.3.11": + version "2.3.11" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.11.tgz#942bc4574a1d7ca4368cb9cb4352e3d2b4b51dea" + integrity sha512-0z+/apYJwKFz/RHp6mOMxz/y7xOvWPYPevuCEyAY3gXsjtaac02E26RvxA+I96rfvmVH/dEMGXNvyJfViR1FSQ== dependencies: "@types/node" "*" safe-buffer "*" From 743e7f2b36067a1ab9ffa0b3091174d1e158ad1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Oct 2021 10:34:57 -0400 Subject: [PATCH 21/31] Bump nodemon from 2.0.12 to 2.0.13 (#4021) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 87 ++++------------------------------------------------ 2 files changed, 7 insertions(+), 82 deletions(-) diff --git a/package.json b/package.json index 9ba0d4a39b..13f2d355e8 100644 --- a/package.json +++ b/package.json @@ -353,7 +353,7 @@ "mini-css-extract-plugin": "^1.6.2", "node-gyp": "7.1.2", "node-loader": "^1.0.3", - "nodemon": "^2.0.12", + "nodemon": "^2.0.13", "playwright": "^1.14.0", "postcss": "^8.3.6", "postcss-loader": "4.3.0", diff --git a/yarn.lock b/yarn.lock index fd43e56c96..bd4f062a41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3256,20 +3256,6 @@ boxen@^1.2.1: term-size "^1.2.0" widest-line "^2.0.0" -boxen@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-4.2.0.tgz#e411b62357d6d6d36587c8ac3d5d974daa070e64" - integrity sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ== - dependencies: - ansi-align "^3.0.0" - camelcase "^5.3.1" - chalk "^3.0.0" - cli-boxes "^2.2.0" - string-width "^4.1.0" - term-size "^2.1.0" - type-fest "^0.8.1" - widest-line "^3.1.0" - boxen@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.0.1.tgz#657528bdd3f59a772b8279b831f27ec2c744664b" @@ -3846,11 +3832,6 @@ cli-boxes@^1.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" integrity sha1-T6kXw+WclKAEzWH47lCdplFocUM= -cli-boxes@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.0.tgz#538ecae8f9c6ca508e3c3c95b453fe93cb4c168d" - integrity sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w== - cli-boxes@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" @@ -6633,13 +6614,6 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" -global-dirs@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-2.0.1.tgz#acdf3bb6685bcd55cb35e8a052266569e9469201" - integrity sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A== - dependencies: - ini "^1.3.5" - global-dirs@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.0.tgz#70a76fe84ea315ab37b1f5576cbde7d48ef72686" @@ -7716,14 +7690,6 @@ is-installed-globally@^0.1.0: global-dirs "^0.1.0" is-path-inside "^1.0.0" -is-installed-globally@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.3.2.tgz#fd3efa79ee670d1187233182d5b0a1dd00313141" - integrity sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g== - dependencies: - global-dirs "^2.0.1" - is-path-inside "^3.0.1" - is-installed-globally@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.4.0.tgz#9a0fd407949c30f86eb6959ef1b7994ed0b7b520" @@ -7747,11 +7713,6 @@ is-npm@^1.0.0: resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" integrity sha1-8vtjpl5JBbQGyGBydloaTceTufQ= -is-npm@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-4.0.0.tgz#c90dd8380696df87a7a6d823c20d0b12bbe3c84d" - integrity sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig== - is-npm@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-5.0.0.tgz#43e8d65cc56e1b67f8d47262cf667099193f45a8" @@ -7810,11 +7771,6 @@ is-path-inside@^2.1.0: dependencies: path-is-inside "^1.0.2" -is-path-inside@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.2.tgz#f5220fc82a3e233757291dddc9c5877f2a1f3017" - integrity sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg== - is-path-inside@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" @@ -8846,7 +8802,7 @@ latest-version@^3.0.0: dependencies: package-json "^4.0.0" -latest-version@^5.0.0, latest-version@^5.1.0: +latest-version@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-5.1.0.tgz#119dfe908fe38d15dfa43ecd13fa12ec8832face" integrity sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA== @@ -10021,10 +9977,10 @@ node-pty@^0.10.1: dependencies: nan "^2.14.0" -nodemon@^2.0.12: - version "2.0.12" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.12.tgz#5dae4e162b617b91f1873b3bfea215dd71e144d5" - integrity sha512-egCTmNZdObdBxUBw6ZNwvZ/xzk24CKRs5K6d+5zbmrMr7rOpPmfPeF6OxM3DDpaRx331CQRFEktn+wrFFfBSOA== +nodemon@^2.0.13: + version "2.0.13" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.13.tgz#67d40d3a4d5bd840aa785c56587269cfcf5d24aa" + integrity sha512-UMXMpsZsv1UXUttCn6gv8eQPhn6DR4BW+txnL3IN5IHqrCwcrT/yWHfL35UsClGXknTH79r5xbu+6J1zNHuSyA== dependencies: chokidar "^3.2.2" debug "^3.2.6" @@ -10035,7 +9991,7 @@ nodemon@^2.0.12: supports-color "^5.5.0" touch "^3.1.0" undefsafe "^2.0.3" - update-notifier "^4.1.0" + update-notifier "^5.1.0" nopt@^4.0.1, nopt@^4.0.3: version "4.0.3" @@ -11500,13 +11456,6 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -pupa@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.0.1.tgz#dbdc9ff48ffbea4a26a069b6f9f7abb051008726" - integrity sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA== - dependencies: - escape-goat "^2.0.0" - pupa@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.1.1.tgz#f5e8fd4afc2c5d97828faa523549ed8744a20d62" @@ -13552,11 +13501,6 @@ term-size@^1.2.0: dependencies: execa "^0.7.0" -term-size@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.0.tgz#1f16adedfe9bdc18800e1776821734086fcc6753" - integrity sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw== - terminal-link@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" @@ -14149,25 +14093,6 @@ update-notifier@^2.2.0, update-notifier@^2.3.0, update-notifier@^2.5.0: semver-diff "^2.0.0" xdg-basedir "^3.0.0" -update-notifier@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-4.1.3.tgz#be86ee13e8ce48fb50043ff72057b5bd598e1ea3" - integrity sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A== - dependencies: - boxen "^4.2.0" - chalk "^3.0.0" - configstore "^5.0.1" - has-yarn "^2.1.0" - import-lazy "^2.1.0" - is-ci "^2.0.0" - is-installed-globally "^0.3.1" - is-npm "^4.0.0" - is-yarn-global "^0.3.0" - latest-version "^5.0.0" - pupa "^2.0.1" - semver-diff "^3.1.1" - xdg-basedir "^4.0.0" - update-notifier@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-5.1.0.tgz#4ab0d7c7f36a231dd7316cf7729313f0214d9ad9" From 3988229a6c7a5d93b8f3646c508d4212c46c8cc0 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 13 Oct 2021 14:48:47 -0400 Subject: [PATCH 22/31] Fix auto-update channel checking and pinning (#4030) --- src/common/user-store/preferences-helpers.ts | 8 +++---- src/common/user-store/user-store.ts | 8 +++---- src/main/app-updater.ts | 9 ++++---- .../utils/__test__/update-channel.test.ts | 18 ++++++++-------- src/main/utils/update-channel.ts | 21 ++++++++++++------- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/common/user-store/preferences-helpers.ts b/src/common/user-store/preferences-helpers.ts index 2320d8ed7b..807bf8ca4c 100644 --- a/src/common/user-store/preferences-helpers.ts +++ b/src/common/user-store/preferences-helpers.ts @@ -23,9 +23,10 @@ import moment from "moment-timezone"; import path from "path"; import os from "os"; import { ThemeStore } from "../../renderer/theme.store"; -import { ObservableToggleSet } from "../utils"; +import { getAppVersion, ObservableToggleSet } from "../utils"; import type {monaco} from "react-monaco-editor"; import merge from "lodash/merge"; +import { SemVer } from "semver"; export interface KubeconfigSyncEntry extends KubeconfigSyncValue { filePath: string; @@ -260,9 +261,8 @@ const editorConfiguration: PreferenceDescription = { fromStore(val) { @@ -318,6 +319,5 @@ export const DESCRIPTORS = { }; export const CONSTANTS = { - defaultUpdateChannel, updateChannels, }; diff --git a/src/common/user-store/user-store.ts b/src/common/user-store/user-store.ts index 68e7ece0d6..f17ac9c5c6 100644 --- a/src/common/user-store/user-store.ts +++ b/src/common/user-store/user-store.ts @@ -20,7 +20,7 @@ */ import { app, ipcMain } from "electron"; -import semver from "semver"; +import semver, { SemVer } from "semver"; import { action, computed, observable, reaction, makeObservable } from "mobx"; import { BaseStore } from "../base-store"; import migrations from "../../migrations/user-store"; @@ -30,7 +30,7 @@ import { appEventBus } from "../event-bus"; import path from "path"; import { fileNameMigration } from "../../migrations/user-store"; import { ObservableToggleSet, toJS } from "../../renderer/utils"; -import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration, CONSTANTS } from "./preferences-helpers"; +import { DESCRIPTORS, KubeconfigSyncValue, UserPreferencesModel, EditorConfiguration } from "./preferences-helpers"; import logger from "../../main/logger"; import type { monaco } from "react-monaco-editor"; import { getPath } from "../utils/getPath"; @@ -107,9 +107,7 @@ export class UserStore extends BaseStore /* implements UserStore return this.shell || process.env.SHELL || process.env.PTYSHELL; } - @computed get isAllowedToDowngrade(): boolean { - return this.updateChannel !== CONSTANTS.defaultUpdateChannel; - } + readonly isAllowedToDowngrade = new SemVer(getAppVersion()).prerelease[0] !== "latest"; startMainReactions() { // track telemetry availability diff --git a/src/main/app-updater.ts b/src/main/app-updater.ts index d22f96d65d..62976d78f8 100644 --- a/src/main/app-updater.ts +++ b/src/main/app-updater.ts @@ -29,7 +29,6 @@ import { ipcMain } from "electron"; import { nextUpdateChannel } from "./utils/update-channel"; import { UserStore } from "../common/user-store"; -const updateChannel = autoUpdater.channel; let installVersion: null | string = null; export function isAutoUpdateEnabled() { @@ -59,13 +58,13 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24 return; } - const us = UserStore.getInstance(); + const userStore = UserStore.getInstance(); autoUpdater.logger = logger; autoUpdater.autoDownload = false; autoUpdater.autoInstallOnAppQuit = false; - autoUpdater.channel = us.updateChannel; - autoUpdater.allowDowngrade = us.isAllowedToDowngrade; + autoUpdater.channel = userStore.updateChannel; + autoUpdater.allowDowngrade = userStore.isAllowedToDowngrade; autoUpdater .on("update-available", (info: UpdateInfo) => { @@ -109,7 +108,7 @@ export const startUpdateChecking = once(function (interval = 1000 * 60 * 60 * 24 } }) .on("update-not-available", () => { - const nextChannel = nextUpdateChannel(updateChannel, autoUpdater.channel); + const nextChannel = nextUpdateChannel(userStore.updateChannel, autoUpdater.channel); logger.info(`${AutoUpdateLogPrefix}: update not available from ${autoUpdater.channel}, will check ${nextChannel} channel next`); diff --git a/src/main/utils/__test__/update-channel.test.ts b/src/main/utils/__test__/update-channel.test.ts index aa368b41bb..ba7ebdd7b3 100644 --- a/src/main/utils/__test__/update-channel.test.ts +++ b/src/main/utils/__test__/update-channel.test.ts @@ -33,17 +33,17 @@ describe("nextUpdateChannel", () => { expect(nextUpdateChannel("latest", "alpha")).toEqual("beta"); }); - it("returns rc if current channel is beta", () => { - expect(nextUpdateChannel("alpha", "beta")).toEqual("rc"); - expect(nextUpdateChannel("beta", "beta")).toEqual("rc"); - expect(nextUpdateChannel("rc", "beta")).toEqual("rc"); - expect(nextUpdateChannel("latest", "beta")).toEqual("rc"); + it("returns latest if current channel is beta", () => { + expect(nextUpdateChannel("alpha", "beta")).toEqual("latest"); + expect(nextUpdateChannel("beta", "beta")).toEqual("latest"); + expect(nextUpdateChannel("rc", "beta")).toEqual("latest"); + expect(nextUpdateChannel("latest", "beta")).toEqual("latest"); }); - it("returns latest if current channel is rc", () => { - expect(nextUpdateChannel("alpha", "rc")).toEqual("latest"); - expect(nextUpdateChannel("beta", "rc")).toEqual("latest"); - expect(nextUpdateChannel("rc", "rc")).toEqual("latest"); + it("returns default if current channel is unknown", () => { + expect(nextUpdateChannel("alpha", "rc")).toEqual("alpha"); + expect(nextUpdateChannel("beta", "rc")).toEqual("beta"); + expect(nextUpdateChannel("rc", "rc")).toEqual("rc"); expect(nextUpdateChannel("latest", "rc")).toEqual("latest"); }); }); diff --git a/src/main/utils/update-channel.ts b/src/main/utils/update-channel.ts index ae185e042a..adf1f59499 100644 --- a/src/main/utils/update-channel.ts +++ b/src/main/utils/update-channel.ts @@ -19,14 +19,19 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/** + * Compute the next update channel from the current updating channel + * @param defaultChannel The default (initial) channel to check + * @param channel The current channel that did not have a new version associated with it + * @returns The channel name of the next release version + */ export function nextUpdateChannel(defaultChannel: string, channel: string): string { - if (channel === "alpha") { - return "beta"; - } else if (channel === "beta") { - return "rc"; - } else if (channel === "rc") { - return "latest"; - } else { - return defaultChannel; + switch (channel) { + case "alpha": + return "beta"; + case "beta": + return "latest"; // there is no RC currently + default: + return defaultChannel; } } From 7e0aeca1192a9347235f06725578dbd7e1d7f515 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 14 Oct 2021 08:46:23 -0400 Subject: [PATCH 23/31] Remove exec.command checking (#3881) --- package.json | 1 - src/common/__tests__/kube-helpers.test.ts | 73 +------ src/common/custom-errors.ts | 34 ---- src/common/kube-helpers.ts | 233 +++++++++------------- types/command-exists.d.ts | 32 --- yarn.lock | 5 - 6 files changed, 99 insertions(+), 279 deletions(-) delete mode 100644 src/common/custom-errors.ts delete mode 100644 types/command-exists.d.ts diff --git a/package.json b/package.json index 13f2d355e8..5a6d205087 100644 --- a/package.json +++ b/package.json @@ -193,7 +193,6 @@ "byline": "^5.0.0", "chalk": "^4.1.0", "chokidar": "^3.4.3", - "command-exists": "1.2.9", "conf": "^7.1.2", "crypto-js": "^4.1.1", "electron-devtools-installer": "^3.2.0", diff --git a/src/common/__tests__/kube-helpers.test.ts b/src/common/__tests__/kube-helpers.test.ts index 5d2bd35344..277398ee02 100644 --- a/src/common/__tests__/kube-helpers.test.ts +++ b/src/common/__tests__/kube-helpers.test.ts @@ -20,7 +20,7 @@ */ import { KubeConfig } from "@kubernetes/client-node"; -import { validateKubeConfig, loadConfigFromString, getNodeWarningConditions } from "../kube-helpers"; +import { validateKubeConfig, loadConfigFromString } from "../kube-helpers"; const kubeconfig = ` apiVersion: v1 @@ -120,38 +120,6 @@ describe("kube helpers", () => { ); }); }); - - describe("with invalid exec command", () => { - it("returns an error", () => { - expect(String(validateKubeConfig(kc, "invalidExec"))).toEqual( - expect.stringContaining("User Exec command \"foo\" not found on host. Please ensure binary is found in PATH or use absolute path to binary in Kubeconfig") - ); - }); - }); - }); - - describe("with validateCluster as false", () => { - describe("with invalid cluster object", () => { - it("does not return an error", () => { - expect(validateKubeConfig(kc, "invalidCluster", { validateCluster: false })).toBeUndefined(); - }); - }); - }); - - describe("with validateUser as false", () => { - describe("with invalid user object", () => { - it("does not return an error", () => { - expect(validateKubeConfig(kc, "invalidUser", { validateUser: false })).toBeUndefined(); - }); - }); - }); - - describe("with validateExec as false", () => { - describe("with invalid exec object", () => { - it("does not return an error", () => { - expect(validateKubeConfig(kc, "invalidExec", { validateExec: false })).toBeUndefined(); - }); - }); }); }); @@ -280,43 +248,4 @@ describe("kube helpers", () => { }); }); }); - - describe("getNodeWarningConditions", () => { - it("should return an empty array if no status or no conditions", () => { - expect(getNodeWarningConditions({}).length).toBe(0); - }); - - it("should return an empty array if all conditions are good", () => { - expect(getNodeWarningConditions({ - status: { - conditions: [ - { - type: "Ready", - status: "foobar" - } - ] - } - }).length).toBe(0); - }); - - it("should all not ready conditions", () => { - const conds = getNodeWarningConditions({ - status: { - conditions: [ - { - type: "Ready", - status: "foobar" - }, - { - type: "NotReady", - status: "true" - }, - ] - } - }); - - expect(conds.length).toBe(1); - expect(conds[0].type).toBe("NotReady"); - }); - }); }); diff --git a/src/common/custom-errors.ts b/src/common/custom-errors.ts deleted file mode 100644 index 2cbc75ccf0..0000000000 --- a/src/common/custom-errors.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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. - */ - -export class ExecValidationNotFoundError extends Error { - 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 (!isAbsolute) { - message += ` Please ensure binary is found in PATH or use absolute path to binary in Kubeconfig`; - } - 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 aff05e68c6..16046b4676 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -19,24 +19,16 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { KubeConfig, V1Node, V1Pod } from "@kubernetes/client-node"; +import { KubeConfig } from "@kubernetes/client-node"; import fse from "fs-extra"; 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"; -export type KubeConfigValidationOpts = { - validateCluster?: boolean; - validateUser?: boolean; - validateExec?: boolean; -}; - export const kubeConfigDefaultPath = path.join(os.homedir(), ".kube", "config"); export function loadConfigFromFileSync(filePath: string): ConfigResult { @@ -86,35 +78,34 @@ const contextSchema = Joi.object({ }), }); -const kubeConfigSchema = Joi - .object({ - users: Joi - .array() - .items(userSchema) - .optional(), - clusters: Joi - .array() - .items(clusterSchema) - .optional(), - contexts: Joi - .array() - .items(contextSchema) - .optional(), - "current-context": Joi - .string() - .min(1) - .optional(), - }) +const kubeConfigSchema = Joi.object({ + users: Joi + .array() + .items(userSchema) + .optional(), + clusters: Joi + .array() + .items(clusterSchema) + .optional(), + contexts: Joi + .array() + .items(contextSchema) + .optional(), + "current-context": Joi + .string() + .min(1) + .optional(), +}) .required(); -export interface KubeConfigOptions { +interface KubeConfigOptions { clusters: Cluster[]; users: User[]; contexts: Context[]; currentContext?: string; } -export interface OptionsResult { +interface OptionsResult { options: KubeConfigOptions; error: Joi.ValidationError; } @@ -132,7 +123,12 @@ function loadToOptions(rawYaml: string): OptionsResult { arrays: true, } }); - const { clusters: rawClusters, users: rawUsers, contexts: rawContexts, "current-context": currentContext } = value ?? {}; + const { + clusters: rawClusters, + users: rawUsers, + contexts: rawContexts, + "current-context": currentContext, + } = value ?? {}; const clusters = newClusters(rawClusters); const users = newUsers(rawUsers); const contexts = newContexts(rawContexts); @@ -175,66 +171,78 @@ export interface SplitConfigEntry { * Breaks kube config into several configs. Each context as it own KubeConfig object */ export function splitConfig(kubeConfig: KubeConfig): SplitConfigEntry[] { - const { contexts = [] } = kubeConfig; - - return contexts.map(context => { + return kubeConfig.getContexts().map(ctx => { const config = new KubeConfig(); + const cluster = kubeConfig.getCluster(ctx.cluster); + const user = kubeConfig.getUser(ctx.user); + const context = kubeConfig.getContextObject(ctx.name); - config.clusters = [kubeConfig.getCluster(context.cluster)].filter(Boolean); - config.users = [kubeConfig.getUser(context.user)].filter(Boolean); - config.contexts = [kubeConfig.getContextObject(context.name)].filter(Boolean); - config.setCurrentContext(context.name); + if (cluster) { + config.addCluster(cluster); + } + + if (user) { + config.addUser(user); + } + + if (context) { + config.addContext(context); + } + + config.setCurrentContext(ctx.name); return { config, - error: validateKubeConfig(config, context.name)?.toString(), + error: validateKubeConfig(config, ctx.name)?.toString(), }; }); } +/** + * Pretty format the object as human readable yaml, such as would be on the filesystem + * @param kubeConfig The kubeconfig object to format as pretty yaml + * @returns The yaml representation of the kubeconfig object + */ export function dumpConfigYaml(kubeConfig: Partial): string { + const clusters = kubeConfig.clusters.map(cluster => ({ + name: cluster.name, + cluster: { + "certificate-authority-data": cluster.caData, + "certificate-authority": cluster.caFile, + server: cluster.server, + "insecure-skip-tls-verify": cluster.skipTLSVerify + } + })); + const contexts = kubeConfig.contexts.map(context => ({ + name: context.name, + context: { + cluster: context.cluster, + user: context.user, + namespace: context.namespace + } + })); + const users = kubeConfig.users.map(user => ({ + name: user.name, + user: { + "client-certificate-data": user.certData, + "client-certificate": user.certFile, + "client-key-data": user.keyData, + "client-key": user.keyFile, + "auth-provider": user.authProvider, + exec: user.exec, + token: user.token, + username: user.username, + password: user.password + } + })); const config = { apiVersion: "v1", kind: "Config", preferences: {}, "current-context": kubeConfig.currentContext, - clusters: kubeConfig.clusters.map(cluster => { - return { - name: cluster.name, - cluster: { - "certificate-authority-data": cluster.caData, - "certificate-authority": cluster.caFile, - server: cluster.server, - "insecure-skip-tls-verify": cluster.skipTLSVerify - } - }; - }), - contexts: kubeConfig.contexts.map(context => { - return { - name: context.name, - context: { - cluster: context.cluster, - user: context.user, - namespace: context.namespace - } - }; - }), - users: kubeConfig.users.map(user => { - return { - name: user.name, - user: { - "client-certificate-data": user.certData, - "client-certificate": user.certFile, - "client-key-data": user.keyData, - "client-key": user.keyFile, - "auth-provider": user.authProvider, - exec: user.exec, - token: user.token, - username: user.username, - password: user.password - } - }; - }) + clusters, + contexts, + users, }; logger.debug("Dumping KubeConfig:", config); @@ -243,70 +251,25 @@ export function dumpConfigYaml(kubeConfig: Partial): string { return yaml.safeDump(config, { skipInvalid: true }); } -export function podHasIssues(pod: V1Pod) { - // Logic adapted from dashboard - const notReady = !!pod.status.conditions.find(condition => { - return condition.type == "Ready" && condition.status !== "True"; - }); - - return ( - notReady || - pod.status.phase !== "Running" || - pod.spec.priority > 500000 // We're interested in high priority pods events regardless of their running status - ); -} - -export function getNodeWarningConditions(node: V1Node) { - return node.status?.conditions?.filter(c => - c.status.toLowerCase() === "true" && c.type !== "Ready" && c.type !== "HostUpgrades" - ) ?? []; -} - /** * Checks if `config` has valid `Context`, `User`, `Cluster`, and `exec` fields (if present when required) * * Note: This function returns an error instead of throwing it, returning `undefined` if the validation passes */ -export function validateKubeConfig(config: KubeConfig, contextName: string, validationOpts: KubeConfigValidationOpts = {}): Error | undefined { - try { - // we only receive a single context, cluster & user object here so lets validate them as this - // will be called when we add a new cluster to Lens +export function validateKubeConfig(config: KubeConfig, contextName: string): Error | undefined { + const contextObject = config.getContextObject(contextName); - const { validateUser = true, validateCluster = true, validateExec = true } = validationOpts; - - const contextObject = config.getContextObject(contextName); - - // Validate the Context Object - if (!contextObject) { - return new Error(`No valid context object provided in kubeconfig for context '${contextName}'`); - } - - // Validate the Cluster Object - if (validateCluster && !config.getCluster(contextObject.cluster)) { - return new Error(`No valid cluster object provided in kubeconfig for context '${contextName}'`); - } - - const user = config.getUser(contextObject.user); - - // Validate the User Object - if (validateUser && !user) { - return new Error(`No valid user object provided in kubeconfig for context '${contextName}'`); - } - - // 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); - - // validate the exec struct in the user object, start with the command field - if (!commandExists.sync(execCommand)) { - return new ExecValidationNotFoundError(execCommand, isAbsolute); - } - } - - return undefined; - } catch (error) { - return error; + if (!contextObject) { + return new Error(`No valid context object provided in kubeconfig for context '${contextName}'`); } + + if (!config.getCluster(contextObject.cluster)) { + return new Error(`No valid cluster object provided in kubeconfig for context '${contextName}'`); + } + + if (!config.getUser(contextObject.user)) { + return new Error(`No valid user object provided in kubeconfig for context '${contextName}'`); + } + + return undefined; } diff --git a/types/command-exists.d.ts b/types/command-exists.d.ts deleted file mode 100644 index 8f07bb978e..0000000000 --- a/types/command-exists.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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. - */ - -export = commandExists; - -declare function commandExists(commandName: string): Promise; -declare function commandExists( - commandName: string, - cb: (error: null, exists: boolean) => void -): void; - -declare namespace commandExists { - function sync(commandName: string): boolean; -} diff --git a/yarn.lock b/yarn.lock index bd4f062a41..006af08175 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4066,11 +4066,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 75ddf48914f5ee3e2a97e32b571cf9f9120b702f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 14 Oct 2021 08:50:10 -0400 Subject: [PATCH 24/31] Upgrade typedoc-plugin-markdown to fix verify-docs (#4031) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5a6d205087..5543c00d56 100644 --- a/package.json +++ b/package.json @@ -379,7 +379,7 @@ "type-fest": "^1.0.2", "typed-emitter": "^1.3.1", "typedoc": "0.22.5", - "typedoc-plugin-markdown": "^3.9.0", + "typedoc-plugin-markdown": "^3.11.3", "typeface-roboto": "^1.1.13", "typescript": "^4.4.3", "typescript-plugin-css-modules": "^3.4.0", diff --git a/yarn.lock b/yarn.lock index 006af08175..5b521a025c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13894,10 +13894,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typedoc-plugin-markdown@^3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.9.0.tgz#d9c0390b8ddeeda56fdbf01264521ef04b3c19c7" - integrity sha512-s445YeUe8bH7me15T+hsHZgNmAvvF7QIpX02vFgseLGtghAwmtdZYVOqPneWoKqRv/JNpPSuyZb3CeblML9jOg== +typedoc-plugin-markdown@^3.11.3: + version "3.11.3" + resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.11.3.tgz#be340b905903f1ce552fa2fa7d677db408ab1041" + integrity sha512-rWiHbEIe0oZetDIsBR24XJVxGOJ91kDcHoj2KhFKxCLoJGX659EKBQkHne9QJ4W2stGhu1fRgFyQaouSBnxukA== dependencies: handlebars "^4.7.7" From 53c9d35832a07e85f1a133e47f59a081fe04eab8 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 14 Oct 2021 08:50:24 -0400 Subject: [PATCH 25/31] Fix cluster icon click in sidebar redirecting to wrong route (#4037) --- src/renderer/components/layout/sidebar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/layout/sidebar.tsx b/src/renderer/components/layout/sidebar.tsx index 66860fa399..ed9b76a8d1 100644 --- a/src/renderer/components/layout/sidebar.tsx +++ b/src/renderer/components/layout/sidebar.tsx @@ -193,7 +193,7 @@ export class Sidebar extends React.Component { source={metadata.source} src={spec.icon?.src} className="mr-5" - onClick={() => navigate(routes.clusterURL())} + onClick={() => navigate("/")} />
{metadata.name} From 6d003515e75f18ae0412bc36510a2c78ae919d66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 08:55:09 -0400 Subject: [PATCH 26/31] Bump tailwindcss from 2.2.4 to 2.2.17 (#4039) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 231 +++++++++++++++++++++++++-------------------------- 2 files changed, 116 insertions(+), 117 deletions(-) diff --git a/package.json b/package.json index 5543c00d56..7c4470a9cb 100644 --- a/package.json +++ b/package.json @@ -372,7 +372,7 @@ "sass-loader": "^8.0.2", "sharp": "^0.29.1", "style-loader": "^2.0.0", - "tailwindcss": "^2.2.4", + "tailwindcss": "^2.2.17", "ts-jest": "26.5.6", "ts-loader": "^7.0.5", "ts-node": "^10.2.1", diff --git a/yarn.lock b/yarn.lock index 5b521a025c..972cd660e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -493,13 +493,6 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@fullhuman/postcss-purgecss@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@fullhuman/postcss-purgecss/-/postcss-purgecss-4.0.3.tgz#55d71712ec1c7a88e0d1ba5f10ce7fb6aa05beb4" - integrity sha512-/EnQ9UDWGGqHkn1UKAwSgh+gJHPKmD+Z+5dQ4gWT4qq2NUyez3zqAfZNwFH3eSgmgO+wjTXfhlLchx2M9/K+7Q== - dependencies: - purgecss "^4.0.3" - "@hapi/b64@5.x.x": version "5.0.0" resolved "https://registry.yarnpkg.com/@hapi/b64/-/b64-5.0.0.tgz#b8210cbd72f4774985e78569b77e97498d24277d" @@ -2766,10 +2759,10 @@ arg@^4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== -arg@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.0.tgz#a20e2bb5710e82950a516b3f933fee5ed478be90" - integrity sha512-4P8Zm2H+BRS+c/xX1LrHw0qKpEhdlZjLCgWy+d78T9vqa2Z2SiD2wMrYuWIAFy5IZUD7nnNXroRttz+0RzlrzQ== +arg@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.1.tgz#eb0c9a8f77786cad2af8ff2b862899842d7b6adb" + integrity sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA== argparse@^1.0.7: version "1.0.10" @@ -3673,10 +3666,10 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.1.tgz#c80b3fab28bf6371e6863325eee67e618b77e6ad" - integrity sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg== +chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" supports-color "^7.1.0" @@ -4012,7 +4005,7 @@ color@3.0.x: color-convert "^1.9.1" color-string "^1.5.2" -color@^3.1.2, color@^3.1.3: +color@^3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/color/-/color-3.1.3.tgz#ca67fb4e7b97d611dcde39eceed422067d91596e" integrity sha512-xgXAcTHa2HeFCGLE9Xs/R82hujGtu9Jd9x4NW3T34+OMs7VoPsjwzRczKHvTAHeJwWFwX5j15+MgAppE8ztObQ== @@ -4310,10 +4303,10 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" -cosmiconfig@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" - integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== +cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" + integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== dependencies: "@types/parse-json" "^4.0.0" import-fresh "^3.2.1" @@ -4446,6 +4439,11 @@ css-box-model@^1.2.0: dependencies: tiny-invariant "^1.0.6" +css-color-names@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" + integrity sha1-gIrcLnnPhHOAabZGyyDsJ762KeA= + css-loader@^5.2.7: version "5.2.7" resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-5.2.7.tgz#9b9f111edf6fb2be5dc62525644cbc9c232064ae" @@ -4876,10 +4874,10 @@ dezalgo@^1.0.0, dezalgo@~1.0.3: asap "^2.0.0" wrappy "1" -didyoumean@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.1.tgz#e92edfdada6537d484d73c0172fd1eba0c4976ff" - integrity sha1-6S7f2tplN9SE1zwBcv0eugxJdv8= +didyoumean@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" + integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== diff-sequences@^26.6.2: version "26.6.2" @@ -5975,29 +5973,16 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.1.1: - version "3.2.4" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.4.tgz#d20aefbf99579383e7f3cc66529158c9b98554d3" - integrity sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ== +fast-glob@^3.1.1, fast-glob@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.0" + glob-parent "^5.1.2" merge2 "^1.3.0" - micromatch "^4.0.2" - picomatch "^2.2.1" - -fast-glob@^3.2.5: - version "3.2.5" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.5.tgz#7939af2a656de79a4f1901903ee8adcaa7cb9661" - integrity sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.0" - merge2 "^1.3.0" - micromatch "^4.0.2" - picomatch "^2.2.1" + micromatch "^4.0.4" fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.1.0" @@ -6558,19 +6543,19 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@^5.1.0, glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" -glob-parent@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.0.tgz#f851b59b388e788f3a44d63fab50382b2859c33c" - integrity sha512-Hdd4287VEJcZXUwv1l8a+vXC1GjOQqXe+VS30w/ypihpcnu9M1n3xeYeJu5CBpeEQj2nAab2xxz28GuA3vp4Ww== +glob-parent@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: - is-glob "^4.0.1" + is-glob "^4.0.3" glob-to-regexp@^0.4.1: version "0.4.1" @@ -6912,6 +6897,11 @@ he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +hex-color-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" + integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== + history@^4.10.1, history@^4.9.0: version "4.10.1" resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" @@ -6969,6 +6959,16 @@ hpack.js@^2.1.6: readable-stream "^2.0.1" wbuf "^1.1.0" +hsl-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e" + integrity sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4= + +hsla-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38" + integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg= + html-encoding-sniffer@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" @@ -7348,11 +7348,6 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== -indexes-of@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" - integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= - infer-owner@^1.0.3, infer-owner@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" @@ -7565,6 +7560,18 @@ is-cidr@^3.0.0: dependencies: cidr-regex "^2.0.10" +is-color-stop@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" + integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U= + dependencies: + css-color-names "^0.0.4" + hex-color-regex "^1.1.0" + hsl-regex "^1.0.0" + hsla-regex "^1.0.0" + rgb-regex "^1.0.1" + rgba-regex "^1.0.0" + is-core-module@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" @@ -7665,10 +7672,10 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" @@ -9154,11 +9161,6 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.toarray@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561" - integrity sha1-JMS/zWsvuji/0FlNsRedjptlZWE= - lodash.topath@^4.5.2: version "4.5.2" resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009" @@ -9464,6 +9466,14 @@ micromatch@^4.0.0, micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== + dependencies: + braces "^3.0.1" + picomatch "^2.2.3" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -9847,12 +9857,12 @@ node-addon-api@^4.1.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.2.0.tgz#117cbb5a959dff0992e1c586ae0393573e4d2a87" integrity sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q== -node-emoji@^1.8.1: - version "1.10.0" - resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.10.0.tgz#8886abd25d9c7bb61802a658523d1f8d2a89b2da" - integrity sha512-Yt3384If5H6BYGVHiHwTL+99OzJKHhgp82S8/dktEK73T26BazdgZ4JZh92xSVtGNJvz9UbXdNAc5hcrXV42vw== +node-emoji@^1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" + integrity sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A== dependencies: - lodash.toarray "^4.4.0" + lodash "^4.17.21" node-fetch-npm@^2.0.2: version "2.0.4" @@ -10332,12 +10342,7 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-hash@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.0.3.tgz#d12db044e03cd2ca3d77c0570d87225b02e1e6ea" - integrity sha512-JPKn0GMu+Fa3zt3Bmr66JhokJU5BaNBIh4ZeTlaCBzrBsOeXzwcKKAK1tbLiPKgvwmPXsDvvLHoWh5Bm7ofIYg== - -object-hash@^2.2.0: +object-hash@^2.0.1, object-hash@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5" integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== @@ -10937,6 +10942,11 @@ picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +picomatch@^2.2.3: + version "2.3.0" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" + integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -11128,31 +11138,14 @@ postcss-modules-values@^4.0.0: dependencies: icss-utils "^5.0.0" -postcss-nested@5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-5.0.5.tgz#f0a107d33a9fab11d7637205f5321e27223e3603" - integrity sha512-GSRXYz5bccobpTzLQZXOnSOfKl6TwVr5CyAQJUPub4nuRJSOECK5AqurxVgmtxP48p0Kc/ndY/YyS1yqldX0Ew== +postcss-nested@5.0.6: + version "5.0.6" + resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-5.0.6.tgz#466343f7fc8d3d46af3e7dba3fcd47d052a945bc" + integrity sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA== dependencies: - postcss-selector-parser "^6.0.4" + postcss-selector-parser "^6.0.6" -postcss-selector-parser@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c" - integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg== - dependencies: - cssesc "^3.0.0" - indexes-of "^1.0.1" - uniq "^1.0.1" - -postcss-selector-parser@^6.0.4: - version "6.0.5" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.5.tgz#042d74e137db83e6f294712096cb413f5aa612c4" - integrity sha512-aFYPoYmXbZ1V6HZaSvat08M97A8HqO6Pjz+PiNpw/DhuRrC72XWAdp3hL6wusDCN31sSmcZyMGa2hZEuX+Xfhg== - dependencies: - cssesc "^3.0.0" - util-deprecate "^1.0.2" - -postcss-selector-parser@^6.0.6: +postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.6: version "6.0.6" resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz#2c5bba8174ac2f6981ab631a42ab0ee54af332ea" integrity sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg== @@ -12223,6 +12216,16 @@ rfc6902@^4.0.2: resolved "https://registry.yarnpkg.com/rfc6902/-/rfc6902-4.0.2.tgz#ce99d3562b9e3287d403462e6bcc81eead8fcea0" integrity sha512-MJOC4iDSv3Qn5/QvhPbrNoRongti6moXSShcRmtbNqOk0WPxlviEdMV4bb9PaULhSxLUXzWd4AjAMKQ3j3y54w== +rgb-regex@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" + integrity sha1-wODWiC3w4jviVKR16O3UGRX+rrE= + +rgba-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" + integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= + rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3, rimraf@^2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" @@ -13353,38 +13356,39 @@ table@^6.0.9: string-width "^4.2.3" strip-ansi "^6.0.1" -tailwindcss@^2.2.4: - version "2.2.4" - resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.4.tgz#6a2e259b1e26125aeaa7cdc479963fd217c308b0" - integrity sha512-OdBCPgazNNsknSP+JfrPzkay9aqKjhKtFhbhgxHgvEFdHy/GuRPo2SCJ4w1SFTN8H6FPI4m6qD/Jj20NWY1GkA== +tailwindcss@^2.2.17: + version "2.2.17" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-2.2.17.tgz#c6332731f9ff1b6628ff589c95c38685347775e3" + integrity sha512-WgRpn+Pxn7eWqlruxnxEbL9ByVRWi3iC10z4b6dW0zSdnkPVC4hPMSWLQkkW8GCyBIv/vbJ0bxIi9dVrl4CfoA== dependencies: - "@fullhuman/postcss-purgecss" "^4.0.3" - arg "^5.0.0" + arg "^5.0.1" bytes "^3.0.0" - chalk "^4.1.1" + chalk "^4.1.2" chokidar "^3.5.2" - color "^3.1.3" - cosmiconfig "^7.0.0" + color "^4.0.1" + cosmiconfig "^7.0.1" detective "^5.2.0" - didyoumean "^1.2.1" + didyoumean "^1.2.2" dlv "^1.1.3" - fast-glob "^3.2.5" + fast-glob "^3.2.7" fs-extra "^10.0.0" - glob-parent "^6.0.0" + glob-parent "^6.0.1" html-tags "^3.1.0" + is-color-stop "^1.1.0" is-glob "^4.0.1" lodash "^4.17.21" lodash.topath "^4.5.2" modern-normalize "^1.1.0" - node-emoji "^1.8.1" + node-emoji "^1.11.0" normalize-path "^3.0.0" object-hash "^2.2.0" postcss-js "^3.0.3" postcss-load-config "^3.1.0" - postcss-nested "5.0.5" + postcss-nested "5.0.6" postcss-selector-parser "^6.0.6" postcss-value-parser "^4.1.0" pretty-hrtime "^1.0.3" + purgecss "^4.0.3" quick-lru "^5.1.1" reduce-css-calc "^2.1.8" resolve "^1.20.0" @@ -13990,11 +13994,6 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^2.0.1" -uniq@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= - unique-filename@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" From fea379c89ffa2f3033cf1d4e8dba04a687a3d64b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 09:28:10 -0400 Subject: [PATCH 27/31] Bump @types/node from 14.17.14 to 14.17.26 (#4041) 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 7c4470a9cb..258930ab34 100644 --- a/package.json +++ b/package.json @@ -286,7 +286,7 @@ "@types/mini-css-extract-plugin": "^0.9.1", "@types/mock-fs": "^4.13.1", "@types/module-alias": "^2.0.1", - "@types/node": "14.17.14", + "@types/node": "14.17.26", "@types/node-fetch": "^2.5.12", "@types/npm": "^2.0.32", "@types/progress-bar-webpack-plugin": "^2.1.2", diff --git a/yarn.lock b/yarn.lock index 972cd660e3..f60a264b64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1733,10 +1733,10 @@ "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@14.17.14", "@types/node@^14.6.2": - version "14.17.14" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.14.tgz#6fda9785b41570eb628bac27be4b602769a3f938" - integrity sha512-rsAj2u8Xkqfc332iXV12SqIsjVi07H479bOP4q94NAcjzmAvapumEhuVIt53koEf7JFrpjgNKjBga5Pnn/GL8A== +"@types/node@*", "@types/node@14.17.26", "@types/node@^14.6.2": + version "14.17.26" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.26.tgz#47a53c7e7804490155a4646d60c8e194816d073c" + integrity sha512-eSTNkK/nfmnC7IKpOJZixDgG0W2/eHz1qyFN7o/rwwwIHsVRp+G9nbh4BrQ77kbQ2zPu286AQRxkuRLPcR3gXw== "@types/node@^10.12.0": version "10.17.24" From a01eecdc79c218f2335c4b061a401ab076d813c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 09:28:35 -0400 Subject: [PATCH 28/31] Bump @testing-library/dom from 8.2.0 to 8.9.0 (#4040) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 258930ab34..e2580b0980 100644 --- a/package.json +++ b/package.json @@ -260,7 +260,7 @@ "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", "@sentry/react": "^6.13.3", "@sentry/types": "^6.8.0", - "@testing-library/dom": "^8.2.0", + "@testing-library/dom": "^8.9.0", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^11.2.6", "@testing-library/user-event": "^13.2.1", diff --git a/yarn.lock b/yarn.lock index f60a264b64..2614e6d285 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1211,7 +1211,21 @@ dependencies: defer-to-connect "^2.0.0" -"@testing-library/dom@>=7", "@testing-library/dom@^7.28.1": +"@testing-library/dom@>=7", "@testing-library/dom@^8.9.0": + version "8.9.0" + resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.9.0.tgz#608ee6f235688a27f8ee180c0d81ff77a5363d59" + integrity sha512-fhmAYtGpFqzKdPq5aLNn/T396qfhYkttHT/5RytdDNSCzg9K/0F/WXF5iDsNBK1M3ZIQbPy7Y0qm4Kup5bqT/w== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/runtime" "^7.12.5" + "@types/aria-query" "^4.2.0" + aria-query "^4.2.2" + chalk "^4.1.0" + dom-accessibility-api "^0.5.6" + lz-string "^1.4.4" + pretty-format "^27.0.2" + +"@testing-library/dom@^7.28.1": version "7.30.3" resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-7.30.3.tgz#779ea9bbb92d63302461800a388a5a890ac22519" integrity sha512-7JhIg2MW6WPwyikH2iL3o7z+FTVgSOd2jqCwTAHqK7Qal2gRRYiUQyURAxtbK9VXm/UTyG9bRihv8C5Tznr2zw== @@ -1225,20 +1239,6 @@ lz-string "^1.4.4" pretty-format "^26.6.2" -"@testing-library/dom@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.2.0.tgz#ac46a1b9d7c81f0d341ae38fb5424b64c27d151e" - integrity sha512-U8cTWENQPHO3QHvxBdfltJ+wC78ytMdg69ASvIdkGdQ/XRg4M9H2vvM3mHddxl+w/fM6NNqzGMwpQoh82v9VIA== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/runtime" "^7.12.5" - "@types/aria-query" "^4.2.0" - aria-query "^4.2.2" - chalk "^4.1.0" - dom-accessibility-api "^0.5.6" - lz-string "^1.4.4" - pretty-format "^27.0.2" - "@testing-library/jest-dom@^5.14.1": version "5.14.1" resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.14.1.tgz#8501e16f1e55a55d675fe73eecee32cdaddb9766" From 9d5689ce69a48037b9f5a111a8cc31a1d30448b0 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 14 Oct 2021 10:25:48 -0400 Subject: [PATCH 29/31] Only allow extensions to use non-lens specific cluster phases (#4036) --- .../catalog-entities/kubernetes-cluster.ts | 17 ++++++++++--- src/extensions/common-api/catalog.ts | 19 +++++++++++++- src/main/cluster-manager.ts | 25 ++++++++++++------- src/main/cluster.ts | 2 +- .../components/hotbar/hotbar-entity-icon.tsx | 3 ++- 5 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/common/catalog-entities/kubernetes-cluster.ts b/src/common/catalog-entities/kubernetes-cluster.ts index 3335d3803d..31e0251966 100644 --- a/src/common/catalog-entities/kubernetes-cluster.ts +++ b/src/common/catalog-entities/kubernetes-cluster.ts @@ -54,15 +54,24 @@ export interface KubernetesClusterSpec extends CatalogEntitySpec { accessibleNamespaces?: string[]; } +export enum LensKubernetesClusterStatus { + DELETING = "deleting", + CONNECTING = "connecting", + CONNECTED = "connected", + DISCONNECTED = "disconnected" +} + export interface KubernetesClusterMetadata extends CatalogEntityMetadata { distro?: string; kubeVersion?: string; } +/** + * @deprecated This is no longer used as it is incorrect. Other sources can add more values + */ export type KubernetesClusterStatusPhase = "connected" | "connecting" | "disconnected" | "deleting"; export interface KubernetesClusterStatus extends CatalogEntityStatus { - phase: KubernetesClusterStatusPhase; } export class KubernetesCluster extends CatalogEntity { @@ -110,15 +119,15 @@ export class KubernetesCluster extends CatalogEntity requestMain(clusterDisconnectHandler, this.metadata.uid) }); break; - case "disconnected": + case LensKubernetesClusterStatus.DISCONNECTED: context.menuItems.push({ title: "Connect", icon: "link", diff --git a/src/extensions/common-api/catalog.ts b/src/extensions/common-api/catalog.ts index 689310b69d..2d703b0dff 100644 --- a/src/extensions/common-api/catalog.ts +++ b/src/extensions/common-api/catalog.ts @@ -19,5 +19,22 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -export * from "../../common/catalog-entities"; +export { + KubernetesCluster, + kubernetesClusterCategory, + GeneralEntity, + WebLink, +} from "../../common/catalog-entities"; + +export type { + KubernetesClusterPrometheusMetrics, + KubernetesClusterSpec, + KubernetesClusterMetadata, + WebLinkSpec, + WebLinkStatus, + WebLinkStatusPhase, + KubernetesClusterStatusPhase, + KubernetesClusterStatus, +} from "../../common/catalog-entities"; + export * from "../../common/catalog/catalog-entity"; diff --git a/src/main/cluster-manager.ts b/src/main/cluster-manager.ts index e72cbd59cc..8cd6664b6a 100644 --- a/src/main/cluster-manager.ts +++ b/src/main/cluster-manager.ts @@ -27,7 +27,7 @@ import logger from "./logger"; import { apiKubePrefix } from "../common/vars"; import { getClusterIdFromHost, Singleton } from "../common/utils"; import { catalogEntityRegistry } from "./catalog"; -import { KubernetesCluster, KubernetesClusterPrometheusMetrics, KubernetesClusterStatusPhase } from "../common/catalog-entities/kubernetes-cluster"; +import { KubernetesCluster, KubernetesClusterPrometheusMetrics, LensKubernetesClusterStatus } from "../common/catalog-entities/kubernetes-cluster"; import { ipcMainOn } from "../common/ipc"; import { once } from "lodash"; import { ClusterStore } from "../common/cluster-store"; @@ -35,6 +35,8 @@ import type { ClusterId } from "../common/cluster-types"; const logPrefix = "[CLUSTER-MANAGER]:"; +const lensSpecificClusterStatuses: Set = new Set(Object.values(LensKubernetesClusterStatus)); + export class ClusterManager extends Singleton { private store = ClusterStore.getInstance(); deleting = observable.set(); @@ -90,6 +92,8 @@ export class ClusterManager extends Singleton { @action protected updateCatalog(clusters: Cluster[]) { + logger.debug("[CLUSTER-MANAGER]: updating catalog from cluster store"); + for (const cluster of clusters) { this.updateEntityFromCluster(cluster); } @@ -144,27 +148,28 @@ export class ClusterManager extends Singleton { @action protected updateEntityStatus(entity: KubernetesCluster, cluster?: Cluster) { if (this.deleting.has(entity.getId())) { - entity.status.phase = "deleting"; + entity.status.phase = LensKubernetesClusterStatus.DELETING; entity.status.enabled = false; } else { - entity.status.phase = ((): KubernetesClusterStatusPhase => { + entity.status.phase = (() => { if (!cluster) { - return "disconnected"; + return LensKubernetesClusterStatus.DISCONNECTED; } if (cluster.accessible) { - return "connected"; + return LensKubernetesClusterStatus.CONNECTED; } if (!cluster.disconnected) { - return "connecting"; + return LensKubernetesClusterStatus.CONNECTING; } - if (entity?.status?.phase) { + // Extensions are not allowed to use the Lens specific status phases + if (!lensSpecificClusterStatuses.has(entity?.status?.phase)) { return entity.status.phase; } - return "disconnected"; + return LensKubernetesClusterStatus.DISCONNECTED; })(); entity.status.enabled = true; @@ -276,7 +281,9 @@ export function catalogEntityFromCluster(cluster: Cluster) { icon: {} }, status: { - phase: cluster.disconnected ? "disconnected" : "connected", + phase: cluster.disconnected + ? LensKubernetesClusterStatus.DISCONNECTED + : LensKubernetesClusterStatus.CONNECTED, reason: "", message: "", active: !cluster.disconnected diff --git a/src/main/cluster.ts b/src/main/cluster.ts index fd8142aa57..b84939a5d3 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -394,7 +394,6 @@ export class Cluster implements ClusterModel, ClusterState { * @internal */ @action disconnect() { - logger.info(`[CLUSTER]: disconnect`, this.getMeta()); this.unbindEvents(); this.contextHandler?.stopServer(); this.disconnected = true; @@ -405,6 +404,7 @@ export class Cluster implements ClusterModel, ClusterState { this.allowedNamespaces = []; this.resourceAccessStatuses.clear(); this.pushState(); + logger.info(`[CLUSTER]: disconnect`, this.getMeta()); } /** diff --git a/src/renderer/components/hotbar/hotbar-entity-icon.tsx b/src/renderer/components/hotbar/hotbar-entity-icon.tsx index fc6628f3eb..05ce960a23 100644 --- a/src/renderer/components/hotbar/hotbar-entity-icon.tsx +++ b/src/renderer/components/hotbar/hotbar-entity-icon.tsx @@ -31,6 +31,7 @@ import { cssNames, IClassName } from "../../utils"; import { Icon } from "../icon"; import { HotbarIcon } from "./hotbar-icon"; import { HotbarStore } from "../../../common/hotbar-store"; +import { LensKubernetesClusterStatus } from "../../../common/catalog-entities/kubernetes-cluster"; interface Props extends DOMAttributes { entity: CatalogEntity; @@ -78,7 +79,7 @@ export class HotbarEntityIcon extends React.Component { return null; } - const className = cssNames("led", { online: this.props.entity.status.phase == "connected"}); // TODO: make it more generic + const className = cssNames("led", { online: this.props.entity.status.phase === LensKubernetesClusterStatus.CONNECTED}); // TODO: make it more generic return
; } From 03c17104321c8b183e88cf1fdf9ae71eca9c5628 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 10:58:20 -0400 Subject: [PATCH 30/31] Bump ws from 7.4.6 to 7.5.5 (#4042) 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 e2580b0980..be99cf1890 100644 --- a/package.json +++ b/package.json @@ -250,7 +250,7 @@ "winston": "^3.3.3", "winston-console-format": "^1.0.8", "winston-transport-browserconsole": "^1.0.5", - "ws": "^7.4.6" + "ws": "^7.5.5" }, "devDependencies": { "@emeraldpay/hashicon-react": "^0.4.0", diff --git a/yarn.lock b/yarn.lock index 2614e6d285..38ce254f43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14710,10 +14710,10 @@ ws@^6.2.1: dependencies: async-limiter "~1.0.0" -ws@^7.3.1, ws@^7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@^7.3.1, ws@^7.4.6, ws@^7.5.5: + version "7.5.5" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" + integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== xdg-basedir@^3.0.0: version "3.0.0" From d2203b3a30ea1ce4464f7c3fc0d3d7e20f140e01 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 14 Oct 2021 15:20:12 -0400 Subject: [PATCH 31/31] Fix verify-docs error (#4045) --- Makefile | 8 +++++--- docs/extensions/typedoc-readme.md.tpl | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c39b42468f..b22527daec 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,8 @@ clean-npm: .PHONY: clean clean: clean-npm clean-extensions rm -rf binaries/client - rm -rf dist/* - rm -rf static/build/* - rm -rf node_modules/ + rm -rf dist + rm -rf static/build + rm -rf node_modules + rm -rf site + rm -rf docs/extensions/api diff --git a/docs/extensions/typedoc-readme.md.tpl b/docs/extensions/typedoc-readme.md.tpl index fe0bdb73a9..0f83a467a1 100644 --- a/docs/extensions/typedoc-readme.md.tpl +++ b/docs/extensions/typedoc-readme.md.tpl @@ -2,6 +2,6 @@ ## APIs -- [Common](modules/common.md) -- [Main](modules/main.md) -- [Renderer](modules/renderer.md) +- [Common](modules/Common.md) +- [Main](modules/Main.md) +- [Renderer](modules/Renderer.md)