diff --git a/package.json b/package.json index fc9c8d7227..1fbd3f535c 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "/src/jest.setup.ts", "jest-canvas-mock" ], + "globalSetup": "/src/jest.timezone.ts", "setupFilesAfterEnv": [ "/src/jest-after-env.setup.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 5a952f701b..3a3d32317c 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 @@ -2,6 +2,51 @@ exports[`extension special characters in page registrations renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`extension special characters in page registrations renders 1`] = ` exports[`extension special characters in page registrations when navigating to route with ID having special characters renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/__snapshots__/navigate-to-extension-page.test.tsx.snap b/src/behaviours/__snapshots__/navigate-to-extension-page.test.tsx.snap index f73444ff0e..c99c770ef1 100644 --- a/src/behaviours/__snapshots__/navigate-to-extension-page.test.tsx.snap +++ b/src/behaviours/__snapshots__/navigate-to-extension-page.test.tsx.snap @@ -2,6 +2,51 @@ exports[`navigate to extension page renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`navigate to extension page renders 1`] = ` exports[`navigate to extension page when extension navigates to child route renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -41,6 +131,51 @@ exports[`navigate to extension page when extension navigates to child route rend exports[`navigate to extension page when extension navigates to route with parameters renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -78,6 +213,51 @@ exports[`navigate to extension page when extension navigates to route with param exports[`navigate to extension page when extension navigates to route without parameters renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -115,6 +295,51 @@ exports[`navigate to extension page when extension navigates to route without pa exports[`navigate to extension page when extension navigates to route without parameters when changing page parameters renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/__snapshots__/navigating-between-routes.test.tsx.snap b/src/behaviours/__snapshots__/navigating-between-routes.test.tsx.snap index bd3c3f51e7..921adfec18 100644 --- a/src/behaviours/__snapshots__/navigating-between-routes.test.tsx.snap +++ b/src/behaviours/__snapshots__/navigating-between-routes.test.tsx.snap @@ -2,6 +2,51 @@ exports[`navigating between routes given route with optional path parameters when navigating to route with path parameters renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -26,6 +71,51 @@ exports[`navigating between routes given route with optional path parameters whe exports[`navigating between routes given route without path parameters when navigating to route renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/add-cluster/__snapshots__/navigation-using-application-menu.test.tsx.snap b/src/behaviours/add-cluster/__snapshots__/navigation-using-application-menu.test.tsx.snap index f6067dec05..1da17bdc47 100644 --- a/src/behaviours/add-cluster/__snapshots__/navigation-using-application-menu.test.tsx.snap +++ b/src/behaviours/add-cluster/__snapshots__/navigation-using-application-menu.test.tsx.snap @@ -2,6 +2,51 @@ exports[`add-cluster - navigation using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`add-cluster - navigation using application menu renders 1`] = ` exports[`add-cluster - navigation using application menu when navigating to add cluster using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/application-update/__snapshots__/installing-update-using-topbar-button.test.tsx.snap b/src/behaviours/application-update/__snapshots__/installing-update-using-topbar-button.test.tsx.snap new file mode 100644 index 0000000000..de3b14e3d2 --- /dev/null +++ b/src/behaviours/application-update/__snapshots__/installing-update-using-topbar-button.test.tsx.snap @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`encourage user to update when sufficient time passed since update was downloaded when started renders 1`] = ` + +
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
+
+
+
+
+
+
+ +`; diff --git a/src/behaviours/application-update/__snapshots__/installing-update-using-tray.test.ts.snap b/src/behaviours/application-update/__snapshots__/installing-update-using-tray.test.ts.snap index dd45d690c5..34fbe7daca 100644 --- a/src/behaviours/application-update/__snapshots__/installing-update-using-tray.test.ts.snap +++ b/src/behaviours/application-update/__snapshots__/installing-update-using-tray.test.ts.snap @@ -3,6 +3,51 @@ exports[`installing update using tray when started renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -23,6 +68,51 @@ exports[`installing update using tray when started renders 1`] = ` exports[`installing update using tray when started when user checks for updates using tray renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -64,7 +154,7 @@ exports[`installing update using tray when started when user checks for updates >
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -125,7 +260,7 @@ exports[`installing update using tray when started when user checks for updates >
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -226,7 +424,7 @@ exports[`installing update using tray when started when user checks for updates >
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -367,7 +628,7 @@ exports[`installing update using tray when started when user checks for updates >
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -538,7 +844,7 @@ exports[`installing update using tray when started when user checks for updates >
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -23,6 +68,51 @@ exports[`installing update when started renders 1`] = ` exports[`installing update when started when user checks for updates renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -43,6 +133,51 @@ exports[`installing update when started when user checks for updates renders 1`] exports[`installing update when started when user checks for updates when new update is discovered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -63,6 +198,69 @@ exports[`installing update when started when user checks for updates when new up exports[`installing update when started when user checks for updates when new update is discovered when download fails renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -83,6 +281,69 @@ exports[`installing update when started when user checks for updates when new up exports[`installing update when started when user checks for updates when new update is discovered when download succeeds renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -103,6 +364,69 @@ exports[`installing update when started when user checks for updates when new up exports[`installing update when started when user checks for updates when new update is discovered when download succeeds when user answers not to install the update renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -123,6 +447,69 @@ exports[`installing update when started when user checks for updates when new up exports[`installing update when started when user checks for updates when new update is discovered when download succeeds when user answers to install the update renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + + +
+
+
@@ -143,6 +530,51 @@ exports[`installing update when started when user checks for updates when new up exports[`installing update when started when user checks for updates when no new update is discovered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/application-update/__snapshots__/periodical-checking-of-updates.test.ts.snap b/src/behaviours/application-update/__snapshots__/periodical-checking-of-updates.test.ts.snap index 744a9dfb7e..84259158ef 100644 --- a/src/behaviours/application-update/__snapshots__/periodical-checking-of-updates.test.ts.snap +++ b/src/behaviours/application-update/__snapshots__/periodical-checking-of-updates.test.ts.snap @@ -3,6 +3,51 @@ exports[`periodical checking of updates given updater is enabled and configuration exists, when started renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/application-update/__snapshots__/selection-of-update-stability.test.ts.snap b/src/behaviours/application-update/__snapshots__/selection-of-update-stability.test.ts.snap index ea700234da..c0ffb43590 100644 --- a/src/behaviours/application-update/__snapshots__/selection-of-update-stability.test.ts.snap +++ b/src/behaviours/application-update/__snapshots__/selection-of-update-stability.test.ts.snap @@ -3,6 +3,51 @@ exports[`selection of update stability when started renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/application-update/installing-update-using-topbar-button.test.tsx b/src/behaviours/application-update/installing-update-using-topbar-button.test.tsx new file mode 100644 index 0000000000..f2b9a58dd1 --- /dev/null +++ b/src/behaviours/application-update/installing-update-using-topbar-button.test.tsx @@ -0,0 +1,144 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import type { AsyncFnMock } from "@async-fn/jest"; +import asyncFn from "@async-fn/jest"; +import type { RenderResult } from "@testing-library/react"; +import { act } from "@testing-library/react"; +import type { CheckForPlatformUpdates } from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable"; +import checkForPlatformUpdatesInjectable from "../../main/application-update/check-for-platform-updates/check-for-platform-updates.injectable"; +import type { DownloadPlatformUpdate } from "../../main/application-update/download-platform-update/download-platform-update.injectable"; +import downloadPlatformUpdateInjectable from "../../main/application-update/download-platform-update/download-platform-update.injectable"; +import publishIsConfiguredInjectable from "../../main/application-update/publish-is-configured.injectable"; +import electronUpdaterIsActiveInjectable from "../../main/electron-app/features/electron-updater-is-active.injectable"; +import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; +import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder"; +import processCheckingForUpdatesInjectable from "../../main/application-update/check-for-updates/process-checking-for-updates.injectable"; +import quitAndInstallUpdateInjectable from "../../main/application-update/quit-and-install-update.injectable"; + +function daysToMilliseconds(days: number) { + return Math.round(days * 24 * 60 * 60 * 1000); +} + +describe("encourage user to update when sufficient time passed since update was downloaded", () => { + let applicationBuilder: ApplicationBuilder; + let checkForPlatformUpdatesMock: AsyncFnMock; + let downloadPlatformUpdateMock: AsyncFnMock; + let quitAndInstallUpdateMock: jest.MockedFunction<() => void>; + + beforeEach(() => { + jest.useFakeTimers(); + + applicationBuilder = getApplicationBuilder(); + + applicationBuilder.beforeApplicationStart(({ mainDi }) => { + checkForPlatformUpdatesMock = asyncFn(); + downloadPlatformUpdateMock = asyncFn(); + + mainDi.override( + checkForPlatformUpdatesInjectable, + () => checkForPlatformUpdatesMock, + ); + + mainDi.override( + downloadPlatformUpdateInjectable, + () => downloadPlatformUpdateMock, + ); + + mainDi.override(electronUpdaterIsActiveInjectable, () => true); + mainDi.override(publishIsConfiguredInjectable, () => true); + + quitAndInstallUpdateMock = jest.fn(); + mainDi.override(quitAndInstallUpdateInjectable, () => quitAndInstallUpdateMock); + }); + }); + + describe("when started", () => { + let rendered: RenderResult; + + beforeEach(async () => { + rendered = await applicationBuilder.render(); + }); + + it("renders", () => { + expect(rendered.baseElement).toMatchSnapshot(); + }); + + it("does not show update button yet", () => { + const button = rendered.queryByTestId("update-button"); + + expect(button).toBeNull(); + }); + + describe("given the update check", () => { + let processCheckingForUpdatesPromise: Promise; + + beforeEach(async () => { + const processCheckingForUpdates = applicationBuilder.dis.mainDi.inject(processCheckingForUpdatesInjectable); + + processCheckingForUpdatesPromise = processCheckingForUpdates("irrelevant"); + }); + + describe("when update downloaded", () => { + let button: HTMLElement; + + beforeEach(async () => { + await checkForPlatformUpdatesMock.resolve({ + updateWasDiscovered: true, + version: "some-version", + }); + + await downloadPlatformUpdateMock.resolve({ downloadWasSuccessful: true }); + await processCheckingForUpdatesPromise; + + button = rendered.getByTestId("update-button"); + }); + + it("shows update button to help user to update", () => { + expect(button).toBeInTheDocument(); + }); + + it("has soft emotional indication in the button", () => { + expect(button).toHaveAttribute("data-warning-level", "light"); + }); + + describe("when button is clicked", () => { + beforeEach(() => { + act(() => button.click()); + }); + + it("shows dropdown with update item", () => { + expect(rendered.getByTestId("update-lens-menu-item")).toBeInTheDocument(); + }); + + it("when selected update now, restarts the application to update", () => { + const updateMenuItem = rendered.getByTestId("update-lens-menu-item"); + + act(() => updateMenuItem.click()); + + expect(quitAndInstallUpdateMock).toBeCalled(); + }); + + it("when dropdown closed without clicking update item, does not restart the application to update", () => { + act(() => button.click()); + + expect(quitAndInstallUpdateMock).not.toBeCalled(); + }); + }); + + it("given just enough time passes for medium update encouragement, has medium emotional indication in the button", () => { + jest.advanceTimersByTime(daysToMilliseconds(22)); + + expect(button).toHaveAttribute("data-warning-level", "medium"); + }); + + it("given just enough time passes for severe update encouragement, has severe emotional indication in the button", () => { + jest.advanceTimersByTime(daysToMilliseconds(26)); + + expect(button).toHaveAttribute("data-warning-level", "high"); + }); + }); + }); + }); +}); 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 8dd45c656a..b8c6804f4d 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 @@ -2,6 +2,51 @@ exports[`extensions - navigation using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`extensions - navigation using application menu renders 1`] = ` exports[`extensions - navigation using application menu when navigating to extensions using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/helm-charts/__snapshots__/add-custom-helm-repository-in-preferences.test.ts.snap b/src/behaviours/helm-charts/__snapshots__/add-custom-helm-repository-in-preferences.test.ts.snap index 21803cf04a..ff6be7d818 100644 --- a/src/behaviours/helm-charts/__snapshots__/add-custom-helm-repository-in-preferences.test.ts.snap +++ b/src/behaviours/helm-charts/__snapshots__/add-custom-helm-repository-in-preferences.test.ts.snap @@ -3,6 +3,51 @@ exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -482,6 +527,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -968,6 +1058,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1563,6 +1698,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when closing the dialog by clicking cancel renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2057,6 +2237,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2652,6 +2877,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when showing the maximal options renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -3423,6 +3693,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when showing the maximal options when hiding maximal options renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -4018,6 +4333,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when showing the maximal options when inputted maximal options renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -4789,6 +5149,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when submitted and some time passes renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -5384,6 +5789,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when submitted and some time passes when activation rejects renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -5878,6 +6328,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when submitted and some time passes when activation resolves with success renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -6365,6 +6860,51 @@ exports[`add custom helm repository in preferences when navigating to preference exports[`add custom helm repository in preferences when navigating to preferences containing helm repositories when active repositories resolve when selecting to add custom repository when inputted minimal options for the repository when submitted and some time passes when activation resolves with success when adding custom repository again renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/helm-charts/__snapshots__/add-helm-repository-from-list-in-preferences.test.ts.snap b/src/behaviours/helm-charts/__snapshots__/add-helm-repository-from-list-in-preferences.test.ts.snap index 82c9bfb7e4..776755635f 100644 --- a/src/behaviours/helm-charts/__snapshots__/add-helm-repository-from-list-in-preferences.test.ts.snap +++ b/src/behaviours/helm-charts/__snapshots__/add-helm-repository-from-list-in-preferences.test.ts.snap @@ -3,6 +3,51 @@ exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -482,6 +527,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -968,6 +1058,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1507,6 +1642,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1993,6 +2173,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding rejects renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2479,6 +2704,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2958,6 +3228,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding resolves when active repositories resolve again renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -3474,6 +3789,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding resolves when active repositories resolve again when select for selecting active repositories is clicked renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -4053,6 +4413,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding resolves when active repositories resolve again when select for selecting active repositories is clicked when active repository is selected renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -4569,6 +4974,51 @@ exports[`add helm repository from list in preferences when navigating to prefere exports[`add helm repository from list in preferences when navigating to preferences containing helm repositories when both active and public repositories resolve when select for adding public repositories is clicked when deactive public repository is selected when adding resolves when active repositories resolve again when select for selecting active repositories is clicked when active repository is selected when removing resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/helm-charts/__snapshots__/listing-active-helm-repositories-in-preferences.test.ts.snap b/src/behaviours/helm-charts/__snapshots__/listing-active-helm-repositories-in-preferences.test.ts.snap index d350470ef4..83666bdfcc 100644 --- a/src/behaviours/helm-charts/__snapshots__/listing-active-helm-repositories-in-preferences.test.ts.snap +++ b/src/behaviours/helm-charts/__snapshots__/listing-active-helm-repositories-in-preferences.test.ts.snap @@ -3,6 +3,51 @@ exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -482,6 +527,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -961,6 +1051,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves when updating repositories reject with any other error renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1332,6 +1467,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves when updating repositories reject with error about no existing repositories renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1811,6 +1991,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves when updating repositories reject with error about no existing repositories when adding default repository reject renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2182,6 +2407,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves when updating repositories reject with error about no existing repositories when adding of default repository resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2661,6 +2931,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves when updating repositories resolve when repositories resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -3177,6 +3492,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves without path to repository cache directory renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -3548,6 +3908,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when configuration resolves without path to repository config file renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -3919,6 +4324,51 @@ exports[`listing active helm repositories in preferences when navigating to pref exports[`listing active helm repositories in preferences when navigating to preferences containing helm repositories when getting configuration rejects renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/helm-charts/__snapshots__/remove-helm-repository-from-list-of-active-repository-in-preferences.test.ts.snap b/src/behaviours/helm-charts/__snapshots__/remove-helm-repository-from-list-of-active-repository-in-preferences.test.ts.snap index c913123fe3..0823b7d1f1 100644 --- a/src/behaviours/helm-charts/__snapshots__/remove-helm-repository-from-list-of-active-repository-in-preferences.test.ts.snap +++ b/src/behaviours/helm-charts/__snapshots__/remove-helm-repository-from-list-of-active-repository-in-preferences.test.ts.snap @@ -3,6 +3,51 @@ exports[`remove helm repository from list of active repositories in preferences when navigating to preferences containing helm repositories renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -482,6 +527,51 @@ exports[`remove helm repository from list of active repositories in preferences exports[`remove helm repository from list of active repositories in preferences when navigating to preferences containing helm repositories when active repositories resolve renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -968,6 +1058,51 @@ exports[`remove helm repository from list of active repositories in preferences exports[`remove helm repository from list of active repositories in preferences when navigating to preferences containing helm repositories when active repositories resolve when removing repository renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1454,6 +1589,51 @@ exports[`remove helm repository from list of active repositories in preferences exports[`remove helm repository from list of active repositories in preferences when navigating to preferences containing helm repositories when active repositories resolve when removing repository when removing resolves renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/closing-preferences.test.tsx.snap b/src/behaviours/preferences/__snapshots__/closing-preferences.test.tsx.snap index 13c0967f4d..b84f16d647 100644 --- a/src/behaviours/preferences/__snapshots__/closing-preferences.test.tsx.snap +++ b/src/behaviours/preferences/__snapshots__/closing-preferences.test.tsx.snap @@ -2,6 +2,51 @@ exports[`preferences - closing-preferences given accessing preferences directly renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -553,6 +598,51 @@ exports[`preferences - closing-preferences given accessing preferences directly exports[`preferences - closing-preferences given accessing preferences directly when navigating to a tab in preferences renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -708,6 +798,51 @@ exports[`preferences - closing-preferences given accessing preferences directly exports[`preferences - closing-preferences given accessing preferences directly when navigating to a tab in preferences when preferences are closed renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -729,6 +864,51 @@ exports[`preferences - closing-preferences given accessing preferences directly exports[`preferences - closing-preferences given accessing preferences directly when preferences are closed renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -750,6 +930,51 @@ exports[`preferences - closing-preferences given accessing preferences directly exports[`preferences - closing-preferences given already in a page and then navigated to preferences renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1301,6 +1526,51 @@ exports[`preferences - closing-preferences given already in a page and then navi exports[`preferences - closing-preferences given already in a page and then navigated to preferences when navigating to a tab in preferences renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1456,6 +1726,51 @@ exports[`preferences - closing-preferences given already in a page and then navi exports[`preferences - closing-preferences given already in a page and then navigated to preferences when navigating to a tab in preferences when preferences are closed renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1611,6 +1926,51 @@ exports[`preferences - closing-preferences given already in a page and then navi exports[`preferences - closing-preferences given already in a page and then navigated to preferences when preferences are closed renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap index 44dd4be6ca..b4b2807e5c 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-application-preferences.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to application preferences given in some child page of preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -217,6 +262,51 @@ exports[`preferences - navigation to application preferences given in some child exports[`preferences - navigation to application preferences given in some child page of preferences, when rendered when navigating to application preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-editor-preferences.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-to-editor-preferences.test.ts.snap index c36139e3a7..d40c0086d6 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-editor-preferences.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-editor-preferences.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to editor preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -541,6 +586,51 @@ exports[`preferences - navigation to editor preferences given in preferences, wh exports[`preferences - navigation to editor preferences given in preferences, when rendered when navigating to editor preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-extension-specific-preferences.test.tsx.snap b/src/behaviours/preferences/__snapshots__/navigation-to-extension-specific-preferences.test.tsx.snap index 79787b5d8d..41039b5881 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-extension-specific-preferences.test.tsx.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-extension-specific-preferences.test.tsx.snap @@ -17,6 +17,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered given extension with registered tab when navigating to specific extension tab renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -206,6 +251,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered given extensions with tabs having same id when navigating to first extension tab renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -407,6 +497,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered given extensions with tabs having same id when navigating to second extension tab renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -608,6 +743,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered given multiple extensions with specific preferences, when navigating to extension specific preferences page renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -832,6 +1012,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1371,6 +1596,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered when extension with specific preferences is enabled renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1945,6 +2215,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered when extension with specific preferences is enabled when navigating to extension preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2158,6 +2473,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences given in preferences, when rendered when extension with specific preferences is enabled when navigating to extension preferences using navigation when extension is disabled renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2316,6 +2676,51 @@ exports[`preferences - navigation to extension specific preferences given in pre exports[`preferences - navigation to extension specific preferences when navigating to extension specific tab renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -2505,6 +2910,51 @@ exports[`preferences - navigation to extension specific preferences when navigat exports[`preferences - navigation to extension specific preferences when navigating to someone else extension specific tab renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-kubernetes-preferences.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-to-kubernetes-preferences.test.ts.snap index 2c169f3a13..67796e88af 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-kubernetes-preferences.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-kubernetes-preferences.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to kubernetes preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -541,6 +586,51 @@ exports[`preferences - navigation to kubernetes preferences given in preferences exports[`preferences - navigation to kubernetes preferences given in preferences, when rendered when navigating to kubernetes preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-proxy-preferences.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-to-proxy-preferences.test.ts.snap index d89450a19d..0ee9cc76b1 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-proxy-preferences.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-proxy-preferences.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to proxy preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -541,6 +586,51 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe exports[`preferences - navigation to proxy preferences given in preferences, when rendered when navigating to proxy preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-telemetry-preferences.test.tsx.snap b/src/behaviours/preferences/__snapshots__/navigation-to-telemetry-preferences.test.tsx.snap index 9b7cb95ae7..5915f12efd 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-telemetry-preferences.test.tsx.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-telemetry-preferences.test.tsx.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to telemetry preferences given URL for Sentry DNS, when navigating to preferences when navigating to telemetry preferences renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -203,6 +248,51 @@ exports[`preferences - navigation to telemetry preferences given URL for Sentry exports[`preferences - navigation to telemetry preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -742,6 +832,51 @@ exports[`preferences - navigation to telemetry preferences given in preferences, exports[`preferences - navigation to telemetry preferences given in preferences, when rendered when extension with telemetry preference items gets enabled renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1293,6 +1428,51 @@ exports[`preferences - navigation to telemetry preferences given in preferences, exports[`preferences - navigation to telemetry preferences given in preferences, when rendered when extension with telemetry preference items gets enabled when clicking link to telemetry preferences from navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -1482,6 +1662,51 @@ exports[`preferences - navigation to telemetry preferences given in preferences, exports[`preferences - navigation to telemetry preferences given no URL for Sentry DNS, when navigating to telemetry preferences renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-to-terminal-preferences.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-to-terminal-preferences.test.ts.snap index 075f780cde..3d1b26f668 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-to-terminal-preferences.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-to-terminal-preferences.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation to terminal preferences given in preferences, when rendered renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -541,6 +586,51 @@ exports[`preferences - navigation to terminal preferences given in preferences, exports[`preferences - navigation to terminal preferences given in preferences, when rendered when navigating to terminal preferences using navigation renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-using-application-menu.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-using-application-menu.test.ts.snap index 212a225aba..339e746af6 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-using-application-menu.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-using-application-menu.test.ts.snap @@ -2,6 +2,51 @@ exports[`preferences - navigation using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`preferences - navigation using application menu renders 1`] = ` exports[`preferences - navigation using application menu when navigating to preferences using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/behaviours/preferences/__snapshots__/navigation-using-tray.test.ts.snap b/src/behaviours/preferences/__snapshots__/navigation-using-tray.test.ts.snap index a53948c022..c395fb5a18 100644 --- a/src/behaviours/preferences/__snapshots__/navigation-using-tray.test.ts.snap +++ b/src/behaviours/preferences/__snapshots__/navigation-using-tray.test.ts.snap @@ -3,6 +3,51 @@ exports[`show-about-using-tray renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -23,6 +68,51 @@ exports[`show-about-using-tray renders 1`] = ` exports[`show-about-using-tray when navigating using tray renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
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 1f1426e962..47b75b4303 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 @@ -2,6 +2,51 @@ exports[`welcome - navigation using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -20,6 +65,51 @@ exports[`welcome - navigation using application menu renders 1`] = ` exports[`welcome - navigation using application menu when navigating to welcome using application menu renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/common/__tests__/timezones.test.ts b/src/common/__tests__/timezones.test.ts new file mode 100644 index 0000000000..e7fa68e87c --- /dev/null +++ b/src/common/__tests__/timezones.test.ts @@ -0,0 +1,12 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +describe("Timezones", () => { + it("should always be UTC", () => { + expect(new Date().getTimezoneOffset()).toBe(0); + }); +}); + +export {}; diff --git a/src/common/application-update/restart-and-install-update-channel/restart-and-install-update-channel.injectable.ts b/src/common/application-update/restart-and-install-update-channel/restart-and-install-update-channel.injectable.ts new file mode 100644 index 0000000000..b6d811e101 --- /dev/null +++ b/src/common/application-update/restart-and-install-update-channel/restart-and-install-update-channel.injectable.ts @@ -0,0 +1,21 @@ +/** + * 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 type { MessageChannel } from "../../utils/channel/message-channel-injection-token"; +import { messageChannelInjectionToken } from "../../utils/channel/message-channel-injection-token"; + +export type RestartAndInstallUpdateChannel = MessageChannel; + +const restartAndInstallUpdateChannel = getInjectable({ + id: "restart-and-install-update-channel", + + instantiate: (): RestartAndInstallUpdateChannel => ({ + id: "restart-and-install-update-channel", + }), + + injectionToken: messageChannelInjectionToken, +}); + +export default restartAndInstallUpdateChannel; diff --git a/src/common/application-update/update-downloaded-date-time/update-downloaded-date-time.injectable.ts b/src/common/application-update/update-downloaded-date-time/update-downloaded-date-time.injectable.ts new file mode 100644 index 0000000000..32a15d310a --- /dev/null +++ b/src/common/application-update/update-downloaded-date-time/update-downloaded-date-time.injectable.ts @@ -0,0 +1,24 @@ +/** + * 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 createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable"; +import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token"; + +const updateDownloadedDateTimeInjectable = getInjectable({ + id: "update-downloaded-date-time", + + instantiate: (di) => { + const createSyncBox = di.inject(createSyncBoxInjectable); + + return createSyncBox( + "update-downloaded-date-time", + null, + ); + }, + + injectionToken: syncBoxInjectionToken, +}); + +export default updateDownloadedDateTimeInjectable; diff --git a/src/jest.timezone.ts b/src/jest.timezone.ts new file mode 100644 index 0000000000..ec39a810e3 --- /dev/null +++ b/src/jest.timezone.ts @@ -0,0 +1,11 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ + +// Setting the timezone to UTC to ensure same timezone for CI and local environments +module.exports = async () => { + process.env.TZ = "UTC"; +}; + +export {}; diff --git a/src/main/application-update/download-update/download-update.injectable.ts b/src/main/application-update/download-update/download-update.injectable.ts index d0ac141b9c..f68b5166c0 100644 --- a/src/main/application-update/download-update/download-update.injectable.ts +++ b/src/main/application-update/download-update/download-update.injectable.ts @@ -9,6 +9,8 @@ import discoveredUpdateVersionInjectable from "../../../common/application-updat import { action, runInAction } from "mobx"; import type { ProgressOfDownload } from "../../../common/application-update/progress-of-update-download/progress-of-update-download.injectable"; import progressOfUpdateDownloadInjectable from "../../../common/application-update/progress-of-update-download/progress-of-update-download.injectable"; +import { getCurrentDateTime } from "../../../common/utils/date/get-current-date-time"; +import updateDownloadedDateTimeInjectable from "../../../common/application-update/update-downloaded-date-time/update-downloaded-date-time.injectable"; const downloadUpdateInjectable = getInjectable({ id: "download-update", @@ -18,6 +20,7 @@ const downloadUpdateInjectable = getInjectable({ const downloadingUpdateState = di.inject(updateIsBeingDownloadedInjectable); const discoveredVersionState = di.inject(discoveredUpdateVersionInjectable); const progressOfUpdateDownload = di.inject(progressOfUpdateDownloadInjectable); + const updateDownloadedDate = di.inject(updateDownloadedDateTimeInjectable); const updateDownloadProgress = action((progressOfDownload: ProgressOfDownload) => { progressOfUpdateDownload.set(progressOfDownload); @@ -38,6 +41,10 @@ const downloadUpdateInjectable = getInjectable({ discoveredVersionState.set(null); } + const currentDateTime = getCurrentDateTime(); + + updateDownloadedDate.set(currentDateTime); + downloadingUpdateState.set(false); }); diff --git a/src/main/application-update/restart-and-install-update/restart-and-install-update-listener.injectable.ts b/src/main/application-update/restart-and-install-update/restart-and-install-update-listener.injectable.ts new file mode 100644 index 0000000000..0580114885 --- /dev/null +++ b/src/main/application-update/restart-and-install-update/restart-and-install-update-listener.injectable.ts @@ -0,0 +1,26 @@ +/** + * 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 restartAndInstallUpdateChannel from "../../../common/application-update/restart-and-install-update-channel/restart-and-install-update-channel.injectable"; +import { messageChannelListenerInjectionToken } from "../../../common/utils/channel/message-channel-listener-injection-token"; +import quitAndInstallUpdateInjectable from "../quit-and-install-update.injectable"; + +const restartAndInstallUpdateListenerInjectable = getInjectable({ + id: "restart-and-install-update-listener", + + instantiate: (di) => { + const quitAndInstall = di.inject(quitAndInstallUpdateInjectable); + const channel = di.inject(restartAndInstallUpdateChannel); + + return { + channel, + handler: quitAndInstall, + }; + }, + + injectionToken: messageChannelListenerInjectionToken, +}); + +export default restartAndInstallUpdateListenerInjectable; diff --git a/src/main/ask-boolean/__snapshots__/ask-boolean.test.ts.snap b/src/main/ask-boolean/__snapshots__/ask-boolean.test.ts.snap index fca2c12cb9..33b2ec4033 100644 --- a/src/main/ask-boolean/__snapshots__/ask-boolean.test.ts.snap +++ b/src/main/ask-boolean/__snapshots__/ask-boolean.test.ts.snap @@ -3,6 +3,51 @@ exports[`ask-boolean given started when asking multiple questions renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -160,6 +205,51 @@ exports[`ask-boolean given started when asking multiple questions renders 1`] = exports[`ask-boolean given started when asking multiple questions when answering to first question renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -249,6 +339,51 @@ exports[`ask-boolean given started when asking multiple questions when answering exports[`ask-boolean given started when asking question renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -338,6 +473,51 @@ exports[`ask-boolean given started when asking question renders 1`] = ` exports[`ask-boolean given started when asking question when user answers "no" renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -358,6 +538,51 @@ exports[`ask-boolean given started when asking question when user answers "no" r exports[`ask-boolean given started when asking question when user answers "yes" renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
@@ -378,6 +603,51 @@ exports[`ask-boolean given started when asking question when user answers "yes" exports[`ask-boolean given started when asking question when user closes notification without answering the question renders 1`] = `
+
+
+ + + home + + + + + arrow_back + + + + + arrow_forward + + +
+
+
diff --git a/src/renderer/components/layout/top-bar/top-bar.tsx b/src/renderer/components/layout/top-bar/top-bar.tsx index 50b3c84f1c..59382d56f0 100644 --- a/src/renderer/components/layout/top-bar/top-bar.tsx +++ b/src/renderer/components/layout/top-bar/top-bar.tsx @@ -8,8 +8,7 @@ import React, { useEffect, useRef } from "react"; import { observer } from "mobx-react"; import type { IComputedValue } from "mobx"; import { Icon } from "../../icon"; -import { watchHistoryState } from "../../../remote-helpers/history-updater"; -import { cssNames, noop } from "../../../utils"; +import { cssNames } from "../../../utils"; import topBarItemsInjectable from "./top-bar-items/top-bar-items.injectable"; import { withInjectables } from "@ogre-tools/injectable-react"; import type { TopBarRegistration } from "./top-bar-registration"; @@ -28,6 +27,7 @@ import goForwardInjectable from "./go-forward.injectable"; import closeWindowInjectable from "./close-window.injectable"; import maximizeWindowInjectable from "./maximize-window.injectable"; import toggleMaximizeWindowInjectable from "./toggle-maximize-window.injectable"; +import watchHistoryStateInjectable from "../../../remote-helpers/watch-history-state.injectable"; interface Dependencies { navigateToCatalog: NavigateToCatalog; @@ -43,6 +43,7 @@ interface Dependencies { minimizeWindow: () => void; toggleMaximizeWindow: () => void; closeWindow: () => void; + watchHistoryState: () => () => void; } const NonInjectedTopBar = observer(({ @@ -59,6 +60,7 @@ const NonInjectedTopBar = observer(({ closeWindow, minimizeWindow, toggleMaximizeWindow, + watchHistoryState, }: Dependencies) => { const elem = useRef(null); @@ -115,7 +117,7 @@ const NonInjectedTopBar = observer(({ onClick={goForward} disabled={!nextEnabled.get()} /> - +
{renderRegisteredItems(items.get())} @@ -196,5 +198,6 @@ export const TopBar = withInjectables(NonInjectedTopBar, { closeWindow: di.inject(closeWindowInjectable), minimizeWindow: di.inject(maximizeWindowInjectable), toggleMaximizeWindow: di.inject(toggleMaximizeWindowInjectable), + watchHistoryState: di.inject(watchHistoryStateInjectable), }), }); diff --git a/src/renderer/components/menu/menu.scss b/src/renderer/components/menu/menu.scss index 943fed026b..30e92d2a75 100644 --- a/src/renderer/components/menu/menu.scss +++ b/src/renderer/components/menu/menu.scss @@ -55,7 +55,7 @@ display: flex; align-items: center; color: var(--color); - padding: 6px var(--padding); + padding: calc(var(--padding) / 2) var(--padding); margin-bottom: -3px; white-space: nowrap; text-decoration: none; diff --git a/src/renderer/components/test-utils/get-application-builder.tsx b/src/renderer/components/test-utils/get-application-builder.tsx index 0274bb7d6d..25101ae634 100644 --- a/src/renderer/components/test-utils/get-application-builder.tsx +++ b/src/renderer/components/test-utils/get-application-builder.tsx @@ -62,6 +62,7 @@ import type { LensMainExtension } from "../../../extensions/lens-main-extension" import type { LensExtension } from "../../../extensions/lens-extension"; import extensionInjectable from "../../../extensions/extension-loader/extension/extension.injectable"; +import { TopBar } from "../layout/top-bar/top-bar"; type Callback = (dis: DiContainers) => void | Promise; @@ -125,6 +126,7 @@ interface DiContainers { interface Environment { renderSidebar: () => React.ReactNode; + renderTopBar: () => React.ReactNode; renderStatusBar: () => React.ReactNode; beforeRender: () => void; onAllowKubeResource: () => void; @@ -166,6 +168,8 @@ export const getApplicationBuilder = () => { application: { renderSidebar: () => null, + renderTopBar: () => , + renderStatusBar: () => , beforeRender: () => { @@ -184,6 +188,7 @@ export const getApplicationBuilder = () => { clusterFrame: { renderSidebar: () => , renderStatusBar: () => null, + renderTopBar: () => null, beforeRender: () => {}, onAllowKubeResource: () => {}, } as Environment, @@ -482,6 +487,7 @@ export const getApplicationBuilder = () => { rendered = render( {environment.renderSidebar()} + {environment.renderTopBar()} {environment.renderStatusBar()} diff --git a/src/renderer/components/update-button/__tests__/__snapshots__/update-button.test.tsx.snap b/src/renderer/components/update-button/__tests__/__snapshots__/update-button.test.tsx.snap deleted file mode 100644 index 3492065df4..0000000000 --- a/src/renderer/components/update-button/__tests__/__snapshots__/update-button.test.tsx.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render if warning level prop passed 1`] = ` - -`; diff --git a/src/renderer/components/update-button/__tests__/update-button.test.tsx b/src/renderer/components/update-button/__tests__/update-button.test.tsx deleted file mode 100644 index 8133bd3845..0000000000 --- a/src/renderer/components/update-button/__tests__/update-button.test.tsx +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ - -import { act } from "@testing-library/react"; -import React from "react"; -import { UpdateButton } from "../update-button"; -import "@testing-library/jest-dom/extend-expect"; -import { getDiForUnitTesting } from "../../../getDiForUnitTesting"; -import type { DiRender } from "../../test-utils/renderFor"; -import { renderFor } from "../../test-utils/renderFor"; - -const update = jest.fn(); - -describe("", () => { - let render: DiRender; - - beforeEach(() => { - - const di = getDiForUnitTesting({ doGeneralOverrides: true }); - - render = renderFor(di); - - update.mockClear(); - }); - - it("should not render if no warning level prop passed", () => { - const { queryByTestId } = render(); - - expect(queryByTestId("update-button")).not.toBeInTheDocument(); - }); - - it("should render if warning level prop passed", () => { - const { getByTestId } = render(); - - expect(getByTestId("update-button")).toMatchSnapshot(); - }); - - it("should open menu when clicked", async () => { - const { getByTestId } = render(); - - const button = getByTestId("update-button"); - - act(() => button.click()); - - expect(getByTestId("update-lens-menu-item")).toBeInTheDocument(); - }); - - it("should call update function when menu item clicked", () => { - const { getByTestId } = render(); - - const button = getByTestId("update-button"); - - act(() => button.click()); - - const menuItem = getByTestId("update-lens-menu-item"); - - menuItem.click(); - - expect(update).toHaveBeenCalled(); - }); - - it("should have light warning level", () => { - const { getByTestId } = render(); - - const button = getByTestId("update-button"); - - expect(button.dataset.warningLevel).toBe("light"); - }); - - it("should have medium warning level", () => { - const { getByTestId } = render(); - - const button = getByTestId("update-button"); - - expect(button.dataset.warningLevel).toBe("medium"); - }); - - it("should have high warning level", () => { - const { getByTestId } = render(); - - const button = getByTestId("update-button"); - - expect(button.dataset.warningLevel).toBe("high"); - }); -}); diff --git a/src/renderer/components/update-button/restart-and-install-update.injectable.ts b/src/renderer/components/update-button/restart-and-install-update.injectable.ts new file mode 100644 index 0000000000..854e0a428f --- /dev/null +++ b/src/renderer/components/update-button/restart-and-install-update.injectable.ts @@ -0,0 +1,22 @@ +/** + * 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 restartAndInstallUpdateChannel from "../../../common/application-update/restart-and-install-update-channel/restart-and-install-update-channel.injectable"; +import messageToChannelInjectable from "../../utils/channel/message-to-channel.injectable"; + +const restartAndInstallUpdateInjectable = getInjectable({ + id: "restart-and-install-update", + + instantiate: (di) => { + const messageToChannel = di.inject(messageToChannelInjectable); + const channel = di.inject(restartAndInstallUpdateChannel); + + return () => { + messageToChannel(channel); + }; + }, +}); + +export default restartAndInstallUpdateInjectable; diff --git a/src/renderer/components/update-button/styles.module.scss b/src/renderer/components/update-button/styles.module.scss index ad4d39a7dd..14b607327b 100644 --- a/src/renderer/components/update-button/styles.module.scss +++ b/src/renderer/components/update-button/styles.module.scss @@ -11,7 +11,7 @@ color: var(--accent-color); display: flex; align-items: center; - padding: 4px 8px; + padding: calc(var(--padding) / 4) var(--padding); gap: 6px; cursor: default; position: relative; diff --git a/src/renderer/components/update-button/update-button.tsx b/src/renderer/components/update-button/update-button.tsx index 6da453de3d..029b58f3fe 100644 --- a/src/renderer/components/update-button/update-button.tsx +++ b/src/renderer/components/update-button/update-button.tsx @@ -11,22 +11,30 @@ import { Menu, MenuItem } from "../menu"; import { cssNames } from "../../utils"; import type { IconProps } from "../icon"; import { Icon } from "../icon"; +import { withInjectables } from "@ogre-tools/injectable-react"; +import { observer } from "mobx-react"; +import type { IComputedValue } from "mobx"; +import restartAndInstallUpdateInjectable from "./restart-and-install-update.injectable"; +import updateWarningLevelInjectable from "./update-warning-level.injectable"; -interface UpdateButtonProps extends HTMLAttributes { - warningLevel?: "light" | "medium" | "high"; +interface UpdateButtonProps extends HTMLAttributes {} + +interface Dependencies { + warningLevel: IComputedValue<"light" | "medium" | "high" | "">; update: () => void; } -export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) { +export const NonInjectedUpdateButton = observer(({ warningLevel, update, id }: UpdateButtonProps & Dependencies) => { const buttonId = id ?? "update-lens-button"; const menuIconProps: IconProps = { material: "update", small: true }; const [opened, setOpened] = useState(false); + const level = warningLevel.get(); const toggle = () => { setOpened(!opened); }; - if (!warningLevel) { + if (!level) { return null; } @@ -34,11 +42,11 @@ export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) { <>