From 47a919e499aa149f5584a95a3214d010d8eb70c5 Mon Sep 17 00:00:00 2001 From: Janne Savolainen Date: Fri, 1 Jul 2022 14:13:33 +0300 Subject: [PATCH] Remove the auto-update status bar item for not being needed anymore Signed-off-by: Janne Savolainen --- ...acters-in-page-registrations.test.tsx.snap | 24 +-- .../navigate-to-extension-page.test.tsx.snap | 60 +------- .../navigating-between-routes.test.tsx.snap | 24 +-- ...ation-using-application-menu.test.tsx.snap | 24 +-- ...g-update-using-topbar-button.test.tsx.snap | 12 +- .../installing-update-using-tray.test.ts.snap | 78 +--------- .../installing-update.test.ts.snap | 78 +--------- ...eriodical-checking-of-updates.test.ts.snap | 12 +- ...selection-of-update-stability.test.ts.snap | 12 +- .../installing-update.test.ts | 28 +--- ...gation-using-application-menu.test.ts.snap | 24 +-- ...elm-repository-in-preferences.test.ts.snap | 144 ++---------------- ...tory-from-list-in-preferences.test.ts.snap | 120 ++------------- ...m-repositories-in-preferences.test.ts.snap | 120 ++------------- ...ive-repository-in-preferences.test.ts.snap | 48 +----- .../closing-preferences.test.tsx.snap | 96 +----------- ...on-to-application-preferences.test.ts.snap | 24 +-- ...igation-to-editor-preferences.test.ts.snap | 24 +-- ...tension-specific-preferences.test.tsx.snap | 120 ++------------- ...ion-to-kubernetes-preferences.test.ts.snap | 24 +-- ...vigation-to-proxy-preferences.test.ts.snap | 24 +-- ...ion-to-telemetry-preferences.test.tsx.snap | 60 +------- ...ation-to-terminal-preferences.test.ts.snap | 24 +-- ...gation-using-application-menu.test.ts.snap | 24 +-- .../navigation-using-tray.test.ts.snap | 24 +-- ...-originating-from-extensions.test.tsx.snap | 9 -- ...gation-using-application-menu.test.ts.snap | 36 +---- .../status-bar/auto-update-component.tsx | 107 ------------- .../auto-update-status-bar-item.injectable.ts | 22 --- 29 files changed, 105 insertions(+), 1321 deletions(-) delete mode 100644 src/renderer/components/status-bar/auto-update-component.tsx delete mode 100644 src/renderer/components/status-bar/auto-update-status-bar-item.injectable.ts diff --git a/src/behaviours/__snapshots__/extension-special-characters-in-page-registrations.test.tsx.snap b/src/behaviours/__snapshots__/extension-special-characters-in-page-registrations.test.tsx.snap index 74307f3b53..2cc8acffca 100644 --- a/src/behaviours/__snapshots__/extension-special-characters-in-page-registrations.test.tsx.snap +++ b/src/behaviours/__snapshots__/extension-special-characters-in-page-registrations.test.tsx.snap @@ -187,17 +187,7 @@ exports[`extension special characters in page registrations renders 1`] = `
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
-
- Checking for updates... -
-
-
+ />
-
-
- Downloading version some-version... -
-
-
-
+ />
-
-
- Download of update failed -
-
-
+ />
-
-
- some-version is available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
-
- Checking for updates... -
-
-
+ />
-
-
- Downloading version some-version... -
-
-
-
+ />
-
-
- Download of update failed -
-
-
+ />
-
-
- some-version is available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
{ let applicationBuilder: ApplicationBuilder; @@ -86,10 +86,6 @@ describe("installing update", () => { ); }); - it("notifies the user that checking for updates is happening", () => { - expect(rendered.getByTestId("app-update-checking")).toBeInTheDocument(); - }); - it("renders", () => { expect(rendered.baseElement).toMatchSnapshot(); }); @@ -103,10 +99,6 @@ describe("installing update", () => { await processCheckingForUpdatesPromise; }); - it("notifies the user", () => { - expect(rendered.getByTestId("app-update-not-available")).toBeInTheDocument(); - }); - it("does not start downloading update", () => { expect(downloadPlatformUpdateMock).not.toHaveBeenCalled(); }); @@ -114,12 +106,6 @@ describe("installing update", () => { it("renders", () => { expect(rendered.baseElement).toMatchSnapshot(); }); - - it("when 5 seconds elapses, clears the notification to the user", () => { - advanceFakeTime(6000); - - expect(rendered.getByTestId("app-update-idle")).toBeInTheDocument(); - }); }); describe("when new update is discovered", () => { @@ -136,10 +122,6 @@ describe("installing update", () => { expect(downloadPlatformUpdateMock).toHaveBeenCalled(); }); - it("notifies the user that download is happening", () => { - expect(rendered.getByTestId("app-update-downloading")).toBeInTheDocument(); - }); - it("renders", () => { expect(rendered.baseElement).toMatchSnapshot(); }); @@ -153,10 +135,6 @@ describe("installing update", () => { expect(quitAndInstallUpdateMock).not.toHaveBeenCalled(); }); - it("notifies the user about failed download", () => { - expect(rendered.getByTestId("app-update-download-failed")).toBeInTheDocument(); - }); - it("renders", () => { expect(rendered.baseElement).toMatchSnapshot(); }); @@ -171,10 +149,6 @@ describe("installing update", () => { expect(quitAndInstallUpdateMock).not.toHaveBeenCalled(); }); - it("notifies the user about successful download", () => { - expect(rendered.getByTestId("app-update-available")).toBeInTheDocument(); - }); - it("renders", () => { expect(rendered.baseElement).toMatchSnapshot(); }); diff --git a/src/behaviours/extensions/__snapshots__/navigation-using-application-menu.test.ts.snap b/src/behaviours/extensions/__snapshots__/navigation-using-application-menu.test.ts.snap index 7abb5b3bf5..aafe097eb1 100644 --- a/src/behaviours/extensions/__snapshots__/navigation-using-application-menu.test.ts.snap +++ b/src/behaviours/extensions/__snapshots__/navigation-using-application-menu.test.ts.snap @@ -187,17 +187,7 @@ exports[`extensions - navigation using application menu renders 1`] = `
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
diff --git a/src/behaviours/welcome/__snapshots__/navigation-using-application-menu.test.ts.snap b/src/behaviours/welcome/__snapshots__/navigation-using-application-menu.test.ts.snap index d7575b76a7..43f0bf8522 100644 --- a/src/behaviours/welcome/__snapshots__/navigation-using-application-menu.test.ts.snap +++ b/src/behaviours/welcome/__snapshots__/navigation-using-application-menu.test.ts.snap @@ -187,17 +187,7 @@ exports[`welcome - navigation using application menu renders 1`] = `
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
-
-
- No new updates available -
-
-
+ />
JSX.Element; -} - -const EndNote = observer(({ version, note }: EndNoteProps) => { - const [start] = useState(Date.now()); - - if (start + 5000 <= reactiveNow()) { - return idle(); - } - - return note(version ?? ""); -}); - -const checking = () => ( - <> - -
Checking for updates...
- -); - -const available = (version: string) =>
{`${version ?? "Update"} is available`}
; - -const notAvailable = () =>
No new updates available
; - -const downloading = (version: string) => { - return ( - <> -
{`Downloading version ${version}...`}
- - - ); -}; - -const downloadFailed = (errMsg: string) =>
{errMsg}
; - -const idle = () =>
; - - -export const NonInjectedAutoUpdateComponent = observer(({ - progressOfUpdateDownload, - discoveredVersionState, - downloadingUpdateState, - checkingForUpdatesState, -}: Dependencies) => { - const discoveredVersion = discoveredVersionState.value.get(); - - const { failed } = progressOfUpdateDownload.value.get(); - - if (downloadingUpdateState.value.get()) { - - assert(discoveredVersion); - - return downloading(discoveredVersion.version); - } - - if (checkingForUpdatesState.value.get()) { - return checking(); - } - - if ( discoveredVersion) { - return ; - } - - if ( failed ) { - return ; - } - - return ; -}); - -export const AutoUpdateComponent = withInjectables(NonInjectedAutoUpdateComponent, { - getProps: (di, props) => ({ - progressOfUpdateDownload: di.inject(progressOfUpdateDownloadInjectable), - discoveredVersionState: di.inject(discoveredUpdateVersionInjectable), - downloadingUpdateState: di.inject(updateIsBeingDownloadedInjectable), - checkingForUpdatesState: di.inject(updatesAreBeingDiscoveredInjectable), - ...props, - }), -}); diff --git a/src/renderer/components/status-bar/auto-update-status-bar-item.injectable.ts b/src/renderer/components/status-bar/auto-update-status-bar-item.injectable.ts deleted file mode 100644 index de8f1518e8..0000000000 --- a/src/renderer/components/status-bar/auto-update-status-bar-item.injectable.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import { computed } from "mobx"; -import { AutoUpdateComponent } from "./auto-update-component"; -import { statusBarItemInjectionToken } from "./status-bar-item-injection-token"; - -const autoUpdateStatusBarItemInjectable = getInjectable({ - id: "auto-update-status-bar-item", - - instantiate: () => ({ - component: AutoUpdateComponent, - position: "left" as const, - visible: computed(() => true), - }), - - injectionToken: statusBarItemInjectionToken, -}); - -export default autoUpdateStatusBarItemInjectable;