From d7199fda8e573f8041f51306808883eaed0995e6 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 28 Apr 2021 12:43:31 -0400 Subject: [PATCH 01/17] release v5.0.0-beta.1 (#2660) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3c572d536..ac6e94bfd8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-lens", "productName": "OpenLens", "description": "OpenLens - Open Source IDE for Kubernetes", - "version": "5.0.0-alpha.4", + "version": "5.0.0-beta.1", "main": "static/build/main.js", "copyright": "© 2021 OpenLens Authors", "license": "MIT", From 41c9a355ede984da22de7391d18f70e478577a57 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 28 Apr 2021 21:38:57 +0300 Subject: [PATCH 02/17] Refactor / fix cluster view visibility (#2654) Signed-off-by: Jari Kolehmainen --- src/renderer/api/catalog-entity-registry.ts | 9 +++++ .../cluster-manager/cluster-manager.tsx | 30 +-------------- .../cluster-manager/cluster-status.tsx | 4 -- .../cluster-manager/cluster-view.tsx | 37 +++++++++++++++---- .../components/cluster-manager/lens-views.ts | 17 +++++++-- .../components/hotbar/hotbar-menu.tsx | 3 +- 6 files changed, 55 insertions(+), 45 deletions(-) diff --git a/src/renderer/api/catalog-entity-registry.ts b/src/renderer/api/catalog-entity-registry.ts index ea0537bda3..4b2d72ea85 100644 --- a/src/renderer/api/catalog-entity-registry.ts +++ b/src/renderer/api/catalog-entity-registry.ts @@ -5,6 +5,7 @@ import "../../common/catalog-entities"; export class CatalogEntityRegistry { @observable protected _items: CatalogEntity[] = observable.array([], { deep: true }); + @observable protected _activeEntity: CatalogEntity; constructor(private categoryRegistry: CatalogCategoryRegistry) {} @@ -39,6 +40,14 @@ export class CatalogEntityRegistry { }); } + set activeEntity(entity: CatalogEntity) { + this._activeEntity = entity; + } + + get activeEntity() { + return this._activeEntity; + } + get items() { return this._items; } diff --git a/src/renderer/components/cluster-manager/cluster-manager.tsx b/src/renderer/components/cluster-manager/cluster-manager.tsx index c09b4d7057..fb1bb9e497 100644 --- a/src/renderer/components/cluster-manager/cluster-manager.tsx +++ b/src/renderer/components/cluster-manager/cluster-manager.tsx @@ -2,49 +2,21 @@ import "./cluster-manager.scss"; import React from "react"; import { Redirect, Route, Switch } from "react-router"; -import { comparer, reaction } from "mobx"; -import { disposeOnUnmount, observer } from "mobx-react"; +import { observer } from "mobx-react"; import { BottomBar } from "./bottom-bar"; import { Catalog, catalogRoute } from "../+catalog"; import { Preferences, preferencesRoute } from "../+preferences"; import { AddCluster, addClusterRoute } from "../+add-cluster"; import { ClusterView } from "./cluster-view"; import { clusterViewRoute } from "./cluster-view.route"; -import { ClusterStore } from "../../../common/cluster-store"; -import { hasLoadedView, initView, lensViews, refreshViews } from "./lens-views"; import { globalPageRegistry } from "../../../extensions/registries/page-registry"; import { Extensions, extensionsRoute } from "../+extensions"; -import { getMatchedClusterId } from "../../navigation"; import { HotbarMenu } from "../hotbar/hotbar-menu"; import { EntitySettings, entitySettingsRoute } from "../+entity-settings"; import { Welcome, welcomeRoute, welcomeURL } from "../+welcome"; @observer export class ClusterManager extends React.Component { - componentDidMount() { - const getMatchedCluster = () => ClusterStore.getInstance().getById(getMatchedClusterId()); - - disposeOnUnmount(this, [ - reaction(getMatchedClusterId, initView, { - fireImmediately: true - }), - reaction(() => !getMatchedClusterId(), () => ClusterStore.getInstance().setActive(null)), - reaction(() => [ - getMatchedClusterId(), // refresh when active cluster-view changed - hasLoadedView(getMatchedClusterId()), // refresh when cluster's webview loaded - getMatchedCluster()?.available, // refresh on disconnect active-cluster - getMatchedCluster()?.ready, // refresh when cluster ready-state change - ], refreshViews, { - fireImmediately: true, - equals: comparer.shallow, - }), - ]); - } - - componentWillUnmount() { - lensViews.clear(); - } - render() { return (
diff --git a/src/renderer/components/cluster-manager/cluster-status.tsx b/src/renderer/components/cluster-manager/cluster-status.tsx index 7fb68ceb36..797b79e709 100644 --- a/src/renderer/components/cluster-manager/cluster-status.tsx +++ b/src/renderer/components/cluster-manager/cluster-status.tsx @@ -39,10 +39,6 @@ export class ClusterStatus extends React.Component { error: res.error, }); }); - - if (this.cluster.disconnected) { - await this.activateCluster(); - } } componentWillUnmount() { diff --git a/src/renderer/components/cluster-manager/cluster-view.tsx b/src/renderer/components/cluster-manager/cluster-view.tsx index fbc55d8db3..448d6afdbf 100644 --- a/src/renderer/components/cluster-manager/cluster-view.tsx +++ b/src/renderer/components/cluster-manager/cluster-view.tsx @@ -5,11 +5,12 @@ import { disposeOnUnmount, observer } from "mobx-react"; import { RouteComponentProps } from "react-router"; import { IClusterViewRouteParams } from "./cluster-view.route"; import { ClusterStatus } from "./cluster-status"; -import { hasLoadedView } from "./lens-views"; +import { hasLoadedView, initView, refreshViews } from "./lens-views"; import { Cluster } from "../../../main/cluster"; -import { navigate } from "../../navigation"; -import { catalogURL } from "../+catalog"; import { ClusterStore } from "../../../common/cluster-store"; +import { requestMain } from "../../../common/ipc"; +import { clusterActivateHandler } from "../../../common/cluster-ipc"; +import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; interface Props extends RouteComponentProps { } @@ -26,15 +27,37 @@ export class ClusterView extends React.Component { async componentDidMount() { disposeOnUnmount(this, [ - reaction(() => this.clusterId, clusterId => ClusterStore.getInstance().setActive(clusterId), { + reaction(() => this.clusterId, (clusterId) => { + this.showCluster(clusterId); + }, { fireImmediately: true, - }), - reaction(() => this.cluster.online, (online) => { - if (!online) navigate(catalogURL()); }) ]); } + componentWillUnmount() { + this.hideCluster(); + } + + showCluster(clusterId: string) { + initView(clusterId); + requestMain(clusterActivateHandler, this.clusterId, false); + + const entity = catalogEntityRegistry.getById(this.clusterId); + + if (entity) { + catalogEntityRegistry.activeEntity = entity; + } + } + + hideCluster() { + refreshViews(); + + if (catalogEntityRegistry.activeEntity?.metadata?.uid === this.clusterId) { + catalogEntityRegistry.activeEntity = null; + } + } + render() { const { cluster } = this; const showStatus = cluster && (!cluster.available || !hasLoadedView(cluster.id) || !cluster.ready); diff --git a/src/renderer/components/cluster-manager/lens-views.ts b/src/renderer/components/cluster-manager/lens-views.ts index 30fae018cc..4b08ad9efe 100644 --- a/src/renderer/components/cluster-manager/lens-views.ts +++ b/src/renderer/components/cluster-manager/lens-views.ts @@ -1,7 +1,8 @@ import { observable, when } from "mobx"; import { ClusterId, ClusterStore, getClusterFrameUrl } from "../../../common/cluster-store"; -import { getMatchedClusterId } from "../../navigation"; +import { navigate } from "../../navigation"; import logger from "../../../main/logger"; +import { catalogURL } from "../+catalog"; export interface LensView { isLoaded?: boolean @@ -16,9 +17,12 @@ export function hasLoadedView(clusterId: ClusterId): boolean { } export async function initView(clusterId: ClusterId) { + refreshViews(clusterId); + if (!clusterId || lensViews.has(clusterId)) { return; } + const cluster = ClusterStore.getInstance().getById(clusterId); if (!cluster) { @@ -51,16 +55,23 @@ export async function autoCleanOnRemove(clusterId: ClusterId, iframe: HTMLIFrame logger.info(`[LENS-VIEW]: remove dashboard, clusterId=${clusterId}`); lensViews.delete(clusterId); + const wasVisible = iframe.style.display !== "none"; + // Keep frame in DOM to avoid possible bugs when same cluster re-created after being removed. // In that case for some reasons `webFrame.routingId` returns some previous frameId (usage in app.tsx) // Issue: https://github.com/lensapp/lens/issues/811 + iframe.style.display = "none"; iframe.dataset.meta = `${iframe.name} was removed at ${new Date().toLocaleString()}`; iframe.removeAttribute("name"); iframe.contentWindow.postMessage("teardown", "*"); + + if (wasVisible) { + navigate(catalogURL()); + } } -export function refreshViews() { - const cluster = ClusterStore.getInstance().getById(getMatchedClusterId()); +export function refreshViews(visibleClusterId?: string) { + const cluster = !visibleClusterId ? null : ClusterStore.getInstance().getById(visibleClusterId); lensViews.forEach(({ clusterId, view, isLoaded }) => { const isCurrent = clusterId === cluster?.id; diff --git a/src/renderer/components/hotbar/hotbar-menu.tsx b/src/renderer/components/hotbar/hotbar-menu.tsx index 931ebc02e8..29c44fc81e 100644 --- a/src/renderer/components/hotbar/hotbar-menu.tsx +++ b/src/renderer/components/hotbar/hotbar-menu.tsx @@ -12,7 +12,6 @@ import { Icon } from "../icon"; import { Badge } from "../badge"; import { CommandOverlay } from "../command-palette"; import { HotbarSwitchCommand } from "./hotbar-switch-command"; -import { ClusterStore } from "../../../common/cluster-store"; import { Tooltip, TooltipPosition } from "../tooltip"; interface Props { @@ -26,7 +25,7 @@ export class HotbarMenu extends React.Component { } isActive(item: CatalogEntity) { - return ClusterStore.getInstance().activeClusterId == item.getId(); + return catalogEntityRegistry.activeEntity?.metadata?.uid == item.getId(); } getEntity(item: HotbarItem) { From fbf1245576e1885b237d580a5a719e629ee42194 Mon Sep 17 00:00:00 2001 From: Black-Hole <158blackhole@gmail.com> Date: Thu, 29 Apr 2021 02:56:02 +0800 Subject: [PATCH 03/17] fix(renderer-log): multiple spaces merge into one (#2655) Signed-off-by: BlackHole1 <158blackhole@gmail.com> --- src/renderer/components/dock/log-list.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/components/dock/log-list.scss b/src/renderer/components/dock/log-list.scss index 8a39dcf925..5accd47fa6 100644 --- a/src/renderer/components/dock/log-list.scss +++ b/src/renderer/components/dock/log-list.scss @@ -30,6 +30,7 @@ span { -webkit-font-smoothing: auto; // Better readability on non-retina screens + white-space: pre; } span.overlay { From dfb1dd763c8963cd8b63f48a8032cfedc5ec7cfd Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 28 Apr 2021 21:56:32 +0300 Subject: [PATCH 04/17] Electron-updater 4.3.8 (#2622) Signed-off-by: Jari Kolehmainen --- yarn.lock | 69 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/yarn.lock b/yarn.lock index f1704da1c9..db1969ce97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1465,9 +1465,9 @@ integrity sha512-e3sW4oEH0qS1QxSfX7PT6xIi5qk/YSMsrB9Lq8EtkhQBZB+bKyfkP+jpLJRySanvBhAQPSv2PEBe81M8Iy/7yg== "@types/node@*": - version "14.0.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.11.tgz#61d4886e2424da73b7b25547f59fdcb534c165a3" - integrity sha512-lCvvI24L21ZVeIiyIUHZ5Oflv1hhHQ5E1S25IRlKIXaRkVgmXpJMI3wUJkmym2bTbCe+WoIibQnMVAU3FguaOg== + version "14.14.41" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.41.tgz#d0b939d94c1d7bd53d04824af45f1139b8c45615" + integrity sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g== "@types/node@^10.12.0": version "10.17.24" @@ -1683,13 +1683,18 @@ resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d" integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA== -"@types/semver@^7.1.0", "@types/semver@^7.2.0": +"@types/semver@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.2.0.tgz#0d72066965e910531e1db4621c15d0ca36b8d83b" integrity sha512-TbB0A8ACUWZt3Y6bQPstW9QNbhNeebdgLX4T/ZfkrswAfUzRiXrgd9seol+X379Wa589Pu4UEx9Uok0D4RjRCQ== dependencies: "@types/node" "*" +"@types/semver@^7.3.4": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb" + integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ== + "@types/serve-static@*": version "1.13.6" resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.6.tgz#866b1b8dec41c36e28c7be40ac725b88be43c5c1" @@ -3194,14 +3199,6 @@ buffer@^5.1.0, buffer@^5.5.0: base64-js "^1.0.2" ieee754 "^1.1.4" -builder-util-runtime@8.7.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.0.tgz#e48ad004835c8284662e8eaf47a53468c66e8e8d" - integrity sha512-G1AqqVM2vYTrSFR982c1NNzwXKrGLQjVjaZaWQdn4O6Z3YKjdMDofw88aD9jpyK9ZXkrCxR0tI3Qe9wNbyTlXg== - dependencies: - debug "^4.1.1" - sax "^1.2.4" - builder-util-runtime@8.7.3: version "8.7.3" resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.3.tgz#0aaafa52d25295c939496f62231ca9ff06c30e40" @@ -4972,17 +4969,17 @@ electron-publish@22.10.5: mime "^2.5.0" electron-updater@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.1.tgz#9d485b6262bc56fcf7ee62b1dc1b3b105a3e96a7" - integrity sha512-UDC5AHCgeiHJYDYWZG/rsl1vdAFKqI/Lm7whN57LKAk8EfhTewhcEHzheRcncLgikMcQL8gFo1KeX51tf5a5Wg== + version "4.3.8" + resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.8.tgz#94f1731682a756385726183e2b04b959cb319456" + integrity sha512-/tB82Ogb2LqaXrUzAD8waJC+TZV52Pr0Znfj7w+i4D+jA2GgrKFI3Pxjp+36y9FcBMQz7kYsMHcB6c5zBJao+A== dependencies: - "@types/semver" "^7.1.0" - builder-util-runtime "8.7.0" - fs-extra "^9.0.0" - js-yaml "^3.13.1" + "@types/semver" "^7.3.4" + builder-util-runtime "8.7.3" + fs-extra "^9.1.0" + js-yaml "^4.0.0" lazy-val "^1.0.4" lodash.isequal "^4.5.0" - semver "^7.1.3" + semver "^7.3.4" electron-window-state@^5.0.3: version "5.0.3" @@ -6526,11 +6523,16 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@^4.1.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.4: +graceful-fs@^4.1.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.2.2, graceful-fs@^4.2.4: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.6" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" + integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== + "graceful-readlink@>= 1.0.0": version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" @@ -8215,7 +8217,15 @@ js-sha3@^0.8.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.1, js-yaml@^3.14.0: +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +js-yaml@^3.14.0: version "3.14.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== @@ -8371,11 +8381,11 @@ jsonfile@^4.0.0: graceful-fs "^4.1.6" jsonfile@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179" - integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg== + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== dependencies: - universalify "^1.0.0" + universalify "^2.0.0" optionalDependencies: graceful-fs "^4.1.6" @@ -12330,7 +12340,7 @@ semver-diff@^3.1.1: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.x, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2: +semver@7.x, semver@^7.2.1, semver@^7.3.2: version "7.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== @@ -13945,11 +13955,6 @@ universalify@^0.1.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== -universalify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d" - integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug== - universalify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" From ac963ede6e7eb25053877a01564e7668db2f186d Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 28 Apr 2021 15:29:02 -0400 Subject: [PATCH 05/17] Ignore failures due to files in bundled folder (#2661) Signed-off-by: Sebastian Malton --- src/extensions/extension-discovery.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/extensions/extension-discovery.ts b/src/extensions/extension-discovery.ts index 4b08631b07..925a2e5138 100644 --- a/src/extensions/extension-discovery.ts +++ b/src/extensions/extension-discovery.ts @@ -43,6 +43,10 @@ interface ExtensionDiscoveryChannelMessage { */ const isDirectoryLike = (lstat: fse.Stats) => lstat.isDirectory() || lstat.isSymbolicLink(); +interface LoadFromFolderOptions { + isBundled?: boolean; +} + /** * Discovers installed bundled and local extensions from the filesystem. * Also watches for added and removed local extensions by watching the directory. @@ -327,7 +331,12 @@ export class ExtensionDiscovery extends Singleton { isEnabled }; } catch (error) { - logger.error(`${logModule}: can't load extension manifest at ${manifestPath}: ${error}`); + if (error.code === "ENOTDIR") { + // ignore this error, probably from .DS_Store file + logger.debug(`${logModule}: failed to load extension manifest through a not-dir-like at ${manifestPath}`); + } else { + logger.error(`${logModule}: can't load extension manifest at ${manifestPath}: ${error}`); + } return null; } @@ -424,12 +433,10 @@ export class ExtensionDiscovery extends Singleton { /** * Loads extension from absolute path, updates this.packagesJson to include it and returns the extension. - * @param absPath Folder path to extension + * @param folderPath Folder path to extension */ - async loadExtensionFromFolder(absPath: string, { isBundled = false }: { - isBundled?: boolean; - } = {}): Promise { - const manifestPath = path.resolve(absPath, manifestFilename); + async loadExtensionFromFolder(folderPath: string, { isBundled = false }: LoadFromFolderOptions = {}): Promise { + const manifestPath = path.resolve(folderPath, manifestFilename); return this.getByManifest(manifestPath, { isBundled }); } From 78c77a169a538e8daffad164a39f1b830cc70370 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 28 Apr 2021 22:40:25 +0300 Subject: [PATCH 06/17] Set product name to window title (#2665) Signed-off-by: Jari Kolehmainen --- src/main/window-manager.ts | 2 ++ src/renderer/template.html | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/window-manager.ts b/src/main/window-manager.ts index ad3cc3a2f2..0a8627b324 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -10,6 +10,7 @@ import { Singleton } from "../common/utils"; import { ClusterFrameInfo, clusterFrameMap } from "../common/cluster-frames"; import { IpcRendererNavigationEvents } from "../renderer/navigation/events"; import logger from "./logger"; +import { productName } from "../common/vars"; export class WindowManager extends Singleton { protected mainWindow: BrowserWindow; @@ -47,6 +48,7 @@ export class WindowManager extends Singleton { this.mainWindow = new BrowserWindow({ x, y, width, height, + title: productName, show: false, minWidth: 700, // accommodate 800 x 600 display minimum minHeight: 500, // accommodate 800 x 600 display minimum diff --git a/src/renderer/template.html b/src/renderer/template.html index 71440e5645..c7df1ee507 100755 --- a/src/renderer/template.html +++ b/src/renderer/template.html @@ -2,7 +2,6 @@ - OpenLens - Open Source Kubernetes IDE From c057f3fc20dba712b0afc956623985a90d731b36 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 29 Apr 2021 12:12:33 +0300 Subject: [PATCH 07/17] Show entity source on tooltip + use it for color (#2669) Signed-off-by: Jari Kolehmainen --- src/renderer/components/hotbar/hotbar-icon.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/hotbar/hotbar-icon.tsx b/src/renderer/components/hotbar/hotbar-icon.tsx index 87699d2cfc..5bc6489c8c 100644 --- a/src/renderer/components/hotbar/hotbar-icon.tsx +++ b/src/renderer/components/hotbar/hotbar-icon.tsx @@ -116,7 +116,7 @@ export class HotbarIcon extends React.Component { generateAvatarStyle(entity: CatalogEntity): React.CSSProperties { return { - "backgroundColor": randomColor({ seed: entity.metadata.name, luminosity: "dark" }) + "backgroundColor": randomColor({ seed: `${entity.metadata.name}-${entity.metadata.source}`, luminosity: "dark" }) }; } @@ -138,7 +138,7 @@ export class HotbarIcon extends React.Component { return (
- {entity.metadata.name} + {entity.metadata.name} ({entity.metadata.source || "local"}) Date: Thu, 29 Apr 2021 12:21:47 +0300 Subject: [PATCH 08/17] Removing add/delete empty cells feature (#2667) Signed-off-by: Alex Andreev --- src/common/hotbar-store.ts | 12 ---- .../components/hotbar/hotbar-menu.scss | 68 +------------------ .../components/hotbar/hotbar-menu.tsx | 22 +----- 3 files changed, 5 insertions(+), 97 deletions(-) diff --git a/src/common/hotbar-store.ts b/src/common/hotbar-store.ts index 6a01b3101e..fa0116937b 100644 --- a/src/common/hotbar-store.ts +++ b/src/common/hotbar-store.ts @@ -158,18 +158,6 @@ export class HotbarStore extends BaseStore { hotbar.items[index] = null; } - addEmptyCell() { - const hotbar = this.getActive(); - - hotbar.items.push(null); - } - - removeEmptyCell(index: number) { - const hotbar = this.getActive(); - - hotbar.items.splice(index, 1); - } - switchToPrevious() { const hotbarStore = HotbarStore.getInstance(); let index = hotbarStore.activeHotbarIndex - 1; diff --git a/src/renderer/components/hotbar/hotbar-menu.scss b/src/renderer/components/hotbar/hotbar-menu.scss index af41e1b95b..6c8559fbd9 100644 --- a/src/renderer/components/hotbar/hotbar-menu.scss +++ b/src/renderer/components/hotbar/hotbar-menu.scss @@ -12,12 +12,6 @@ height: 4px; // extra spacing for mac-os "traffic-light" buttons } - &:hover { - .AddCellButton { - opacity: 1; - } - } - .HotbarItems { --cellWidth: 40px; --cellHeight: 40px; @@ -53,55 +47,23 @@ transform: translateZ(0); // Remove flickering artifacts &:hover { - .cellDeleteButton { - opacity: 1; - transition: opacity 0.1s 0.2s; - } - - &:not(.empty) { + &:not(:empty) { box-shadow: 0 0 0px 3px #ffffff1a; } } &.animating { - &.empty { + &:empty { animation: shake .6s cubic-bezier(.36,.07,.19,.97) both; transform: translate3d(0, 0, 0); backface-visibility: hidden; perspective: 1000px; } - &:not(.empty) { + &:not(:empty) { animation: outline 0.8s cubic-bezier(0.19, 1, 0.22, 1); } } - - .cellDeleteButton { - width: 2rem; - height: 2rem; - border-radius: 50%; - background-color: var(--textColorDimmed); - position: absolute; - top: -7px; - right: -7px; - color: var(--secondaryBackground); - opacity: 0; - border: 3px solid var(--clusterMenuBackground); - box-sizing: border-box; - - &:hover { - background-color: white; - transition: all 0.2s; - } - - .Icon { - --smallest-size: 12px; - font-weight: bold; - position: relative; - top: -2px; - left: .5px; - } - } } } @@ -141,30 +103,6 @@ } } } - - .AddCellButton { - width: 40px; - height: 40px; - min-height: 40px; - margin: 12px auto 8px; - background-color: transparent; - color: var(--textColorDimmed); - border-radius: 6px; - transition: all 0.2s; - cursor: pointer; - z-index: 1; - opacity: 0; - transition: all 0.2s; - - &:hover { - background-color: var(--sidebarBackground); - } - - .Icon { - --size: 24px; - margin-left: 2px; - } - } } @keyframes shake { diff --git a/src/renderer/components/hotbar/hotbar-menu.tsx b/src/renderer/components/hotbar/hotbar-menu.tsx index 29c44fc81e..168f630327 100644 --- a/src/renderer/components/hotbar/hotbar-menu.tsx +++ b/src/renderer/components/hotbar/hotbar-menu.tsx @@ -6,7 +6,7 @@ import { observer } from "mobx-react"; import { HotbarIcon } from "./hotbar-icon"; import { cssNames, IClassName } from "../../utils"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; -import { defaultHotbarCells, HotbarItem, HotbarStore } from "../../../common/hotbar-store"; +import { HotbarItem, HotbarStore } from "../../../common/hotbar-store"; import { CatalogEntity, catalogEntityRunContext } from "../../api/catalog-entity"; import { Icon } from "../icon"; import { Badge } from "../badge"; @@ -72,14 +72,6 @@ export class HotbarMenu extends React.Component { }); } - renderAddCellButton() { - return ( - - ); - } - render() { const { className } = this.props; const hotbarStore = HotbarStore.getInstance(); @@ -90,7 +82,6 @@ export class HotbarMenu extends React.Component {
{this.renderGrid()} - {this.hotbar.items.length != defaultHotbarCells && this.renderAddCellButton()}
this.previous()} /> @@ -119,23 +110,14 @@ function HotbarCell(props: HotbarCellProps) { const [animating, setAnimating] = useState(false); const onAnimationEnd = () => { setAnimating(false); }; const onClick = () => { setAnimating(true); }; - const onDeleteClick = (evt: Event | React.SyntheticEvent) => { - evt.stopPropagation(); - HotbarStore.getInstance().removeEmptyCell(props.index); - }; return (
{props.children} - {!props.children && ( -
- -
- )}
); } From 0a604201d4761797130a7db1b8ab87493e2f821d Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Thu, 29 Apr 2021 12:24:48 +0300 Subject: [PATCH 09/17] Fix hotbar icon kind light theme (#2668) Signed-off-by: Jari Kolehmainen --- src/renderer/components/hotbar/hotbar-icon.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/hotbar/hotbar-icon.scss b/src/renderer/components/hotbar/hotbar-icon.scss index f75867d96c..1da432d568 100644 --- a/src/renderer/components/hotbar/hotbar-icon.scss +++ b/src/renderer/components/hotbar/hotbar-icon.scss @@ -48,7 +48,7 @@ margin: -8px; font-size: var(--font-size-small); background: var(--clusterMenuBackground); - color: white; + color: var(--textColorAccent); padding: 0px; border-radius: 50%; border: 2px solid var(--clusterMenuBackground); From f61f768fc79b01283574de8da0513c7403207c08 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 29 Apr 2021 05:25:44 -0400 Subject: [PATCH 10/17] fix getNodeWarningConditions (#2644) Signed-off-by: Sebastian Malton --- src/common/__tests__/kube-helpers.test.ts | 41 ++++++++++++++++++++++- src/common/kube-helpers.ts | 4 +-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/common/__tests__/kube-helpers.test.ts b/src/common/__tests__/kube-helpers.test.ts index ddecc6bde8..2a346bfef5 100644 --- a/src/common/__tests__/kube-helpers.test.ts +++ b/src/common/__tests__/kube-helpers.test.ts @@ -1,5 +1,5 @@ import { KubeConfig } from "@kubernetes/client-node"; -import { validateKubeConfig, loadConfig } from "../kube-helpers"; +import { validateKubeConfig, loadConfig, getNodeWarningConditions } from "../kube-helpers"; const kubeconfig = ` apiVersion: v1 @@ -251,4 +251,43 @@ 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/kube-helpers.ts b/src/common/kube-helpers.ts index fb4691fedb..e4a1168699 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -174,9 +174,9 @@ export function podHasIssues(pod: V1Pod) { } export function getNodeWarningConditions(node: V1Node) { - return node.status.conditions.filter(c => + return node.status?.conditions?.filter(c => c.status.toLowerCase() === "true" && c.type !== "Ready" && c.type !== "HostUpgrades" - ); + ) ?? []; } /** From 2c3750c2409e7bc39c0e60aca07d9323521c26b2 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 29 Apr 2021 08:29:32 -0400 Subject: [PATCH 11/17] Fix display name on accessible namespaces notification (#2657) Signed-off-by: Sebastian Malton --- src/renderer/ipc/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/ipc/index.tsx b/src/renderer/ipc/index.tsx index 924e313880..0c14f8eaeb 100644 --- a/src/renderer/ipc/index.tsx +++ b/src/renderer/ipc/index.tsx @@ -76,7 +76,7 @@ function ListNamespacesForbiddenHandler(event: IpcRendererEvent, ...[clusterId]: (
Add Accessible Namespaces -

Cluster {ClusterStore.getInstance().active.name} does not have permissions to list namespaces. Please add the namespaces you have access to.

+

Cluster {ClusterStore.getInstance().getById(clusterId).name} does not have permissions to list namespaces. Please add the namespaces you have access to.