mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make Runnable and RunnableSync require ids
- Allows for better error messages related to mismatched runAfter's so that mismatched injection tokens are easy to fix Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
38ca06fc80
commit
f178cf05eb
@ -25,13 +25,19 @@ describe("runManyFor", () => {
|
|||||||
|
|
||||||
const someInjectable = getInjectable({
|
const someInjectable = getInjectable({
|
||||||
id: "some-injectable",
|
id: "some-injectable",
|
||||||
instantiate: () => ({ run: () => runMock("some-call") }),
|
instantiate: () => ({
|
||||||
|
id: "some-injectable",
|
||||||
|
run: () => runMock("some-call"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
const someOtherInjectable = getInjectable({
|
const someOtherInjectable = getInjectable({
|
||||||
id: "some-other-injectable",
|
id: "some-other-injectable",
|
||||||
instantiate: () => ({ run: () => runMock("some-other-call") }),
|
instantiate: () => ({
|
||||||
|
id: "some-other-injectable",
|
||||||
|
run: () => runMock("some-other-call"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -79,6 +85,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-injectable-1",
|
id: "some-injectable-1",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-injectable-1",
|
||||||
run: () => runMock("third-level-run"),
|
run: () => runMock("third-level-run"),
|
||||||
runAfter: di.inject(someInjectable2),
|
runAfter: di.inject(someInjectable2),
|
||||||
}),
|
}),
|
||||||
@ -90,6 +97,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-injectable-2",
|
id: "some-injectable-2",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-injectable-2",
|
||||||
run: () => runMock("second-level-run"),
|
run: () => runMock("second-level-run"),
|
||||||
runAfter: di.inject(someInjectable3),
|
runAfter: di.inject(someInjectable3),
|
||||||
}),
|
}),
|
||||||
@ -99,7 +107,10 @@ describe("runManyFor", () => {
|
|||||||
|
|
||||||
const someInjectable3 = getInjectable({
|
const someInjectable3 = getInjectable({
|
||||||
id: "some-injectable-3",
|
id: "some-injectable-3",
|
||||||
instantiate: () => ({ run: () => runMock("first-level-run") }),
|
instantiate: () => ({
|
||||||
|
id: "some-injectable-3",
|
||||||
|
run: () => runMock("first-level-run"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -186,6 +197,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-runnable-1",
|
id: "some-runnable-1",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-runnable-1",
|
||||||
run: () => runMock("some-runnable-1"),
|
run: () => runMock("some-runnable-1"),
|
||||||
runAfter: di.inject(someOtherInjectable),
|
runAfter: di.inject(someOtherInjectable),
|
||||||
}),
|
}),
|
||||||
@ -197,6 +209,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-runnable-2",
|
id: "some-runnable-2",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-2",
|
||||||
run: () => runMock("some-runnable-2"),
|
run: () => runMock("some-runnable-2"),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -232,6 +245,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-runnable-1",
|
id: "some-runnable-1",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-1",
|
||||||
run: (parameter) => runMock("run-of-some-runnable-1", parameter),
|
run: (parameter) => runMock("run-of-some-runnable-1", parameter),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -242,6 +256,7 @@ describe("runManyFor", () => {
|
|||||||
id: "some-runnable-2",
|
id: "some-runnable-2",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-2",
|
||||||
run: (parameter) => runMock("run-of-some-runnable-2", parameter),
|
run: (parameter) => runMock("run-of-some-runnable-2", parameter),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,9 @@ import { filter, forEach, map, tap } from "lodash/fp";
|
|||||||
import { throwWithIncorrectHierarchyFor } from "./throw-with-incorrect-hierarchy-for";
|
import { throwWithIncorrectHierarchyFor } from "./throw-with-incorrect-hierarchy-for";
|
||||||
|
|
||||||
export interface Runnable<TParameter = void> {
|
export interface Runnable<TParameter = void> {
|
||||||
|
id: string;
|
||||||
run: Run<TParameter>;
|
run: Run<TParameter>;
|
||||||
runAfter?: this;
|
runAfter?: Runnable<TParameter>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Run<Param> = (parameter: Param) => Promise<void> | void;
|
type Run<Param> = (parameter: Param) => Promise<void> | void;
|
||||||
|
|||||||
@ -21,13 +21,19 @@ describe("runManySyncFor", () => {
|
|||||||
|
|
||||||
const someInjectable = getInjectable({
|
const someInjectable = getInjectable({
|
||||||
id: "some-injectable",
|
id: "some-injectable",
|
||||||
instantiate: () => ({ run: () => runMock("some-call") }),
|
instantiate: () => ({
|
||||||
|
id: "some-injectable",
|
||||||
|
run: () => runMock("some-call"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
const someOtherInjectable = getInjectable({
|
const someOtherInjectable = getInjectable({
|
||||||
id: "some-other-injectable",
|
id: "some-other-injectable",
|
||||||
instantiate: () => ({ run: () => runMock("some-other-call") }),
|
instantiate: () => ({
|
||||||
|
id: "some-other-injectable",
|
||||||
|
run: () => runMock("some-other-call"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -62,6 +68,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-injectable-1",
|
id: "some-injectable-1",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-injectable-1",
|
||||||
run: () => runMock("third-level-run"),
|
run: () => runMock("third-level-run"),
|
||||||
runAfter: di.inject(someInjectable2),
|
runAfter: di.inject(someInjectable2),
|
||||||
}),
|
}),
|
||||||
@ -73,6 +80,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-injectable-2",
|
id: "some-injectable-2",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-injectable-2",
|
||||||
run: () => runMock("second-level-run"),
|
run: () => runMock("second-level-run"),
|
||||||
runAfter: di.inject(someInjectable3),
|
runAfter: di.inject(someInjectable3),
|
||||||
}),
|
}),
|
||||||
@ -82,7 +90,10 @@ describe("runManySyncFor", () => {
|
|||||||
|
|
||||||
const someInjectable3 = getInjectable({
|
const someInjectable3 = getInjectable({
|
||||||
id: "some-injectable-3",
|
id: "some-injectable-3",
|
||||||
instantiate: () => ({ run: () => runMock("first-level-run") }),
|
instantiate: () => ({
|
||||||
|
id: "some-injectable-3",
|
||||||
|
run: () => runMock("first-level-run"),
|
||||||
|
}),
|
||||||
injectionToken: someInjectionTokenForRunnables,
|
injectionToken: someInjectionTokenForRunnables,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -115,6 +126,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-runnable-1",
|
id: "some-runnable-1",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "some-runnable-1",
|
||||||
run: () => runMock("some-runnable-1"),
|
run: () => runMock("some-runnable-1"),
|
||||||
runAfter: di.inject(someOtherInjectable),
|
runAfter: di.inject(someOtherInjectable),
|
||||||
}),
|
}),
|
||||||
@ -126,6 +138,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-runnable-2",
|
id: "some-runnable-2",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-2",
|
||||||
run: () => runMock("some-runnable-2"),
|
run: () => runMock("some-runnable-2"),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -161,6 +174,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-runnable-1",
|
id: "some-runnable-1",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-1",
|
||||||
run: (parameter) => runMock("run-of-some-runnable-1", parameter),
|
run: (parameter) => runMock("run-of-some-runnable-1", parameter),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -171,6 +185,7 @@ describe("runManySyncFor", () => {
|
|||||||
id: "some-runnable-2",
|
id: "some-runnable-2",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "some-runnable-2",
|
||||||
run: (parameter) => runMock("run-of-some-runnable-2", parameter),
|
run: (parameter) => runMock("run-of-some-runnable-2", parameter),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@ -3,17 +3,15 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { pipeline } from "@ogre-tools/fp";
|
import { pipeline } from "@ogre-tools/fp";
|
||||||
import type {
|
import type { DiContainerForInjection, InjectionToken } from "@ogre-tools/injectable";
|
||||||
DiContainerForInjection,
|
|
||||||
InjectionToken,
|
|
||||||
} from "@ogre-tools/injectable";
|
|
||||||
import { filter, forEach, map, tap } from "lodash/fp";
|
import { filter, forEach, map, tap } from "lodash/fp";
|
||||||
import type { Runnable } from "./run-many-for";
|
import type { Runnable } from "./run-many-for";
|
||||||
import { throwWithIncorrectHierarchyFor } from "./throw-with-incorrect-hierarchy-for";
|
import { throwWithIncorrectHierarchyFor } from "./throw-with-incorrect-hierarchy-for";
|
||||||
|
|
||||||
export interface RunnableSync<TParameter = void> {
|
export interface RunnableSync<TParameter = void> {
|
||||||
|
id: string;
|
||||||
run: RunSync<TParameter>;
|
run: RunSync<TParameter>;
|
||||||
runAfter?: this;
|
runAfter?: RunnableSync<TParameter>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type RunSync<Param> = (parameter: Param) => void;
|
type RunSync<Param> = (parameter: Param) => void;
|
||||||
|
|||||||
@ -5,12 +5,10 @@
|
|||||||
import type { Runnable } from "./run-many-for";
|
import type { Runnable } from "./run-many-for";
|
||||||
import type { RunnableSync } from "./run-many-sync-for";
|
import type { RunnableSync } from "./run-many-sync-for";
|
||||||
|
|
||||||
export const throwWithIncorrectHierarchyFor =
|
export const throwWithIncorrectHierarchyFor = (allRunnables: Runnable<any>[] | RunnableSync<any>[]) => (
|
||||||
(allRunnables: Runnable<any>[] | RunnableSync<any>[]) =>
|
(runnable: Runnable<any> | RunnableSync<any>) => {
|
||||||
(runnable: Runnable<any> | RunnableSync<any>) => {
|
if (runnable.runAfter && !allRunnables.includes(runnable.runAfter)) {
|
||||||
if (runnable.runAfter && !allRunnables.includes(runnable.runAfter)) {
|
throw new Error(`Tried to run runnable "${runnable.id}" after the runnable "${runnable.runAfter.id}" which does not same injection token.`);
|
||||||
throw new Error(
|
}
|
||||||
"Tried to run runnable after other runnable which does not same injection token.",
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ const setupAppPathsInjectable = getInjectable({
|
|||||||
const joinPaths = di.inject(joinPathsInjectable);
|
const joinPaths = di.inject(joinPathsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-app-paths",
|
||||||
run: () => {
|
run: () => {
|
||||||
if (directoryForIntegrationTesting) {
|
if (directoryForIntegrationTesting) {
|
||||||
setElectronAppPath("appData", directoryForIntegrationTesting);
|
setElectronAppPath("appData", directoryForIntegrationTesting);
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const emitCurrentVersionToAnalyticsInjectable = getInjectable({
|
|||||||
const buildVersion = di.inject(buildVersionInjectable);
|
const buildVersion = di.inject(buildVersionInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "emit-current-version-to-analytics",
|
||||||
run: () => {
|
run: () => {
|
||||||
emitEvent({
|
emitEvent({
|
||||||
name: "app",
|
name: "app",
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const startCheckingForUpdatesInjectable = getInjectable({
|
|||||||
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
const updatingIsEnabled = di.inject(updatingIsEnabledInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-checking-for-updates",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
if (updatingIsEnabled && !periodicalCheckForUpdates.started) {
|
if (updatingIsEnabled && !periodicalCheckForUpdates.started) {
|
||||||
await periodicalCheckForUpdates.start();
|
await periodicalCheckForUpdates.start();
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopCheckingForUpdatesInjectable = getInjectable({
|
|||||||
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
const periodicalCheckForUpdates = di.inject(periodicalCheckForUpdatesInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-checking-for-updates",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
if (periodicalCheckForUpdates.started) {
|
if (periodicalCheckForUpdates.started) {
|
||||||
await periodicalCheckForUpdates.stop();
|
await periodicalCheckForUpdates.stop();
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startWatchingIfUpdateShouldHappenOnQuitInjectable = getInjectable({
|
|||||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-watching-if-update-should-happen-on-quit",
|
||||||
run: () => {
|
run: () => {
|
||||||
watchIfUpdateShouldHappenOnQuit.start();
|
watchIfUpdateShouldHappenOnQuit.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopWatchingIfUpdateShouldHappenOnQuitInjectable = getInjectable({
|
|||||||
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
const watchIfUpdateShouldHappenOnQuit = di.inject(watchIfUpdateShouldHappenOnQuitInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-watching-if-update-should-happen-on-quit",
|
||||||
run: () => {
|
run: () => {
|
||||||
watchIfUpdateShouldHappenOnQuit.stop();
|
watchIfUpdateShouldHappenOnQuit.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startCatalogSyncInjectable = getInjectable({
|
|||||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-catalog-sync",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
if (!catalogSyncToRenderer.started) {
|
if (!catalogSyncToRenderer.started) {
|
||||||
await catalogSyncToRenderer.start();
|
await catalogSyncToRenderer.start();
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopCatalogSyncInjectable = getInjectable({
|
|||||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-catalog-sync",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
if (catalogSyncToRenderer.started) {
|
if (catalogSyncToRenderer.started) {
|
||||||
await catalogSyncToRenderer.stop();
|
await catalogSyncToRenderer.stop();
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const initializeClusterManagerInjectable = getInjectable({
|
|||||||
const clusterManager = di.inject(clusterManagerInjectable);
|
const clusterManager = di.inject(clusterManagerInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "initialize-cluster-manager",
|
||||||
run: () => {
|
run: () => {
|
||||||
clusterManager.init();
|
clusterManager.init();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const cleanUpDeepLinkingInjectable = getInjectable({
|
|||||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "clean-up-deep-linking",
|
||||||
run: () => {
|
run: () => {
|
||||||
lensProtocolRouterMain.cleanup();
|
lensProtocolRouterMain.cleanup();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const hideDockForLastClosedWindowInjectable = getInjectable({
|
|||||||
const getVisibleWindows = di.inject(getVisibleWindowsInjectable);
|
const getVisibleWindows = di.inject(getVisibleWindowsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "hide-dock-when-there-are-no-windows",
|
||||||
run: () => {
|
run: () => {
|
||||||
const visibleWindows = getVisibleWindows();
|
const visibleWindows = getVisibleWindows();
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const showDockForFirstOpenedWindowInjectable = getInjectable({
|
|||||||
const app = di.inject(electronAppInjectable);
|
const app = di.inject(electronAppInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "show-dock-for-first-opened-window",
|
||||||
run: () => {
|
run: () => {
|
||||||
app.dock?.show();
|
app.dock?.show();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const enforceSingleApplicationInstanceInjectable = getInjectable({
|
|||||||
const exitApp = di.inject(exitAppInjectable);
|
const exitApp = di.inject(exitAppInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "enforce-single-application-instance",
|
||||||
run: () => {
|
run: () => {
|
||||||
if (!requestSingleInstanceLock()) {
|
if (!requestSingleInstanceLock()) {
|
||||||
exitApp();
|
exitApp();
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const setupApplicationNameInjectable = getInjectable({
|
|||||||
const appName = di.inject(appNameInjectable);
|
const appName = di.inject(appNameInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-application-name",
|
||||||
run: () => {
|
run: () => {
|
||||||
app.setName(appName);
|
app.setName(appName);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -26,6 +26,7 @@ const setupDeepLinkingInjectable = getInjectable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-deep-linking",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
logger.info(`📟 Setting protocol client for lens://`);
|
logger.info(`📟 Setting protocol client for lens://`);
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const setupDeveloperToolsInDevelopmentEnvironmentInjectable = getInjectable({
|
|||||||
const logger = di.inject(loggerInjectable);
|
const logger = di.inject(loggerInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-developer-tools-in-development-environment",
|
||||||
run: () => {
|
run: () => {
|
||||||
if (process.env.NODE_ENV !== "development") {
|
if (process.env.NODE_ENV !== "development") {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const setupDeviceShutdownInjectable = getInjectable({
|
|||||||
const exitApp = di.inject(exitAppInjectable);
|
const exitApp = di.inject(exitAppInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-device-shutdown",
|
||||||
run: () => {
|
run: () => {
|
||||||
powerMonitor.on("shutdown", async () => {
|
powerMonitor.on("shutdown", async () => {
|
||||||
exitApp();
|
exitApp();
|
||||||
|
|||||||
@ -36,6 +36,7 @@ const setupIpcMainHandlersInjectable = getInjectable({
|
|||||||
const clustersThatAreBeingDeleted = di.inject(clustersThatAreBeingDeletedInjectable);
|
const clustersThatAreBeingDeleted = di.inject(clustersThatAreBeingDeletedInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-ipc-main-handlers",
|
||||||
run: () => {
|
run: () => {
|
||||||
logger.debug("[APP-MAIN] initializing ipc main handlers");
|
logger.debug("[APP-MAIN] initializing ipc main handlers");
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@ const setupMainWindowVisibilityAfterActivationInjectable = getInjectable({
|
|||||||
const logger = di.inject(loggerInjectable);
|
const logger = di.inject(loggerInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-main-window-visibility-after-activation",
|
||||||
run: () => {
|
run: () => {
|
||||||
app.on("activate", async (_, windowIsVisible) => {
|
app.on("activate", async (_, windowIsVisible) => {
|
||||||
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const setupRunnablesAfterWindowIsOpenedInjectable = getInjectable({
|
|||||||
const afterWindowIsOpened = runManyFor(di)(afterWindowIsOpenedInjectionToken);
|
const afterWindowIsOpened = runManyFor(di)(afterWindowIsOpenedInjectionToken);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-runnables-after-window-is-opened",
|
||||||
run: () => {
|
run: () => {
|
||||||
const app = di.inject(electronAppInjectable);
|
const app = di.inject(electronAppInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ const setupRunnablesBeforeClosingOfApplicationInjectable = getInjectable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-closing-of-application",
|
||||||
run: () => {
|
run: () => {
|
||||||
const app = di.inject(electronAppInjectable);
|
const app = di.inject(electronAppInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -219,7 +219,10 @@ const overrideRunnablesHavingSideEffects = (di: DiContainer) => {
|
|||||||
startCatalogSyncInjectable,
|
startCatalogSyncInjectable,
|
||||||
startKubeConfigSyncInjectable,
|
startKubeConfigSyncInjectable,
|
||||||
].forEach((injectable) => {
|
].forEach((injectable) => {
|
||||||
di.override(injectable, () => ({ run: () => {} }));
|
di.override(injectable, () => ({
|
||||||
|
id: injectable.id,
|
||||||
|
run: () => {},
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -231,18 +234,20 @@ const overrideOperatingSystem = (di: DiContainer) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const overrideElectronFeatures = (di: DiContainer) => {
|
const overrideElectronFeatures = (di: DiContainer) => {
|
||||||
di.override(setupMainWindowVisibilityAfterActivationInjectable, () => ({
|
[
|
||||||
run: () => {},
|
setupMainWindowVisibilityAfterActivationInjectable,
|
||||||
}));
|
setupDeviceShutdownInjectable,
|
||||||
|
setupDeepLinkingInjectable,
|
||||||
|
setupApplicationNameInjectable,
|
||||||
|
setupRunnablesBeforeClosingOfApplicationInjectable,
|
||||||
|
].forEach((injectable) => {
|
||||||
|
di.override(injectable, () => ({
|
||||||
|
id: injectable.id,
|
||||||
|
run: () => {},
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
di.override(setupDeviceShutdownInjectable, () => ({
|
|
||||||
run: () => {},
|
|
||||||
}));
|
|
||||||
|
|
||||||
di.override(setupDeepLinkingInjectable, () => ({ run: () => {} }));
|
|
||||||
di.override(exitAppInjectable, () => () => {});
|
di.override(exitAppInjectable, () => () => {});
|
||||||
di.override(setupApplicationNameInjectable, () => ({ run: () => {} }));
|
|
||||||
di.override(setupRunnablesBeforeClosingOfApplicationInjectable, () => ({ run: () => {} }));
|
|
||||||
di.override(getCommandLineSwitchInjectable, () => () => "irrelevant");
|
di.override(getCommandLineSwitchInjectable, () => () => "irrelevant");
|
||||||
di.override(requestSingleInstanceLockInjectable, () => () => true);
|
di.override(requestSingleInstanceLockInjectable, () => () => true);
|
||||||
di.override(disableHardwareAccelerationInjectable, () => () => {});
|
di.override(disableHardwareAccelerationInjectable, () => () => {});
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const startApplicationMenuInjectable = getInjectable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-application-menu",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await applicationMenu.start();
|
await applicationMenu.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const stopApplicationMenuInjectable = getInjectable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-application-menu",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await applicationMenu.stop();
|
await applicationMenu.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const setupListenerForCurrentClusterFrameInjectable = getInjectable({
|
|||||||
id: "setup-listener-for-current-cluster-frame",
|
id: "setup-listener-for-current-cluster-frame",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "setup-listener-for-current-cluster-frame",
|
||||||
run: () => {
|
run: () => {
|
||||||
const currentClusterFrameState = di.inject(currentClusterFrameClusterIdStateInjectable);
|
const currentClusterFrameState = di.inject(currentClusterFrameClusterIdStateInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const cleanUpShellSessionsInjectable = getInjectable({
|
|||||||
id: "clean-up-shell-sessions",
|
id: "clean-up-shell-sessions",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "clean-up-shell-sessions",
|
||||||
run: () => {
|
run: () => {
|
||||||
ShellSession.cleanup();
|
ShellSession.cleanup();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const emitCloseToEventBusInjectable = getInjectable({
|
|||||||
const appEventBus = di.inject(appEventBusInjectable);
|
const appEventBus = di.inject(appEventBusInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "emit-close-to-event-bus",
|
||||||
run: () => {
|
run: () => {
|
||||||
appEventBus.emit({ name: "app", action: "close" });
|
appEventBus.emit({ name: "app", action: "close" });
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const emitServiceStartToEventBusInjectable = getInjectable({
|
|||||||
const appEventBus = di.inject(appEventBusInjectable);
|
const appEventBus = di.inject(appEventBusInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "emit-service-start-to-event-bus",
|
||||||
run: () => {
|
run: () => {
|
||||||
appEventBus.emit({ name: "service", action: "start" });
|
appEventBus.emit({ name: "service", action: "start" });
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const flagRendererAsLoadedInjectable = getInjectable({
|
|||||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "flag-renderer-as-loaded",
|
||||||
run: () => {
|
run: () => {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const flagRendererAsNotLoadedInjectable = getInjectable({
|
|||||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-deep-linking",
|
||||||
run: () => {
|
run: () => {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||||
|
|||||||
@ -21,6 +21,7 @@ const initializeExtensionsInjectable = getInjectable({
|
|||||||
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "initialize-extensions",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
logger.info("🧩 Initializing extensions");
|
logger.info("🧩 Initializing extensions");
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const addKubeconfigSyncAsEntitySourceInjectable = getInjectable({
|
|||||||
const entityRegistry = di.inject(catalogEntityRegistryInjectable);
|
const entityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "add-kubeconfig-sync-as-entity-source",
|
||||||
run: () => {
|
run: () => {
|
||||||
entityRegistry.addComputedSource("kubeconfig-sync", kubeConfigSyncManager.source);
|
entityRegistry.addComputedSource("kubeconfig-sync", kubeConfigSyncManager.source);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -18,6 +18,7 @@ const startKubeConfigSyncInjectable = getInjectable({
|
|||||||
const ensureDir = di.inject(ensureDirInjectable);
|
const ensureDir = di.inject(ensureDirInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-kubeconfig-sync",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await ensureDir(directoryForKubeConfigs);
|
await ensureDir(directoryForKubeConfigs);
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopKubeConfigSyncInjectable = getInjectable({
|
|||||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-kube-config-sync",
|
||||||
run: () => {
|
run: () => {
|
||||||
kubeConfigSyncManager.stopSync();
|
kubeConfigSyncManager.stopSync();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -18,6 +18,7 @@ const setupDetectorRegistryInjectable = getInjectable({
|
|||||||
const detectorRegistry = di.inject(detectorRegistryInjectable);
|
const detectorRegistry = di.inject(detectorRegistryInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-detector-registry",
|
||||||
run: () => {
|
run: () => {
|
||||||
detectorRegistry
|
detectorRegistry
|
||||||
.add(ClusterIdDetector)
|
.add(ClusterIdDetector)
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const setupHardwareAccelerationInjectable = getInjectable({
|
|||||||
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-hardware-acceleration",
|
||||||
run: () => {
|
run: () => {
|
||||||
if (hardwareAccelerationShouldBeDisabled) {
|
if (hardwareAccelerationShouldBeDisabled) {
|
||||||
disableHardwareAcceleration();
|
disableHardwareAcceleration();
|
||||||
|
|||||||
@ -11,6 +11,7 @@ const setupHotbarStoreInjectable = getInjectable({
|
|||||||
id: "setup-hotbar-store",
|
id: "setup-hotbar-store",
|
||||||
|
|
||||||
instantiate: (di) => ({
|
instantiate: (di) => ({
|
||||||
|
id: "setup-hotbar-store",
|
||||||
run: () => {
|
run: () => {
|
||||||
const hotbarStore = di.inject(hotbarStoreInjectable);
|
const hotbarStore = di.inject(hotbarStoreInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const setupImmerInjectable = getInjectable({
|
|||||||
id: "setup-immer",
|
id: "setup-immer",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "setup-immer",
|
||||||
run: () => {
|
run: () => {
|
||||||
// Docs: https://immerjs.github.io/immer/
|
// Docs: https://immerjs.github.io/immer/
|
||||||
// Required in `utils/storage-helper.ts`
|
// Required in `utils/storage-helper.ts`
|
||||||
|
|||||||
@ -26,6 +26,7 @@ const setupLensProxyInjectable = getInjectable({
|
|||||||
const buildVersion = di.inject(buildVersionInjectable);
|
const buildVersion = di.inject(buildVersionInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-lens-proxy",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
try {
|
try {
|
||||||
logger.info("🔌 Starting LensProxy");
|
logger.info("🔌 Starting LensProxy");
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const setupMobxInjectable = getInjectable({
|
|||||||
id: "setup-mobx",
|
id: "setup-mobx",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "setup-mobx",
|
||||||
run: () => {
|
run: () => {
|
||||||
// Docs: https://mobx.js.org/configuration.html
|
// Docs: https://mobx.js.org/configuration.html
|
||||||
Mobx.configure({
|
Mobx.configure({
|
||||||
|
|||||||
@ -18,6 +18,7 @@ const setupPrometheusRegistryInjectable = getInjectable({
|
|||||||
const prometheusProviderRegistry = di.inject(prometheusProviderRegistryInjectable);
|
const prometheusProviderRegistry = di.inject(prometheusProviderRegistryInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-prometheus-registry",
|
||||||
run: () => {
|
run: () => {
|
||||||
prometheusProviderRegistry
|
prometheusProviderRegistry
|
||||||
.registerProvider(new PrometheusLens())
|
.registerProvider(new PrometheusLens())
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const setupProxyEnvInjectable = getInjectable({
|
|||||||
const getCommandLineSwitch = di.inject(getCommandLineSwitchInjectable);
|
const getCommandLineSwitch = di.inject(getCommandLineSwitchInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-proxy-env",
|
||||||
run: () => {
|
run: () => {
|
||||||
const switchValue = getCommandLineSwitch("proxy-server");
|
const switchValue = getCommandLineSwitch("proxy-server");
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const setupReactionsInUserStoreInjectable = getInjectable({
|
|||||||
const userStore = di.inject(userStoreInjectable);
|
const userStore = di.inject(userStoreInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-reactions-in-user-store",
|
||||||
run: () => {
|
run: () => {
|
||||||
userStore.startMainReactions();
|
userStore.startMainReactions();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const setupShellInjectable = getInjectable({
|
|||||||
const electronApp = di.inject(electronAppInjectable);
|
const electronApp = di.inject(electronAppInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-shell",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
logger.info("🐚 Syncing shell environment");
|
logger.info("🐚 Syncing shell environment");
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const setupSyncingOfGeneralCatalogEntitiesInjectable = getInjectable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-syncing-of-general-catalog-entities",
|
||||||
run: () => {
|
run: () => {
|
||||||
syncGeneralCatalogEntities();
|
syncGeneralCatalogEntities();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const setupSyncingOfWeblinksInjectable = getInjectable({
|
|||||||
const syncWeblinks = di.inject(syncWeblinksInjectable);
|
const syncWeblinks = di.inject(syncWeblinksInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-syncing-of-weblinks",
|
||||||
run: () => {
|
run: () => {
|
||||||
syncWeblinks();
|
syncWeblinks();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const setupSystemCaInjectable = getInjectable({
|
|||||||
id: "setup-system-ca",
|
id: "setup-system-ca",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "setup-system-ca",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await injectSystemCAs();
|
await injectSystemCAs();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopClusterManagerInjectable = getInjectable({
|
|||||||
const clusterManager = di.inject(clusterManagerInjectable);
|
const clusterManager = di.inject(clusterManagerInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-cluster-manager",
|
||||||
run: () => {
|
run: () => {
|
||||||
clusterManager.stop();
|
clusterManager.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startBroadcastingThemeChangeInjectable = getInjectable({
|
|||||||
const broadcastThemeChange = di.inject(broadcastThemeChangeInjectable);
|
const broadcastThemeChange = di.inject(broadcastThemeChangeInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-broadcasting-theme-change",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await broadcastThemeChange.start();
|
await broadcastThemeChange.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopBroadcastingThemeChangeInjectable = getInjectable({
|
|||||||
const broadcastThemeChange = di.inject(broadcastThemeChangeInjectable);
|
const broadcastThemeChange = di.inject(broadcastThemeChangeInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-broadcasting-theme-change",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await broadcastThemeChange.stop();
|
await broadcastThemeChange.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startSyncingThemeFromOperatingSystemInjectable = getInjectable({
|
|||||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-syncing-theme-from-operating-system",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await syncTheme.start();
|
await syncTheme.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopSyncingThemeFromOperatingSystemInjectable = getInjectable({
|
|||||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-syncing-theme-from-operating-system",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await syncTheme.stop();
|
await syncTheme.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startTrayInjectable = getInjectable({
|
|||||||
const electronTray = di.inject(electronTrayInjectable);
|
const electronTray = di.inject(electronTrayInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-tray",
|
||||||
run: () => {
|
run: () => {
|
||||||
electronTray.start();
|
electronTray.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const stopTrayInjectable = getInjectable({
|
|||||||
const electronTray = di.inject(electronTrayInjectable);
|
const electronTray = di.inject(electronTrayInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-tray",
|
||||||
run: () => {
|
run: () => {
|
||||||
electronTray.stop();
|
electronTray.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const startReactiveTrayMenuIconInjectable = getInjectable({
|
|||||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-reactive-tray-menu-icon",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await reactiveTrayMenuIcon.start();
|
await reactiveTrayMenuIcon.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopReactiveTrayMenuIconInjectable = getInjectable({
|
|||||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-reactive-tray-menu-icon",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await reactiveTrayMenuIcon.stop();
|
await reactiveTrayMenuIcon.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,6 +14,7 @@ const startReactiveTrayMenuItemsInjectable = getInjectable({
|
|||||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-reactive-tray-menu-items",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await reactiveTrayMenuItems.start();
|
await reactiveTrayMenuItems.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const stopReactiveTrayMenuItemsInjectable = getInjectable({
|
|||||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "stop-reactive-tray-menu-items",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await reactiveTrayMenuItems.stop();
|
await reactiveTrayMenuItems.stop();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startListeningOfChannelsInjectable = getInjectable({
|
|||||||
const listeningOfChannels = di.inject(listeningOfChannelsInjectable);
|
const listeningOfChannels = di.inject(listeningOfChannelsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-listening-of-channels-main",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await listeningOfChannels.start();
|
await listeningOfChannels.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -11,6 +11,7 @@ const setupOnApiErrorListenersInjectable = getInjectable({
|
|||||||
id: "setup-on-api-error-listeners",
|
id: "setup-on-api-error-listeners",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "setup-on-api-error-listeners",
|
||||||
run: () => {
|
run: () => {
|
||||||
apiBase?.onError.addListener(onApiError);
|
apiBase?.onError.addListener(onApiError);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,6 +17,7 @@ const setupAppPathsInjectable = getInjectable({
|
|||||||
const appPathsState = di.inject(appPathsStateInjectable);
|
const appPathsState = di.inject(appPathsStateInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "setup-app-paths",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
const appPaths = await requestFromChannel(
|
const appPaths = await requestFromChannel(
|
||||||
appPathsChannel,
|
appPathsChannel,
|
||||||
|
|||||||
@ -16,6 +16,7 @@ const startTopbarStateSyncInjectable = getInjectable({
|
|||||||
const ipcRenderer = di.inject(ipcRendererInjectable);
|
const ipcRenderer = di.inject(ipcRendererInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-topbar-state-sync",
|
||||||
run: () => {
|
run: () => {
|
||||||
ipcRenderer.on("history:can-go-back", action((event, canGoBack: boolean) => {
|
ipcRenderer.on("history:can-go-back", action((event, canGoBack: boolean) => {
|
||||||
state.prevEnabled = canGoBack;
|
state.prevEnabled = canGoBack;
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const setupSystemCaInjectable = getInjectable({
|
|||||||
id: "setup-system-ca",
|
id: "setup-system-ca",
|
||||||
|
|
||||||
instantiate: () => ({
|
instantiate: () => ({
|
||||||
|
id: "setup-system-ca",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await injectSystemCAs();
|
await injectSystemCAs();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -104,9 +104,17 @@ export const getDiForUnitTesting = (
|
|||||||
|
|
||||||
di.override(getRandomIdInjectable, () => () => "some-irrelevant-random-id");
|
di.override(getRandomIdInjectable, () => () => "some-irrelevant-random-id");
|
||||||
di.override(platformInjectable, () => "darwin");
|
di.override(platformInjectable, () => "darwin");
|
||||||
di.override(startTopbarStateSyncInjectable, () => ({
|
|
||||||
run: () => {},
|
[
|
||||||
}));
|
startTopbarStateSyncInjectable,
|
||||||
|
setupSystemCaInjectable,
|
||||||
|
setupOnApiErrorListenersInjectable,
|
||||||
|
].forEach((injectable) => {
|
||||||
|
di.override(injectable, () => ({
|
||||||
|
id: injectable.id,
|
||||||
|
run: () => {},
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
di.override(terminalSpawningPoolInjectable, () => document.createElement("div"));
|
di.override(terminalSpawningPoolInjectable, () => document.createElement("div"));
|
||||||
di.override(hostedClusterIdInjectable, () => undefined);
|
di.override(hostedClusterIdInjectable, () => undefined);
|
||||||
@ -180,9 +188,6 @@ export const getDiForUnitTesting = (
|
|||||||
|
|
||||||
di.override(fileSystemProvisionerStoreInjectable, () => ({}) as FileSystemProvisionerStore);
|
di.override(fileSystemProvisionerStoreInjectable, () => ({}) as FileSystemProvisionerStore);
|
||||||
|
|
||||||
di.override(setupSystemCaInjectable, () => ({ run: () => {} }));
|
|
||||||
di.override(setupOnApiErrorListenersInjectable, () => ({ run: () => {} }));
|
|
||||||
|
|
||||||
di.override(defaultShellInjectable, () => "some-default-shell");
|
di.override(defaultShellInjectable, () => "some-default-shell");
|
||||||
|
|
||||||
di.override(userStoreInjectable, () => ({
|
di.override(userStoreInjectable, () => ({
|
||||||
|
|||||||
@ -13,6 +13,7 @@ const startListeningOfChannelsInjectable = getInjectable({
|
|||||||
const listeningOfChannels = di.inject(listeningOfChannelsInjectable);
|
const listeningOfChannels = di.inject(listeningOfChannelsInjectable);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "start-listening-of-channels-renderer",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
await listeningOfChannels.start();
|
await listeningOfChannels.start();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -25,6 +25,7 @@ const provideInitialValuesForSyncBoxesInjectable = getInjectable({
|
|||||||
di.inject(createSyncBoxStateInjectable, syncBox.id).set(state);
|
di.inject(createSyncBoxStateInjectable, syncBox.id).set(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
id: "provide-initial-values-for-sync-boxes",
|
||||||
run: async () => {
|
run: async () => {
|
||||||
const initialValues = await requestFromChannel(syncBoxInitialValueChannel);
|
const initialValues = await requestFromChannel(syncBoxInitialValueChannel);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user