mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Adapt changes in master back to state where release branch is
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
aab8255641
commit
0091a41359
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import packageJson from "../../../package.json";
|
||||
import { applicationInformationToken } from "../../common/vars/application-information-token";
|
||||
|
||||
const applicationInformationInjectable = getInjectable({
|
||||
id: "application-information",
|
||||
injectionToken: applicationInformationToken,
|
||||
instantiate: () => {
|
||||
const { version, config, productName, build, copyright, description, name } = packageJson;
|
||||
|
||||
return { version, config, productName, build, copyright, description, name };
|
||||
},
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
export default applicationInformationInjectable;
|
||||
@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "./application-information-injectable";
|
||||
|
||||
export default getGlobalOverride(applicationInformationInjectable, () => ({
|
||||
name: "some-product-name",
|
||||
productName: "some-product-name",
|
||||
version: "6.0.0",
|
||||
build: {} as any,
|
||||
config: {
|
||||
k8sProxyVersion: "0.2.1",
|
||||
bundledKubectlVersion: "1.23.3",
|
||||
bundledHelmVersion: "3.7.2",
|
||||
sentryDsn: "",
|
||||
contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
|
||||
welcomeRoute: "/welcome",
|
||||
},
|
||||
copyright: "some-copyright-information",
|
||||
description: "some-descriptive-text",
|
||||
}));
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverride } from "@k8slens/test-utils";
|
||||
import { getGlobalOverride } from "../../../common/test-utils/get-global-override";
|
||||
import requestSystemCAsInjectable from "./request-system-cas.injectable";
|
||||
|
||||
export default getGlobalOverride(requestSystemCAsInjectable, () => async () => []);
|
||||
|
||||
@ -3,15 +3,9 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { createContainer } from "@ogre-tools/injectable";
|
||||
import { runInAction } from "mobx";
|
||||
import applicationInformationInjectable from "../common/vars/application-information-injectable";
|
||||
|
||||
export const getDi = () => {
|
||||
const di = createContainer("main");
|
||||
|
||||
runInAction(() => {
|
||||
di.register(applicationInformationInjectable);
|
||||
});
|
||||
|
||||
return di;
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
import { chunk } from "lodash/fp";
|
||||
import type { DiContainer, Injectable } from "@ogre-tools/injectable";
|
||||
import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable";
|
||||
import { createContainer, isInjectable } from "@ogre-tools/injectable";
|
||||
import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import spawnInjectable from "./child-process/spawn.injectable";
|
||||
import initializeExtensionsInjectable from "./start-main-application/runnables/initialize-extensions.injectable";
|
||||
@ -28,8 +28,6 @@ import waitUntilBundledExtensionsAreLoadedInjectable from "./start-main-applicat
|
||||
import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import initializeClusterManagerInjectable from "./cluster/initialize-manager.injectable";
|
||||
import type { GlobalOverride } from "../common/test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "../common/vars/application-information-injectable";
|
||||
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";
|
||||
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
|
||||
|
||||
export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {}) {
|
||||
@ -39,12 +37,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {})
|
||||
|
||||
const di = createContainer("main");
|
||||
|
||||
di.register(getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => "production",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
}));
|
||||
|
||||
setLegacyGlobalDiForExtensionApi(di, Environments.main);
|
||||
|
||||
di.preventSideEffects();
|
||||
@ -58,7 +50,6 @@ export function getDiForUnitTesting(opts: { doGeneralOverrides?: boolean } = {})
|
||||
|
||||
runInAction(() => {
|
||||
registerMobX(di);
|
||||
di.register(applicationInformationInjectable);
|
||||
|
||||
chunk(100)(injectables).forEach(chunkInjectables => {
|
||||
di.register(...chunkInjectables);
|
||||
|
||||
@ -4,15 +4,9 @@
|
||||
*/
|
||||
|
||||
import { createContainer } from "@ogre-tools/injectable";
|
||||
import { runInAction } from "mobx";
|
||||
import applicationInformationInjectable from "../common/vars/application-information-injectable";
|
||||
|
||||
export const getDi = () => {
|
||||
const di = createContainer("renderer");
|
||||
|
||||
runInAction(() => {
|
||||
di.register(applicationInformationInjectable);
|
||||
});
|
||||
|
||||
return di;
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
import { noop, chunk } from "lodash/fp";
|
||||
import type { Injectable } from "@ogre-tools/injectable";
|
||||
import { createContainer, isInjectable, getInjectable } from "@ogre-tools/injectable";
|
||||
import { createContainer, isInjectable } from "@ogre-tools/injectable";
|
||||
import { Environments, setLegacyGlobalDiForExtensionApi } from "../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import requestFromChannelInjectable from "./utils/channel/request-from-channel.injectable";
|
||||
import { getOverrideFsWithFakes } from "../test-utils/override-fs-with-fakes";
|
||||
@ -18,8 +18,6 @@ import { registerMobX } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import watchHistoryStateInjectable from "./remote-helpers/watch-history-state.injectable";
|
||||
import legacyOnChannelListenInjectable from "./ipc/legacy-channel-listen.injectable";
|
||||
import type { GlobalOverride } from "../common/test-utils/get-global-override";
|
||||
import applicationInformationInjectable from "../common/vars/application-information-injectable";
|
||||
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";
|
||||
|
||||
export const getDiForUnitTesting = (
|
||||
opts: { doGeneralOverrides?: boolean } = {},
|
||||
@ -28,12 +26,6 @@ export const getDiForUnitTesting = (
|
||||
|
||||
const di = createContainer("renderer");
|
||||
|
||||
di.register(getInjectable({
|
||||
id: "node-env",
|
||||
instantiate: () => "production",
|
||||
injectionToken: nodeEnvInjectionToken,
|
||||
}));
|
||||
|
||||
di.preventSideEffects();
|
||||
|
||||
setLegacyGlobalDiForExtensionApi(di, Environments.renderer);
|
||||
@ -47,7 +39,6 @@ export const getDiForUnitTesting = (
|
||||
|
||||
runInAction(() => {
|
||||
registerMobX(di);
|
||||
di.register(applicationInformationInjectable);
|
||||
|
||||
chunk(100)(injectables).forEach((chunkInjectables) => {
|
||||
di.register(...chunkInjectables);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { applicationInformationToken } from "@k8slens/application";
|
||||
import { applicationInformationToken } from "../common/vars/application-information-token";
|
||||
|
||||
export const applicationInformationFakeInjectable = getInjectable({
|
||||
id: "application-information-fake",
|
||||
@ -14,15 +14,19 @@ export const applicationInformationFakeInjectable = getInjectable({
|
||||
productName: "some-product-name",
|
||||
version: "6.0.0",
|
||||
updatingIsEnabled: false,
|
||||
k8sProxyVersion: "0.2.1",
|
||||
bundledKubectlVersion: "1.23.3",
|
||||
bundledHelmVersion: "3.7.2",
|
||||
sentryDsn: "",
|
||||
contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
|
||||
welcomeRoute: "/welcome",
|
||||
copyright: "some-copyright-information",
|
||||
description: "some-descriptive-text",
|
||||
dependencies: {},
|
||||
build: {},
|
||||
|
||||
config: {
|
||||
welcomeRoute: "/welcome",
|
||||
bundledKubectlVersion: "1.23.3",
|
||||
bundledHelmVersion: "3.7.2",
|
||||
k8sProxyVersion: "0.2.1",
|
||||
sentryDsn: "",
|
||||
contentSecurityPolicy: "script-src 'unsafe-eval' 'self'; frame-src http://*.localhost:*/; img-src * data:",
|
||||
}
|
||||
}),
|
||||
|
||||
injectionToken: applicationInformationToken,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { nodeEnvInjectionToken } from "../main/library";
|
||||
import nodeEnvInjectionToken from "../common/vars/node-env-injection-token";
|
||||
|
||||
const nodeEnvForTestingEnvInjectable = getInjectable({
|
||||
id: "node-env-for-testing-env",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user