mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Convert runMany and runManySync to use injectManyWithMeta + move to seperate package (#7244)
* Convert runMany and runManySync to use injectManyWithMeta Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors due to new Runnable requirements Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add documentation for verifyRunnablesAreDAG Signed-off-by: Sebastian Malton <sebastian@malton.name> * Simplify convertToWithIdWith Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move all utility functions to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move testing utilities to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move run-many and run-many-sync to separate package Signed-off-by: Sebastian Malton <sebastian@malton.name> * Replace all internal uses of utilities with new packages Signed-off-by: Sebastian Malton <sebastian@malton.name> * Use new @k8slens/run-many package in core Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add dep to open-lens Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of @k8slens/test-utils Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup getGlobalOverride Signed-off-by: Sebastian Malton <sebastian@malton.name> * Move tests to new package too Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix type errors Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup uses of AsyncResult and autoBind Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fixup remaining import issues Signed-off-by: Sebastian Malton <sebastian@malton.name> * Finial fixups to fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix lint Signed-off-by: Sebastian Malton <sebastian@malton.name> * Revert moving "testUsingFakeTime" to separate package - This fixes tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix integration tests Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix unit test failing due to spelling fix Signed-off-by: Sebastian Malton <sebastian@malton.name> --------- Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
ad9bafe2a5
commit
2789bcebcb
754 files changed
+2715
-2752
No files matched your search
@@ -5,7 +5,7 @@
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import populateApplicationMenuInjectable from "./main/populate-application-menu.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import { getCompositePaths } from "../../common/utils/composite/get-composite-paths/get-composite-paths";
|
||||
import platformInjectable, { allPlatforms } from "../../common/vars/platform.injectable";
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
import populateApplicationMenuInjectable from "./main/populate-application-menu.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import { getCompositePaths } from "../../common/utils/composite/get-composite-paths/get-composite-paths";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import applicationMenuItemInjectionToken from "./main/menu-items/application-menu-item-injection-token";
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import { applicationInformationToken } from "@k8slens/application";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { bundledExtensionInjectionToken } from "../../../../../../common/library";
|
||||
import { object } from "../../../../../../common/utils";
|
||||
import { object } from "@k8slens/utilities";
|
||||
import buildSemanticVersionInjectable from "../../../../../../common/vars/build-semantic-version.injectable";
|
||||
|
||||
const specificVersionsInjectable = getInjectable({
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import populateApplicationMenuInjectable from "./populate-application-menu.injectable";
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
|
||||
export default getGlobalOverride(populateApplicationMenuInjectable, () => () => {});
|
||||
+6
-11
@@ -9,18 +9,13 @@ import { onLoadOfApplicationInjectionToken } from "@k8slens/application";
|
||||
const startApplicationMenuInjectable = getInjectable({
|
||||
id: "start-application-menu",
|
||||
|
||||
instantiate: (di) => {
|
||||
const applicationMenu = di.inject(
|
||||
applicationMenuReactivityInjectable,
|
||||
);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const applicationMenu = di.inject(applicationMenuReactivityInjectable);
|
||||
|
||||
return {
|
||||
id: "start-application-menu",
|
||||
run: () => {
|
||||
applicationMenu.start();
|
||||
},
|
||||
};
|
||||
},
|
||||
applicationMenu.start();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
+9
-8
@@ -4,19 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import applicationMenuReactivityInjectable from "./application-menu-reactivity.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../main/start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopApplicationMenuInjectable = getInjectable({
|
||||
id: "stop-application-menu",
|
||||
|
||||
instantiate: (di) => {
|
||||
const applicationMenu = di.inject(applicationMenuReactivityInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const applicationMenu = di.inject(applicationMenuReactivityInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-application-menu",
|
||||
run: () => void applicationMenu.stop(),
|
||||
};
|
||||
},
|
||||
applicationMenu.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import type { DownloadPlatformUpdate } from "./main/download-update/download-pla
|
||||
import downloadPlatformUpdateInjectable from "./main/download-update/download-platform-update/download-platform-update.injectable";
|
||||
import quitAndInstallUpdateInjectable from "./main/quit-and-install-update.injectable";
|
||||
import periodicalCheckForUpdatesInjectable from "./child-features/periodical-checking-of-updates/main/periodical-check-for-updates.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import emitEventInjectable from "../../common/app-event-bus/emit-event.injectable";
|
||||
import getBuildVersionInjectable from "../../main/vars/build-version/get-build-version.injectable";
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import type { ApplicationBuilder } from "../../../../renderer/components/test-ut
|
||||
import { getApplicationBuilder } from "../../../../renderer/components/test-utils/get-application-builder";
|
||||
import processCheckingForUpdatesInjectable from "../../main/process-checking-for-updates.injectable";
|
||||
import quitAndInstallUpdateInjectable from "../../main/quit-and-install-update.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../../../common/test-utils/use-fake-time";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../../../test-utils/use-fake-time";
|
||||
|
||||
function daysToMilliseconds(days: number) {
|
||||
return Math.round(days * 24 * 60 * 60 * 1000);
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import styles from "./styles.module.scss";
|
||||
import type { HTMLAttributes } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { Menu, MenuItem } from "../../../../../../../renderer/components/menu";
|
||||
import { cssNames } from "../../../../../../../renderer/utils";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import type { IconProps } from "../../../../../../../renderer/components/icon";
|
||||
import { Icon } from "../../../../../../../renderer/components/icon";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
|
||||
+1
-1
@@ -14,11 +14,11 @@ import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import processCheckingForUpdatesInjectable from "../../main/process-checking-for-updates.injectable";
|
||||
import type { RenderResult } from "@testing-library/react";
|
||||
import { fireEvent } from "@testing-library/react";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../../../common/test-utils/use-fake-time";
|
||||
import quitAndInstallUpdateInjectable from "../../main/quit-and-install-update.injectable";
|
||||
import timeAfterUpdateMustBeInstalledInjectable from "./renderer/force-update-modal/time-after-update-must-be-installed.injectable";
|
||||
import secondsAfterInstallStartsInjectable from "./renderer/force-update-modal/seconds-after-install-starts.injectable";
|
||||
import forceUpdateModalRootFrameComponentInjectable from "./renderer/force-update-modal/force-update-modal-root-frame-component.injectable";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../../../test-utils/use-fake-time";
|
||||
|
||||
const TIME_AFTER_UPDATE_MUST_BE_INSTALLED = 1000;
|
||||
const TIME_AFTER_INSTALL_STARTS = 5 * 1000;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { computed } from "mobx";
|
||||
import { getGlobalOverride } from "../../../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import forceUpdateModalRootFrameComponentInjectable from "./force-update-modal-root-frame-component.injectable";
|
||||
|
||||
export default getGlobalOverride(
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import periodicalCheckForUpdatesInjectable from "./periodical-check-for-updates.injectable";
|
||||
import { getGlobalOverride } from "../../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
|
||||
export default getGlobalOverride(periodicalCheckForUpdatesInjectable, () => ({
|
||||
start: () => {},
|
||||
|
||||
+9
-12
@@ -10,19 +10,16 @@ import { afterApplicationIsLoadedInjectionToken } from "@k8slens/application";
|
||||
const startCheckingForUpdatesInjectable = getInjectable({
|
||||
id: "start-checking-for-updates",
|
||||
|
||||
instantiate: (di) => {
|
||||
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
||||
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
||||
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
||||
|
||||
return {
|
||||
id: "start-checking-for-updates",
|
||||
run: () => {
|
||||
if (updatingIsEnabled && !periodicalCheckForUpdates.started) {
|
||||
periodicalCheckForUpdates.start();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
if (updatingIsEnabled && !periodicalCheckForUpdates.started) {
|
||||
periodicalCheckForUpdates.start();
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterApplicationIsLoadedInjectionToken,
|
||||
});
|
||||
|
||||
+10
-13
@@ -4,25 +4,22 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import periodicalCheckForUpdatesInjectable from "./periodical-check-for-updates.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../../../main/start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopCheckingForUpdatesInjectable = getInjectable({
|
||||
id: "stop-checking-for-updates",
|
||||
|
||||
instantiate: (di) => {
|
||||
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-checking-for-updates",
|
||||
run: () => {
|
||||
if (periodicalCheckForUpdates.started) {
|
||||
periodicalCheckForUpdates.stop();
|
||||
}
|
||||
if (periodicalCheckForUpdates.started) {
|
||||
periodicalCheckForUpdates.stop();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import electronUpdaterIsActiveInjectable from "../../../../main/electron-app/fea
|
||||
import publishIsConfiguredInjectable from "../../main/updating-is-enabled/publish-is-configured/publish-is-configured.injectable";
|
||||
import processCheckingForUpdatesInjectable from "../../main/process-checking-for-updates.injectable";
|
||||
import periodicalCheckForUpdatesInjectable from "./main/periodical-check-for-updates.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../../../common/test-utils/use-fake-time";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../../../test-utils/use-fake-time";
|
||||
|
||||
const ENOUGH_TIME = 1000 * 60 * 60 * 2;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { DownloadPlatformUpdate } from "./main/download-update/download-pla
|
||||
import downloadPlatformUpdateInjectable from "./main/download-update/download-platform-update/download-platform-update.injectable";
|
||||
import setUpdateOnQuitInjectable from "../../main/electron-app/features/set-update-on-quit.injectable";
|
||||
import processCheckingForUpdatesInjectable from "./main/process-checking-for-updates.injectable";
|
||||
import { testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import staticFilesDirectoryInjectable from "../../common/vars/static-files-directory.injectable";
|
||||
|
||||
describe("installing update", () => {
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import checkForPlatformUpdatesInjectable from "./check-for-platform-updates.injectable";
|
||||
import { getGlobalOverrideForFunction } from "../../../../../common/test-utils/get-global-override-for-function";
|
||||
import { getGlobalOverrideForFunction } from "@k8slens/test-utils";
|
||||
|
||||
export default getGlobalOverrideForFunction(checkForPlatformUpdatesInjectable);
|
||||
+2
-2
@@ -10,9 +10,9 @@ import type { AppUpdater, UpdateCheckResult } from "electron-updater";
|
||||
import type { CheckForPlatformUpdates } from "./check-for-platform-updates.injectable";
|
||||
import checkForPlatformUpdatesInjectable from "./check-for-platform-updates.injectable";
|
||||
import type { UpdateChannel, ReleaseChannel } from "../../../common/update-channels";
|
||||
import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status";
|
||||
import { getPromiseStatus } from "@k8slens/test-utils";
|
||||
import loggerInjectable from "../../../../../common/logger.injectable";
|
||||
import { noop } from "../../../../../common/utils";
|
||||
import { noop } from "@k8slens/utilities";
|
||||
|
||||
describe("check-for-platform-updates", () => {
|
||||
let checkForPlatformUpdates: CheckForPlatformUpdates;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getGlobalOverrideForFunction } from "../../../../../common/test-utils/get-global-override-for-function";
|
||||
import { getGlobalOverrideForFunction } from "@k8slens/test-utils";
|
||||
import downloadPlatformUpdateInjectable from "./download-platform-update.injectable";
|
||||
|
||||
export default getGlobalOverrideForFunction(downloadPlatformUpdateInjectable);
|
||||
+2
-2
@@ -9,10 +9,10 @@ import downloadPlatformUpdateInjectable from "./download-platform-update.injecta
|
||||
import type { AppUpdater } from "electron-updater";
|
||||
import type { AsyncFnMock } from "@async-fn/jest";
|
||||
import asyncFn from "@async-fn/jest";
|
||||
import { getPromiseStatus } from "../../../../../common/test-utils/get-promise-status";
|
||||
import { getPromiseStatus } from "@k8slens/test-utils";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../../../common/logger.injectable";
|
||||
import { noop } from "../../../../../common/utils";
|
||||
import { noop } from "@k8slens/utilities";
|
||||
|
||||
describe("download-platform-update", () => {
|
||||
let downloadPlatformUpdate: DownloadPlatformUpdate;
|
||||
|
||||
+14
-17
@@ -11,25 +11,22 @@ import buildVersionInjectable from "../../../main/vars/build-version/build-versi
|
||||
const emitCurrentVersionToAnalyticsInjectable = getInjectable({
|
||||
id: "emit-current-version-to-analytics",
|
||||
|
||||
instantiate: (di) => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
|
||||
return {
|
||||
id: "emit-current-version-to-analytics",
|
||||
run: () => {
|
||||
emitAppEvent({
|
||||
name: "app",
|
||||
action: "current-version",
|
||||
emitAppEvent({
|
||||
name: "app",
|
||||
action: "current-version",
|
||||
|
||||
params: {
|
||||
version: buildVersion.get(),
|
||||
currentDateTime: getCurrentDateTime(),
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
params: {
|
||||
version: buildVersion.get(),
|
||||
currentDateTime: getCurrentDateTime(),
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterApplicationIsLoadedInjectionToken,
|
||||
});
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getGlobalOverride } from "../../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import publishIsConfiguredInjectable from "./publish-is-configured.injectable";
|
||||
|
||||
export default getGlobalOverride(publishIsConfiguredInjectable, () => false);
|
||||
+6
-9
@@ -9,16 +9,13 @@ import watchIfUpdateShouldHappenOnQuitInjectable from "./watch-if-update-should-
|
||||
const startWatchingIfUpdateShouldHappenOnQuitInjectable = getInjectable({
|
||||
id: "start-watching-if-update-should-happen-on-quit",
|
||||
|
||||
instantiate: (di) => {
|
||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||
|
||||
return {
|
||||
id: "start-watching-if-update-should-happen-on-quit",
|
||||
run: () => {
|
||||
watchIfUpdateShouldHappenOnQuit.start();
|
||||
},
|
||||
};
|
||||
},
|
||||
watchIfUpdateShouldHappenOnQuit.start();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
+9
-8
@@ -4,19 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import watchIfUpdateShouldHappenOnQuitInjectable from "./watch-if-update-should-happen-on-quit.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../../main/start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopWatchingIfUpdateShouldHappenOnQuitInjectable = getInjectable({
|
||||
id: "stop-watching-if-update-should-happen-on-quit",
|
||||
|
||||
instantiate: (di) => {
|
||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-watching-if-update-should-happen-on-quit",
|
||||
run: () => void watchIfUpdateShouldHappenOnQuit.stop(),
|
||||
};
|
||||
},
|
||||
watchIfUpdateShouldHappenOnQuit.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@@ -12,8 +12,8 @@ import type { CatalogEntityActionContext } from "../../common/catalog";
|
||||
import { CatalogCategory, categoryVersion, CatalogEntity } from "../../common/catalog";
|
||||
import catalogCategoryRegistryInjectable from "../../common/catalog/category-registry.injectable";
|
||||
import navigateToCatalogInjectable from "../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import { flushPromises } from "../../common/test-utils/flush-promises";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import type { CatalogEntityOnBeforeRun, CatalogEntityRegistry } from "../../renderer/api/catalog/entity/registry";
|
||||
import catalogEntityRegistryInjectable from "../../renderer/api/catalog/entity/registry.injectable";
|
||||
import type { ApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
@@ -9,7 +9,7 @@ import { KubernetesCluster, WebLink } from "../../common/catalog-entities";
|
||||
import getClusterByIdInjectable from "../../common/cluster-store/get-by-id.injectable";
|
||||
import { Cluster } from "../../common/cluster/cluster";
|
||||
import navigateToCatalogInjectable from "../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
import catalogEntityRegistryInjectable from "../../renderer/api/catalog/entity/registry.injectable";
|
||||
import showEntityDetailsInjectable from "../../renderer/components/+catalog/entity-details/show.injectable";
|
||||
import { type ApplicationBuilder, getApplicationBuilder } from "../../renderer/components/test-utils/get-application-builder";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import { casChannel } from "../common/channel";
|
||||
import certificateAuthoritiesChannelListenerInjectable from "./channel-handler.injectable";
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import { getRequestChannelListenerInjectable } from "../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
import { casChannel } from "../common/channel";
|
||||
import { globalAgent } from "https";
|
||||
import { isString } from "../../../common/utils";
|
||||
import { isString } from "@k8slens/utilities";
|
||||
|
||||
const certificateAuthoritiesChannelListenerInjectable = getRequestChannelListenerInjectable({
|
||||
channel: casChannel,
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import execFileInjectable from "../../../common/fs/exec-file.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import type { AsyncResult } from "../../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
import { requestSystemCAsInjectionToken } from "../common/request-system-cas-token";
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet#other_assertions
|
||||
@@ -17,7 +17,7 @@ const requestSystemCAsInjectable = getInjectable({
|
||||
const execFile = di.inject(execFileInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
|
||||
const execSecurity = async (...args: string[]): Promise<AsyncResult<string[]>> => {
|
||||
const execSecurity = async (...args: string[]): AsyncResult<string[]> => {
|
||||
const result = await execFile("/usr/bin/security", args);
|
||||
|
||||
if (!result.callWasSuccessful) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Cluster } from "../../../common/cluster/cluster";
|
||||
import navigateToCatalogInjectable from "../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
import { advanceFakeTime } from "../../../common/test-utils/use-fake-time";
|
||||
import { advanceFakeTime } from "../../../test-utils/use-fake-time";
|
||||
|
||||
const currentClusterServerUrl = "https://localhost";
|
||||
const nonCurrentClusterServerUrl = "http://localhost";
|
||||
|
||||
+1
-1
@@ -8,8 +8,8 @@ import clusterStoreInjectable from "../../../../common/cluster-store/cluster-sto
|
||||
import directoryForLensLocalStorageInjectable from "../../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||
import removePathInjectable from "../../../../common/fs/remove.injectable";
|
||||
import joinPathsInjectable from "../../../../common/path/join-paths.injectable";
|
||||
import { noop } from "../../../../common/utils";
|
||||
import clusterConnectionInjectable from "../../../../main/cluster/cluster-connection.injectable";
|
||||
import { noop } from "@k8slens/utilities";
|
||||
import { getRequestChannelListenerInjectable } from "../../../../main/utils/channel/channel-listeners/listener-tokens";
|
||||
import { deleteClusterChannel } from "../common/delete-channel";
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,6 @@
|
||||
import { KubeObjectStatusLevel } from "../../../common/k8s-api/kube-object-status";
|
||||
import { KubeObject } from "../../../common/k8s-api/kube-object";
|
||||
import React from "react";
|
||||
import { testUsingFakeTime } from "../../../common/test-utils/use-fake-time";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { IAtom } from "mobx";
|
||||
@@ -20,6 +19,7 @@ import { act } from "@testing-library/react";
|
||||
import { observer } from "mobx-react";
|
||||
import { kubeObjectStatusTextInjectionToken } from "../../../renderer/components/kube-object-status-icon/kube-object-status-text-injection-token";
|
||||
import { KubeObjectStatusIcon } from "../../../renderer/components/kube-object-status-icon";
|
||||
import { testUsingFakeTime } from "../../../test-utils/use-fake-time";
|
||||
|
||||
describe("show status for a kube object", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
@@ -20,9 +20,9 @@ import writeJsonFileInjectable from "../../common/fs/write-json-file.injectable"
|
||||
import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import storageSaveDelayInjectable from "../../renderer/utils/create-storage/storage-save-delay.injectable";
|
||||
import { flushPromises } from "../../common/test-utils/flush-promises";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for core", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
+2
-2
@@ -15,13 +15,13 @@ import pathExistsInjectable from "../../common/fs/path-exists.injectable";
|
||||
import readJsonFileInjectable from "../../common/fs/read-json-file.injectable";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import assert from "assert";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import type { IObservableValue } from "mobx";
|
||||
import { runInAction, computed, observable } from "mobx";
|
||||
import storageSaveDelayInjectable from "../../renderer/utils/create-storage/storage-save-delay.injectable";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { flushPromises } from "../../common/test-utils/flush-promises";
|
||||
import type { ClusterPageMenuRegistration } from "../../extensions/common-api/types";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("cluster - sidebar and tab navigation for extensions", () => {
|
||||
let applicationBuilder: ApplicationBuilder;
|
||||
|
||||
@@ -14,7 +14,6 @@ import emitClusterStateUpdateInjectable from "./emit-update.injectable";
|
||||
const setupClusterStateBroadcastingInjectable = getInjectable({
|
||||
id: "setup-cluster-state-broadcasting",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-cluster-state-broadcasting",
|
||||
run: () => {
|
||||
const emitClusterStateUpdate = di.inject(emitClusterStateUpdateInjectable);
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
@@ -36,7 +35,7 @@ const setupClusterStateBroadcastingInjectable = getInjectable({
|
||||
}
|
||||
});
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
runAfter: initClusterStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
@@ -11,17 +11,16 @@ import requestInitialClusterStatesInjectable from "./request-initial.injectable"
|
||||
const setupClusterStateSyncInjectable = getInjectable({
|
||||
id: "setup-cluster-state-sync",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-cluster-state-sync",
|
||||
run: async () => {
|
||||
const requestInitialClusterStates = di.inject(requestInitialClusterStatesInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
const initalStates = await requestInitialClusterStates();
|
||||
const initialStates = await requestInitialClusterStates();
|
||||
|
||||
for (const { clusterId, state } of initalStates) {
|
||||
for (const { clusterId, state } of initialStates) {
|
||||
getClusterById(clusterId)?.setState(state);
|
||||
}
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
runAfter: initClusterStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
@@ -9,17 +9,14 @@ import initUserStoreInjectable from "../../../../main/stores/init-user-store.inj
|
||||
|
||||
const initClusterStoreInjectable = getInjectable({
|
||||
id: "init-cluster-store",
|
||||
instantiate: (di) => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
};
|
||||
},
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: initUserStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@ import initUserStoreInjectable from "../../../../renderer/stores/init-user-store
|
||||
const initClusterStoreInjectable = getInjectable({
|
||||
id: "init-cluster-store",
|
||||
instantiate: (di) => ({
|
||||
id: "init-cluster-store",
|
||||
run: () => {
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
|
||||
clusterStore.load();
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
runAfter: initUserStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
@@ -9,7 +9,6 @@ import { onLoadOfApplicationInjectionToken } from "@k8slens/application";
|
||||
const initFileSystemProvisionerStoreInjectable = getInjectable({
|
||||
id: "init-file-system-provisioner-store",
|
||||
instantiate: (di) => ({
|
||||
id: "init-file-system-provisioner-store",
|
||||
run: () => {
|
||||
const store = di.inject(fileSystemProvisionerStoreInjectable);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../../../renderer/before-
|
||||
const initFileSystemProvisionerStoreInjectable = getInjectable({
|
||||
id: "init-file-system-provisioner-store",
|
||||
instantiate: (di) => ({
|
||||
id: "init-file-system-provisioner-store",
|
||||
run: () => {
|
||||
const store = di.inject(fileSystemProvisionerStoreInjectable);
|
||||
|
||||
|
||||
+3
-3
@@ -17,8 +17,8 @@ import requestPublicHelmRepositoriesInjectable from "./child-features/preference
|
||||
import isPathInjectable from "../../renderer/components/input/validators/is-path.injectable";
|
||||
import showSuccessNotificationInjectable from "../../renderer/components/notifications/show-success-notification.injectable";
|
||||
import showErrorNotificationInjectable from "../../renderer/components/notifications/show-error-notification.injectable";
|
||||
import type { AsyncResult } from "../../common/utils/async-result";
|
||||
import { testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
import { testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("add custom helm repository in preferences", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
@@ -26,7 +26,7 @@ describe("add custom helm repository in preferences", () => {
|
||||
let showErrorNotificationMock: jest.Mock;
|
||||
let rendered: RenderResult;
|
||||
let execFileMock: AsyncFnMock<ExecFile>;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => Promise<AsyncResult<HelmRepo[]>>>;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => AsyncResult<HelmRepo[]>>;
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import type { HelmRepo } from "../../common/helm/helm-repo";
|
||||
import requestPublicHelmRepositoriesInjectable from "./child-features/preferences/renderer/adding-of-public-helm-repository/public-helm-repositories/request-public-helm-repositories.injectable";
|
||||
import showSuccessNotificationInjectable from "../../renderer/components/notifications/show-success-notification.injectable";
|
||||
import showErrorNotificationInjectable from "../../renderer/components/notifications/show-error-notification.injectable";
|
||||
import type { AsyncResult } from "../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
|
||||
describe("add helm repository from list in preferences", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
@@ -23,7 +23,7 @@ describe("add helm repository from list in preferences", () => {
|
||||
let showErrorNotificationMock: jest.Mock;
|
||||
let rendered: RenderResult;
|
||||
let execFileMock: AsyncFnMock<ExecFile>;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => Promise<AsyncResult<HelmRepo[]>>>;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => AsyncResult<HelmRepo[]>>;
|
||||
let callForPublicHelmRepositoriesMock: AsyncFnMock<() => Promise<HelmRepo[]>>;
|
||||
|
||||
beforeEach(async () => {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverrideForFunction } from "../../../../../../../common/test-utils/get-global-override-for-function";
|
||||
import { getGlobalOverrideForFunction } from "@k8slens/test-utils";
|
||||
import requestPublicHelmRepositoriesInjectable from "./request-public-helm-repositories.injectable";
|
||||
|
||||
export default getGlobalOverrideForFunction(requestPublicHelmRepositoriesInjectable);
|
||||
+1
-1
@@ -30,7 +30,7 @@ import type { RequestDetailedHelmRelease } from "../../../renderer/components/+h
|
||||
import requestDetailedHelmReleaseInjectable from "../../../renderer/components/+helm-releases/release-details/release-details-model/request-detailed-helm-release.injectable";
|
||||
import type { RequestHelmReleases } from "../../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
|
||||
import requestHelmReleasesInjectable from "../../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
|
||||
import { flushPromises } from "../../../common/test-utils/flush-promises";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
|
||||
describe("installing helm chart from new tab", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { getApplicationBuilder } from "../../../renderer/components/test-utils/g
|
||||
import { HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.api";
|
||||
import getRandomInstallChartTabIdInjectable from "../../../renderer/components/dock/install-chart/get-random-install-chart-tab-id.injectable";
|
||||
import requestCreateHelmReleaseInjectable from "../../../common/k8s-api/endpoints/helm-releases.api/request-create.injectable";
|
||||
import { flushPromises } from "../../../common/test-utils/flush-promises";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import directoryForLensLocalStorageInjectable from "../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||
import hostedClusterIdInjectable from "../../../renderer/cluster-frame-context/hosted-cluster-id.injectable";
|
||||
import dockStoreInjectable from "../../../renderer/components/dock/dock/store.injectable";
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import loggerInjectable from "../../common/logger.injectable";
|
||||
import type { Logger } from "../../common/logger";
|
||||
import requestPublicHelmRepositoriesInjectable from "./child-features/preferences/renderer/adding-of-public-helm-repository/public-helm-repositories/request-public-helm-repositories.injectable";
|
||||
import showErrorNotificationInjectable from "../../renderer/components/notifications/show-error-notification.injectable";
|
||||
import { noop } from "../../common/utils";
|
||||
import { noop } from "@k8slens/utilities";
|
||||
|
||||
describe("listing active helm repositories in preferences", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
+2
-2
@@ -14,12 +14,12 @@ import helmBinaryPathInjectable from "../../main/helm/helm-binary-path.injectabl
|
||||
import getActiveHelmRepositoriesInjectable from "../../main/helm/repositories/get-active-helm-repositories/get-active-helm-repositories.injectable";
|
||||
import type { HelmRepo } from "../../common/helm/helm-repo";
|
||||
import requestPublicHelmRepositoriesInjectable from "./child-features/preferences/renderer/adding-of-public-helm-repository/public-helm-repositories/request-public-helm-repositories.injectable";
|
||||
import type { AsyncResult } from "../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
|
||||
describe("remove helm repository from list of active repositories in preferences", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
let rendered: RenderResult;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => Promise<AsyncResult<HelmRepo[]>>>;
|
||||
let getActiveHelmRepositoriesMock: AsyncFnMock<() => AsyncResult<HelmRepo[]>>;
|
||||
let execFileMock: AsyncFnMock<ExecFile>;
|
||||
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -17,10 +17,10 @@ import type { RequestHelmReleaseConfiguration } from "../../../common/k8s-api/en
|
||||
import requestHelmReleaseConfigurationInjectable from "../../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
|
||||
import type { RequestHelmReleases } from "../../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
|
||||
import requestHelmReleasesInjectable from "../../../common/k8s-api/endpoints/helm-releases.api/request-releases.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../../common/test-utils/use-fake-time";
|
||||
import dockStoreInjectable from "../../../renderer/components/dock/dock/store.injectable";
|
||||
import type { ApplicationBuilder } from "../../../renderer/components/test-utils/get-application-builder";
|
||||
import { getApplicationBuilder } from "../../../renderer/components/test-utils/get-application-builder";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../../test-utils/use-fake-time";
|
||||
|
||||
describe("New Upgrade Helm Chart Dock Tab", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
@@ -15,7 +15,6 @@ import type { RequestHelmReleaseConfiguration } from "../../common/k8s-api/endpo
|
||||
import requestHelmReleaseConfigurationInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-configuration.injectable";
|
||||
import type { RequestHelmReleaseUpdate } from "../../common/k8s-api/endpoints/helm-releases.api/request-update.injectable";
|
||||
import requestHelmReleaseUpdateInjectable from "../../common/k8s-api/endpoints/helm-releases.api/request-update.injectable";
|
||||
import { testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import type { RequestDetailedHelmRelease } from "../../renderer/components/+helm-releases/release-details/release-details-model/request-detailed-helm-release.injectable";
|
||||
import requestDetailedHelmReleaseInjectable from "../../renderer/components/+helm-releases/release-details/release-details-model/request-detailed-helm-release.injectable";
|
||||
import showSuccessNotificationInjectable from "../../renderer/components/notifications/show-success-notification.injectable";
|
||||
@@ -30,6 +29,7 @@ import requestHelmChartVersionsInjectable from "../../common/k8s-api/endpoints/h
|
||||
import requestHelmChartReadmeInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-readme.injectable";
|
||||
import requestHelmChartValuesInjectable from "../../common/k8s-api/endpoints/helm-charts.api/request-values.injectable";
|
||||
import { HelmChart } from "../../common/k8s-api/endpoints/helm-charts.api";
|
||||
import { testUsingFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("showing details for helm release", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
@@ -9,17 +9,14 @@ import setupSyncingOfGeneralCatalogEntitiesInjectable from "../../../../main/sta
|
||||
|
||||
const initHotbarStoreInjectable = getInjectable({
|
||||
id: "init-hotbar-store",
|
||||
instantiate: (di) => {
|
||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "init-hotbar-store",
|
||||
run: () => {
|
||||
hotbarStore.load();
|
||||
},
|
||||
runAfter: di.inject(setupSyncingOfGeneralCatalogEntitiesInjectable),
|
||||
};
|
||||
},
|
||||
hotbarStore.load();
|
||||
},
|
||||
runAfter: setupSyncingOfGeneralCatalogEntitiesInjectable,
|
||||
}),
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -10,13 +10,12 @@ import initClusterStoreInjectable from "../../../cluster/store/renderer/init.inj
|
||||
const initHotbarStoreInjectable = getInjectable({
|
||||
id: "init-hotbar-store",
|
||||
instantiate: (di) => ({
|
||||
id: "init-hotbar-store",
|
||||
run: () => {
|
||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||
|
||||
hotbarStore.load();
|
||||
},
|
||||
runAfter: di.inject(initClusterStoreInjectable),
|
||||
runAfter: initClusterStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import { reloadPageChannel } from "../common/channel";
|
||||
import reloadPageChannelListenerInjectable from "./register-listener.injectable";
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { generalCatalogEntityInjectionToken } from "../../../common/catalog-entities/general-catalog-entities/general-catalog-entity-injection-token";
|
||||
import { GeneralEntity } from "../../../common/catalog-entities";
|
||||
import { buildURL } from "../../../common/utils/buildUrl";
|
||||
import { buildURL } from "@k8slens/utilities";
|
||||
import preferencesRouteInjectable from "./preferences-route.injectable";
|
||||
|
||||
const preferencesCatalogEntityInjectable = getInjectable({
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import React from "react";
|
||||
import { Notice } from "../../../../../../renderer/components/+extensions/notice";
|
||||
import type { UserStore } from "../../../../../../common/user-store";
|
||||
import { iter, tuple } from "../../../../../../renderer/utils";
|
||||
import { iter, tuple } from "@k8slens/utilities";
|
||||
import { SubTitle } from "../../../../../../renderer/components/layout/sub-title";
|
||||
import { PathPicker } from "../../../../../../renderer/components/path-picker/path-picker";
|
||||
import { Spinner } from "../../../../../../renderer/components/spinner";
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getGlobalOverride } from "../../../../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import defaultShellInjectable from "./default-shell.injectable";
|
||||
|
||||
export default getGlobalOverride(
|
||||
|
||||
@@ -7,7 +7,7 @@ import styles from "./removable-item.module.scss";
|
||||
import type { DOMAttributes } from "react";
|
||||
import React from "react";
|
||||
|
||||
import { cssNames } from "../../../../renderer/utils";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Icon } from "../../../../renderer/components/icon";
|
||||
|
||||
export interface RemovableItemProps extends DOMAttributes<any>{
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import type { ClusterManager } from "../../main/cluster/manager";
|
||||
import exitAppInjectable from "../../main/electron-app/features/exit-app.injectable";
|
||||
import clusterManagerInjectable from "../../main/cluster/manager.injectable";
|
||||
import stopServicesAndExitAppInjectable from "../../main/stop-services-and-exit-app.injectable";
|
||||
import { advanceFakeTime, testUsingFakeTime } from "../../common/test-utils/use-fake-time";
|
||||
import { testUsingFakeTime, advanceFakeTime } from "../../test-utils/use-fake-time";
|
||||
|
||||
describe("quitting the app using application menu", () => {
|
||||
describe("given application has started", () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getApplicationBuilder } from "../../renderer/components/test-utils/get-
|
||||
import type { ResolveSystemProxy } from "../../common/utils/resolve-system-proxy/resolve-system-proxy-injection-token";
|
||||
import { resolveSystemProxyInjectionToken } from "../../common/utils/resolve-system-proxy/resolve-system-proxy-injection-token";
|
||||
import resolveSystemProxyFromElectronInjectable from "../../main/utils/resolve-system-proxy/resolve-system-proxy-from-electron.injectable";
|
||||
import { getPromiseStatus } from "../../common/test-utils/get-promise-status";
|
||||
import { getPromiseStatus } from "@k8slens/test-utils";
|
||||
|
||||
describe("resolve-system-proxy", () => {
|
||||
let builder: ApplicationBuilder;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import computeShellEnvironmentInjectable from "./compute-shell-environment.injectable";
|
||||
|
||||
export default getGlobalOverride(computeShellEnvironmentInjectable, () => async () => ({
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { AsyncResult } from "../../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import isWindowsInjectable from "../../../common/vars/is-windows.injectable";
|
||||
import computeUnixShellEnvironmentInjectable from "./compute-unix-shell-environment.injectable";
|
||||
|
||||
export type EnvironmentVariables = Partial<Record<string, string>>;
|
||||
export type ComputeShellEnvironment = (shell: string) => Promise<AsyncResult<EnvironmentVariables | undefined, string>>;
|
||||
export type ComputeShellEnvironment = (shell: string) => AsyncResult<EnvironmentVariables | undefined, string>;
|
||||
|
||||
const computeShellEnvironmentInjectable = getInjectable({
|
||||
id: "compute-shell-environment",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import computeUnixShellEnvironmentInjectable from "./compute-unix-shell-environment.injectable";
|
||||
|
||||
export default getGlobalOverride(computeUnixShellEnvironmentInjectable, () => async () => {
|
||||
|
||||
+10
-10
@@ -10,14 +10,14 @@ import randomUUIDInjectable from "../../../main/crypto/random-uuid.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import processExecPathInjectable from "./execPath.injectable";
|
||||
import processEnvInjectable from "./env.injectable";
|
||||
import { object } from "../../../common/utils";
|
||||
import type { AsyncResult } from "../../../common/utils/async-result";
|
||||
import { object } from "@k8slens/utilities";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
|
||||
export interface UnixShellEnvOptions {
|
||||
signal: AbortSignal;
|
||||
}
|
||||
|
||||
export type ComputeUnixShellEnvironment = (shell: string, opts: UnixShellEnvOptions) => Promise<AsyncResult<EnvironmentVariables, string>>;
|
||||
export type ComputeUnixShellEnvironment = (shell: string, opts: UnixShellEnvOptions) => AsyncResult<EnvironmentVariables, string>;
|
||||
|
||||
/**
|
||||
* @param src The object containing the current environment variables
|
||||
@@ -36,9 +36,9 @@ const getResetProcessEnv = (src: Partial<Record<string, string>>, overrides: Par
|
||||
...overrides,
|
||||
},
|
||||
resetEnvPairs: (target) => {
|
||||
for (const [name, orginalValue] of originals) {
|
||||
if (typeof orginalValue === "string") {
|
||||
target[name] = orginalValue;
|
||||
for (const [name, originalValue] of originals) {
|
||||
if (typeof originalValue === "string") {
|
||||
target[name] = originalValue;
|
||||
} else {
|
||||
delete target[name];
|
||||
}
|
||||
@@ -61,7 +61,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
||||
const processExecPath = di.inject(processExecPathInjectable);
|
||||
const processEnv = di.inject(processEnvInjectable);
|
||||
|
||||
const getShellSpecifices = (shellName: string) => {
|
||||
const getShellSpecifics = (shellName: string) => {
|
||||
const mark = randomUUID().replace(/-/g, "");
|
||||
const regex = new RegExp(`${mark}(\\{.*\\})${mark}`);
|
||||
|
||||
@@ -100,7 +100,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
||||
TERM: "screen-256color-bce", // required for fish
|
||||
});
|
||||
const shellName = getBasenameOfPath(shellPath);
|
||||
const { command, shellArgs, regex } = getShellSpecifices(shellName);
|
||||
const { command, shellArgs, regex } = getShellSpecifics(shellName);
|
||||
|
||||
logger.info(`[UNIX-SHELL-ENV]: running against ${shellPath}`, { command, shellArgs });
|
||||
|
||||
@@ -143,7 +143,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
||||
if (code || signal) {
|
||||
return resolve({
|
||||
callWasSuccessful: false,
|
||||
error: `Shell did not exit sucessfully: ${getErrorContext({ code, signal })}`,
|
||||
error: `Shell did not exit successfully: ${getErrorContext({ code, signal })}`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ const computeUnixShellEnvironmentInjectable = getInjectable({
|
||||
if (!matchedOutput) {
|
||||
return resolve({
|
||||
callWasSuccessful: false,
|
||||
error: "Something has blocked the shell from producing the environement variables",
|
||||
error: "Something has blocked the shell from producing the environment variables",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import type { ChildProcessWithoutNullStreams } from "child_process";
|
||||
import EventEmitter from "events";
|
||||
import { flushPromises } from "../../../common/test-utils/flush-promises";
|
||||
import { flushPromises } from "@k8slens/test-utils";
|
||||
import type { Spawn } from "../../../main/child-process/spawn.injectable";
|
||||
import spawnInjectable from "../../../main/child-process/spawn.injectable";
|
||||
import randomUUIDInjectable from "../../../main/crypto/random-uuid.injectable";
|
||||
@@ -142,7 +142,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -155,7 +155,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -248,7 +248,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -261,7 +261,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -353,7 +353,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -366,7 +366,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -457,7 +457,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 1,\n "signal": null,\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -470,7 +470,7 @@ describe("computeUnixShellEnvironment technical tests", () => {
|
||||
it("should resolve with a failed call", async () => {
|
||||
await expect(unixShellEnv).resolves.toEqual({
|
||||
callWasSuccessful: false,
|
||||
error: 'Shell did not exit sucessfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
error: 'Shell did not exit successfully: {\n "code": 0,\n "signal": "SIGKILL",\n "stdout": "",\n "stderr": ""\n}',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,67 +5,66 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "@k8slens/application";
|
||||
import { unionPATHs } from "../../../common/utils/union-env-path";
|
||||
import isSnapPackageInjectable from "../../../common/vars/is-snap-package.injectable";
|
||||
import electronAppInjectable from "../../../main/electron-app/electron-app.injectable";
|
||||
import computeShellEnvironmentInjectable from "./compute-shell-environment.injectable";
|
||||
import userShellSettingInjectable from "../../../common/user-store/shell-setting.injectable";
|
||||
import emitShellSyncFailedInjectable from "./emit-failure.injectable";
|
||||
import { unionPATHs } from "@k8slens/utilities";
|
||||
|
||||
const setupShellInjectable = getInjectable({
|
||||
id: "setup-shell",
|
||||
|
||||
instantiate: (di) => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const isSnapPackage = di.inject(isSnapPackageInjectable);
|
||||
const electronApp = di.inject(electronAppInjectable);
|
||||
const resolvedUserShellSetting = di.inject(userShellSettingInjectable);
|
||||
const computeShellEnvironment = di.inject(computeShellEnvironmentInjectable);
|
||||
const emitShellSyncFailed = di.inject(emitShellSyncFailedInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const isSnapPackage = di.inject(isSnapPackageInjectable);
|
||||
const electronApp = di.inject(electronAppInjectable);
|
||||
const resolvedUserShellSetting = di.inject(userShellSettingInjectable);
|
||||
const computeShellEnvironment = di.inject(computeShellEnvironmentInjectable);
|
||||
const emitShellSyncFailed = di.inject(emitShellSyncFailedInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-shell",
|
||||
run: async (): Promise<void> => {
|
||||
logger.info("🐚 Syncing shell environment");
|
||||
logger.info("🐚 Syncing shell environment");
|
||||
|
||||
const result = await computeShellEnvironment(resolvedUserShellSetting.get());
|
||||
const result = await computeShellEnvironment(resolvedUserShellSetting.get());
|
||||
|
||||
if (!result.callWasSuccessful) {
|
||||
logger.error(`[SHELL-SYNC]: ${result.error}`);
|
||||
emitShellSyncFailed(result.error);
|
||||
if (!result.callWasSuccessful) {
|
||||
logger.error(`[SHELL-SYNC]: ${result.error}`);
|
||||
emitShellSyncFailed(result.error);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const env = result.response;
|
||||
const env = result.response;
|
||||
|
||||
if (!env) {
|
||||
return void logger.debug("[SHELL-SYNC]: nothing to do, env not special in shells");
|
||||
}
|
||||
if (!env) {
|
||||
logger.debug("[SHELL-SYNC]: nothing to do, env not special in shells");
|
||||
|
||||
if (!env.LANG) {
|
||||
// the LANG env var expects an underscore instead of electron's dash
|
||||
env.LANG = `${electronApp.getLocale().replace("-", "_")}.UTF-8`;
|
||||
} else if (!env.LANG.endsWith(".UTF-8")) {
|
||||
env.LANG += ".UTF-8";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSnapPackage) {
|
||||
// Prefer the synced PATH over the initial one
|
||||
process.env.PATH = unionPATHs(env.PATH ?? "", process.env.PATH ?? "");
|
||||
}
|
||||
if (!env.LANG) {
|
||||
// the LANG env var expects an underscore instead of electron's dash
|
||||
env.LANG = `${electronApp.getLocale().replace("-", "_")}.UTF-8`;
|
||||
} else if (!env.LANG.endsWith(".UTF-8")) {
|
||||
env.LANG += ".UTF-8";
|
||||
}
|
||||
|
||||
// The spread operator allows joining of objects. The precedence is last to first.
|
||||
process.env = {
|
||||
...env,
|
||||
...process.env,
|
||||
};
|
||||
if (!isSnapPackage) {
|
||||
// Prefer the synced PATH over the initial one
|
||||
process.env.PATH = unionPATHs(env.PATH ?? "", process.env.PATH ?? "");
|
||||
}
|
||||
|
||||
logger.info(`[SHELL-SYNC]: Synced shell env`);
|
||||
logger.debug(`[SHELL-SYNC]: updated env`, process.env);
|
||||
},
|
||||
};
|
||||
},
|
||||
// The spread operator allows joining of objects. The precedence is last to first.
|
||||
process.env = {
|
||||
...env,
|
||||
...process.env,
|
||||
};
|
||||
|
||||
logger.info(`[SHELL-SYNC]: Synced shell env`);
|
||||
logger.debug(`[SHELL-SYNC]: updated env`, process.env);
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { identity } from "lodash/fp";
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import telemetryDecoratorInjectable from "./telemetry-decorator.injectable";
|
||||
|
||||
export default getGlobalOverride(telemetryDecoratorInjectable, () => ({
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../../../../common/test-utils/get-global-override";
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import loadTerminalFontInjectable from "./load-font.injectable";
|
||||
|
||||
export default getGlobalOverride(loadTerminalFontInjectable, () => async () => {});
|
||||
@@ -10,7 +10,6 @@ import loadTerminalFontInjectable from "./load-font.injectable";
|
||||
const preloadTerminalFontsInjectable = getInjectable({
|
||||
id: "preload-terminal-fonts",
|
||||
instantiate: (di) => ({
|
||||
id: "preload-terminal-fonts",
|
||||
run: async () => {
|
||||
const terminalFonts = di.inject(terminalFontsInjectable);
|
||||
const loadTerminalFont = di.inject(loadTerminalFontInjectable);
|
||||
|
||||
+13
-16
@@ -10,23 +10,20 @@ import emitSystemThemeTypeUpdateInjectable from "./emit-update.injectable";
|
||||
|
||||
const setupSystemThemeTypeUpdaterEmitterInjectable = getInjectable({
|
||||
id: "setup-system-theme-type-updater-emitter",
|
||||
instantiate: (di) => {
|
||||
const operatingSystemTheme = di.inject(operatingSystemThemeInjectable);
|
||||
const emitSystemThemeTypeUpdate = di.inject(emitSystemThemeTypeUpdateInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const operatingSystemTheme = di.inject(operatingSystemThemeInjectable);
|
||||
const emitSystemThemeTypeUpdate = di.inject(emitSystemThemeTypeUpdateInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-system-theme-type-updater-emitter",
|
||||
run: () => {
|
||||
reaction(
|
||||
() => operatingSystemTheme.get(),
|
||||
emitSystemThemeTypeUpdate,
|
||||
{
|
||||
fireImmediately: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
reaction(
|
||||
() => operatingSystemTheme.get(),
|
||||
emitSystemThemeTypeUpdate,
|
||||
{
|
||||
fireImmediately: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
}),
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@@ -11,14 +11,13 @@ import requestInitialSystemThemeTypeInjectable from "./request-initial.injectabl
|
||||
const initializeSystemThemeTypeInjectable = getInjectable({
|
||||
id: "initialize-system-theme-type",
|
||||
instantiate: (di) => ({
|
||||
id: "initialize-system-theme-type",
|
||||
run: async () => {
|
||||
const systemThemeConfiguration = di.inject(systemThemeConfigurationInjectable);
|
||||
const requestInitialSystemThemeType = di.inject(requestInitialSystemThemeTypeInjectable);
|
||||
|
||||
systemThemeConfiguration.set(await requestInitialSystemThemeType());
|
||||
},
|
||||
runAfter: di.inject(initUserStoreInjectable),
|
||||
runAfter: initUserStoreInjectable,
|
||||
}),
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user