mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Update injectable library (#4842)
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com>
This commit is contained in:
parent
e8ca1ddf87
commit
b65f6e00ec
@ -194,8 +194,8 @@
|
|||||||
"@hapi/call": "^8.0.1",
|
"@hapi/call": "^8.0.1",
|
||||||
"@hapi/subtext": "^7.0.3",
|
"@hapi/subtext": "^7.0.3",
|
||||||
"@kubernetes/client-node": "^0.16.1",
|
"@kubernetes/client-node": "^0.16.1",
|
||||||
"@ogre-tools/injectable": "3.2.1",
|
"@ogre-tools/injectable": "5.0.1",
|
||||||
"@ogre-tools/injectable-react": "3.2.1",
|
"@ogre-tools/injectable-react": "5.0.1",
|
||||||
"@sentry/electron": "^2.5.4",
|
"@sentry/electron": "^2.5.4",
|
||||||
"@sentry/integrations": "^6.15.0",
|
"@sentry/integrations": "^6.15.0",
|
||||||
"@types/circular-dependency-plugin": "5.0.4",
|
"@types/circular-dependency-plugin": "5.0.4",
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import getCustomKubeConfigDirectoryInjectable from "../app-paths/get-custom-kube
|
|||||||
import clusterStoreInjectable from "../cluster-store/cluster-store.injectable";
|
import clusterStoreInjectable from "../cluster-store/cluster-store.injectable";
|
||||||
import type { ClusterModel } from "../cluster-types";
|
import type { ClusterModel } from "../cluster-types";
|
||||||
import type {
|
import type {
|
||||||
DependencyInjectionContainer,
|
DiContainer,
|
||||||
} from "@ogre-tools/injectable";
|
} from "@ogre-tools/injectable";
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ jest.mock("electron", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
describe("cluster-store", () => {
|
describe("cluster-store", () => {
|
||||||
let mainDi: DependencyInjectionContainer;
|
let mainDi: DiContainer;
|
||||||
let clusterStore: ClusterStore;
|
let clusterStore: ClusterStore;
|
||||||
let createCluster: (model: ClusterModel) => Cluster;
|
let createCluster: (model: ClusterModel) => Cluster;
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import electron from "electron";
|
|||||||
import { stdout, stderr } from "process";
|
import { stdout, stderr } from "process";
|
||||||
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
|
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
|
||||||
import userStoreInjectable from "../user-store/user-store.injectable";
|
import userStoreInjectable from "../user-store/user-store.injectable";
|
||||||
import type { DependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
import type { ClusterStoreModel } from "../cluster-store/cluster-store";
|
import type { ClusterStoreModel } from "../cluster-store/cluster-store";
|
||||||
import { defaultTheme } from "../vars";
|
import { defaultTheme } from "../vars";
|
||||||
@ -37,7 +37,7 @@ console = new Console(stdout, stderr);
|
|||||||
|
|
||||||
describe("user store tests", () => {
|
describe("user store tests", () => {
|
||||||
let userStore: UserStore;
|
let userStore: UserStore;
|
||||||
let mainDi: DependencyInjectionContainer;
|
let mainDi: DiContainer;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
const dis = getDisForUnitTesting({ doGeneralOverrides: true });
|
const dis = getDisForUnitTesting({ doGeneralOverrides: true });
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appEventBus } from "./event-bus";
|
import { appEventBus } from "./event-bus";
|
||||||
|
|
||||||
const appEventBusInjectable = getInjectable({
|
const appEventBusInjectable = getInjectable({
|
||||||
|
id: "app-event-bus",
|
||||||
instantiate: () => appEventBus,
|
instantiate: () => appEventBus,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default appEventBusInjectable;
|
export default appEventBusInjectable;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { createChannel } from "../ipc-channel/create-channel/create-channel";
|
|||||||
|
|
||||||
export type AppPaths = Record<PathName, string>;
|
export type AppPaths = Record<PathName, string>;
|
||||||
|
|
||||||
export const appPathsInjectionToken = getInjectionToken<AppPaths>();
|
export const appPathsInjectionToken = getInjectionToken<AppPaths>({ id: "app-paths-token" });
|
||||||
|
|
||||||
export const appPathsIpcChannel = createChannel<AppPaths>("app-paths");
|
export const appPathsIpcChannel = createChannel<AppPaths>("app-paths");
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { DependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { AppPaths, appPathsInjectionToken } from "./app-path-injection-token";
|
import { AppPaths, appPathsInjectionToken } from "./app-path-injection-token";
|
||||||
import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable";
|
import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable";
|
||||||
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
|
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
|
||||||
@ -13,8 +13,8 @@ import directoryForIntegrationTestingInjectable from "../../main/app-paths/direc
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
describe("app-paths", () => {
|
describe("app-paths", () => {
|
||||||
let mainDi: DependencyInjectionContainer;
|
let mainDi: DiContainer;
|
||||||
let rendererDi: DependencyInjectionContainer;
|
let rendererDi: DiContainer;
|
||||||
let runSetups: () => Promise<void[]>;
|
let runSetups: () => Promise<void[]>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import directoryForUserDataInjectable from "../directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../directory-for-user-data/directory-for-user-data.injectable";
|
||||||
|
|
||||||
const directoryForBinariesInjectable = getInjectable({
|
const directoryForBinariesInjectable = getInjectable({
|
||||||
|
id: "directory-for-binaries",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
path.join(di.inject(directoryForUserDataInjectable), "binaries"),
|
path.join(di.inject(directoryForUserDataInjectable), "binaries"),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForBinariesInjectable;
|
export default directoryForBinariesInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appPathsInjectionToken } from "../app-path-injection-token";
|
import { appPathsInjectionToken } from "../app-path-injection-token";
|
||||||
|
|
||||||
const directoryForDownloadsInjectable = getInjectable({
|
const directoryForDownloadsInjectable = getInjectable({
|
||||||
|
id: "directory-for-downloads",
|
||||||
instantiate: (di) => di.inject(appPathsInjectionToken).downloads,
|
instantiate: (di) => di.inject(appPathsInjectionToken).downloads,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForDownloadsInjectable;
|
export default directoryForDownloadsInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appPathsInjectionToken } from "../app-path-injection-token";
|
import { appPathsInjectionToken } from "../app-path-injection-token";
|
||||||
|
|
||||||
const directoryForExesInjectable = getInjectable({
|
const directoryForExesInjectable = getInjectable({
|
||||||
|
id: "directory-for-exes",
|
||||||
instantiate: (di) => di.inject(appPathsInjectionToken).exe,
|
instantiate: (di) => di.inject(appPathsInjectionToken).exe,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForExesInjectable;
|
export default directoryForExesInjectable;
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForUserDataInjectable from "../directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../directory-for-user-data/directory-for-user-data.injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
const directoryForKubeConfigsInjectable = getInjectable({
|
const directoryForKubeConfigsInjectable = getInjectable({
|
||||||
|
id: "directory-for-kube-configs",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
path.resolve(di.inject(directoryForUserDataInjectable), "kubeconfigs"),
|
path.resolve(di.inject(directoryForUserDataInjectable), "kubeconfigs"),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForKubeConfigsInjectable;
|
export default directoryForKubeConfigsInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appPathsInjectionToken } from "../app-path-injection-token";
|
import { appPathsInjectionToken } from "../app-path-injection-token";
|
||||||
|
|
||||||
const directoryForTempInjectable = getInjectable({
|
const directoryForTempInjectable = getInjectable({
|
||||||
|
id: "directory-for-temp",
|
||||||
instantiate: (di) => di.inject(appPathsInjectionToken).temp,
|
instantiate: (di) => di.inject(appPathsInjectionToken).temp,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForTempInjectable;
|
export default directoryForTempInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appPathsInjectionToken } from "../app-path-injection-token";
|
import { appPathsInjectionToken } from "../app-path-injection-token";
|
||||||
|
|
||||||
const directoryForUserDataInjectable = getInjectable({
|
const directoryForUserDataInjectable = getInjectable({
|
||||||
|
id: "directory-for-user-data",
|
||||||
instantiate: (di) => di.inject(appPathsInjectionToken).userData,
|
instantiate: (di) => di.inject(appPathsInjectionToken).userData,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForUserDataInjectable;
|
export default directoryForUserDataInjectable;
|
||||||
|
|||||||
@ -2,21 +2,21 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import directoryForKubeConfigsInjectable from "../directory-for-kube-configs/directory-for-kube-configs.injectable";
|
import directoryForKubeConfigsInjectable from "../directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||||
|
|
||||||
const getCustomKubeConfigDirectoryInjectable = getInjectable({
|
const getCustomKubeConfigDirectoryInjectable = getInjectable({
|
||||||
|
id: "get-custom-kube-config-directory",
|
||||||
|
|
||||||
instantiate: (di) => (directoryName: string) => {
|
instantiate: (di) => (directoryName: string) => {
|
||||||
const directoryForKubeConfigs = di.inject(directoryForKubeConfigsInjectable);
|
const directoryForKubeConfigs = di.inject(directoryForKubeConfigsInjectable);
|
||||||
|
|
||||||
return path.resolve(
|
return path.resolve(
|
||||||
directoryForKubeConfigs,
|
directoryForKubeConfigs,
|
||||||
directoryName,
|
directoryName,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getCustomKubeConfigDirectoryInjectable;
|
export default getCustomKubeConfigDirectoryInjectable;
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { comparer, computed } from "mobx";
|
import { comparer, computed } from "mobx";
|
||||||
import hostedClusterInjectable from "./hosted-cluster.injectable";
|
import hostedClusterInjectable from "./hosted-cluster.injectable";
|
||||||
|
|
||||||
const allowedResourcesInjectable = getInjectable({
|
const allowedResourcesInjectable = getInjectable({
|
||||||
|
id: "allowed-resources",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const cluster = di.inject(hostedClusterInjectable);
|
const cluster = di.inject(hostedClusterInjectable);
|
||||||
|
|
||||||
@ -15,7 +17,6 @@ const allowedResourcesInjectable = getInjectable({
|
|||||||
equals: (cur, prev) => comparer.structural(cur, prev),
|
equals: (cur, prev) => comparer.structural(cur, prev),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default allowedResourcesInjectable;
|
export default allowedResourcesInjectable;
|
||||||
|
|||||||
@ -2,17 +2,17 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ClusterStore } from "./cluster-store";
|
import { ClusterStore } from "./cluster-store";
|
||||||
import { createClusterInjectionToken } from "../cluster/create-cluster-injection-token";
|
import { createClusterInjectionToken } from "../cluster/create-cluster-injection-token";
|
||||||
|
|
||||||
const clusterStoreInjectable = getInjectable({
|
const clusterStoreInjectable = getInjectable({
|
||||||
|
id: "cluster-store",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
ClusterStore.createInstance({
|
ClusterStore.createInstance({
|
||||||
createCluster: di.inject(createClusterInjectionToken),
|
createCluster: di.inject(createClusterInjectionToken),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default clusterStoreInjectable;
|
export default clusterStoreInjectable;
|
||||||
|
|||||||
@ -2,18 +2,18 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getHostedClusterId } from "../utils";
|
import { getHostedClusterId } from "../utils";
|
||||||
import clusterStoreInjectable from "./cluster-store.injectable";
|
import clusterStoreInjectable from "./cluster-store.injectable";
|
||||||
|
|
||||||
const hostedClusterInjectable = getInjectable({
|
const hostedClusterInjectable = getInjectable({
|
||||||
|
id: "hosted-cluster",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const hostedClusterId = getHostedClusterId();
|
const hostedClusterId = getHostedClusterId();
|
||||||
|
|
||||||
return di.inject(clusterStoreInjectable).getById(hostedClusterId);
|
return di.inject(clusterStoreInjectable).getById(hostedClusterId);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default hostedClusterInjectable;
|
export default hostedClusterInjectable;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { AuthorizationV1Api, KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
|
import { AuthorizationV1Api, KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
|
||||||
import logger from "../logger";
|
import logger from "../logger";
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
export type CanI = (resourceAttributes: V1ResourceAttributes) => Promise<boolean>;
|
export type CanI = (resourceAttributes: V1ResourceAttributes) => Promise<boolean>;
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ export function authorizationReview(proxyConfig: KubeConfig): CanI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const authorizationReviewInjectable = getInjectable({
|
const authorizationReviewInjectable = getInjectable({
|
||||||
|
id: "authorization-review",
|
||||||
instantiate: () => authorizationReview,
|
instantiate: () => authorizationReview,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default authorizationReviewInjectable;
|
export default authorizationReviewInjectable;
|
||||||
|
|||||||
@ -7,4 +7,4 @@ import type { ClusterModel } from "../cluster-types";
|
|||||||
import type { Cluster } from "./cluster";
|
import type { Cluster } from "./cluster";
|
||||||
|
|
||||||
export const createClusterInjectionToken =
|
export const createClusterInjectionToken =
|
||||||
getInjectionToken<(model: ClusterModel) => Cluster>();
|
getInjectionToken<(model: ClusterModel) => Cluster>({ id: "create-cluster-token" });
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { CoreV1Api, KubeConfig } from "@kubernetes/client-node";
|
import { CoreV1Api, KubeConfig } from "@kubernetes/client-node";
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
export type ListNamespaces = () => Promise<string[]>;
|
export type ListNamespaces = () => Promise<string[]>;
|
||||||
|
|
||||||
@ -18,8 +18,8 @@ export function listNamespaces(config: KubeConfig): ListNamespaces {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const listNamespacesInjectable = getInjectable({
|
const listNamespacesInjectable = getInjectable({
|
||||||
|
id: "list-namespaces",
|
||||||
instantiate: () => listNamespaces,
|
instantiate: () => listNamespaces,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default listNamespacesInjectable;
|
export default listNamespacesInjectable;
|
||||||
|
|||||||
@ -2,18 +2,18 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
|
|
||||||
const directoryForLensLocalStorageInjectable = getInjectable({
|
const directoryForLensLocalStorageInjectable = getInjectable({
|
||||||
|
id: "directory-for-lens-local-storage",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
path.resolve(
|
path.resolve(
|
||||||
di.inject(directoryForUserDataInjectable),
|
di.inject(directoryForUserDataInjectable),
|
||||||
"lens-local-storage",
|
"lens-local-storage",
|
||||||
),
|
),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForLensLocalStorageInjectable;
|
export default directoryForLensLocalStorageInjectable;
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import fse from "fs-extra";
|
import fse from "fs-extra";
|
||||||
|
|
||||||
const fsInjectable = getInjectable({
|
const fsInjectable = getInjectable({
|
||||||
|
id: "fs",
|
||||||
instantiate: () => fse,
|
instantiate: () => fse,
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default fsInjectable;
|
export default fsInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import fsInjectable from "./fs.injectable";
|
import fsInjectable from "./fs.injectable";
|
||||||
|
|
||||||
const readDirInjectable = getInjectable({
|
const readDirInjectable = getInjectable({
|
||||||
|
id: "read-dir",
|
||||||
instantiate: (di) => di.inject(fsInjectable).readdir,
|
instantiate: (di) => di.inject(fsInjectable).readdir,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default readDirInjectable;
|
export default readDirInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import fsInjectable from "./fs.injectable";
|
import fsInjectable from "./fs.injectable";
|
||||||
|
|
||||||
const readFileInjectable = getInjectable({
|
const readFileInjectable = getInjectable({
|
||||||
|
id: "read-file",
|
||||||
instantiate: (di) => di.inject(fsInjectable).readFile,
|
instantiate: (di) => di.inject(fsInjectable).readFile,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default readFileInjectable;
|
export default readFileInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import fsInjectable from "./fs.injectable";
|
import fsInjectable from "./fs.injectable";
|
||||||
|
|
||||||
const readJsonFileInjectable = getInjectable({
|
const readJsonFileInjectable = getInjectable({
|
||||||
|
id: "read-json-file",
|
||||||
instantiate: (di) => di.inject(fsInjectable).readJson,
|
instantiate: (di) => di.inject(fsInjectable).readJson,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default readJsonFileInjectable;
|
export default readJsonFileInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { EnsureOptions, WriteOptions } from "fs-extra";
|
import type { EnsureOptions, WriteOptions } from "fs-extra";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import type { JsonValue } from "type-fest";
|
import type { JsonValue } from "type-fest";
|
||||||
@ -23,6 +23,8 @@ const writeJsonFile = ({ writeJson, ensureDir }: Dependencies) => async (filePat
|
|||||||
};
|
};
|
||||||
|
|
||||||
const writeJsonFileInjectable = getInjectable({
|
const writeJsonFileInjectable = getInjectable({
|
||||||
|
id: "write-json-file",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const { writeJson, ensureDir } = di.inject(fsInjectable);
|
const { writeJson, ensureDir } = di.inject(fsInjectable);
|
||||||
|
|
||||||
@ -31,8 +33,6 @@ const writeJsonFileInjectable = getInjectable({
|
|||||||
ensureDir,
|
ensureDir,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default writeJsonFileInjectable;
|
export default writeJsonFileInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { HotbarStore } from "./hotbar-store";
|
import { HotbarStore } from "./hotbar-store";
|
||||||
|
|
||||||
const hotbarManagerInjectable = getInjectable({
|
const hotbarManagerInjectable = getInjectable({
|
||||||
|
id: "hotbar-manager",
|
||||||
instantiate: () => HotbarStore.getInstance(),
|
instantiate: () => HotbarStore.getInstance(),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default hotbarManagerInjectable;
|
export default hotbarManagerInjectable;
|
||||||
|
|||||||
@ -2,13 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { UserStore } from "./user-store";
|
import { UserStore } from "./user-store";
|
||||||
|
|
||||||
const userStoreInjectable = getInjectable({
|
const userStoreInjectable = getInjectable({
|
||||||
|
id: "user-store",
|
||||||
instantiate: () => UserStore.createInstance(),
|
instantiate: () => UserStore.createInstance(),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default userStoreInjectable;
|
export default userStoreInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import allowedResourcesInjectable from "../cluster-store/allowed-resources.injectable";
|
import allowedResourcesInjectable from "../cluster-store/allowed-resources.injectable";
|
||||||
import type { KubeResource } from "../rbac";
|
import type { KubeResource } from "../rbac";
|
||||||
|
|
||||||
@ -10,13 +10,13 @@ export type IsAllowedResource = (resource: KubeResource) => boolean;
|
|||||||
|
|
||||||
// TODO: This injectable obscures MobX de-referencing. Make it more apparent in usage.
|
// TODO: This injectable obscures MobX de-referencing. Make it more apparent in usage.
|
||||||
const isAllowedResourceInjectable = getInjectable({
|
const isAllowedResourceInjectable = getInjectable({
|
||||||
|
id: "is-allowed-resource",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const allowedResources = di.inject(allowedResourcesInjectable);
|
const allowedResources = di.inject(allowedResourcesInjectable);
|
||||||
|
|
||||||
return (resource: KubeResource) => allowedResources.get().has(resource);
|
return (resource: KubeResource) => allowedResources.get().has(resource);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isAllowedResourceInjectable;
|
export default isAllowedResourceInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { isLinux } from "../vars";
|
import { isLinux } from "../vars";
|
||||||
|
|
||||||
const isLinuxInjectable = getInjectable({
|
const isLinuxInjectable = getInjectable({
|
||||||
|
id: "is-linux",
|
||||||
instantiate: () => isLinux,
|
instantiate: () => isLinux,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isLinuxInjectable;
|
export default isLinuxInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { isWindows } from "../vars";
|
import { isWindows } from "../vars";
|
||||||
|
|
||||||
const isWindowsInjectable = getInjectable({
|
const isWindowsInjectable = getInjectable({
|
||||||
|
id: "is-windows",
|
||||||
instantiate: () => isWindows,
|
instantiate: () => isWindows,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isWindowsInjectable;
|
export default isWindowsInjectable;
|
||||||
|
|||||||
@ -2,12 +2,10 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { Injectable } from "@ogre-tools/injectable";
|
import type { Injectable, TentativeTuple } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
||||||
|
|
||||||
type TentativeTuple<T> = T extends object ? [T] : [undefined?];
|
|
||||||
|
|
||||||
type FactoryType = <
|
type FactoryType = <
|
||||||
TInjectable extends Injectable<unknown, TInstance, TInstantiationParameter>,
|
TInjectable extends Injectable<unknown, TInstance, TInstantiationParameter>,
|
||||||
TInstantiationParameter,
|
TInstantiationParameter,
|
||||||
|
|||||||
@ -2,11 +2,9 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { Injectable } from "@ogre-tools/injectable";
|
import type { Injectable, TentativeTuple } from "@ogre-tools/injectable";
|
||||||
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
||||||
|
|
||||||
type TentativeTuple<T> = T extends object ? [T] : [undefined?];
|
|
||||||
|
|
||||||
type MapInjectables<T> = {
|
type MapInjectables<T> = {
|
||||||
[Key in keyof T]: T[Key] extends () => infer Res ? Res : never;
|
[Key in keyof T]: T[Key] extends () => infer Res ? Res : never;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,11 +2,9 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { Injectable } from "@ogre-tools/injectable";
|
import type { Injectable, TentativeTuple } from "@ogre-tools/injectable";
|
||||||
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
import { getLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
|
||||||
|
|
||||||
type TentativeTuple<T> = T extends object ? [T] : [undefined?];
|
|
||||||
|
|
||||||
export const asLegacyGlobalObjectForExtensionApi = <
|
export const asLegacyGlobalObjectForExtensionApi = <
|
||||||
TInjectable extends Injectable<unknown, unknown, TInstantiationParameter>,
|
TInjectable extends Injectable<unknown, unknown, TInstantiationParameter>,
|
||||||
TInstantiationParameter,
|
TInstantiationParameter,
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { DependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
let legacyGlobalDi: DependencyInjectionContainer;
|
let legacyGlobalDi: DiContainer;
|
||||||
|
|
||||||
export const setLegacyGlobalDiForExtensionApi = (di: DependencyInjectionContainer) => {
|
export const setLegacyGlobalDiForExtensionApi = (di: DiContainer) => {
|
||||||
legacyGlobalDi = di;
|
legacyGlobalDi = di;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import extensionsStoreInjectable from "../../extensions-store/extensions-store.injectable";
|
import extensionsStoreInjectable from "../../extensions-store/extensions-store.injectable";
|
||||||
|
|
||||||
const getEnabledExtensionsInjectable = getInjectable({
|
const getEnabledExtensionsInjectable = getInjectable({
|
||||||
|
id: "get-enabled-extensions",
|
||||||
|
|
||||||
instantiate: (di) => () =>
|
instantiate: (di) => () =>
|
||||||
di.inject(extensionsStoreInjectable).enabledExtensions,
|
di.inject(extensionsStoreInjectable).enabledExtensions,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getEnabledExtensionsInjectable;
|
export default getEnabledExtensionsInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ExtensionDiscovery } from "./extension-discovery";
|
import { ExtensionDiscovery } from "./extension-discovery";
|
||||||
import extensionLoaderInjectable from "../extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "../extension-loader/extension-loader.injectable";
|
||||||
import isCompatibleExtensionInjectable from "./is-compatible-extension/is-compatible-extension.injectable";
|
import isCompatibleExtensionInjectable from "./is-compatible-extension/is-compatible-extension.injectable";
|
||||||
@ -14,6 +14,8 @@ import extensionPackageRootDirectoryInjectable from "../extension-installer/exte
|
|||||||
import installExtensionsInjectable from "../extension-installer/install-extensions/install-extensions.injectable";
|
import installExtensionsInjectable from "../extension-installer/install-extensions/install-extensions.injectable";
|
||||||
|
|
||||||
const extensionDiscoveryInjectable = getInjectable({
|
const extensionDiscoveryInjectable = getInjectable({
|
||||||
|
id: "extension-discovery",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
new ExtensionDiscovery({
|
new ExtensionDiscovery({
|
||||||
extensionLoader: di.inject(extensionLoaderInjectable),
|
extensionLoader: di.inject(extensionLoaderInjectable),
|
||||||
@ -36,8 +38,6 @@ const extensionDiscoveryInjectable = getInjectable({
|
|||||||
extensionPackageRootDirectoryInjectable,
|
extensionPackageRootDirectoryInjectable,
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionDiscoveryInjectable;
|
export default extensionDiscoveryInjectable;
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appSemVer } from "../../../common/vars";
|
import { appSemVer } from "../../../common/vars";
|
||||||
import { isCompatibleBundledExtension } from "./is-compatible-bundled-extension";
|
import { isCompatibleBundledExtension } from "./is-compatible-bundled-extension";
|
||||||
|
|
||||||
const isCompatibleBundledExtensionInjectable = getInjectable({
|
const isCompatibleBundledExtensionInjectable = getInjectable({
|
||||||
|
id: "is-compatible-bundled-extension",
|
||||||
instantiate: () => isCompatibleBundledExtension({ appSemVer }),
|
instantiate: () => isCompatibleBundledExtension({ appSemVer }),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isCompatibleBundledExtensionInjectable;
|
export default isCompatibleBundledExtensionInjectable;
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { appSemVer } from "../../../common/vars";
|
import { appSemVer } from "../../../common/vars";
|
||||||
import { isCompatibleExtension } from "./is-compatible-extension";
|
import { isCompatibleExtension } from "./is-compatible-extension";
|
||||||
|
|
||||||
const isCompatibleExtensionInjectable = getInjectable({
|
const isCompatibleExtensionInjectable = getInjectable({
|
||||||
|
id: "is-compatible-extension",
|
||||||
instantiate: () => isCompatibleExtension({ appSemVer }),
|
instantiate: () => isCompatibleExtension({ appSemVer }),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isCompatibleExtensionInjectable;
|
export default isCompatibleExtensionInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ExtensionInstallationStateStore } from "./extension-installation-state-store";
|
import { ExtensionInstallationStateStore } from "./extension-installation-state-store";
|
||||||
|
|
||||||
const extensionInstallationStateStoreInjectable = getInjectable({
|
const extensionInstallationStateStoreInjectable = getInjectable({
|
||||||
|
id: "extension-installation-state-store",
|
||||||
instantiate: () => new ExtensionInstallationStateStore(),
|
instantiate: () => new ExtensionInstallationStateStore(),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionInstallationStateStoreInjectable;
|
export default extensionInstallationStateStoreInjectable;
|
||||||
|
|||||||
@ -2,19 +2,19 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ExtensionInstaller } from "./extension-installer";
|
import { ExtensionInstaller } from "./extension-installer";
|
||||||
import extensionPackageRootDirectoryInjectable from "./extension-package-root-directory/extension-package-root-directory.injectable";
|
import extensionPackageRootDirectoryInjectable from "./extension-package-root-directory/extension-package-root-directory.injectable";
|
||||||
|
|
||||||
const extensionInstallerInjectable = getInjectable({
|
const extensionInstallerInjectable = getInjectable({
|
||||||
|
id: "extension-installer",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
new ExtensionInstaller({
|
new ExtensionInstaller({
|
||||||
extensionPackageRootDirectory: di.inject(
|
extensionPackageRootDirectory: di.inject(
|
||||||
extensionPackageRootDirectoryInjectable,
|
extensionPackageRootDirectoryInjectable,
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionInstallerInjectable;
|
export default extensionInstallerInjectable;
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForUserDataInjectable
|
import directoryForUserDataInjectable
|
||||||
from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
|
|
||||||
const extensionPackageRootDirectoryInjectable = getInjectable({
|
const extensionPackageRootDirectoryInjectable = getInjectable({
|
||||||
instantiate: (di) => di.inject(directoryForUserDataInjectable),
|
id: "extension-package-root-directory",
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
instantiate: (di) => di.inject(directoryForUserDataInjectable),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionPackageRootDirectoryInjectable;
|
export default extensionPackageRootDirectoryInjectable;
|
||||||
|
|||||||
@ -2,13 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import extensionInstallerInjectable from "../extension-installer.injectable";
|
import extensionInstallerInjectable from "../extension-installer.injectable";
|
||||||
|
|
||||||
const installExtensionInjectable = getInjectable({
|
const installExtensionInjectable = getInjectable({
|
||||||
|
id: "install-extension",
|
||||||
instantiate: (di) => di.inject(extensionInstallerInjectable).installPackage,
|
instantiate: (di) => di.inject(extensionInstallerInjectable).installPackage,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default installExtensionInjectable;
|
export default installExtensionInjectable;
|
||||||
|
|||||||
@ -2,13 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import extensionInstallerInjectable from "../extension-installer.injectable";
|
import extensionInstallerInjectable from "../extension-installer.injectable";
|
||||||
|
|
||||||
const installExtensionsInjectable = getInjectable({
|
const installExtensionsInjectable = getInjectable({
|
||||||
|
id: "install-extensions",
|
||||||
instantiate: (di) => di.inject(extensionInstallerInjectable).installPackages,
|
instantiate: (di) => di.inject(extensionInstallerInjectable).installPackages,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default installExtensionsInjectable;
|
export default installExtensionsInjectable;
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { createExtensionInstance } from "./create-extension-instance";
|
import { createExtensionInstance } from "./create-extension-instance";
|
||||||
import fileSystemProvisionerStoreInjectable from "./file-system-provisioner-store/file-system-provisioner-store.injectable";
|
import fileSystemProvisionerStoreInjectable from "./file-system-provisioner-store/file-system-provisioner-store.injectable";
|
||||||
|
|
||||||
const createExtensionInstanceInjectable = getInjectable({
|
const createExtensionInstanceInjectable = getInjectable({
|
||||||
|
id: "create-extension-instance",
|
||||||
|
|
||||||
instantiate: (di) => createExtensionInstance({
|
instantiate: (di) => createExtensionInstance({
|
||||||
fileSystemProvisionerStore: di.inject(fileSystemProvisionerStoreInjectable),
|
fileSystemProvisionerStore: di.inject(fileSystemProvisionerStoreInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createExtensionInstanceInjectable;
|
export default createExtensionInstanceInjectable;
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import directoryForUserDataInjectable from "../../../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
import directoryForUserDataInjectable from "../../../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
|
|
||||||
const directoryForExtensionDataInjectable = getInjectable({
|
const directoryForExtensionDataInjectable = getInjectable({
|
||||||
|
id: "directory-for-extension-data",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
path.join(di.inject(directoryForUserDataInjectable), "extension_data"),
|
path.join(di.inject(directoryForUserDataInjectable), "extension_data"),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForExtensionDataInjectable;
|
export default directoryForExtensionDataInjectable;
|
||||||
|
|||||||
@ -2,19 +2,19 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { FileSystemProvisionerStore } from "./file-system-provisioner-store";
|
import { FileSystemProvisionerStore } from "./file-system-provisioner-store";
|
||||||
import directoryForExtensionDataInjectable from "./directory-for-extension-data/directory-for-extension-data.injectable";
|
import directoryForExtensionDataInjectable from "./directory-for-extension-data/directory-for-extension-data.injectable";
|
||||||
|
|
||||||
const fileSystemProvisionerStoreInjectable = getInjectable({
|
const fileSystemProvisionerStoreInjectable = getInjectable({
|
||||||
|
id: "file-system-provisioner-store",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
FileSystemProvisionerStore.createInstance({
|
FileSystemProvisionerStore.createInstance({
|
||||||
directoryForExtensionData: di.inject(
|
directoryForExtensionData: di.inject(
|
||||||
directoryForExtensionDataInjectable,
|
directoryForExtensionDataInjectable,
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default fileSystemProvisionerStoreInjectable;
|
export default fileSystemProvisionerStoreInjectable;
|
||||||
|
|||||||
@ -2,20 +2,20 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ExtensionLoader } from "./extension-loader";
|
import { ExtensionLoader } from "./extension-loader";
|
||||||
import updateExtensionsStateInjectable from "./update-extensions-state/update-extensions-state.injectable";
|
import updateExtensionsStateInjectable from "./update-extensions-state/update-extensions-state.injectable";
|
||||||
import createExtensionInstanceInjectable
|
import createExtensionInstanceInjectable
|
||||||
from "./create-extension-instance/create-extension-instance.injectable";
|
from "./create-extension-instance/create-extension-instance.injectable";
|
||||||
|
|
||||||
const extensionLoaderInjectable = getInjectable({
|
const extensionLoaderInjectable = getInjectable({
|
||||||
|
id: "extension-loader",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
new ExtensionLoader({
|
new ExtensionLoader({
|
||||||
updateExtensionsState: di.inject(updateExtensionsStateInjectable),
|
updateExtensionsState: di.inject(updateExtensionsStateInjectable),
|
||||||
createExtensionInstance: di.inject(createExtensionInstanceInjectable),
|
createExtensionInstance: di.inject(createExtensionInstanceInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionLoaderInjectable;
|
export default extensionLoaderInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import extensionsStoreInjectable from "../../extensions-store/extensions-store.injectable";
|
import extensionsStoreInjectable from "../../extensions-store/extensions-store.injectable";
|
||||||
|
|
||||||
const updateExtensionsStateInjectable = getInjectable({
|
const updateExtensionsStateInjectable = getInjectable({
|
||||||
|
id: "upadte-extensions-state",
|
||||||
instantiate: (di) => di.inject(extensionsStoreInjectable).mergeState,
|
instantiate: (di) => di.inject(extensionsStoreInjectable).mergeState,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default updateExtensionsStateInjectable;
|
export default updateExtensionsStateInjectable;
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForUserDataInjectable
|
import directoryForUserDataInjectable
|
||||||
from "../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
from "../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||||
|
|
||||||
const extensionPackagesRootInjectable = getInjectable({
|
const extensionPackagesRootInjectable = getInjectable({
|
||||||
|
id: "extension-packages-root",
|
||||||
instantiate: (di) => di.inject(directoryForUserDataInjectable),
|
instantiate: (di) => di.inject(directoryForUserDataInjectable),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionPackagesRootInjectable;
|
export default extensionPackagesRootInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ExtensionsStore } from "./extensions-store";
|
import { ExtensionsStore } from "./extensions-store";
|
||||||
|
|
||||||
const extensionsStoreInjectable = getInjectable({
|
const extensionsStoreInjectable = getInjectable({
|
||||||
|
id: "extensions-store",
|
||||||
instantiate: () => ExtensionsStore.createInstance(),
|
instantiate: () => ExtensionsStore.createInstance(),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionsStoreInjectable;
|
export default extensionsStoreInjectable;
|
||||||
|
|||||||
@ -2,18 +2,18 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import extensionLoaderInjectable from "./extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "./extension-loader/extension-loader.injectable";
|
||||||
|
|
||||||
const extensionsInjectable = getInjectable({
|
const extensionsInjectable = getInjectable({
|
||||||
|
id: "extensions",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const extensionLoader = di.inject(extensionLoaderInjectable);
|
const extensionLoader = di.inject(extensionLoaderInjectable);
|
||||||
|
|
||||||
return computed(() => extensionLoader.enabledExtensionInstances);
|
return computed(() => extensionLoader.enabledExtensionInstances);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default extensionsInjectable;
|
export default extensionsInjectable;
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import extensionsInjectable from "./extensions.injectable";
|
import extensionsInjectable from "./extensions.injectable";
|
||||||
import type { LensMainExtension } from "./lens-main-extension";
|
import type { LensMainExtension } from "./lens-main-extension";
|
||||||
|
|
||||||
const mainExtensionsInjectable = getInjectable({
|
const mainExtensionsInjectable = getInjectable({
|
||||||
lifecycle: lifecycleEnum.singleton,
|
id: "main-extensions",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
di.inject(extensionsInjectable) as IComputedValue<LensMainExtension[]>,
|
di.inject(extensionsInjectable) as IComputedValue<LensMainExtension[]>,
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import extensionsInjectable from "./extensions.injectable";
|
import extensionsInjectable from "./extensions.injectable";
|
||||||
import type { LensRendererExtension } from "./lens-renderer-extension";
|
import type { LensRendererExtension } from "./lens-renderer-extension";
|
||||||
|
|
||||||
const rendererExtensionsInjectable = getInjectable({
|
const rendererExtensionsInjectable = getInjectable({
|
||||||
|
id: "renderer-extensions",
|
||||||
instantiate: (di) => di.inject(extensionsInjectable) as IComputedValue<LensRendererExtension[]>,
|
instantiate: (di) => di.inject(extensionsInjectable) as IComputedValue<LensRendererExtension[]>,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default rendererExtensionsInjectable;
|
export default rendererExtensionsInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
|
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
|
||||||
|
|
||||||
const appNameInjectable = getInjectable({
|
const appNameInjectable = getInjectable({
|
||||||
|
id: "app-name",
|
||||||
instantiate: (di) => di.inject(electronAppInjectable).name,
|
instantiate: (di) => di.inject(electronAppInjectable).name,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default appNameInjectable;
|
export default appNameInjectable;
|
||||||
|
|||||||
@ -3,9 +3,8 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
DependencyInjectionContainer,
|
DiContainerForSetup,
|
||||||
getInjectable,
|
getInjectable,
|
||||||
lifecycleEnum,
|
|
||||||
} from "@ogre-tools/injectable";
|
} from "@ogre-tools/injectable";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -22,38 +21,40 @@ import appNameInjectable from "./app-name/app-name.injectable";
|
|||||||
import directoryForIntegrationTestingInjectable from "./directory-for-integration-testing/directory-for-integration-testing.injectable";
|
import directoryForIntegrationTestingInjectable from "./directory-for-integration-testing/directory-for-integration-testing.injectable";
|
||||||
|
|
||||||
const appPathsInjectable = getInjectable({
|
const appPathsInjectable = getInjectable({
|
||||||
setup: (di) => {
|
id: "app-paths",
|
||||||
const directoryForIntegrationTesting = di.inject(
|
|
||||||
|
setup: async (di) => {
|
||||||
|
const directoryForIntegrationTesting = await di.inject(
|
||||||
directoryForIntegrationTestingInjectable,
|
directoryForIntegrationTestingInjectable,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (directoryForIntegrationTesting) {
|
if (directoryForIntegrationTesting) {
|
||||||
setupPathForAppDataInIntegrationTesting(di, directoryForIntegrationTesting);
|
await setupPathForAppDataInIntegrationTesting(di, directoryForIntegrationTesting);
|
||||||
}
|
}
|
||||||
|
|
||||||
setupPathForUserData(di);
|
await setupPathForUserData(di);
|
||||||
registerAppPathsChannel(di);
|
await registerAppPathsChannel(di);
|
||||||
},
|
},
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
getAppPaths({ getAppPath: di.inject(getElectronAppPathInjectable) }),
|
getAppPaths({ getAppPath: di.inject(getElectronAppPathInjectable) }),
|
||||||
|
|
||||||
injectionToken: appPathsInjectionToken,
|
injectionToken: appPathsInjectionToken,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default appPathsInjectable;
|
export default appPathsInjectable;
|
||||||
|
|
||||||
const registerAppPathsChannel = (di: DependencyInjectionContainer) => {
|
const registerAppPathsChannel = async (di: DiContainerForSetup) => {
|
||||||
const registerChannel = di.inject(registerChannelInjectable);
|
const registerChannel = await di.inject(registerChannelInjectable);
|
||||||
|
const appPaths = await di.inject(appPathsInjectable);
|
||||||
|
|
||||||
registerChannel(appPathsIpcChannel, () => di.inject(appPathsInjectable));
|
registerChannel(appPathsIpcChannel, () => appPaths);
|
||||||
};
|
};
|
||||||
|
|
||||||
const setupPathForUserData = (di: DependencyInjectionContainer) => {
|
const setupPathForUserData = async (di: DiContainerForSetup) => {
|
||||||
const setElectronAppPath = di.inject(setElectronAppPathInjectable);
|
const setElectronAppPath = await di.inject(setElectronAppPathInjectable);
|
||||||
const appName = di.inject(appNameInjectable);
|
const appName = await di.inject(appNameInjectable);
|
||||||
const getAppPath = di.inject(getElectronAppPathInjectable);
|
const getAppPath = await di.inject(getElectronAppPathInjectable);
|
||||||
|
|
||||||
const appDataPath = getAppPath("appData");
|
const appDataPath = getAppPath("appData");
|
||||||
|
|
||||||
@ -61,8 +62,8 @@ const setupPathForUserData = (di: DependencyInjectionContainer) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Todo: this kludge is here only until we have a proper place to setup integration testing.
|
// Todo: this kludge is here only until we have a proper place to setup integration testing.
|
||||||
const setupPathForAppDataInIntegrationTesting = (di: DependencyInjectionContainer, appDataPath: string) => {
|
const setupPathForAppDataInIntegrationTesting = async (di: DiContainerForSetup, appDataPath: string) => {
|
||||||
const setElectronAppPath = di.inject(setElectronAppPathInjectable);
|
const setElectronAppPath = await di.inject(setElectronAppPathInjectable);
|
||||||
|
|
||||||
setElectronAppPath("appData", appDataPath);
|
setElectronAppPath("appData", appDataPath);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
|
||||||
const directoryForIntegrationTestingInjectable = getInjectable({
|
const directoryForIntegrationTestingInjectable = getInjectable({
|
||||||
|
id: "directory-for-integration-testing",
|
||||||
instantiate: () => process.env.CICD,
|
instantiate: () => process.env.CICD,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForIntegrationTestingInjectable;
|
export default directoryForIntegrationTestingInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
|
|
||||||
const electronAppInjectable = getInjectable({
|
const electronAppInjectable = getInjectable({
|
||||||
|
id: "electron-app",
|
||||||
instantiate: () => app,
|
instantiate: () => app,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronAppInjectable from "./electron-app/electron-app.injectable";
|
import electronAppInjectable from "./electron-app/electron-app.injectable";
|
||||||
import { getElectronAppPath } from "./get-electron-app-path";
|
import { getElectronAppPath } from "./get-electron-app-path";
|
||||||
|
|
||||||
const getElectronAppPathInjectable = getInjectable({
|
const getElectronAppPathInjectable = getInjectable({
|
||||||
|
id: "get-electron-app-path",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
getElectronAppPath({ app: di.inject(electronAppInjectable) }),
|
getElectronAppPath({ app: di.inject(electronAppInjectable) }),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getElectronAppPathInjectable;
|
export default getElectronAppPathInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ipcMain } from "electron";
|
import { ipcMain } from "electron";
|
||||||
|
|
||||||
const ipcMainInjectable = getInjectable({
|
const ipcMainInjectable = getInjectable({
|
||||||
|
id: "ipc-main",
|
||||||
instantiate: () => ipcMain,
|
instantiate: () => ipcMain,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import ipcMainInjectable from "./ipc-main/ipc-main.injectable";
|
import ipcMainInjectable from "./ipc-main/ipc-main.injectable";
|
||||||
import { registerChannel } from "./register-channel";
|
import { registerChannel } from "./register-channel";
|
||||||
|
|
||||||
const registerChannelInjectable = getInjectable({
|
const registerChannelInjectable = getInjectable({
|
||||||
|
id: "register-channel",
|
||||||
|
|
||||||
instantiate: (di) => registerChannel({
|
instantiate: (di) => registerChannel({
|
||||||
ipcMain: di.inject(ipcMainInjectable),
|
ipcMain: di.inject(ipcMainInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default registerChannelInjectable;
|
export default registerChannelInjectable;
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { PathName } from "../../../common/app-paths/app-path-names";
|
import type { PathName } from "../../../common/app-paths/app-path-names";
|
||||||
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
|
import electronAppInjectable from "../get-electron-app-path/electron-app/electron-app.injectable";
|
||||||
|
|
||||||
const setElectronAppPathInjectable = getInjectable({
|
const setElectronAppPathInjectable = getInjectable({
|
||||||
|
id: "set-electron-app-path",
|
||||||
|
|
||||||
instantiate: (di) => (name: PathName, path: string) : void =>
|
instantiate: (di) => (name: PathName, path: string) : void =>
|
||||||
di.inject(electronAppInjectable).setPath(name, path),
|
di.inject(electronAppInjectable).setPath(name, path),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default setElectronAppPathInjectable;
|
export default setElectronAppPathInjectable;
|
||||||
|
|||||||
@ -2,18 +2,18 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||||
import { KubeconfigSyncManager } from "./kubeconfig-sync-manager";
|
import { KubeconfigSyncManager } from "./kubeconfig-sync-manager";
|
||||||
import { createClusterInjectionToken } from "../../../common/cluster/create-cluster-injection-token";
|
import { createClusterInjectionToken } from "../../../common/cluster/create-cluster-injection-token";
|
||||||
|
|
||||||
const kubeconfigSyncManagerInjectable = getInjectable({
|
const kubeconfigSyncManagerInjectable = getInjectable({
|
||||||
|
id: "kubeconfig-sync-manager",
|
||||||
|
|
||||||
instantiate: (di) => new KubeconfigSyncManager({
|
instantiate: (di) => new KubeconfigSyncManager({
|
||||||
directoryForKubeConfigs: di.inject(directoryForKubeConfigsInjectable),
|
directoryForKubeConfigs: di.inject(directoryForKubeConfigsInjectable),
|
||||||
createCluster: di.inject(createClusterInjectionToken),
|
createCluster: di.inject(createClusterInjectionToken),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default kubeconfigSyncManagerInjectable;
|
export default kubeconfigSyncManagerInjectable;
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import { ContextHandler } from "./context-handler";
|
import { ContextHandler } from "./context-handler";
|
||||||
import createKubeAuthProxyInjectable from "../kube-auth-proxy/create-kube-auth-proxy.injectable";
|
import createKubeAuthProxyInjectable from "../kube-auth-proxy/create-kube-auth-proxy.injectable";
|
||||||
|
|
||||||
const createContextHandlerInjectable = getInjectable({
|
const createContextHandlerInjectable = getInjectable({
|
||||||
|
id: "create-context-handler",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const dependencies = {
|
const dependencies = {
|
||||||
createKubeAuthProxy: di.inject(createKubeAuthProxyInjectable),
|
createKubeAuthProxy: di.inject(createKubeAuthProxyInjectable),
|
||||||
@ -15,8 +17,6 @@ const createContextHandlerInjectable = getInjectable({
|
|||||||
|
|
||||||
return (cluster: Cluster) => new ContextHandler(dependencies, cluster);
|
return (cluster: Cluster) => new ContextHandler(dependencies, cluster);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createContextHandlerInjectable;
|
export default createContextHandlerInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Cluster, ClusterDependencies } from "../../common/cluster/cluster";
|
import { Cluster, ClusterDependencies } from "../../common/cluster/cluster";
|
||||||
import directoryForKubeConfigsInjectable from "../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
import directoryForKubeConfigsInjectable from "../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||||
import createKubeconfigManagerInjectable from "../kubeconfig-manager/create-kubeconfig-manager.injectable";
|
import createKubeconfigManagerInjectable from "../kubeconfig-manager/create-kubeconfig-manager.injectable";
|
||||||
@ -13,6 +13,8 @@ import authorizationReviewInjectable from "../../common/cluster/authorization-re
|
|||||||
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
import listNamespacesInjectable from "../../common/cluster/list-namespaces.injectable";
|
||||||
|
|
||||||
const createClusterInjectable = getInjectable({
|
const createClusterInjectable = getInjectable({
|
||||||
|
id: "create-cluster",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const dependencies: ClusterDependencies = {
|
const dependencies: ClusterDependencies = {
|
||||||
directoryForKubeConfigs: di.inject(directoryForKubeConfigsInjectable),
|
directoryForKubeConfigs: di.inject(directoryForKubeConfigsInjectable),
|
||||||
@ -27,8 +29,6 @@ const createClusterInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
|
|
||||||
injectionToken: createClusterInjectionToken,
|
injectionToken: createClusterInjectionToken,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createClusterInjectable;
|
export default createClusterInjectable;
|
||||||
|
|||||||
@ -27,7 +27,6 @@ export const getDiForUnitTesting = (
|
|||||||
const injectableInstance = require(filePath).default;
|
const injectableInstance = require(filePath).default;
|
||||||
|
|
||||||
di.register({
|
di.register({
|
||||||
id: filePath,
|
|
||||||
...injectableInstance,
|
...injectableInstance,
|
||||||
aliases: [injectableInstance, ...(injectableInstance.aliases || [])],
|
aliases: [injectableInstance, ...(injectableInstance.aliases || [])],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,19 +2,19 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import electronMenuItemsInjectable from "../../menu/electron-menu-items.injectable";
|
import electronMenuItemsInjectable from "../../menu/electron-menu-items.injectable";
|
||||||
import directoryForLensLocalStorageInjectable
|
import directoryForLensLocalStorageInjectable
|
||||||
from "../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
from "../../../common/directory-for-lens-local-storage/directory-for-lens-local-storage.injectable";
|
||||||
import { initIpcMainHandlers } from "./init-ipc-main-handlers";
|
import { initIpcMainHandlers } from "./init-ipc-main-handlers";
|
||||||
|
|
||||||
const initIpcMainHandlersInjectable = getInjectable({
|
const initIpcMainHandlersInjectable = getInjectable({
|
||||||
|
id: "init-ipc-main-handlers",
|
||||||
|
|
||||||
instantiate: (di) => initIpcMainHandlers({
|
instantiate: (di) => initIpcMainHandlers({
|
||||||
electronMenuItems: di.inject(electronMenuItemsInjectable),
|
electronMenuItems: di.inject(electronMenuItemsInjectable),
|
||||||
directoryForLensLocalStorage: di.inject(directoryForLensLocalStorageInjectable),
|
directoryForLensLocalStorage: di.inject(directoryForLensLocalStorageInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default initIpcMainHandlersInjectable;
|
export default initIpcMainHandlersInjectable;
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { KubeAuthProxy } from "./kube-auth-proxy";
|
import { KubeAuthProxy } from "./kube-auth-proxy";
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import bundledKubectlInjectable from "../kubectl/bundled-kubectl.injectable";
|
import bundledKubectlInjectable from "../kubectl/bundled-kubectl.injectable";
|
||||||
|
|
||||||
const createKubeAuthProxyInjectable = getInjectable({
|
const createKubeAuthProxyInjectable = getInjectable({
|
||||||
|
id: "create-kube-auth-proxy",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const bundledKubectl = di.inject(bundledKubectlInjectable);
|
const bundledKubectl = di.inject(bundledKubectlInjectable);
|
||||||
|
|
||||||
@ -18,8 +20,6 @@ const createKubeAuthProxyInjectable = getInjectable({
|
|||||||
return (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) =>
|
return (cluster: Cluster, environmentVariables: NodeJS.ProcessEnv) =>
|
||||||
new KubeAuthProxy(dependencies, cluster, environmentVariables);
|
new KubeAuthProxy(dependencies, cluster, environmentVariables);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createKubeAuthProxyInjectable;
|
export default createKubeAuthProxyInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import directoryForTempInjectable from "../../common/app-paths/directory-for-temp/directory-for-temp.injectable";
|
import directoryForTempInjectable from "../../common/app-paths/directory-for-temp/directory-for-temp.injectable";
|
||||||
import { KubeconfigManager } from "./kubeconfig-manager";
|
import { KubeconfigManager } from "./kubeconfig-manager";
|
||||||
@ -12,6 +12,8 @@ export interface KubeConfigManagerInstantiationParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createKubeconfigManagerInjectable = getInjectable({
|
const createKubeconfigManagerInjectable = getInjectable({
|
||||||
|
id: "create-kubeconfig-manager",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const dependencies = {
|
const dependencies = {
|
||||||
directoryForTemp: di.inject(directoryForTempInjectable),
|
directoryForTemp: di.inject(directoryForTempInjectable),
|
||||||
@ -19,8 +21,6 @@ const createKubeconfigManagerInjectable = getInjectable({
|
|||||||
|
|
||||||
return (cluster: Cluster) => new KubeconfigManager(dependencies, cluster);
|
return (cluster: Cluster) => new KubeconfigManager(dependencies, cluster);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createKubeconfigManagerInjectable;
|
export default createKubeconfigManagerInjectable;
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { getBundledKubectlVersion } from "../../common/utils";
|
import { getBundledKubectlVersion } from "../../common/utils";
|
||||||
import createKubectlInjectable from "./create-kubectl.injectable";
|
import createKubectlInjectable from "./create-kubectl.injectable";
|
||||||
|
|
||||||
const bundledKubectlInjectable = getInjectable({
|
const bundledKubectlInjectable = getInjectable({
|
||||||
|
id: "bundled-kubectl",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const createKubectl = di.inject(createKubectlInjectable);
|
const createKubectl = di.inject(createKubectlInjectable);
|
||||||
|
|
||||||
@ -14,8 +16,6 @@ const bundledKubectlInjectable = getInjectable({
|
|||||||
|
|
||||||
return createKubectl(bundledKubectlVersion);
|
return createKubectl(bundledKubectlVersion);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default bundledKubectlInjectable;
|
export default bundledKubectlInjectable;
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Kubectl } from "./kubectl";
|
import { Kubectl } from "./kubectl";
|
||||||
import directoryForKubectlBinariesInjectable from "./directory-for-kubectl-binaries/directory-for-kubectl-binaries.injectable";
|
import directoryForKubectlBinariesInjectable from "./directory-for-kubectl-binaries/directory-for-kubectl-binaries.injectable";
|
||||||
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
import userStoreInjectable from "../../common/user-store/user-store.injectable";
|
||||||
|
|
||||||
const createKubectlInjectable = getInjectable({
|
const createKubectlInjectable = getInjectable({
|
||||||
|
id: "create-kubectl",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const dependencies = {
|
const dependencies = {
|
||||||
userStore: di.inject(userStoreInjectable),
|
userStore: di.inject(userStoreInjectable),
|
||||||
@ -20,8 +22,6 @@ const createKubectlInjectable = getInjectable({
|
|||||||
return (clusterVersion: string) =>
|
return (clusterVersion: string) =>
|
||||||
new Kubectl(dependencies, clusterVersion);
|
new Kubectl(dependencies, clusterVersion);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createKubectlInjectable;
|
export default createKubectlInjectable;
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import directoryForBinariesInjectable from "../../../common/app-paths/directory-for-binaries/directory-for-binaries.injectable";
|
import directoryForBinariesInjectable from "../../../common/app-paths/directory-for-binaries/directory-for-binaries.injectable";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
const directoryForKubectlBinariesInjectable = getInjectable({
|
const directoryForKubectlBinariesInjectable = getInjectable({
|
||||||
|
id: "directory-for-kubectl-binaries",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
path.join(di.inject(directoryForBinariesInjectable), "kubectl"),
|
path.join(di.inject(directoryForBinariesInjectable), "kubectl"),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default directoryForKubectlBinariesInjectable;
|
export default directoryForKubectlBinariesInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
||||||
|
|
||||||
const electronMenuItemsInjectable = getInjectable({
|
const electronMenuItemsInjectable = getInjectable({
|
||||||
lifecycle: lifecycleEnum.singleton,
|
id: "electron-menu-items",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const extensions = di.inject(mainExtensionsInjectable);
|
const extensions = di.inject(mainExtensionsInjectable);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { ConfigurableDependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { LensMainExtension } from "../../extensions/lens-main-extension";
|
import { LensMainExtension } from "../../extensions/lens-main-extension";
|
||||||
import electronMenuItemsInjectable from "./electron-menu-items.injectable";
|
import electronMenuItemsInjectable from "./electron-menu-items.injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
@ -12,7 +12,7 @@ import { getDiForUnitTesting } from "../getDiForUnitTesting";
|
|||||||
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
||||||
|
|
||||||
describe("electron-menu-items", () => {
|
describe("electron-menu-items", () => {
|
||||||
let di: ConfigurableDependencyInjectionContainer;
|
let di: DiContainer;
|
||||||
let electronMenuItems: IComputedValue<MenuRegistration[]>;
|
let electronMenuItems: IComputedValue<MenuRegistration[]>;
|
||||||
let extensionsStub: ObservableMap<string, LensMainExtension>;
|
let extensionsStub: ObservableMap<string, LensMainExtension>;
|
||||||
|
|
||||||
|
|||||||
@ -2,19 +2,19 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "../../../extensions/extension-loader/extension-loader.injectable";
|
||||||
import { LensProtocolRouterMain } from "./lens-protocol-router-main";
|
import { LensProtocolRouterMain } from "./lens-protocol-router-main";
|
||||||
import extensionsStoreInjectable from "../../../extensions/extensions-store/extensions-store.injectable";
|
import extensionsStoreInjectable from "../../../extensions/extensions-store/extensions-store.injectable";
|
||||||
|
|
||||||
const lensProtocolRouterMainInjectable = getInjectable({
|
const lensProtocolRouterMainInjectable = getInjectable({
|
||||||
|
id: "lens-protocol-router-main",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
new LensProtocolRouterMain({
|
new LensProtocolRouterMain({
|
||||||
extensionLoader: di.inject(extensionLoaderInjectable),
|
extensionLoader: di.inject(extensionLoaderInjectable),
|
||||||
extensionsStore: di.inject(extensionsStoreInjectable),
|
extensionsStore: di.inject(extensionsStoreInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default lensProtocolRouterMainInjectable;
|
export default lensProtocolRouterMainInjectable;
|
||||||
|
|||||||
@ -2,19 +2,19 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { shellApiRequest } from "./shell-api-request";
|
import { shellApiRequest } from "./shell-api-request";
|
||||||
import createShellSessionInjectable from "../../shell-session/create-shell-session.injectable";
|
import createShellSessionInjectable from "../../shell-session/create-shell-session.injectable";
|
||||||
import shellRequestAuthenticatorInjectable
|
import shellRequestAuthenticatorInjectable
|
||||||
from "./shell-request-authenticator/shell-request-authenticator.injectable";
|
from "./shell-request-authenticator/shell-request-authenticator.injectable";
|
||||||
|
|
||||||
const shellApiRequestInjectable = getInjectable({
|
const shellApiRequestInjectable = getInjectable({
|
||||||
|
id: "shell-api-request",
|
||||||
|
|
||||||
instantiate: (di) => shellApiRequest({
|
instantiate: (di) => shellApiRequest({
|
||||||
createShellSession: di.inject(createShellSessionInjectable),
|
createShellSession: di.inject(createShellSessionInjectable),
|
||||||
authenticateRequest: di.inject(shellRequestAuthenticatorInjectable).authenticate,
|
authenticateRequest: di.inject(shellRequestAuthenticatorInjectable).authenticate,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default shellApiRequestInjectable;
|
export default shellApiRequestInjectable;
|
||||||
|
|||||||
@ -2,10 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ShellRequestAuthenticator } from "./shell-request-authenticator";
|
import { ShellRequestAuthenticator } from "./shell-request-authenticator";
|
||||||
|
|
||||||
const shellRequestAuthenticatorInjectable = getInjectable({
|
const shellRequestAuthenticatorInjectable = getInjectable({
|
||||||
|
id: "shell-request-authenticator",
|
||||||
|
|
||||||
instantiate: () => {
|
instantiate: () => {
|
||||||
const authenticator = new ShellRequestAuthenticator();
|
const authenticator = new ShellRequestAuthenticator();
|
||||||
|
|
||||||
@ -13,8 +15,6 @@ const shellRequestAuthenticatorInjectable = getInjectable({
|
|||||||
|
|
||||||
return authenticator;
|
return authenticator;
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default shellRequestAuthenticatorInjectable;
|
export default shellRequestAuthenticatorInjectable;
|
||||||
|
|||||||
@ -2,17 +2,17 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { Router } from "../router";
|
import { Router } from "../router";
|
||||||
import routePortForwardInjectable
|
import routePortForwardInjectable
|
||||||
from "../routes/port-forward/route-port-forward/route-port-forward.injectable";
|
from "../routes/port-forward/route-port-forward/route-port-forward.injectable";
|
||||||
|
|
||||||
const routerInjectable = getInjectable({
|
const routerInjectable = getInjectable({
|
||||||
|
id: "router",
|
||||||
|
|
||||||
instantiate: (di) => new Router({
|
instantiate: (di) => new Router({
|
||||||
routePortForward: di.inject(routePortForwardInjectable),
|
routePortForward: di.inject(routePortForwardInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default routerInjectable;
|
export default routerInjectable;
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { PortForward, PortForwardArgs } from "./port-forward";
|
import { PortForward, PortForwardArgs } from "./port-forward";
|
||||||
import bundledKubectlInjectable from "../../kubectl/bundled-kubectl.injectable";
|
import bundledKubectlInjectable from "../../kubectl/bundled-kubectl.injectable";
|
||||||
|
|
||||||
const createPortForwardInjectable = getInjectable({
|
const createPortForwardInjectable = getInjectable({
|
||||||
|
id: "create-port-forward",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const bundledKubectl = di.inject(bundledKubectlInjectable);
|
const bundledKubectl = di.inject(bundledKubectlInjectable);
|
||||||
|
|
||||||
@ -17,8 +19,6 @@ const createPortForwardInjectable = getInjectable({
|
|||||||
return (pathToKubeConfig: string, args: PortForwardArgs) =>
|
return (pathToKubeConfig: string, args: PortForwardArgs) =>
|
||||||
new PortForward(dependencies, pathToKubeConfig, args);
|
new PortForward(dependencies, pathToKubeConfig, args);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createPortForwardInjectable;
|
export default createPortForwardInjectable;
|
||||||
|
|||||||
@ -3,15 +3,15 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { routePortForward } from "./route-port-forward";
|
import { routePortForward } from "./route-port-forward";
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import createPortForwardInjectable from "../create-port-forward.injectable";
|
import createPortForwardInjectable from "../create-port-forward.injectable";
|
||||||
|
|
||||||
const routePortForwardInjectable = getInjectable({
|
const routePortForwardInjectable = getInjectable({
|
||||||
|
id: "route-port-forward",
|
||||||
|
|
||||||
instantiate: (di) => routePortForward({
|
instantiate: (di) => routePortForward({
|
||||||
createPortForward: di.inject(createPortForwardInjectable),
|
createPortForward: di.inject(createPortForwardInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default routePortForwardInjectable;
|
export default routePortForwardInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import type { Cluster } from "../../common/cluster/cluster";
|
import type { Cluster } from "../../common/cluster/cluster";
|
||||||
import type WebSocket from "ws";
|
import type WebSocket from "ws";
|
||||||
import localShellSessionInjectable from "./local-shell-session/local-shell-session.injectable";
|
import localShellSessionInjectable from "./local-shell-session/local-shell-session.injectable";
|
||||||
@ -16,14 +16,14 @@ interface Args {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createShellSessionInjectable = getInjectable({
|
const createShellSessionInjectable = getInjectable({
|
||||||
|
id: "create-shell-session",
|
||||||
|
|
||||||
instantiate:
|
instantiate:
|
||||||
(di) =>
|
(di) =>
|
||||||
({ nodeName, ...rest }: Args) =>
|
({ nodeName, ...rest }: Args) =>
|
||||||
!nodeName
|
!nodeName
|
||||||
? di.inject(localShellSessionInjectable, rest)
|
? di.inject(localShellSessionInjectable, rest)
|
||||||
: di.inject(nodeShellSessionInjectable, { nodeName, ...rest }),
|
: di.inject(nodeShellSessionInjectable, { nodeName, ...rest }),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default createShellSessionInjectable;
|
export default createShellSessionInjectable;
|
||||||
|
|||||||
@ -16,6 +16,8 @@ interface InstantiationParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const localShellSessionInjectable = getInjectable({
|
const localShellSessionInjectable = getInjectable({
|
||||||
|
id: "local-shell-session",
|
||||||
|
|
||||||
instantiate: (di, { cluster, tabId, webSocket }: InstantiationParameter) => {
|
instantiate: (di, { cluster, tabId, webSocket }: InstantiationParameter) => {
|
||||||
const createKubectl = di.inject(createKubectlInjectable);
|
const createKubectl = di.inject(createKubectlInjectable);
|
||||||
const localShellEnvModify = di.inject(terminalShellEnvModifiersInjectable);
|
const localShellEnvModify = di.inject(terminalShellEnvModifiersInjectable);
|
||||||
|
|||||||
@ -16,6 +16,8 @@ interface InstantiationParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nodeShellSessionInjectable = getInjectable({
|
const nodeShellSessionInjectable = getInjectable({
|
||||||
|
id: "node-shell-session",
|
||||||
|
|
||||||
instantiate: (di, { cluster, tabId, webSocket, nodeName }: InstantiationParameter) => {
|
instantiate: (di, { cluster, tabId, webSocket, nodeName }: InstantiationParameter) => {
|
||||||
const createKubectl = di.inject(createKubectlInjectable);
|
const createKubectl = di.inject(createKubectlInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -6,14 +6,16 @@
|
|||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
||||||
import mainExtensionsInjectable from "../../../extensions/main-extensions.injectable";
|
import mainExtensionsInjectable from "../../../extensions/main-extensions.injectable";
|
||||||
import { terminalShellEnvModify } from "./terminal-shell-env-modifiers";
|
import { terminalShellEnvModify } from "./terminal-shell-env-modifiers";
|
||||||
|
|
||||||
const terminalShellEnvModifyInjectable = getInjectable({
|
const terminalShellEnvModifyInjectable = getInjectable({
|
||||||
|
id: "terminal-shell-env-modify",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
terminalShellEnvModify({
|
terminalShellEnvModify({
|
||||||
extensions: di.inject(mainExtensionsInjectable),
|
extensions: di.inject(mainExtensionsInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
lifecycle: lifecycleEnum.singleton,
|
||||||
});
|
});
|
||||||
|
|
||||||
export default terminalShellEnvModifyInjectable;
|
export default terminalShellEnvModifyInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
import mainExtensionsInjectable from "../../extensions/main-extensions.injectable";
|
||||||
|
|
||||||
const trayItemsInjectable = getInjectable({
|
const trayItemsInjectable = getInjectable({
|
||||||
lifecycle: lifecycleEnum.singleton,
|
id: "tray-items",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const extensions = di.inject(mainExtensionsInjectable);
|
const extensions = di.inject(mainExtensionsInjectable);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import type { ConfigurableDependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { LensMainExtension } from "../../extensions/lens-main-extension";
|
import { LensMainExtension } from "../../extensions/lens-main-extension";
|
||||||
import trayItemsInjectable from "./tray-menu-items.injectable";
|
import trayItemsInjectable from "./tray-menu-items.injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
@ -12,7 +12,7 @@ import mainExtensionsInjectable from "../../extensions/main-extensions.injectabl
|
|||||||
import type { TrayMenuRegistration } from "./tray-menu-registration";
|
import type { TrayMenuRegistration } from "./tray-menu-registration";
|
||||||
|
|
||||||
describe("tray-menu-items", () => {
|
describe("tray-menu-items", () => {
|
||||||
let di: ConfigurableDependencyInjectionContainer;
|
let di: DiContainer;
|
||||||
let trayMenuItems: IComputedValue<TrayMenuRegistration[]>;
|
let trayMenuItems: IComputedValue<TrayMenuRegistration[]>;
|
||||||
let extensionsStub: ObservableMap<string, LensMainExtension>;
|
let extensionsStub: ObservableMap<string, LensMainExtension>;
|
||||||
|
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { catalogEntityRegistry } from "../catalog-entity-registry";
|
import { catalogEntityRegistry } from "../catalog-entity-registry";
|
||||||
|
|
||||||
const catalogEntityRegistryInjectable = getInjectable({
|
const catalogEntityRegistryInjectable = getInjectable({
|
||||||
|
id: "catalog-entity-registry",
|
||||||
instantiate: () => catalogEntityRegistry,
|
instantiate: () => catalogEntityRegistry,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default catalogEntityRegistryInjectable;
|
export default catalogEntityRegistryInjectable;
|
||||||
|
|||||||
@ -2,15 +2,17 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { AppPaths, appPathsInjectionToken, appPathsIpcChannel } from "../../common/app-paths/app-path-injection-token";
|
import { AppPaths, appPathsInjectionToken, appPathsIpcChannel } from "../../common/app-paths/app-path-injection-token";
|
||||||
import getValueFromRegisteredChannelInjectable from "./get-value-from-registered-channel/get-value-from-registered-channel.injectable";
|
import getValueFromRegisteredChannelInjectable from "./get-value-from-registered-channel/get-value-from-registered-channel.injectable";
|
||||||
|
|
||||||
let syncAppPaths: AppPaths;
|
let syncAppPaths: AppPaths;
|
||||||
|
|
||||||
const appPathsInjectable = getInjectable({
|
const appPathsInjectable = getInjectable({
|
||||||
|
id: "app-paths",
|
||||||
|
|
||||||
setup: async (di) => {
|
setup: async (di) => {
|
||||||
const getValueFromRegisteredChannel = di.inject(
|
const getValueFromRegisteredChannel = await di.inject(
|
||||||
getValueFromRegisteredChannelInjectable,
|
getValueFromRegisteredChannelInjectable,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -20,8 +22,6 @@ const appPathsInjectable = getInjectable({
|
|||||||
instantiate: () => syncAppPaths,
|
instantiate: () => syncAppPaths,
|
||||||
|
|
||||||
injectionToken: appPathsInjectionToken,
|
injectionToken: appPathsInjectionToken,
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default appPathsInjectable;
|
export default appPathsInjectable;
|
||||||
|
|||||||
@ -2,15 +2,15 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import ipcRendererInjectable from "./ipc-renderer/ipc-renderer.injectable";
|
import ipcRendererInjectable from "./ipc-renderer/ipc-renderer.injectable";
|
||||||
import { getValueFromRegisteredChannel } from "./get-value-from-registered-channel";
|
import { getValueFromRegisteredChannel } from "./get-value-from-registered-channel";
|
||||||
|
|
||||||
const getValueFromRegisteredChannelInjectable = getInjectable({
|
const getValueFromRegisteredChannelInjectable = getInjectable({
|
||||||
|
id: "get-value-from-registered-channel",
|
||||||
|
|
||||||
instantiate: (di) =>
|
instantiate: (di) =>
|
||||||
getValueFromRegisteredChannel({ ipcRenderer: di.inject(ipcRendererInjectable) }),
|
getValueFromRegisteredChannel({ ipcRenderer: di.inject(ipcRendererInjectable) }),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getValueFromRegisteredChannelInjectable;
|
export default getValueFromRegisteredChannelInjectable;
|
||||||
|
|||||||
@ -2,12 +2,12 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
|
|
||||||
const ipcRendererInjectable = getInjectable({
|
const ipcRendererInjectable = getInjectable({
|
||||||
|
id: "ipc-renderer",
|
||||||
instantiate: () => ipcRenderer,
|
instantiate: () => ipcRenderer,
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
causesSideEffects: true,
|
causesSideEffects: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import { SentryInit } from "../common/sentry";
|
|||||||
import { registerCustomThemes } from "./components/monaco-editor";
|
import { registerCustomThemes } from "./components/monaco-editor";
|
||||||
import { getDi } from "./getDi";
|
import { getDi } from "./getDi";
|
||||||
import { DiContextProvider } from "@ogre-tools/injectable-react";
|
import { DiContextProvider } from "@ogre-tools/injectable-react";
|
||||||
import type { DependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import extensionLoaderInjectable from "../extensions/extension-loader/extension-loader.injectable";
|
import extensionLoaderInjectable from "../extensions/extension-loader/extension-loader.injectable";
|
||||||
import extensionDiscoveryInjectable from "../extensions/extension-discovery/extension-discovery.injectable";
|
import extensionDiscoveryInjectable from "../extensions/extension-discovery/extension-discovery.injectable";
|
||||||
import extensionInstallationStateStoreInjectable from "../extensions/extension-installation-state-store/extension-installation-state-store.injectable";
|
import extensionInstallationStateStoreInjectable from "../extensions/extension-installation-state-store/extension-installation-state-store.injectable";
|
||||||
@ -55,7 +55,7 @@ async function attachChromeDebugger() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function bootstrap(di: DependencyInjectionContainer) {
|
export async function bootstrap(di: DiContainer) {
|
||||||
await di.runSetups();
|
await di.runSetups();
|
||||||
|
|
||||||
const rootElem = document.getElementById("app");
|
const rootElem = document.getElementById("app");
|
||||||
|
|||||||
@ -2,12 +2,14 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { ClusterFrameContext } from "./cluster-frame-context";
|
import { ClusterFrameContext } from "./cluster-frame-context";
|
||||||
import namespaceStoreInjectable from "../components/+namespaces/namespace-store/namespace-store.injectable";
|
import namespaceStoreInjectable from "../components/+namespaces/namespace-store/namespace-store.injectable";
|
||||||
import hostedClusterInjectable from "../../common/cluster-store/hosted-cluster.injectable";
|
import hostedClusterInjectable from "../../common/cluster-store/hosted-cluster.injectable";
|
||||||
|
|
||||||
const clusterFrameContextInjectable = getInjectable({
|
const clusterFrameContextInjectable = getInjectable({
|
||||||
|
id: "cluster-frame-context",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const cluster = di.inject(hostedClusterInjectable);
|
const cluster = di.inject(hostedClusterInjectable);
|
||||||
|
|
||||||
@ -19,8 +21,6 @@ const clusterFrameContextInjectable = getInjectable({
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default clusterFrameContextInjectable;
|
export default clusterFrameContextInjectable;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ConfigurableDependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import type { CatalogCategorySpec } from "../../../../common/catalog";
|
import type { CatalogCategorySpec } from "../../../../common/catalog";
|
||||||
import type { LensRendererExtension } from "../../../../extensions/lens-renderer-extension";
|
import type { LensRendererExtension } from "../../../../extensions/lens-renderer-extension";
|
||||||
@ -35,7 +35,7 @@ class TestCategory extends CatalogCategory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("Custom Category Columns", () => {
|
describe("Custom Category Columns", () => {
|
||||||
let di: ConfigurableDependencyInjectionContainer;
|
let di: DiContainer;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = getDiForUnitTesting();
|
di = getDiForUnitTesting();
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ConfigurableDependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import type React from "react";
|
import type React from "react";
|
||||||
import type { LensRendererExtension } from "../../../../extensions/lens-renderer-extension";
|
import type { LensRendererExtension } from "../../../../extensions/lens-renderer-extension";
|
||||||
@ -13,7 +13,7 @@ import type { CustomCategoryViewRegistration } from "../custom-views";
|
|||||||
import customCategoryViewsInjectable from "../custom-views.injectable";
|
import customCategoryViewsInjectable from "../custom-views.injectable";
|
||||||
|
|
||||||
describe("Custom Category Views", () => {
|
describe("Custom Category Views", () => {
|
||||||
let di: ConfigurableDependencyInjectionContainer;
|
let di: DiContainer;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
di = getDiForUnitTesting();
|
di = getDiForUnitTesting();
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { CatalogEntityStore } from "./catalog-entity.store";
|
import { CatalogEntityStore } from "./catalog-entity.store";
|
||||||
import catalogEntityRegistryInjectable from "../../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
import catalogEntityRegistryInjectable from "../../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
||||||
|
|
||||||
const catalogEntityStoreInjectable = getInjectable({
|
const catalogEntityStoreInjectable = getInjectable({
|
||||||
|
id: "catalog-entity-store",
|
||||||
|
|
||||||
instantiate: (di) => new CatalogEntityStore({
|
instantiate: (di) => new CatalogEntityStore({
|
||||||
registry: di.inject(catalogEntityRegistryInjectable),
|
registry: di.inject(catalogEntityRegistryInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default catalogEntityStoreInjectable;
|
export default catalogEntityStoreInjectable;
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { browseCatalogTab } from "../../../../common/routes";
|
import { browseCatalogTab } from "../../../../common/routes";
|
||||||
import createStorageInjectable from "../../../utils/create-storage/create-storage.injectable";
|
import createStorageInjectable from "../../../utils/create-storage/create-storage.injectable";
|
||||||
|
|
||||||
const catalogPreviousActiveTabStorageInjectable = getInjectable({
|
const catalogPreviousActiveTabStorageInjectable = getInjectable({
|
||||||
|
id: "catalog-previous-active-tab-storage",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const createStorage = di.inject(createStorageInjectable);
|
const createStorage = di.inject(createStorageInjectable);
|
||||||
|
|
||||||
@ -15,8 +17,6 @@ const catalogPreviousActiveTabStorageInjectable = getInjectable({
|
|||||||
browseCatalogTab,
|
browseCatalogTab,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default catalogPreviousActiveTabStorageInjectable;
|
export default catalogPreviousActiveTabStorageInjectable;
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { CatalogEntityRegistry } from "../../api/catalog-entity-registry";
|
|||||||
import { CatalogEntityDetailRegistry } from "../../../extensions/registries";
|
import { CatalogEntityDetailRegistry } from "../../../extensions/registries";
|
||||||
import type { CatalogEntityStore } from "./catalog-entity-store/catalog-entity.store";
|
import type { CatalogEntityStore } from "./catalog-entity-store/catalog-entity.store";
|
||||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||||
import type { DependencyInjectionContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
import catalogEntityStoreInjectable from "./catalog-entity-store/catalog-entity-store.injectable";
|
import catalogEntityStoreInjectable from "./catalog-entity-store/catalog-entity-store.injectable";
|
||||||
import catalogEntityRegistryInjectable
|
import catalogEntityRegistryInjectable
|
||||||
from "../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
from "../../api/catalog-entity-registry/catalog-entity-registry.injectable";
|
||||||
@ -95,7 +95,7 @@ describe("<Catalog />", () => {
|
|||||||
}, onRun);
|
}, onRun);
|
||||||
}
|
}
|
||||||
|
|
||||||
let di: DependencyInjectionContainer;
|
let di: DiContainer;
|
||||||
let catalogEntityStore: CatalogEntityStore;
|
let catalogEntityStore: CatalogEntityStore;
|
||||||
let catalogEntityRegistry: CatalogEntityRegistry;
|
let catalogEntityRegistry: CatalogEntityRegistry;
|
||||||
let render: DiRender;
|
let render: DiRender;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed, IComputedValue } from "mobx";
|
import { computed, IComputedValue } from "mobx";
|
||||||
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
|
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
|
||||||
import rendererExtensionsInjectable from "../../../extensions/renderer-extensions.injectable";
|
import rendererExtensionsInjectable from "../../../extensions/renderer-extensions.injectable";
|
||||||
@ -45,10 +45,11 @@ function getAdditionCategoryColumns({ extensions }: Dependencies): IComputedValu
|
|||||||
}
|
}
|
||||||
|
|
||||||
const categoryColumnsInjectable = getInjectable({
|
const categoryColumnsInjectable = getInjectable({
|
||||||
|
id: "category-columns",
|
||||||
|
|
||||||
instantiate: (di) => getAdditionCategoryColumns({
|
instantiate: (di) => getAdditionCategoryColumns({
|
||||||
extensions: di.inject(rendererExtensionsInjectable),
|
extensions: di.inject(rendererExtensionsInjectable),
|
||||||
}),
|
}),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default categoryColumnsInjectable;
|
export default categoryColumnsInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { orderBy } from "lodash";
|
import { orderBy } from "lodash";
|
||||||
import { computed, IComputedValue } from "mobx";
|
import { computed, IComputedValue } from "mobx";
|
||||||
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
|
import type { LensRendererExtension } from "../../../extensions/lens-renderer-extension";
|
||||||
@ -49,10 +49,11 @@ function getCustomCategoryViews({ extensions }: Dependencies): IComputedValue<Ma
|
|||||||
}
|
}
|
||||||
|
|
||||||
const customCategoryViewsInjectable = getInjectable({
|
const customCategoryViewsInjectable = getInjectable({
|
||||||
|
id: "custom-category-views",
|
||||||
|
|
||||||
instantiate: (di) => getCustomCategoryViews({
|
instantiate: (di) => getCustomCategoryViews({
|
||||||
extensions: di.inject(rendererExtensionsInjectable),
|
extensions: di.inject(rendererExtensionsInjectable),
|
||||||
}),
|
}),
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default customCategoryViewsInjectable;
|
export default customCategoryViewsInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { orderBy } from "lodash";
|
import { orderBy } from "lodash";
|
||||||
import type { IComputedValue } from "mobx";
|
import type { IComputedValue } from "mobx";
|
||||||
import type { CatalogCategory, CatalogEntity } from "../../../common/catalog";
|
import type { CatalogCategory, CatalogEntity } from "../../../common/catalog";
|
||||||
@ -85,11 +85,11 @@ const getCategoryColumns = ({ extensionColumns }: Dependencies) => ({ activeCate
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getCategoryColumnsInjectable = getInjectable({
|
const getCategoryColumnsInjectable = getInjectable({
|
||||||
|
id: "get-category-columns",
|
||||||
|
|
||||||
instantiate: (di) => getCategoryColumns({
|
instantiate: (di) => getCategoryColumns({
|
||||||
extensionColumns: di.inject(categoryColumnsInjectable),
|
extensionColumns: di.inject(categoryColumnsInjectable),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default getCategoryColumnsInjectable;
|
export default getCategoryColumnsInjectable;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable, lifecycleEnum } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import {
|
import {
|
||||||
ClusterOverviewStorageState,
|
ClusterOverviewStorageState,
|
||||||
ClusterOverviewStore,
|
ClusterOverviewStore,
|
||||||
@ -13,6 +13,8 @@ import createStorageInjectable from "../../../utils/create-storage/create-storag
|
|||||||
import apiManagerInjectable from "../../kube-object-menu/dependencies/api-manager.injectable";
|
import apiManagerInjectable from "../../kube-object-menu/dependencies/api-manager.injectable";
|
||||||
|
|
||||||
const clusterOverviewStoreInjectable = getInjectable({
|
const clusterOverviewStoreInjectable = getInjectable({
|
||||||
|
id: "cluster-overview-store",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const createStorage = di.inject(createStorageInjectable);
|
const createStorage = di.inject(createStorageInjectable);
|
||||||
|
|
||||||
@ -34,8 +36,6 @@ const clusterOverviewStoreInjectable = getInjectable({
|
|||||||
|
|
||||||
return store;
|
return store;
|
||||||
},
|
},
|
||||||
|
|
||||||
lifecycle: lifecycleEnum.singleton,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default clusterOverviewStoreInjectable;
|
export default clusterOverviewStoreInjectable;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user