mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fixup type errors due to new Runnable requirements
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
ecf3eff8d4
commit
d12f59a6a4
@ -121,7 +121,7 @@ describe("KubeApi", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
describe("when resource request fufills with a resource", () => {
|
||||
describe("when resource request fulfills with a resource", () => {
|
||||
beforeEach(async () => {
|
||||
await fetchMock.resolveSpecific(
|
||||
["https://127.0.0.1:12345/api-kube/apis/networking.k8s.io/v1"],
|
||||
@ -283,7 +283,7 @@ describe("KubeApi", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("when resource request fufills with no resource", () => {
|
||||
describe("when resource request fulfills with no resource", () => {
|
||||
beforeEach(async () => {
|
||||
await fetchMock.resolveSpecific(
|
||||
["https://127.0.0.1:12345/api-kube/apis/networking.k8s.io/v1"],
|
||||
@ -307,7 +307,7 @@ describe("KubeApi", () => {
|
||||
|
||||
|
||||
|
||||
describe("when resource request fufills with a resource", () => {
|
||||
describe("when resource request fulfills with a resource", () => {
|
||||
beforeEach(async () => {
|
||||
await fetchMock.resolveSpecific(
|
||||
["https://127.0.0.1:12345/api-kube/apis/networking.k8s.io/v1beta1"],
|
||||
@ -509,7 +509,7 @@ describe("KubeApi", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
describe("when resource request fufills with a resource", () => {
|
||||
describe("when resource request fulfills with a resource", () => {
|
||||
beforeEach(async () => {
|
||||
await fetchMock.resolveSpecific(
|
||||
["https://127.0.0.1:12345/api-kube/apis/extensions"],
|
||||
|
||||
@ -4,23 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import applicationMenuReactivityInjectable from "./application-menu-reactivity.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -5,24 +5,21 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import periodicalCheckForUpdatesInjectable from "./periodical-check-for-updates.injectable";
|
||||
import updatingIsEnabledInjectable from "../../../main/updating-is-enabled/updating-is-enabled.injectable";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../../../../main/start-main-application/runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../../main/start-main-application/runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../../main/start-main-application/runnable-tokens/phases";
|
||||
import emitAppEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
|
||||
import { getCurrentDateTime } from "../../../common/utils/date/get-current-date-time";
|
||||
import buildVersionInjectable from "../../../main/vars/build-version/build-version.injectable";
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -3,22 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
import watchIfUpdateShouldHappenOnQuitInjectable from "./watch-if-update-should-happen-on-quit.injectable";
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -7,14 +7,13 @@ import { isEqual } from "lodash";
|
||||
import { autorun } from "mobx";
|
||||
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
||||
import type { ClusterId, ClusterState } from "../../../../common/cluster-types";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../../../main/start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
import initClusterStoreInjectable from "../../store/main/init.injectable";
|
||||
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,
|
||||
});
|
||||
|
||||
@ -4,22 +4,19 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../../../main/start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
import initUserStoreInjectable from "../../../../main/stores/init-user-store.injectable";
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
@ -4,12 +4,11 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import fileSystemProvisionerStoreInjectable from "../../../extensions/extension-loader/file-system-provisioner-store/file-system-provisioner-store.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/phases";
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@ -4,22 +4,19 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import hotbarStoreInjectable from "../../../../common/hotbars/store.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
import setupSyncingOfGeneralCatalogEntitiesInjectable from "../../../../main/start-main-application/runnables/setup-syncing-of-general-catalog-entities.injectable";
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../main/start-main-application/runnable-tokens/phases";
|
||||
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";
|
||||
@ -15,57 +15,56 @@ import emitShellSyncFailedInjectable from "./emit-failure.injectable";
|
||||
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,
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -4,29 +4,26 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { reaction } from "mobx";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../../main/start-main-application/runnable-tokens/phases";
|
||||
import operatingSystemThemeInjectable from "../../../../main/theme/operating-system-theme.injectable";
|
||||
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,
|
||||
});
|
||||
|
||||
@ -18,38 +18,35 @@ import { appPathsRunnablePhaseInjectionToken } from "../start-main-application/r
|
||||
const setupAppPathsInjectable = getInjectable({
|
||||
id: "setup-app-paths",
|
||||
|
||||
instantiate: (di) => {
|
||||
const setElectronAppPath = di.inject(setElectronAppPathInjectable);
|
||||
const appName = di.inject(appNameInjectable);
|
||||
const getElectronAppPath = di.inject(getElectronAppPathInjectable);
|
||||
const appPathsState = di.inject(appPathsStateInjectable);
|
||||
const directoryForIntegrationTesting = di.inject(directoryForIntegrationTestingInjectable);
|
||||
const joinPaths = di.inject(joinPathsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const setElectronAppPath = di.inject(setElectronAppPathInjectable);
|
||||
const appName = di.inject(appNameInjectable);
|
||||
const getElectronAppPath = di.inject(getElectronAppPathInjectable);
|
||||
const appPathsState = di.inject(appPathsStateInjectable);
|
||||
const directoryForIntegrationTesting = di.inject(directoryForIntegrationTestingInjectable);
|
||||
const joinPaths = di.inject(joinPathsInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-app-paths",
|
||||
run: () => {
|
||||
if (directoryForIntegrationTesting) {
|
||||
setElectronAppPath("appData", directoryForIntegrationTesting);
|
||||
}
|
||||
if (directoryForIntegrationTesting) {
|
||||
setElectronAppPath("appData", directoryForIntegrationTesting);
|
||||
}
|
||||
|
||||
const appDataPath = getElectronAppPath("appData");
|
||||
const appDataPath = getElectronAppPath("appData");
|
||||
|
||||
setElectronAppPath("userData", joinPaths(appDataPath, appName));
|
||||
setElectronAppPath("userData", joinPaths(appDataPath, appName));
|
||||
|
||||
const appPaths = pipeline(
|
||||
pathNames,
|
||||
map(name => [name, getElectronAppPath(name)]),
|
||||
fromPairs,
|
||||
) as AppPaths;
|
||||
const appPaths = pipeline(
|
||||
pathNames,
|
||||
map(name => [name, getElectronAppPath(name)]),
|
||||
fromPairs,
|
||||
) as AppPaths;
|
||||
|
||||
appPathsState.set(appPaths);
|
||||
appPathsState.set(appPaths);
|
||||
|
||||
// NOTE: this is the worse of two evils. This makes sure that `RunnableSync` always is sync
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
// NOTE: this is the worse of two evils. This makes sure that `RunnableSync` always is sync
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: appPathsRunnablePhaseInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,24 +3,21 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../start-main-application/runnable-tokens/after-root-frame-is-ready-injection-token";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
||||
|
||||
const startCatalogSyncInjectable = getInjectable({
|
||||
id: "start-catalog-sync",
|
||||
|
||||
instantiate: (di) => {
|
||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||
|
||||
return {
|
||||
id: "start-catalog-sync",
|
||||
run: () => {
|
||||
if (!catalogSyncToRenderer.started) {
|
||||
catalogSyncToRenderer.start();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
if (!catalogSyncToRenderer.started) {
|
||||
catalogSyncToRenderer.start();
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterRootFrameIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,25 +4,22 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import catalogSyncToRendererInjectable from "./catalog-sync-to-renderer.injectable";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../start-main-application/runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopCatalogSyncInjectable = getInjectable({
|
||||
id: "stop-catalog-sync",
|
||||
|
||||
instantiate: (di) => {
|
||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const catalogSyncToRenderer = di.inject(catalogSyncToRendererInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-catalog-sync",
|
||||
run: () => {
|
||||
if (catalogSyncToRenderer.started) {
|
||||
catalogSyncToRenderer.stop();
|
||||
}
|
||||
if (catalogSyncToRenderer.started) {
|
||||
catalogSyncToRenderer.stop();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,21 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
import clusterManagerInjectable from "./manager.injectable";
|
||||
|
||||
const initializeClusterManagerInjectable = getInjectable({
|
||||
id: "initialize-cluster-manager",
|
||||
instantiate: (di) => {
|
||||
const clusterManager = di.inject(clusterManagerInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const clusterManager = di.inject(clusterManagerInjectable);
|
||||
|
||||
return {
|
||||
id: "initialize-cluster-manager",
|
||||
run: () => {
|
||||
clusterManager.init();
|
||||
},
|
||||
};
|
||||
},
|
||||
clusterManager.init();
|
||||
},
|
||||
}),
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
@ -3,20 +3,21 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import lensProtocolRouterMainInjectable from "../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
||||
|
||||
const cleanUpDeepLinkingInjectable = getInjectable({
|
||||
id: "clean-up-deep-linking",
|
||||
|
||||
instantiate: (di) => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
|
||||
return {
|
||||
id: "clean-up-deep-linking",
|
||||
run: () => void lensProtocolRouterMain.cleanup(),
|
||||
};
|
||||
},
|
||||
lensProtocolRouterMain.cleanup();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../../../start-main-application/runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../../../start-main-application/runnable-tokens/phases";
|
||||
import electronAppInjectable from "../../electron-app.injectable";
|
||||
import { isEmpty } from "lodash/fp";
|
||||
import getVisibleWindowsInjectable from "../../../start-main-application/lens-window/get-visible-windows.injectable";
|
||||
@ -11,23 +11,19 @@ import getVisibleWindowsInjectable from "../../../start-main-application/lens-wi
|
||||
const hideDockForLastClosedWindowInjectable = getInjectable({
|
||||
id: "hide-dock-when-there-are-no-windows",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const getVisibleWindows = di.inject(getVisibleWindowsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const getVisibleWindows = di.inject(getVisibleWindowsInjectable);
|
||||
const visibleWindows = getVisibleWindows();
|
||||
|
||||
return {
|
||||
id: "hide-dock-when-there-are-no-windows",
|
||||
run: () => {
|
||||
const visibleWindows = getVisibleWindows();
|
||||
if (isEmpty(visibleWindows)) {
|
||||
app.dock?.hide();
|
||||
}
|
||||
|
||||
if (isEmpty(visibleWindows)) {
|
||||
app.dock?.hide();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,21 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import electronAppInjectable from "../../electron-app.injectable";
|
||||
import { afterWindowIsOpenedInjectionToken } from "../../../start-main-application/runnable-tokens/after-window-is-opened-injection-token";
|
||||
import { afterWindowIsOpenedInjectionToken } from "../../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const showDockForFirstOpenedWindowInjectable = getInjectable({
|
||||
id: "show-dock-for-first-opened-window",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
|
||||
return {
|
||||
id: "show-dock-for-first-opened-window",
|
||||
run: () => {
|
||||
app.dock?.show();
|
||||
},
|
||||
};
|
||||
},
|
||||
app.dock?.show();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterWindowIsOpenedInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,28 +3,25 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import requestSingleInstanceLockInjectable from "../features/request-single-instance-lock.injectable";
|
||||
import exitAppInjectable from "../features/exit-app.injectable";
|
||||
|
||||
const enforceSingleApplicationInstanceInjectable = getInjectable({
|
||||
id: "enforce-single-application-instance",
|
||||
|
||||
instantiate: (di) => {
|
||||
const requestSingleInstanceLock = di.inject(requestSingleInstanceLockInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const requestSingleInstanceLock = di.inject(requestSingleInstanceLockInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
|
||||
return {
|
||||
id: "enforce-single-application-instance",
|
||||
run: () => {
|
||||
if (!requestSingleInstanceLock()) {
|
||||
exitApp();
|
||||
}
|
||||
if (!requestSingleInstanceLock()) {
|
||||
exitApp();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,25 +4,22 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import appNameInjectable from "../../../common/vars/app-name.injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import electronAppInjectable from "../electron-app.injectable";
|
||||
|
||||
const setupApplicationNameInjectable = getInjectable({
|
||||
id: "setup-application-name",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const appName = di.inject(appNameInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const appName = di.inject(appNameInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-application-name",
|
||||
run: () => {
|
||||
app.setName(appName);
|
||||
app.setName(appName);
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -7,68 +7,63 @@ import electronAppInjectable from "../electron-app.injectable";
|
||||
import openDeepLinkInjectable from "../../protocol-handler/lens-protocol-router-main/open-deep-link-for-url/open-deep-link.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import commandLineArgumentsInjectable from "../../utils/command-line-arguments.injectable";
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import { find, startsWith, toLower, map } from "lodash/fp";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { startsWith, toLower } from "lodash/fp";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import showApplicationWindowInjectable from "../../start-main-application/lens-window/show-application-window.injectable";
|
||||
|
||||
const setupDeepLinkingInjectable = getInjectable({
|
||||
id: "setup-deep-linking",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const openDeepLinkForUrl = di.inject(openDeepLinkInjectable);
|
||||
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const openDeepLinkForUrl = di.inject(openDeepLinkInjectable);
|
||||
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
||||
const firstInstanceCommandLineArguments = di.inject(commandLineArgumentsInjectable);
|
||||
|
||||
const firstInstanceCommandLineArguments = di.inject(
|
||||
commandLineArgumentsInjectable,
|
||||
);
|
||||
logger.info(`📟 Setting protocol client for lens://`);
|
||||
|
||||
return {
|
||||
id: "setup-deep-linking",
|
||||
run: async () => {
|
||||
logger.info(`📟 Setting protocol client for lens://`);
|
||||
if (app.setAsDefaultProtocolClient("lens")) {
|
||||
logger.info("📟 Protocol client register succeeded ✅");
|
||||
} else {
|
||||
logger.info("📟 Protocol client register failed ❗");
|
||||
}
|
||||
|
||||
if (app.setAsDefaultProtocolClient("lens")) {
|
||||
logger.info("📟 Protocol client register succeeded ✅");
|
||||
} else {
|
||||
logger.info("📟 Protocol client register failed ❗");
|
||||
}
|
||||
const url = getDeepLinkUrl(firstInstanceCommandLineArguments);
|
||||
|
||||
const url = getDeepLinkUrl(firstInstanceCommandLineArguments);
|
||||
if (url) {
|
||||
await openDeepLinkForUrl(url);
|
||||
}
|
||||
|
||||
if (url) {
|
||||
await openDeepLinkForUrl(url);
|
||||
}
|
||||
app.on("open-url", async (event, url) => {
|
||||
event.preventDefault();
|
||||
|
||||
app.on("open-url", async (event, url) => {
|
||||
event.preventDefault();
|
||||
await openDeepLinkForUrl(url);
|
||||
});
|
||||
|
||||
await openDeepLinkForUrl(url);
|
||||
});
|
||||
app.on(
|
||||
"second-instance",
|
||||
async (_, secondInstanceCommandLineArguments) => {
|
||||
const url = getDeepLinkUrl(secondInstanceCommandLineArguments);
|
||||
|
||||
app.on(
|
||||
"second-instance",
|
||||
await showApplicationWindow();
|
||||
|
||||
async (_, secondInstanceCommandLineArguments) => {
|
||||
const url = getDeepLinkUrl(secondInstanceCommandLineArguments);
|
||||
|
||||
await showApplicationWindow();
|
||||
|
||||
if (url) {
|
||||
await openDeepLinkForUrl(url);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
if (url) {
|
||||
await openDeepLinkForUrl(url);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
export default setupDeepLinkingInjectable;
|
||||
|
||||
const getDeepLinkUrl = (commandLineArguments: string[]) =>
|
||||
pipeline(commandLineArguments, map(toLower), find(startsWith("lens://")));
|
||||
const getDeepLinkUrl = (commandLineArguments: string[]) => (
|
||||
commandLineArguments
|
||||
.map(toLower)
|
||||
.find(startsWith("lens://"))
|
||||
);
|
||||
|
||||
@ -5,37 +5,38 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import nodeEnvInjectionToken from "../../../common/vars/node-env-injection-token";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const setupDeveloperToolsInDevelopmentEnvironmentInjectable = getInjectable({
|
||||
id: "setup-developer-tools-in-development-environment",
|
||||
|
||||
instantiate: (di) => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const nodeEnv = di.inject(nodeEnvInjectionToken);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const nodeEnv = di.inject(nodeEnvInjectionToken);
|
||||
|
||||
return {
|
||||
id: "setup-developer-tools-in-development-environment",
|
||||
run: () => {
|
||||
if (nodeEnv !== "development") {
|
||||
return;
|
||||
if (nodeEnv !== "development") {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("🤓 Installing developer tools");
|
||||
|
||||
void (async () => {
|
||||
try {
|
||||
const {
|
||||
default: devToolsInstaller,
|
||||
REACT_DEVELOPER_TOOLS,
|
||||
} = await import("electron-devtools-installer");
|
||||
|
||||
const name = await devToolsInstaller([REACT_DEVELOPER_TOOLS]);
|
||||
|
||||
logger.info(`[DEVTOOLS-INSTALLER]: installed ${name}`);
|
||||
} catch (error) {
|
||||
logger.error(`[DEVTOOLS-INSTALLER]: failed`, { error });
|
||||
}
|
||||
|
||||
logger.info("🤓 Installing developer tools");
|
||||
|
||||
import("electron-devtools-installer")
|
||||
.then(({ default: devToolsInstaller, REACT_DEVELOPER_TOOLS }) =>
|
||||
devToolsInstaller([REACT_DEVELOPER_TOOLS]),
|
||||
)
|
||||
.then((name) =>
|
||||
logger.info(`[DEVTOOLS-INSTALLER]: installed ${name}`),
|
||||
)
|
||||
.catch((error) =>
|
||||
logger.error(`[DEVTOOLS-INSTALLER]: failed`, { error }),
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
})();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -5,24 +5,19 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import powerMonitorInjectable from "../features/power-monitor.injectable";
|
||||
import exitAppInjectable from "../features/exit-app.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const setupDeviceShutdownInjectable = getInjectable({
|
||||
id: "setup-device-shutdown",
|
||||
|
||||
instantiate: (di) => {
|
||||
const powerMonitor = di.inject(powerMonitorInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const powerMonitor = di.inject(powerMonitorInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-device-shutdown",
|
||||
run: () => {
|
||||
powerMonitor.on("shutdown", async () => {
|
||||
exitApp();
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
powerMonitor.on("shutdown", exitApp);
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { setupIpcMainHandlers } from "./setup-ipc-main-handlers";
|
||||
import loggerInjectable from "../../../../common/logger.injectable";
|
||||
import clusterStoreInjectable from "../../../../common/cluster-store/cluster-store.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../start-main-application/runnable-tokens/phases";
|
||||
import applicationMenuItemCompositeInjectable from "../../../../features/application-menu/main/application-menu-item-composite.injectable";
|
||||
import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.injectable";
|
||||
import getClusterByIdInjectable from "../../../../common/cluster-store/get-by-id.injectable";
|
||||
@ -15,29 +15,26 @@ import pushCatalogToRendererInjectable from "../../../catalog-sync-to-renderer/p
|
||||
const setupIpcMainHandlersInjectable = getInjectable({
|
||||
id: "setup-ipc-main-handlers",
|
||||
|
||||
instantiate: (di) => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const applicationMenuItemComposite = di.inject(applicationMenuItemCompositeInjectable);
|
||||
const pushCatalogToRenderer = di.inject(pushCatalogToRendererInjectable);
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const applicationMenuItemComposite = di.inject(applicationMenuItemCompositeInjectable);
|
||||
const pushCatalogToRenderer = di.inject(pushCatalogToRendererInjectable);
|
||||
const clusterStore = di.inject(clusterStoreInjectable);
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
const getClusterById = di.inject(getClusterByIdInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-ipc-main-handlers",
|
||||
run: () => {
|
||||
logger.debug("[APP-MAIN] initializing ipc main handlers");
|
||||
logger.debug("[APP-MAIN] initializing ipc main handlers");
|
||||
|
||||
setupIpcMainHandlers({
|
||||
applicationMenuItemComposite,
|
||||
pushCatalogToRenderer,
|
||||
clusterStore,
|
||||
emitAppEvent,
|
||||
getClusterById,
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
setupIpcMainHandlers({
|
||||
applicationMenuItemComposite,
|
||||
pushCatalogToRenderer,
|
||||
clusterStore,
|
||||
emitAppEvent,
|
||||
getClusterById,
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
causesSideEffects: true,
|
||||
|
||||
@ -5,30 +5,27 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import electronAppInjectable from "../electron-app.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import showApplicationWindowInjectable from "../../start-main-application/lens-window/show-application-window.injectable";
|
||||
|
||||
const setupMainWindowVisibilityAfterActivationInjectable = getInjectable({
|
||||
id: "setup-main-window-visibility-after-activation",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const showApplicationWindow = di.inject(showApplicationWindowInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-main-window-visibility-after-activation",
|
||||
run: () => {
|
||||
app.on("activate", async (_, windowIsVisible) => {
|
||||
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
||||
app.on("activate", (_, windowIsVisible) => {
|
||||
logger.info("APP:ACTIVATE", { hasVisibleWindows: windowIsVisible });
|
||||
|
||||
if (!windowIsVisible) {
|
||||
await showApplicationWindow();
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
if (!windowIsVisible) {
|
||||
void showApplicationWindow();
|
||||
}
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,29 +3,25 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken, afterWindowIsOpenedInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import electronAppInjectable from "../electron-app.injectable";
|
||||
import { runManyFor } from "../../../common/runnable/run-many-for";
|
||||
import { afterWindowIsOpenedInjectionToken } from "../../start-main-application/runnable-tokens/after-window-is-opened-injection-token";
|
||||
|
||||
const setupRunnablesAfterWindowIsOpenedInjectable = getInjectable({
|
||||
id: "setup-runnables-after-window-is-opened",
|
||||
|
||||
instantiate: (di) => {
|
||||
const afterWindowIsOpened = runManyFor(di)(afterWindowIsOpenedInjectionToken);
|
||||
const app = di.inject(electronAppInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const afterWindowIsOpened = runManyFor(di)(afterWindowIsOpenedInjectionToken);
|
||||
const app = di.inject(electronAppInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-runnables-after-window-is-opened",
|
||||
run: () => {
|
||||
app.on("browser-window-created", () => {
|
||||
afterWindowIsOpened();
|
||||
});
|
||||
app.on("browser-window-created", () => {
|
||||
afterWindowIsOpened();
|
||||
});
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,9 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken, beforeQuitOfFrontEndInjectionToken, beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import electronAppInjectable from "../electron-app.injectable";
|
||||
import isIntegrationTestingInjectable from "../../../common/vars/is-integration-testing.injectable";
|
||||
import autoUpdaterInjectable from "../features/auto-updater.injectable";
|
||||
@ -14,40 +12,36 @@ import { runManySyncFor } from "../../../common/runnable/run-many-sync-for";
|
||||
const setupRunnablesBeforeClosingOfApplicationInjectable = getInjectable({
|
||||
id: "setup-closing-of-application",
|
||||
|
||||
instantiate: (di) => {
|
||||
const runManySync = runManySyncFor(di);
|
||||
const runRunnablesBeforeQuitOfFrontEnd = runManySync(beforeQuitOfFrontEndInjectionToken);
|
||||
const runRunnablesBeforeQuitOfBackEnd = runManySync(beforeQuitOfBackEndInjectionToken);
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const isIntegrationTesting = di.inject(isIntegrationTestingInjectable);
|
||||
const autoUpdater = di.inject(autoUpdaterInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const runManySync = runManySyncFor(di);
|
||||
const runRunnablesBeforeQuitOfFrontEnd = runManySync(beforeQuitOfFrontEndInjectionToken);
|
||||
const runRunnablesBeforeQuitOfBackEnd = runManySync(beforeQuitOfBackEndInjectionToken);
|
||||
const app = di.inject(electronAppInjectable);
|
||||
const isIntegrationTesting = di.inject(isIntegrationTestingInjectable);
|
||||
const autoUpdater = di.inject(autoUpdaterInjectable);
|
||||
let isAutoUpdating = false;
|
||||
|
||||
return {
|
||||
id: "setup-closing-of-application",
|
||||
run: () => {
|
||||
let isAutoUpdating = false;
|
||||
autoUpdater.on("before-quit-for-update", () => {
|
||||
isAutoUpdating = true;
|
||||
});
|
||||
|
||||
autoUpdater.on("before-quit-for-update", () => {
|
||||
isAutoUpdating = true;
|
||||
});
|
||||
app.on("will-quit", (event) => {
|
||||
runRunnablesBeforeQuitOfFrontEnd();
|
||||
|
||||
app.on("will-quit", (event) => {
|
||||
runRunnablesBeforeQuitOfFrontEnd();
|
||||
const shouldQuitBackEnd = isIntegrationTesting || isAutoUpdating;
|
||||
|
||||
const shouldQuitBackEnd = isIntegrationTesting || isAutoUpdating;
|
||||
if (shouldQuitBackEnd) {
|
||||
runRunnablesBeforeQuitOfBackEnd();
|
||||
} else {
|
||||
// IMPORTANT: This cannot be destructured as it would break binding of "this" for the Electron event
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
if (shouldQuitBackEnd) {
|
||||
runRunnablesBeforeQuitOfBackEnd();
|
||||
} else {
|
||||
// IMPORTANT: This cannot be destructured as it would break binding of "this" for the Electron event
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,10 +4,12 @@
|
||||
*/
|
||||
|
||||
// @experimental
|
||||
export { afterApplicationIsLoadedInjectionToken } from "./start-main-application/runnable-tokens/after-application-is-loaded-injection-token";
|
||||
export { beforeApplicationIsLoadingInjectionToken } from "./start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
export { beforeElectronIsReadyInjectionToken } from "./start-main-application/runnable-tokens/before-electron-is-ready-injection-token";
|
||||
export { onLoadOfApplicationInjectionToken } from "./start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
export {
|
||||
afterApplicationIsLoadedInjectionToken,
|
||||
beforeApplicationIsLoadingInjectionToken,
|
||||
beforeElectronIsReadyInjectionToken,
|
||||
onLoadOfApplicationInjectionToken,
|
||||
} from "./start-main-application/runnable-tokens/phases";
|
||||
export { createApplication } from "./create-app";
|
||||
export type { CreateApplication, Application, ApplicationConfig } from "../common/create-app";
|
||||
export * as Mobx from "mobx";
|
||||
|
||||
@ -2,23 +2,16 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { pipeline } from "@ogre-tools/fp";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { filter } from "lodash/fp";
|
||||
import { applicationWindowInjectionToken } from "./application-window/application-window-injection-token";
|
||||
|
||||
const getVisibleWindowsInjectable = getInjectable({
|
||||
id: "get-visible-windows",
|
||||
|
||||
instantiate: (di) => {
|
||||
const getAllLensWindows = () => di.injectMany(applicationWindowInjectionToken);
|
||||
|
||||
return () =>
|
||||
pipeline(
|
||||
getAllLensWindows(),
|
||||
filter((lensWindow) => !!lensWindow.isVisible),
|
||||
);
|
||||
},
|
||||
instantiate: (di) => () => (
|
||||
di.injectMany(applicationWindowInjectionToken)
|
||||
.filter(window => window.isVisible)
|
||||
),
|
||||
});
|
||||
|
||||
export default getVisibleWindowsInjectable;
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
|
||||
export const afterApplicationIsLoadedInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-application-is-loaded",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
|
||||
export const afterRootFrameIsReadyInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-root-frame-is-ready",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
|
||||
export const afterWindowIsOpenedInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-window-is-opened",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
|
||||
export const beforeApplicationIsLoadingInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "before-application-is-loading",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { RunnableSync } from "../../../common/runnable/run-many-sync-for";
|
||||
|
||||
export const beforeElectronIsReadyInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-electron-is-ready",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { RunnableSync } from "../../../common/runnable/run-many-sync-for";
|
||||
|
||||
export const beforeQuitOfBackEndInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-quit-of-back-end",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { RunnableSync } from "../../../common/runnable/run-many-sync-for";
|
||||
|
||||
export const beforeQuitOfFrontEndInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-quit-of-front-end",
|
||||
});
|
||||
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
|
||||
export const onLoadOfApplicationInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "on-load-of-application",
|
||||
});
|
||||
@ -4,8 +4,7 @@
|
||||
*/
|
||||
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../../common/runnable/run-many-for";
|
||||
import type { RunnableSync } from "../../../common/runnable/run-many-sync-for";
|
||||
import type { Runnable, RunnableSync } from "../../../common/runnable/types";
|
||||
|
||||
/**
|
||||
* These tokens are here so that the importing of their respective dependencies
|
||||
@ -26,3 +25,35 @@ export const showLoadingRunnablePhaseInjectionToken = getInjectionToken<Runnable
|
||||
export const showInitialWindowRunnablePhaseInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "show-initial-window-runnable-phase",
|
||||
});
|
||||
|
||||
export const onLoadOfApplicationInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "on-load-of-application",
|
||||
});
|
||||
|
||||
export const beforeQuitOfFrontEndInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-quit-of-front-end",
|
||||
});
|
||||
|
||||
export const beforeQuitOfBackEndInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-quit-of-back-end",
|
||||
});
|
||||
|
||||
export const beforeElectronIsReadyInjectionToken = getInjectionToken<RunnableSync>({
|
||||
id: "before-electron-is-ready",
|
||||
});
|
||||
|
||||
export const beforeApplicationIsLoadingInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "before-application-is-loading",
|
||||
});
|
||||
|
||||
export const afterWindowIsOpenedInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-window-is-opened",
|
||||
});
|
||||
|
||||
export const afterRootFrameIsReadyInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-root-frame-is-ready",
|
||||
});
|
||||
|
||||
export const afterApplicationIsLoadedInjectionToken = getInjectionToken<Runnable>({
|
||||
id: "after-application-is-loaded",
|
||||
});
|
||||
|
||||
@ -3,14 +3,13 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../runnable-tokens/phases";
|
||||
import { ShellSession } from "../../shell-session/shell-session";
|
||||
|
||||
const cleanUpShellSessionsInjectable = getInjectable({
|
||||
id: "clean-up-shell-sessions",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "clean-up-shell-sessions",
|
||||
run: () => void ShellSession.cleanup(),
|
||||
}),
|
||||
|
||||
|
||||
@ -4,23 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import emitAppEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const emitCloseToEventBusInjectable = getInjectable({
|
||||
id: "emit-close-to-event-bus",
|
||||
|
||||
instantiate: (di) => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
|
||||
return {
|
||||
id: "emit-close-to-event-bus",
|
||||
run: () => {
|
||||
emitAppEvent({ name: "app", action: "close" });
|
||||
emitAppEvent({ name: "app", action: "close" });
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,21 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import emitAppEventInjectable from "../../../common/app-event-bus/emit-event.injectable";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const emitServiceStartToEventBusInjectable = getInjectable({
|
||||
id: "emit-service-start-to-event-bus",
|
||||
|
||||
instantiate: (di) => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const emitAppEvent = di.inject(emitAppEventInjectable);
|
||||
|
||||
return {
|
||||
id: "emit-service-start-to-event-bus",
|
||||
run: () => {
|
||||
emitAppEvent({ name: "service", action: "start" });
|
||||
},
|
||||
};
|
||||
},
|
||||
emitAppEvent({ name: "service", action: "start" });
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterApplicationIsLoadedInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,26 +3,23 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../../runnable-tokens/after-root-frame-is-ready-injection-token";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../../runnable-tokens/phases";
|
||||
import lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
||||
import { runInAction } from "mobx";
|
||||
|
||||
const flagRendererAsLoadedInjectable = getInjectable({
|
||||
id: "flag-renderer-as-loaded",
|
||||
|
||||
instantiate: (di) => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
|
||||
return {
|
||||
id: "flag-renderer-as-loaded",
|
||||
run: () => {
|
||||
runInAction(() => {
|
||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||
lensProtocolRouterMain.rendererLoaded = true;
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
runInAction(() => {
|
||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||
lensProtocolRouterMain.rendererLoaded = true;
|
||||
});
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: afterRootFrameIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -5,26 +5,23 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { runInAction } from "mobx";
|
||||
import lensProtocolRouterMainInjectable from "../../../protocol-handler/lens-protocol-router-main/lens-protocol-router-main.injectable";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../../runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../../runnable-tokens/phases";
|
||||
|
||||
const flagRendererAsNotLoadedInjectable = getInjectable({
|
||||
id: "stop-deep-linking",
|
||||
|
||||
instantiate: (di) => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const lensProtocolRouterMain = di.inject(lensProtocolRouterMainInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-deep-linking",
|
||||
run: () => {
|
||||
runInAction(() => {
|
||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||
lensProtocolRouterMain.rendererLoaded = false;
|
||||
});
|
||||
runInAction(() => {
|
||||
// Todo: remove this kludge which enables out-of-place temporal dependency.
|
||||
lensProtocolRouterMain.rendererLoaded = false;
|
||||
});
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -9,56 +9,51 @@ import loggerInjectable from "../../../common/logger.injectable";
|
||||
import extensionDiscoveryInjectable from "../../../extensions/extension-discovery/extension-discovery.injectable";
|
||||
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
|
||||
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const initializeExtensionsInjectable = getInjectable({
|
||||
id: "initialize-extensions",
|
||||
|
||||
instantiate: (di) => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const extensionDiscovery = di.inject(extensionDiscoveryInjectable);
|
||||
const extensionLoader = di.inject(extensionLoaderInjectable);
|
||||
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const extensionDiscovery = di.inject(extensionDiscoveryInjectable);
|
||||
const extensionLoader = di.inject(extensionLoaderInjectable);
|
||||
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||
|
||||
return {
|
||||
id: "initialize-extensions",
|
||||
run: async () => {
|
||||
logger.info("🧩 Initializing extensions");
|
||||
logger.info("🧩 Initializing extensions");
|
||||
|
||||
await extensionDiscovery.init();
|
||||
await extensionDiscovery.init();
|
||||
|
||||
await extensionLoader.init();
|
||||
await extensionLoader.init();
|
||||
|
||||
try {
|
||||
const extensions = await extensionDiscovery.load();
|
||||
try {
|
||||
const extensions = await extensionDiscovery.load();
|
||||
|
||||
// Start watching after bundled extensions are loaded
|
||||
extensionDiscovery.watchExtensions();
|
||||
// Start watching after bundled extensions are loaded
|
||||
extensionDiscovery.watchExtensions();
|
||||
|
||||
// Subscribe to extensions that are copied or deleted to/from the extensions folder
|
||||
extensionDiscovery.events
|
||||
.on("add", (extension: InstalledExtension) => {
|
||||
extensionLoader.addExtension(extension);
|
||||
})
|
||||
.on("remove", (lensExtensionId: LensExtensionId) => {
|
||||
extensionLoader.removeExtension(lensExtensionId);
|
||||
});
|
||||
// Subscribe to extensions that are copied or deleted to/from the extensions folder
|
||||
extensionDiscovery.events
|
||||
.on("add", (extension: InstalledExtension) => {
|
||||
extensionLoader.addExtension(extension);
|
||||
})
|
||||
.on("remove", (lensExtensionId: LensExtensionId) => {
|
||||
extensionLoader.removeExtension(lensExtensionId);
|
||||
});
|
||||
|
||||
extensionLoader.initExtensions(extensions);
|
||||
} catch (error: any) {
|
||||
showErrorPopup(
|
||||
"Lens Error",
|
||||
`Could not load extensions${
|
||||
error?.message ? `: ${error.message}` : ""
|
||||
}`,
|
||||
);
|
||||
extensionLoader.initExtensions(extensions);
|
||||
} catch (error: any) {
|
||||
showErrorPopup(
|
||||
"Lens Error",
|
||||
`Could not load extensions${error?.message ? `: ${error.message}` : ""}`,
|
||||
);
|
||||
|
||||
console.error(error);
|
||||
console.trace();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
console.error(error);
|
||||
console.trace();
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
causesSideEffects: true,
|
||||
|
||||
|
||||
@ -5,21 +5,18 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import kubeconfigSyncManagerInjectable from "../../../catalog-sources/kubeconfig-sync/manager.injectable";
|
||||
import catalogEntityRegistryInjectable from "../../../catalog/entity-registry.injectable";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../runnable-tokens/phases";
|
||||
|
||||
const addKubeconfigSyncAsEntitySourceInjectable = getInjectable({
|
||||
id: "add-kubeconfig-sync-as-entity-source",
|
||||
instantiate: (di) => {
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
const entityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
const entityRegistry = di.inject(catalogEntityRegistryInjectable);
|
||||
|
||||
return {
|
||||
id: "add-kubeconfig-sync-as-entity-source",
|
||||
run: () => {
|
||||
entityRegistry.addComputedSource("kubeconfig-sync", kubeConfigSyncManager.source);
|
||||
},
|
||||
};
|
||||
},
|
||||
entityRegistry.addComputedSource("kubeconfig-sync", kubeConfigSyncManager.source);
|
||||
},
|
||||
}),
|
||||
injectionToken: afterApplicationIsLoadedInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "../../runnable-tokens/phases";
|
||||
import directoryForKubeConfigsInjectable from "../../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import ensureDirInjectable from "../../../../common/fs/ensure-dir.injectable";
|
||||
import kubeconfigSyncManagerInjectable from "../../../catalog-sources/kubeconfig-sync/manager.injectable";
|
||||
@ -12,21 +12,18 @@ import addKubeconfigSyncAsEntitySourceInjectable from "./add-source.injectable";
|
||||
const startKubeConfigSyncInjectable = getInjectable({
|
||||
id: "start-kubeconfig-sync",
|
||||
|
||||
instantiate: (di) => {
|
||||
const directoryForKubeConfigs = di.inject(directoryForKubeConfigsInjectable);
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
const ensureDir = di.inject(ensureDirInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const directoryForKubeConfigs = di.inject(directoryForKubeConfigsInjectable);
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
const ensureDir = di.inject(ensureDirInjectable);
|
||||
|
||||
return {
|
||||
id: "start-kubeconfig-sync",
|
||||
run: async () => {
|
||||
await ensureDir(directoryForKubeConfigs);
|
||||
await ensureDir(directoryForKubeConfigs);
|
||||
|
||||
kubeConfigSyncManager.startSync();
|
||||
},
|
||||
runAfter: di.inject(addKubeconfigSyncAsEntitySourceInjectable),
|
||||
};
|
||||
},
|
||||
kubeConfigSyncManager.startSync();
|
||||
},
|
||||
runAfter: addKubeconfigSyncAsEntitySourceInjectable,
|
||||
}),
|
||||
|
||||
injectionToken: afterApplicationIsLoadedInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,20 +3,21 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../runnable-tokens/phases";
|
||||
import kubeconfigSyncManagerInjectable from "../../../catalog-sources/kubeconfig-sync/manager.injectable";
|
||||
|
||||
const stopKubeConfigSyncInjectable = getInjectable({
|
||||
id: "stop-kube-config-sync",
|
||||
|
||||
instantiate: (di) => {
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const kubeConfigSyncManager = di.inject(kubeconfigSyncManagerInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-kube-config-sync",
|
||||
run: () => void kubeConfigSyncManager.stopSync(),
|
||||
};
|
||||
},
|
||||
kubeConfigSyncManager.stopSync();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import { getMessageChannelListenerInjectable } from "../../../../common/utils/channel/message-channel-listener-injection-token";
|
||||
import { rootFrameHasRenderedChannel } from "../../../../common/root-frame/root-frame-rendered-channel";
|
||||
import { runManyFor } from "../../../../common/runnable/run-many-for";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../../runnable-tokens/after-root-frame-is-ready-injection-token";
|
||||
import { afterRootFrameIsReadyInjectionToken } from "../../runnable-tokens/phases";
|
||||
|
||||
const rootFrameRenderedChannelListenerInjectable = getMessageChannelListenerInjectable({
|
||||
id: "action",
|
||||
|
||||
@ -3,21 +3,22 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../../runnable-tokens/phases";
|
||||
import initializeSentryReportingWithInjectable from "../../../../common/error-reporting/initialize-sentry-reporting.injectable";
|
||||
import initializeSentryOnMainInjectable from "./initialize-on-main.injectable";
|
||||
|
||||
const setupSentryInjectable = getInjectable({
|
||||
id: "setup-sentry",
|
||||
instantiate: (di) => {
|
||||
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
|
||||
const initializeSentryOnMain = di.inject(initializeSentryOnMainInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
|
||||
const initializeSentryOnMain = di.inject(initializeSentryOnMainInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-sentry",
|
||||
run: () => void initializeSentryReportingWith(initializeSentryOnMain),
|
||||
};
|
||||
},
|
||||
initializeSentryReportingWith(initializeSentryOnMain);
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -5,26 +5,23 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import disableHardwareAccelerationInjectable from "../../electron-app/features/disable-hardware-acceleration.injectable";
|
||||
import hardwareAccelerationShouldBeDisabledInjectable from "../../vars/hardware-acceleration-should-be-disabled.injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupHardwareAccelerationInjectable = getInjectable({
|
||||
id: "setup-hardware-acceleration",
|
||||
|
||||
instantiate: (di) => {
|
||||
const hardwareAccelerationShouldBeDisabled = di.inject(hardwareAccelerationShouldBeDisabledInjectable);
|
||||
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const hardwareAccelerationShouldBeDisabled = di.inject(hardwareAccelerationShouldBeDisabledInjectable);
|
||||
const disableHardwareAcceleration = di.inject(disableHardwareAccelerationInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-hardware-acceleration",
|
||||
run: () => {
|
||||
if (hardwareAccelerationShouldBeDisabled) {
|
||||
disableHardwareAcceleration();
|
||||
}
|
||||
if (hardwareAccelerationShouldBeDisabled) {
|
||||
disableHardwareAcceleration();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,27 +4,24 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import electronAppInjectable from "../../electron-app/electron-app.injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupHostnamesInjectable = getInjectable({
|
||||
id: "setup-hostnames",
|
||||
|
||||
instantiate: (di) => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const app = di.inject(electronAppInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-hostnames",
|
||||
run: () => {
|
||||
app.commandLine.appendSwitch("host-rules", [
|
||||
"MAP localhost 127.0.0.1",
|
||||
"MAP lens.app 127.0.0.1",
|
||||
"MAP *.lens.app 127.0.0.1",
|
||||
].join());
|
||||
app.commandLine.appendSwitch("host-rules", [
|
||||
"MAP localhost 127.0.0.1",
|
||||
"MAP lens.app 127.0.0.1",
|
||||
"MAP *.lens.app 127.0.0.1",
|
||||
].join());
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,19 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import * as Immer from "immer";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { setAutoFreeze, enableMapSet } from "immer";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupImmerInjectable = getInjectable({
|
||||
id: "setup-immer",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "setup-immer",
|
||||
run: () => {
|
||||
// Docs: https://immerjs.github.io/immer/
|
||||
// Required in `utils/storage-helper.ts`
|
||||
Immer.setAutoFreeze(false); // allow to merge mobx observables
|
||||
Immer.enableMapSet(); // allow to merge maps and sets
|
||||
setAutoFreeze(false); // allow to merge mobx observables
|
||||
enableMapSet(); // allow to merge maps and sets
|
||||
|
||||
return undefined;
|
||||
},
|
||||
|
||||
@ -5,47 +5,44 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { generate } from "selfsigned";
|
||||
import lensProxyCertificateInjectable from "../../../common/certificate/lens-proxy-certificate.injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupLensProxyCertificateInjectable = getInjectable({
|
||||
id: "setup-lens-proxy-certificate",
|
||||
|
||||
instantiate: (di) => {
|
||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-lens-proxy-certificate",
|
||||
run: () => {
|
||||
const cert = generate([
|
||||
{ name: "commonName", value: "Lens Certificate Authority" },
|
||||
{ name: "organizationName", value: "Lens" },
|
||||
], {
|
||||
keySize: 2048,
|
||||
algorithm: "sha256",
|
||||
days: 365,
|
||||
extensions: [
|
||||
{
|
||||
name: "basicConstraints",
|
||||
cA: true,
|
||||
},
|
||||
{
|
||||
name: "subjectAltName",
|
||||
altNames: [
|
||||
{ type: 2, value: "*.lens.app" },
|
||||
{ type: 2, value: "lens.app" },
|
||||
{ type: 2, value: "localhost" },
|
||||
{ type: 7, ip: "127.0.0.1" },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const cert = generate([
|
||||
{ name: "commonName", value: "Lens Certificate Authority" },
|
||||
{ name: "organizationName", value: "Lens" },
|
||||
], {
|
||||
keySize: 2048,
|
||||
algorithm: "sha256",
|
||||
days: 365,
|
||||
extensions: [
|
||||
{
|
||||
name: "basicConstraints",
|
||||
cA: true,
|
||||
},
|
||||
{
|
||||
name: "subjectAltName",
|
||||
altNames: [
|
||||
{ type: 2, value: "*.lens.app" },
|
||||
{ type: 2, value: "lens.app" },
|
||||
{ type: 2, value: "localhost" },
|
||||
{ type: 7, ip: "127.0.0.1" },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
lensProxyCertificate.set(cert);
|
||||
lensProxyCertificate.set(cert);
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -9,7 +9,7 @@ import loggerInjectable from "../../../common/logger.injectable";
|
||||
import lensProxyPortInjectable from "../../lens-proxy/lens-proxy-port.injectable";
|
||||
import isWindowsInjectable from "../../../common/vars/is-windows.injectable";
|
||||
import showErrorPopupInjectable from "../../electron-app/features/show-error-popup.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/phases";
|
||||
import buildVersionInjectable from "../../vars/build-version/build-version.injectable";
|
||||
import initializeBuildVersionInjectable from "../../vars/build-version/init.injectable";
|
||||
import lensProxyCertificateInjectable from "../../../common/certificate/lens-proxy-certificate.injectable";
|
||||
@ -19,68 +19,65 @@ import { Agent } from "https";
|
||||
const setupLensProxyInjectable = getInjectable({
|
||||
id: "setup-lens-proxy",
|
||||
|
||||
instantiate: (di) => {
|
||||
const lensProxy = di.inject(lensProxyInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const lensProxyPort = di.inject(lensProxyPortInjectable);
|
||||
const isWindows = di.inject(isWindowsInjectable);
|
||||
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||
const fetch = di.inject(fetchInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const lensProxy = di.inject(lensProxyInjectable);
|
||||
const exitApp = di.inject(exitAppInjectable);
|
||||
const logger = di.inject(loggerInjectable);
|
||||
const lensProxyPort = di.inject(lensProxyPortInjectable);
|
||||
const isWindows = di.inject(isWindowsInjectable);
|
||||
const showErrorPopup = di.inject(showErrorPopupInjectable);
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||
const fetch = di.inject(fetchInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-lens-proxy",
|
||||
run: async () => {
|
||||
try {
|
||||
logger.info("🔌 Starting LensProxy");
|
||||
await lensProxy.listen(); // lensProxy.port available
|
||||
} catch (error: any) {
|
||||
showErrorPopup("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||
try {
|
||||
logger.info("🔌 Starting LensProxy");
|
||||
await lensProxy.listen(); // lensProxy.port available
|
||||
} catch (error: any) {
|
||||
showErrorPopup("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||
|
||||
return exitApp();
|
||||
}
|
||||
|
||||
// test proxy connection
|
||||
try {
|
||||
logger.info("🔎 Testing LensProxy connection ...");
|
||||
const versionResponse = await fetch(`https://127.0.0.1:${lensProxyPort.get()}/version`, {
|
||||
agent: new Agent({
|
||||
ca: lensProxyCertificate.get()?.cert,
|
||||
}),
|
||||
});
|
||||
|
||||
const { version: versionFromProxy } = await versionResponse.json() as { version: string };
|
||||
|
||||
if (buildVersion.get() !== versionFromProxy) {
|
||||
logger.error("Proxy server responded with invalid response");
|
||||
|
||||
return exitApp();
|
||||
}
|
||||
|
||||
// test proxy connection
|
||||
try {
|
||||
logger.info("🔎 Testing LensProxy connection ...");
|
||||
const versionResponse = await fetch(`https://127.0.0.1:${lensProxyPort.get()}/version`, {
|
||||
agent: new Agent({
|
||||
ca: lensProxyCertificate.get()?.cert,
|
||||
}),
|
||||
});
|
||||
logger.info("⚡ LensProxy connection OK");
|
||||
} catch (error) {
|
||||
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
||||
|
||||
const { version: versionFromProxy } = await versionResponse.json() as { version: string };
|
||||
const hostsPath = isWindows
|
||||
? "C:\\windows\\system32\\drivers\\etc\\hosts"
|
||||
: "/etc/hosts";
|
||||
const message = [
|
||||
`Failed connection test: ${error}`,
|
||||
"Check to make sure that no other versions of Lens are running",
|
||||
`Check ${hostsPath} to make sure that it is clean and that the localhost loopback is at the top and set to 127.0.0.1`,
|
||||
"If you have HTTP_PROXY or http_proxy set in your environment, make sure that the localhost and the ipv4 loopback address 127.0.0.1 are added to the NO_PROXY environment variable.",
|
||||
];
|
||||
|
||||
if (buildVersion.get() !== versionFromProxy) {
|
||||
logger.error("Proxy server responded with invalid response");
|
||||
showErrorPopup("Lens Proxy Error", message.join("\n\n"));
|
||||
|
||||
return exitApp();
|
||||
}
|
||||
|
||||
logger.info("⚡ LensProxy connection OK");
|
||||
} catch (error) {
|
||||
logger.error(`🛑 LensProxy: failed connection test: ${error}`);
|
||||
|
||||
const hostsPath = isWindows
|
||||
? "C:\\windows\\system32\\drivers\\etc\\hosts"
|
||||
: "/etc/hosts";
|
||||
const message = [
|
||||
`Failed connection test: ${error}`,
|
||||
"Check to make sure that no other versions of Lens are running",
|
||||
`Check ${hostsPath} to make sure that it is clean and that the localhost loopback is at the top and set to 127.0.0.1`,
|
||||
"If you have HTTP_PROXY or http_proxy set in your environment, make sure that the localhost and the ipv4 loopback address 127.0.0.1 are added to the NO_PROXY environment variable.",
|
||||
];
|
||||
|
||||
showErrorPopup("Lens Proxy Error", message.join("\n\n"));
|
||||
|
||||
return exitApp();
|
||||
}
|
||||
},
|
||||
runAfter: di.inject(initializeBuildVersionInjectable),
|
||||
};
|
||||
},
|
||||
return exitApp();
|
||||
}
|
||||
},
|
||||
runAfter: initializeBuildVersionInjectable,
|
||||
}),
|
||||
|
||||
causesSideEffects: true,
|
||||
|
||||
|
||||
@ -4,13 +4,12 @@
|
||||
*/
|
||||
import * as Mobx from "mobx";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupMobxInjectable = getInjectable({
|
||||
id: "setup-mobx",
|
||||
|
||||
instantiate: () => ({
|
||||
id: "setup-mobx",
|
||||
run: () => {
|
||||
// Docs: https://mobx.js.org/configuration.html
|
||||
Mobx.configure({
|
||||
|
||||
@ -3,42 +3,37 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeElectronIsReadyInjectionToken } from "../runnable-tokens/phases";
|
||||
import getCommandLineSwitchInjectable from "../../electron-app/features/get-command-line-switch.injectable";
|
||||
|
||||
const setupProxyEnvInjectable = getInjectable({
|
||||
id: "setup-proxy-env",
|
||||
|
||||
instantiate: (di) => {
|
||||
const getCommandLineSwitch = di.inject(getCommandLineSwitchInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const getCommandLineSwitch = di.inject(getCommandLineSwitchInjectable);
|
||||
const switchValue = getCommandLineSwitch("proxy-server");
|
||||
|
||||
return {
|
||||
id: "setup-proxy-env",
|
||||
run: () => {
|
||||
const switchValue = getCommandLineSwitch("proxy-server");
|
||||
let httpsProxy = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || "";
|
||||
|
||||
let httpsProxy =
|
||||
process.env.HTTPS_PROXY || process.env.HTTP_PROXY || "";
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.HTTP_PROXY;
|
||||
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.HTTP_PROXY;
|
||||
if (switchValue !== "") {
|
||||
httpsProxy = switchValue;
|
||||
}
|
||||
|
||||
if (switchValue !== "") {
|
||||
httpsProxy = switchValue;
|
||||
}
|
||||
if (httpsProxy !== "") {
|
||||
process.env.APP_HTTPS_PROXY = httpsProxy;
|
||||
}
|
||||
|
||||
if (httpsProxy !== "") {
|
||||
process.env.APP_HTTPS_PROXY = httpsProxy;
|
||||
}
|
||||
if (getCommandLineSwitch("proxy-server") !== "") {
|
||||
process.env.HTTPS_PROXY = getCommandLineSwitch("proxy-server");
|
||||
}
|
||||
|
||||
if (getCommandLineSwitch("proxy-server") !== "") {
|
||||
process.env.HTTPS_PROXY = getCommandLineSwitch("proxy-server");
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeElectronIsReadyInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,23 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import syncGeneralCatalogEntitiesInjectable from "../../catalog-sources/sync-general-catalog-entities.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const setupSyncingOfGeneralCatalogEntitiesInjectable = getInjectable({
|
||||
id: "setup-syncing-of-general-catalog-entities",
|
||||
|
||||
instantiate: (di) => {
|
||||
const syncGeneralCatalogEntities = di.inject(
|
||||
syncGeneralCatalogEntitiesInjectable,
|
||||
);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const syncGeneralCatalogEntities = di.inject(syncGeneralCatalogEntitiesInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-syncing-of-general-catalog-entities",
|
||||
run: () => {
|
||||
syncGeneralCatalogEntities();
|
||||
},
|
||||
};
|
||||
},
|
||||
syncGeneralCatalogEntities();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,22 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../runnable-tokens/phases";
|
||||
import syncWeblinksInjectable from "../../catalog-sources/sync-weblinks.injectable";
|
||||
|
||||
const setupSyncingOfWeblinksInjectable = getInjectable({
|
||||
id: "setup-syncing-of-weblinks",
|
||||
|
||||
instantiate: (di) => {
|
||||
const syncWeblinks = di.inject(syncWeblinksInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const syncWeblinks = di.inject(syncWeblinksInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-syncing-of-weblinks",
|
||||
run: () => {
|
||||
syncWeblinks();
|
||||
},
|
||||
};
|
||||
},
|
||||
syncWeblinks();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,14 +3,17 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../runnable-tokens/phases";
|
||||
import injectSystemCAsInjectable from "../../../features/certificate-authorities/common/inject-system-cas.injectable";
|
||||
|
||||
const setupSystemCaInjectable = getInjectable({
|
||||
id: "setup-system-ca",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-system-ca",
|
||||
run: di.inject(injectSystemCAsInjectable),
|
||||
run: async () => {
|
||||
const injectSystemCAs = di.inject(injectSystemCAsInjectable);
|
||||
|
||||
await injectSystemCAs();
|
||||
},
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
@ -18,33 +18,30 @@ const getDeepLinkUrl = (commandLineArguments: string[]) => (
|
||||
|
||||
const showInitialWindowInjectable = getInjectable({
|
||||
id: "show-initial-window",
|
||||
instantiate: (di) => {
|
||||
const shouldStartHidden = di.inject(shouldStartHiddenInjectable);
|
||||
const shouldStartWindow = !shouldStartHidden;
|
||||
const createFirstApplicationWindow = di.inject(createFirstApplicationWindowInjectable);
|
||||
const splashWindow = di.inject(splashWindowInjectable);
|
||||
const openDeepLink = di.inject(openDeepLinkInjectable);
|
||||
const commandLineArguments = di.inject(commandLineArgumentsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const shouldStartHidden = di.inject(shouldStartHiddenInjectable);
|
||||
const shouldStartWindow = !shouldStartHidden;
|
||||
const createFirstApplicationWindow = di.inject(createFirstApplicationWindowInjectable);
|
||||
const splashWindow = di.inject(splashWindowInjectable);
|
||||
const openDeepLink = di.inject(openDeepLinkInjectable);
|
||||
const commandLineArguments = di.inject(commandLineArgumentsInjectable);
|
||||
|
||||
return {
|
||||
id: "show-initial-window",
|
||||
run: async () => {
|
||||
if (shouldStartWindow) {
|
||||
const deepLinkUrl = getDeepLinkUrl(commandLineArguments);
|
||||
if (shouldStartWindow) {
|
||||
const deepLinkUrl = getDeepLinkUrl(commandLineArguments);
|
||||
|
||||
if (deepLinkUrl) {
|
||||
await openDeepLink(deepLinkUrl);
|
||||
} else {
|
||||
const applicationWindow = createFirstApplicationWindow();
|
||||
if (deepLinkUrl) {
|
||||
await openDeepLink(deepLinkUrl);
|
||||
} else {
|
||||
const applicationWindow = createFirstApplicationWindow();
|
||||
|
||||
await applicationWindow.start();
|
||||
}
|
||||
|
||||
splashWindow.close();
|
||||
await applicationWindow.start();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
splashWindow.close();
|
||||
}
|
||||
},
|
||||
}),
|
||||
injectionToken: showInitialWindowRunnablePhaseInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -9,20 +9,18 @@ import { showLoadingRunnablePhaseInjectionToken } from "../runnable-tokens/phase
|
||||
|
||||
const showLoadingInjectable = getInjectable({
|
||||
id: "show-loading",
|
||||
instantiate: (di) => {
|
||||
const shouldStartHidden = di.inject(shouldStartHiddenInjectable);
|
||||
const shouldShowLoadingWindow = !shouldStartHidden;
|
||||
const splashWindow = di.inject(splashWindowInjectable);
|
||||
|
||||
return {
|
||||
id: "show-loading",
|
||||
run: async () => {
|
||||
if (shouldShowLoadingWindow) {
|
||||
await splashWindow.start();
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const shouldStartHidden = di.inject(shouldStartHiddenInjectable);
|
||||
const shouldShowLoadingWindow = !shouldStartHidden;
|
||||
const splashWindow = di.inject(splashWindowInjectable);
|
||||
|
||||
if (shouldShowLoadingWindow) {
|
||||
await splashWindow.start();
|
||||
}
|
||||
},
|
||||
}),
|
||||
injectionToken: showLoadingRunnablePhaseInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -4,23 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import clusterManagerInjectable from "../../cluster/manager.injectable";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../runnable-tokens/before-quit-of-front-end-injection-token";
|
||||
import { beforeQuitOfFrontEndInjectionToken } from "../runnable-tokens/phases";
|
||||
|
||||
const stopClusterManagerInjectable = getInjectable({
|
||||
id: "stop-cluster-manager",
|
||||
|
||||
instantiate: (di) => {
|
||||
const clusterManager = di.inject(clusterManagerInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const clusterManager = di.inject(clusterManagerInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-cluster-manager",
|
||||
run: () => {
|
||||
clusterManager.stop();
|
||||
clusterManager.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
};
|
||||
},
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfFrontEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -6,12 +6,8 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
import { runManyFor } from "../../common/runnable/run-many-for";
|
||||
import { runManySyncFor } from "../../common/runnable/run-many-sync-for";
|
||||
import { beforeElectronIsReadyInjectionToken } from "./runnable-tokens/before-electron-is-ready-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "./runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "./runnable-tokens/on-load-of-application-injection-token";
|
||||
import { afterApplicationIsLoadedInjectionToken } from "./runnable-tokens/after-application-is-loaded-injection-token";
|
||||
import * as phases from "./runnable-tokens/phases";
|
||||
import waitForElectronToBeReadyInjectable from "../electron-app/features/wait-for-electron-to-be-ready.injectable";
|
||||
import { appPathsRunnablePhaseInjectionToken, showInitialWindowRunnablePhaseInjectionToken, showLoadingRunnablePhaseInjectionToken } from "./runnable-tokens/phases";
|
||||
|
||||
const startMainApplicationInjectable = getInjectable({
|
||||
id: "start-main-application",
|
||||
@ -21,13 +17,13 @@ const startMainApplicationInjectable = getInjectable({
|
||||
const runManySync = runManySyncFor(di);
|
||||
const waitForElectronToBeReady = di.inject(waitForElectronToBeReadyInjectable);
|
||||
|
||||
const appPathsRunnablePhase = runManySync(appPathsRunnablePhaseInjectionToken);
|
||||
const beforeElectronIsReady = runManySync(beforeElectronIsReadyInjectionToken);
|
||||
const beforeApplicationIsLoading = runMany(beforeApplicationIsLoadingInjectionToken);
|
||||
const showLoadingRunnablePhase = runMany(showLoadingRunnablePhaseInjectionToken);
|
||||
const onLoadOfApplication = runMany(onLoadOfApplicationInjectionToken);
|
||||
const showInitialWindowRunnablePhase = runMany(showInitialWindowRunnablePhaseInjectionToken);
|
||||
const afterApplicationIsLoaded = runMany(afterApplicationIsLoadedInjectionToken);
|
||||
const appPathsRunnablePhase = runManySync(phases.appPathsRunnablePhaseInjectionToken);
|
||||
const beforeElectronIsReady = runManySync(phases.beforeElectronIsReadyInjectionToken);
|
||||
const beforeApplicationIsLoading = runMany(phases.beforeApplicationIsLoadingInjectionToken);
|
||||
const showLoadingRunnablePhase = runMany(phases.showLoadingRunnablePhaseInjectionToken);
|
||||
const onLoadOfApplication = runMany(phases.onLoadOfApplicationInjectionToken);
|
||||
const showInitialWindowRunnablePhase = runMany(phases.showInitialWindowRunnablePhaseInjectionToken);
|
||||
const afterApplicationIsLoaded = runMany(phases.afterApplicationIsLoadedInjectionToken);
|
||||
|
||||
return () => {
|
||||
// Stuff happening before application is ready needs to be synchronous because of
|
||||
|
||||
@ -5,24 +5,21 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import userStoreFileNameMigrationInjectable from "../../common/user-store/file-name-migration.injectable";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
import initDefaultUpdateChannelInjectable from "../vars/default-update-channel/init.injectable";
|
||||
|
||||
const initUserStoreInjectable = getInjectable({
|
||||
id: "init-user-store",
|
||||
instantiate: (di) => {
|
||||
const userStore = di.inject(userStoreInjectable);
|
||||
const userStoreFileNameMigration = di.inject(userStoreFileNameMigrationInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const userStore = di.inject(userStoreInjectable);
|
||||
const userStoreFileNameMigration = di.inject(userStoreFileNameMigrationInjectable);
|
||||
|
||||
return {
|
||||
id: "init-user-store",
|
||||
run: async () => {
|
||||
await userStoreFileNameMigration();
|
||||
userStore.load();
|
||||
},
|
||||
runAfter: di.inject(initDefaultUpdateChannelInjectable),
|
||||
};
|
||||
},
|
||||
await userStoreFileNameMigration();
|
||||
userStore.load();
|
||||
},
|
||||
runAfter: initDefaultUpdateChannelInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -4,21 +4,18 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import syncThemeFromOperatingSystemInjectable from "../../electron-app/features/sync-theme-from-operating-system.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const startSyncingThemeFromOperatingSystemInjectable = getInjectable({
|
||||
id: "start-syncing-theme-from-operating-system",
|
||||
|
||||
instantiate: (di) => {
|
||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||
|
||||
return {
|
||||
id: "start-syncing-theme-from-operating-system",
|
||||
run: () => {
|
||||
syncTheme.start();
|
||||
},
|
||||
};
|
||||
},
|
||||
syncTheme.start();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,19 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import syncThemeFromOperatingSystemInjectable from "../../electron-app/features/sync-theme-from-operating-system.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopSyncingThemeFromOperatingSystemInjectable = getInjectable({
|
||||
id: "stop-syncing-theme-from-operating-system",
|
||||
|
||||
instantiate: (di) => {
|
||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const syncTheme = di.inject(syncThemeFromOperatingSystemInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-syncing-theme-from-operating-system",
|
||||
run: () => void syncTheme.stop(),
|
||||
};
|
||||
},
|
||||
syncTheme.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,22 +3,19 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import electronTrayInjectable from "./electron-tray.injectable";
|
||||
|
||||
const startTrayInjectable = getInjectable({
|
||||
id: "start-tray",
|
||||
|
||||
instantiate: (di) => {
|
||||
const electronTray = di.inject(electronTrayInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const electronTray = di.inject(electronTrayInjectable);
|
||||
|
||||
return {
|
||||
id: "start-tray",
|
||||
run: () => {
|
||||
electronTray.start();
|
||||
},
|
||||
};
|
||||
},
|
||||
electronTray.start();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,21 +4,22 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import electronTrayInjectable from "./electron-tray.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import stopReactiveTrayMenuItemsInjectable from "../reactive-tray-menu-items/stop-reactive-tray-menu-items.injectable";
|
||||
|
||||
const stopTrayInjectable = getInjectable({
|
||||
id: "stop-tray",
|
||||
|
||||
instantiate: (di) => {
|
||||
const electronTray = di.inject(electronTrayInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const electronTray = di.inject(electronTrayInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-tray",
|
||||
run: () => void electronTray.stop(),
|
||||
runAfter: di.inject(stopReactiveTrayMenuItemsInjectable),
|
||||
};
|
||||
},
|
||||
electronTray.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
runAfter: stopReactiveTrayMenuItemsInjectable,
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,25 +3,22 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import startTrayInjectable from "../electron-tray/start-tray.injectable";
|
||||
import reactiveTrayMenuIconInjectable from "./reactive.injectable";
|
||||
|
||||
const startReactiveTrayMenuIconInjectable = getInjectable({
|
||||
id: "start-reactive-tray-menu-icon",
|
||||
|
||||
instantiate: (di) => {
|
||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||
|
||||
return {
|
||||
id: "start-reactive-tray-menu-icon",
|
||||
run: () => {
|
||||
reactiveTrayMenuIcon.start();
|
||||
},
|
||||
reactiveTrayMenuIcon.start();
|
||||
},
|
||||
|
||||
runAfter: di.inject(startTrayInjectable),
|
||||
};
|
||||
},
|
||||
runAfter: startTrayInjectable,
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,20 +3,21 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import reactiveTrayMenuIconInjectable from "./reactive.injectable";
|
||||
|
||||
const stopReactiveTrayMenuIconInjectable = getInjectable({
|
||||
id: "stop-reactive-tray-menu-icon",
|
||||
|
||||
instantiate: (di) => {
|
||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const reactiveTrayMenuIcon = di.inject(reactiveTrayMenuIconInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-reactive-tray-menu-icon",
|
||||
run: () => void reactiveTrayMenuIcon.stop(),
|
||||
};
|
||||
},
|
||||
reactiveTrayMenuIcon.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,24 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import reactiveTrayMenuItemsInjectable from "./reactive-tray-menu-items.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import startTrayInjectable from "../electron-tray/start-tray.injectable";
|
||||
|
||||
const startReactiveTrayMenuItemsInjectable = getInjectable({
|
||||
id: "start-reactive-tray-menu-items",
|
||||
|
||||
instantiate: (di) => {
|
||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||
|
||||
return {
|
||||
id: "start-reactive-tray-menu-items",
|
||||
run: () => {
|
||||
reactiveTrayMenuItems.start();
|
||||
},
|
||||
|
||||
runAfter: di.inject(startTrayInjectable),
|
||||
};
|
||||
},
|
||||
reactiveTrayMenuItems.start();
|
||||
},
|
||||
runAfter: startTrayInjectable,
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -4,19 +4,20 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import reactiveTrayMenuItemsInjectable from "./reactive-tray-menu-items.injectable";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/before-quit-of-back-end-injection-token";
|
||||
import { beforeQuitOfBackEndInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const stopReactiveTrayMenuItemsInjectable = getInjectable({
|
||||
id: "stop-reactive-tray-menu-items",
|
||||
|
||||
instantiate: (di) => {
|
||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const reactiveTrayMenuItems = di.inject(reactiveTrayMenuItemsInjectable);
|
||||
|
||||
return {
|
||||
id: "stop-reactive-tray-menu-items",
|
||||
run: () => void reactiveTrayMenuItems.stop(),
|
||||
};
|
||||
},
|
||||
reactiveTrayMenuItems.stop();
|
||||
|
||||
return undefined;
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: beforeQuitOfBackEndInjectionToken,
|
||||
});
|
||||
|
||||
@ -6,29 +6,26 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { reaction } from "mobx";
|
||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||
import setLoginItemSettingsInjectable from "../electron-app/features/set-login-item-settings.injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../start-main-application/runnable-tokens/phases";
|
||||
|
||||
const setupSyncOpenAtLoginWithOsInjectable = getInjectable({
|
||||
id: "setup-sync-open-at-login-with-os",
|
||||
instantiate: (di) => {
|
||||
const setLoginItemSettings = di.inject(setLoginItemSettingsInjectable);
|
||||
const userStore = di.inject(userStoreInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const setLoginItemSettings = di.inject(setLoginItemSettingsInjectable);
|
||||
const userStore = di.inject(userStoreInjectable);
|
||||
|
||||
return {
|
||||
id: "setup-sync-open-at-login-with-os",
|
||||
run: () => {
|
||||
reaction(() => userStore.openAtLogin, openAtLogin => {
|
||||
setLoginItemSettings({
|
||||
openAtLogin,
|
||||
openAsHidden: true,
|
||||
args: ["--hidden"],
|
||||
});
|
||||
}, {
|
||||
fireImmediately: true,
|
||||
reaction(() => userStore.openAtLogin, openAtLogin => {
|
||||
setLoginItemSettings({
|
||||
openAtLogin,
|
||||
openAsHidden: true,
|
||||
args: ["--hidden"],
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
}, {
|
||||
fireImmediately: true,
|
||||
});
|
||||
},
|
||||
}),
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -3,25 +3,22 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../start-main-application/runnable-tokens/on-load-of-application-injection-token";
|
||||
import { onLoadOfApplicationInjectionToken } from "../../../start-main-application/runnable-tokens/phases";
|
||||
import listeningOnMessageChannelsInjectable from "../../../../common/utils/channel/listening-on-message-channels.injectable";
|
||||
import listeningOnRequestChannelsInjectable from "./listening-on-request-channels.injectable";
|
||||
|
||||
const startListeningOnChannelsInjectable = getInjectable({
|
||||
id: "start-listening-on-channels-main",
|
||||
|
||||
instantiate: (di) => {
|
||||
const listeningOnMessageChannels = di.inject(listeningOnMessageChannelsInjectable);
|
||||
const listeningOnRequestChannels = di.inject(listeningOnRequestChannelsInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: () => {
|
||||
const listeningOnMessageChannels = di.inject(listeningOnMessageChannelsInjectable);
|
||||
const listeningOnRequestChannels = di.inject(listeningOnRequestChannelsInjectable);
|
||||
|
||||
return {
|
||||
id: "start-listening-on-channels-main",
|
||||
run: () => {
|
||||
listeningOnMessageChannels.start();
|
||||
listeningOnRequestChannels.start();
|
||||
},
|
||||
};
|
||||
},
|
||||
listeningOnMessageChannels.start();
|
||||
listeningOnRequestChannels.start();
|
||||
},
|
||||
}),
|
||||
|
||||
injectionToken: onLoadOfApplicationInjectionToken,
|
||||
});
|
||||
|
||||
@ -3,19 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import buildVersionInjectable from "./build-version.injectable";
|
||||
|
||||
const initializeBuildVersionInjectable = getInjectable({
|
||||
id: "initialize-build-version",
|
||||
instantiate: (di) => {
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const buildVersion = di.inject(buildVersionInjectable);
|
||||
|
||||
return {
|
||||
id: "initialize-build-version",
|
||||
run: () => buildVersion.init(),
|
||||
};
|
||||
},
|
||||
await buildVersion.init();
|
||||
},
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -3,21 +3,20 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import initReleaseChannelInjectable from "../release-channel/init.injectable";
|
||||
import defaultUpdateChannelInjectable from "../../../features/application-update/common/selected-update-channel/default-update-channel.injectable";
|
||||
|
||||
const initDefaultUpdateChannelInjectable = getInjectable({
|
||||
id: "init-default-update-channel",
|
||||
instantiate: (di) => {
|
||||
const defaultUpdateChannel = di.inject(defaultUpdateChannelInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const defaultUpdateChannel = di.inject(defaultUpdateChannelInjectable);
|
||||
|
||||
return {
|
||||
id: "init-default-update-channel",
|
||||
run: () => defaultUpdateChannel.init(),
|
||||
runAfter: di.inject(initReleaseChannelInjectable),
|
||||
};
|
||||
},
|
||||
await defaultUpdateChannel.init();
|
||||
},
|
||||
runAfter: initReleaseChannelInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -4,20 +4,19 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import releaseChannelInjectable from "../../../common/vars/release-channel.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import initSemanticBuildVersionInjectable from "../semantic-build-version/init.injectable";
|
||||
|
||||
const initReleaseChannelInjectable = getInjectable({
|
||||
id: "init-release-channel",
|
||||
instantiate: (di) => {
|
||||
const releaseChannel = di.inject(releaseChannelInjectable);
|
||||
instantiate: (di) => ({
|
||||
run: async () => {
|
||||
const releaseChannel = di.inject(releaseChannelInjectable);
|
||||
|
||||
return {
|
||||
id: "init-release-channel",
|
||||
run: () => releaseChannel.init(),
|
||||
runAfter: di.inject(initSemanticBuildVersionInjectable),
|
||||
};
|
||||
},
|
||||
await releaseChannel.init();
|
||||
},
|
||||
runAfter: initSemanticBuildVersionInjectable,
|
||||
}),
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
});
|
||||
|
||||
|
||||
@ -4,18 +4,19 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import buildSemanticVersionInjectable from "../../../common/vars/build-semantic-version.injectable";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/before-application-is-loading-injection-token";
|
||||
import { beforeApplicationIsLoadingInjectionToken } from "../../start-main-application/runnable-tokens/phases";
|
||||
import initializeBuildVersionInjectable from "../build-version/init.injectable";
|
||||
|
||||
const initSemanticBuildVersionInjectable = getInjectable({
|
||||
id: "init-semantic-build-version",
|
||||
instantiate: (di) => {
|
||||
const buildSemanticVersion = di.inject(buildSemanticVersionInjectable);
|
||||
|
||||
return {
|
||||
id: "init-semantic-build-version",
|
||||
run: () => buildSemanticVersion.init(),
|
||||
runAfter: di.inject(initializeBuildVersionInjectable),
|
||||
run: async () => {
|
||||
const buildSemanticVersion = di.inject(buildSemanticVersionInjectable);
|
||||
|
||||
await buildSemanticVersion.init();
|
||||
},
|
||||
runAfter: initializeBuildVersionInjectable,
|
||||
};
|
||||
},
|
||||
injectionToken: beforeApplicationIsLoadingInjectionToken,
|
||||
|
||||
@ -12,7 +12,6 @@ const setupAppPathsInjectable = getInjectable({
|
||||
id: "setup-app-paths",
|
||||
|
||||
instantiate: (di) => ({
|
||||
id: "setup-app-paths",
|
||||
run: async () => {
|
||||
const requestFromChannel = di.inject(requestFromChannelInjectionToken);
|
||||
const appPathsState = di.inject(appPathsStateInjectable);
|
||||
|
||||
@ -9,7 +9,6 @@ import { beforeFrameStartsFirstInjectionToken } from "../tokens";
|
||||
const configureImmerInjectable = getInjectable({
|
||||
id: "configure-immer",
|
||||
instantiate: () => ({
|
||||
id: "configure-immer",
|
||||
run: () => {
|
||||
// Docs: https://immerjs.github.io/immer/
|
||||
// Required in `utils/storage-helper.ts`
|
||||
|
||||
@ -9,7 +9,6 @@ import { beforeFrameStartsFirstInjectionToken } from "../tokens";
|
||||
const configureMobxInjectable = getInjectable({
|
||||
id: "configure-mobx",
|
||||
instantiate: () => ({
|
||||
id: "configure-mobx",
|
||||
run: () => {
|
||||
// Docs: https://mobx.js.org/configuration.html
|
||||
configure({
|
||||
|
||||
@ -10,7 +10,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
|
||||
const loadMonacoThemesInjectable = getInjectable({
|
||||
id: "load-monaco-themes",
|
||||
instantiate: (di) => ({
|
||||
id: "load-monaco-themes",
|
||||
run: () => {
|
||||
const customThemes = di.injectMany(customMonacoThemeInjectionToken);
|
||||
const addNewMonacoTheme = di.inject(addNewMonacoThemeInjectable);
|
||||
|
||||
@ -19,7 +19,6 @@ import maybeKubeApiInjectable from "../../../common/k8s-api/maybe-kube-api.injec
|
||||
const setupAutoRegistrationInjectable = getInjectable({
|
||||
id: "setup-auto-registration",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-auto-registration",
|
||||
run: () => {
|
||||
const autoRegistrationEmitter = di.inject(autoRegistrationEmitterInjectable);
|
||||
const beforeApiManagerInitializationCrds: CustomResourceDefinition[] = [];
|
||||
|
||||
@ -12,7 +12,6 @@ import { beforeMainFrameStartsFirstInjectionToken } from "../tokens";
|
||||
const setupCurrentClusterBroadcastInjectable = getInjectable({
|
||||
id: "setup-current-cluster-broadcast",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-current-cluster-broadcast",
|
||||
run: () => {
|
||||
const matchedClusterId = di.inject(matchedClusterIdInjectable);
|
||||
const sendMessageToChannel = di.inject(sendMessageToChannelInjectionToken);
|
||||
|
||||
@ -14,7 +14,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
|
||||
const setupKubernetesClusterCatalogAddMenuListenerInjectable = getInjectable({
|
||||
id: "setup-kubernetes-cluster-catalog-add-menu-listener",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-kubernetes-cluster-catalog-add-menu-listener",
|
||||
run: () => {
|
||||
const navigateToAddCluster = di.inject(navigateToAddClusterInjectable);
|
||||
const addSyncEntries = di.inject(addSyncEntriesInjectable);
|
||||
|
||||
@ -14,7 +14,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
|
||||
const setupKubernetesClusterContextMenuOpenInjectable = getInjectable({
|
||||
id: "setup-kubernetes-cluster-context-menu-open",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-kubernetes-cluster-context-menu-open",
|
||||
run: () => {
|
||||
const catalogCategoryRegistry = di.inject(catalogCategoryRegistryInjectable);
|
||||
const openDeleteClusterDialog = di.inject(openDeleteClusterDialogInjectable);
|
||||
|
||||
@ -10,7 +10,6 @@ import requestLensProxyCertificateInjectable from "../../certificate/request-len
|
||||
const setupLensProxyCertificateInjectable = getInjectable({
|
||||
id: "setup-lens-proxy-certificate",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-lens-proxy-certificate",
|
||||
run: async () => {
|
||||
const requestLensProxyCertificate = di.inject(requestLensProxyCertificateInjectable);
|
||||
const lensProxyCertificate = di.inject(lensProxyCertificateInjectable);
|
||||
|
||||
@ -9,7 +9,6 @@ import { beforeFrameStartsSecondInjectionToken } from "../tokens";
|
||||
const setupRootMacClassnameInjectable = getInjectable({
|
||||
id: "setup-root-mac-classname",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-root-mac-classname",
|
||||
run: () => {
|
||||
const isMac = di.inject(isMacInjectable);
|
||||
const rootElem = document.getElementById("app");
|
||||
|
||||
@ -10,7 +10,6 @@ import { init } from "@sentry/electron/renderer";
|
||||
const setupSentryInjectable = getInjectable({
|
||||
id: "setup-sentry",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-sentry",
|
||||
run: () => {
|
||||
const initializeSentryReportingWith = di.inject(initializeSentryReportingWithInjectable);
|
||||
|
||||
|
||||
@ -9,10 +9,9 @@ import { WeblinkAddCommand } from "../../components/catalog-entities/weblink-add
|
||||
import commandOverlayInjectable from "../../components/command-palette/command-overlay.injectable";
|
||||
import { beforeFrameStartsSecondInjectionToken } from "../tokens";
|
||||
|
||||
const setupWeblickContextMenuOpenInjectable = getInjectable({
|
||||
id: "setup-weblick-context-menu-open",
|
||||
const setupWeblinkContextMenuOpenInjectable = getInjectable({
|
||||
id: "setup-weblink-context-menu-open",
|
||||
instantiate: (di) => ({
|
||||
id: "setup-weblick-context-menu-open",
|
||||
run: () => {
|
||||
const catalogCategoryRegistry = di.inject(catalogCategoryRegistryInjectable);
|
||||
const commandOverlay = di.inject(commandOverlayInjectable);
|
||||
@ -31,4 +30,4 @@ const setupWeblickContextMenuOpenInjectable = getInjectable({
|
||||
injectionToken: beforeFrameStartsSecondInjectionToken,
|
||||
});
|
||||
|
||||
export default setupWeblickContextMenuOpenInjectable;
|
||||
export default setupWeblinkContextMenuOpenInjectable;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type { Runnable } from "../../common/runnable/run-many-for";
|
||||
import type { Runnable } from "../../common/runnable/types";
|
||||
|
||||
// NOTE: these are run before any other token, mostly to set up things that all other runnables need
|
||||
export const beforeFrameStartsFirstInjectionToken = getInjectionToken<Runnable>({
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user