mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into replace-kubectl-proxy-with-lens-k8s-proxy
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
commit
ecdc386b64
@ -3,4 +3,4 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default {};
|
export default ""; // mostly path to bundled file or data-url (webpack)
|
||||||
3404
extensions/kube-object-event-status/package-lock.json
generated
3404
extensions/kube-object-event-status/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -18,8 +18,8 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||||
"ts-loader": "^8.0.4",
|
"ts-loader": "latest",
|
||||||
"typescript": "^4.3.2",
|
"typescript": "latest",
|
||||||
"webpack": "^4.46.0"
|
"webpack": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5612
extensions/metrics-cluster-feature/package-lock.json
generated
5612
extensions/metrics-cluster-feature/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,10 +19,10 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||||
"jest": "^26.6.3",
|
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
"ts-loader": "^8.0.4",
|
"jest": "latest",
|
||||||
"typescript": "^4.3.2",
|
"ts-loader": "latest",
|
||||||
"webpack": "^4.44.2"
|
"typescript": "latest",
|
||||||
|
"webpack": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5931
extensions/node-menu/package-lock.json
generated
5931
extensions/node-menu/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -18,9 +18,9 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||||
"jest": "^26.6.3",
|
"jest": "latest",
|
||||||
"ts-loader": "^8.0.4",
|
"ts-loader": "latest",
|
||||||
"typescript": "^4.3.2",
|
"typescript": "latest",
|
||||||
"webpack": "^4.46.0"
|
"webpack": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5931
extensions/pod-menu/package-lock.json
generated
5931
extensions/pod-menu/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -18,9 +18,9 @@
|
|||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
"@k8slens/extensions": "file:../../src/extensions/npm/extensions",
|
||||||
"jest": "^26.6.3",
|
"jest": "latest",
|
||||||
"ts-loader": "^8.0.4",
|
"ts-loader": "latest",
|
||||||
"typescript": "^4.3.2",
|
"typescript": "latest",
|
||||||
"webpack": "^4.46.0"
|
"webpack": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
64
package.json
64
package.json
@ -3,7 +3,7 @@
|
|||||||
"productName": "OpenLens",
|
"productName": "OpenLens",
|
||||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||||
"homepage": "https://github.com/lensapp/lens",
|
"homepage": "https://github.com/lensapp/lens",
|
||||||
"version": "5.4.0-beta.3",
|
"version": "5.4.0-beta.5",
|
||||||
"main": "static/build/main.js",
|
"main": "static/build/main.js",
|
||||||
"copyright": "© 2021 OpenLens Authors",
|
"copyright": "© 2021 OpenLens Authors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -16,9 +16,9 @@
|
|||||||
"dev-build": "concurrently yarn:compile:*",
|
"dev-build": "concurrently yarn:compile:*",
|
||||||
"debug-build": "concurrently yarn:compile:main yarn:compile:extension-types",
|
"debug-build": "concurrently yarn:compile:main yarn:compile:extension-types",
|
||||||
"dev-run": "nodemon --watch static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
|
"dev-run": "nodemon --watch static/build/main.js --exec \"electron --remote-debugging-port=9223 --inspect .\"",
|
||||||
"dev:main": "yarn run compile:main --watch",
|
"dev:main": "yarn run compile:main --watch --progress",
|
||||||
"dev:renderer": "yarn run webpack-dev-server --config webpack.renderer.ts",
|
"dev:renderer": "yarn run compile:renderer --watch --progress",
|
||||||
"dev:extension-types": "yarn run compile:extension-types --watch",
|
"dev:extension-types": "yarn run compile:extension-types --watch --progress",
|
||||||
"compile": "env NODE_ENV=production concurrently yarn:compile:*",
|
"compile": "env NODE_ENV=production concurrently yarn:compile:*",
|
||||||
"compile:main": "yarn run webpack --config webpack.main.ts",
|
"compile:main": "yarn run webpack --config webpack.main.ts",
|
||||||
"compile:renderer": "yarn run webpack --config webpack.renderer.ts",
|
"compile:renderer": "yarn run webpack --config webpack.renderer.ts",
|
||||||
@ -64,7 +64,7 @@
|
|||||||
},
|
},
|
||||||
"moduleNameMapper": {
|
"moduleNameMapper": {
|
||||||
"\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.ts",
|
"\\.(css|scss)$": "<rootDir>/__mocks__/styleMock.ts",
|
||||||
"\\.(svg)$": "<rootDir>/__mocks__/imageMock.ts"
|
"\\.(svg|png|jpg|eot|woff2?|ttf)$": "<rootDir>/__mocks__/assetMock.ts"
|
||||||
},
|
},
|
||||||
"modulePathIgnorePatterns": [
|
"modulePathIgnorePatterns": [
|
||||||
"<rootDir>/dist",
|
"<rootDir>/dist",
|
||||||
@ -212,8 +212,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",
|
||||||
@ -286,7 +286,7 @@
|
|||||||
"@material-ui/core": "^4.12.3",
|
"@material-ui/core": "^4.12.3",
|
||||||
"@material-ui/icons": "^4.11.2",
|
"@material-ui/icons": "^4.11.2",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
|
||||||
"@sentry/types": "^6.14.1",
|
"@sentry/types": "^6.14.1",
|
||||||
"@testing-library/jest-dom": "^5.16.1",
|
"@testing-library/jest-dom": "^5.16.1",
|
||||||
"@testing-library/react": "^11.2.7",
|
"@testing-library/react": "^11.2.7",
|
||||||
@ -309,12 +309,11 @@
|
|||||||
"@types/lodash": "^4.14.177",
|
"@types/lodash": "^4.14.177",
|
||||||
"@types/marked": "^4.0.1",
|
"@types/marked": "^4.0.1",
|
||||||
"@types/md5-file": "^4.0.2",
|
"@types/md5-file": "^4.0.2",
|
||||||
"@types/mini-css-extract-plugin": "^0.9.1",
|
"@types/mini-css-extract-plugin": "^2.4.0",
|
||||||
"@types/mock-fs": "^4.13.1",
|
"@types/mock-fs": "^4.13.1",
|
||||||
"@types/node": "14.17.33",
|
"@types/node": "14.17.33",
|
||||||
"@types/node-fetch": "^2.5.12",
|
"@types/node-fetch": "^2.5.12",
|
||||||
"@types/npm": "^2.0.32",
|
"@types/npm": "^2.0.32",
|
||||||
"@types/progress-bar-webpack-plugin": "^2.1.2",
|
|
||||||
"@types/proper-lockfile": "^4.1.2",
|
"@types/proper-lockfile": "^4.1.2",
|
||||||
"@types/randomcolor": "^0.5.6",
|
"@types/randomcolor": "^0.5.6",
|
||||||
"@types/react": "^17.0.34",
|
"@types/react": "^17.0.34",
|
||||||
@ -337,36 +336,35 @@
|
|||||||
"@types/triple-beam": "^1.3.2",
|
"@types/triple-beam": "^1.3.2",
|
||||||
"@types/url-parse": "^1.4.5",
|
"@types/url-parse": "^1.4.5",
|
||||||
"@types/uuid": "^8.3.3",
|
"@types/uuid": "^8.3.3",
|
||||||
"@types/webpack": "^4.41.32",
|
"@types/webpack": "^5.28.0",
|
||||||
"@types/webpack-dev-server": "^3.11.6",
|
"@types/webpack-dev-server": "^4.7.2",
|
||||||
"@types/webpack-env": "^1.16.3",
|
"@types/webpack-env": "^1.16.3",
|
||||||
"@types/webpack-node-externals": "^1.7.1",
|
"@types/webpack-node-externals": "^2.5.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
||||||
"@typescript-eslint/parser": "^5.10.1",
|
"@typescript-eslint/parser": "^5.10.1",
|
||||||
"ansi_up": "^5.1.0",
|
"ansi_up": "^5.1.0",
|
||||||
"chart.js": "^2.9.4",
|
"chart.js": "^2.9.4",
|
||||||
"circular-dependency-plugin": "^5.2.2",
|
"circular-dependency-plugin": "^5.2.2",
|
||||||
"color": "^3.2.1",
|
"color": "^3.2.1",
|
||||||
"concurrently": "^5.3.0",
|
"concurrently": "^7.0.0",
|
||||||
"css-loader": "^5.2.7",
|
"css-loader": "^6.5.1",
|
||||||
"deepdash": "^5.3.9",
|
"deepdash": "^5.3.9",
|
||||||
"dompurify": "^2.3.4",
|
"dompurify": "^2.3.4",
|
||||||
"electron": "^14.2.4",
|
"electron": "^14.2.4",
|
||||||
"electron-builder": "^22.14.5",
|
"electron-builder": "^22.14.5",
|
||||||
"electron-notarize": "^0.3.0",
|
"electron-notarize": "^0.3.0",
|
||||||
"esbuild": "^0.13.15",
|
"esbuild": "^0.13.15",
|
||||||
"esbuild-loader": "^2.16.0",
|
"esbuild-loader": "^2.18.0",
|
||||||
"eslint": "^8.7.0",
|
"eslint": "^8.7.0",
|
||||||
"eslint-plugin-header": "^3.1.1",
|
"eslint-plugin-header": "^3.1.1",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.25.4",
|
||||||
"eslint-plugin-react": "^7.28.0",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"eslint-plugin-react-hooks": "^4.3.0",
|
"eslint-plugin-react-hooks": "^4.3.0",
|
||||||
"eslint-plugin-unused-imports": "^2.0.0",
|
"eslint-plugin-unused-imports": "^2.0.0",
|
||||||
"file-loader": "^6.2.0",
|
|
||||||
"flex.box": "^3.4.4",
|
"flex.box": "^3.4.4",
|
||||||
"fork-ts-checker-webpack-plugin": "^5.2.1",
|
"fork-ts-checker-webpack-plugin": "^6.5.0",
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
"hoist-non-react-statics": "^3.3.2",
|
||||||
"html-webpack-plugin": "^4.5.2",
|
"html-webpack-plugin": "^5.5.0",
|
||||||
"ignore-loader": "^0.1.2",
|
"ignore-loader": "^0.1.2",
|
||||||
"include-media": "^1.4.9",
|
"include-media": "^1.4.9",
|
||||||
"jest": "26.6.3",
|
"jest": "26.6.3",
|
||||||
@ -374,43 +372,41 @@
|
|||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"jest-mock-extended": "^1.0.18",
|
"jest-mock-extended": "^1.0.18",
|
||||||
"make-plural": "^6.2.2",
|
"make-plural": "^6.2.2",
|
||||||
"mini-css-extract-plugin": "^1.6.2",
|
"mini-css-extract-plugin": "^2.5.2",
|
||||||
"node-gyp": "7.1.2",
|
"node-gyp": "7.1.2",
|
||||||
"node-loader": "^1.0.3",
|
"node-loader": "^2.0.0",
|
||||||
"nodemon": "^2.0.15",
|
"nodemon": "^2.0.15",
|
||||||
"playwright": "^1.17.1",
|
"playwright": "^1.17.1",
|
||||||
"postcss": "^8.4.5",
|
"postcss": "^8.4.5",
|
||||||
"postcss-loader": "^4.3.0",
|
"postcss-loader": "^6.2.1",
|
||||||
"progress-bar-webpack-plugin": "^2.1.0",
|
|
||||||
"randomcolor": "^0.6.2",
|
"randomcolor": "^0.6.2",
|
||||||
"raw-loader": "^4.0.2",
|
|
||||||
"react-beautiful-dnd": "^13.1.0",
|
"react-beautiful-dnd": "^13.1.0",
|
||||||
"react-refresh": "^0.9.0",
|
"react-refresh": "^0.11.0",
|
||||||
|
"react-refresh-typescript": "^2.0.3",
|
||||||
"react-router-dom": "^5.3.0",
|
"react-router-dom": "^5.3.0",
|
||||||
"react-select": "3.2.0",
|
"react-select": "3.2.0",
|
||||||
"react-select-event": "^5.1.0",
|
"react-select-event": "^5.1.0",
|
||||||
"react-table": "^7.7.0",
|
"react-table": "^7.7.0",
|
||||||
"react-window": "^1.8.6",
|
"react-window": "^1.8.6",
|
||||||
"sass": "^1.45.1",
|
"sass": "^1.45.1",
|
||||||
"sass-loader": "^10.2.0",
|
"sass-loader": "^12.4.0",
|
||||||
"sharp": "^0.29.3",
|
"sharp": "^0.29.3",
|
||||||
"style-loader": "^2.0.0",
|
"style-loader": "^3.3.1",
|
||||||
"tailwindcss": "^3.0.7",
|
"tailwindcss": "^3.0.7",
|
||||||
"ts-jest": "26.5.6",
|
"ts-jest": "26.5.6",
|
||||||
"ts-loader": "^7.0.5",
|
"ts-loader": "^9.2.6",
|
||||||
"ts-node": "^10.4.0",
|
"ts-node": "^10.4.0",
|
||||||
"type-fest": "^1.0.2",
|
"type-fest": "^1.0.2",
|
||||||
"typed-emitter": "^1.4.0",
|
"typed-emitter": "^1.4.0",
|
||||||
"typedoc": "0.22.10",
|
"typedoc": "0.22.10",
|
||||||
"typedoc-plugin-markdown": "^3.11.3",
|
"typedoc-plugin-markdown": "^3.11.12",
|
||||||
"typeface-roboto": "^1.1.13",
|
"typeface-roboto": "^1.1.13",
|
||||||
"typescript": "^4.5.2",
|
"typescript": "^4.5.2",
|
||||||
"typescript-plugin-css-modules": "^3.4.0",
|
"typescript-plugin-css-modules": "^3.4.0",
|
||||||
"url-loader": "^4.1.1",
|
"webpack": "^5.69.0",
|
||||||
"webpack": "^4.46.0",
|
"webpack-cli": "^4.9.2",
|
||||||
"webpack-cli": "^3.3.12",
|
"webpack-dev-server": "^4.7.4",
|
||||||
"webpack-dev-server": "^3.11.3",
|
"webpack-node-externals": "^3.0.0",
|
||||||
"webpack-node-externals": "^1.7.2",
|
|
||||||
"xterm": "^4.15.0",
|
"xterm": "^4.15.0",
|
||||||
"xterm-addon-fit": "^0.5.0"
|
"xterm-addon-fit": "^0.5.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,14 +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;
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import { app } from "electron";
|
|||||||
import type { CatalogEntitySpec } from "../catalog/catalog-entity";
|
import type { CatalogEntitySpec } from "../catalog/catalog-entity";
|
||||||
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
import { IpcRendererNavigationEvents } from "../../renderer/navigation/events";
|
||||||
import { requestClusterActivation, requestClusterDisconnection } from "../../renderer/ipc";
|
import { requestClusterActivation, requestClusterDisconnection } from "../../renderer/ipc";
|
||||||
|
import KubeClusterCategoryIcon from "./icons/kubernetes.svg";
|
||||||
|
|
||||||
export interface KubernetesClusterPrometheusMetrics {
|
export interface KubernetesClusterPrometheusMetrics {
|
||||||
address?: {
|
address?: {
|
||||||
@ -138,7 +139,7 @@ class KubernetesClusterCategory extends CatalogCategory {
|
|||||||
public readonly kind = "CatalogCategory";
|
public readonly kind = "CatalogCategory";
|
||||||
public metadata = {
|
public metadata = {
|
||||||
name: "Clusters",
|
name: "Clusters",
|
||||||
icon: require(`!!raw-loader!./icons/kubernetes.svg`).default, // eslint-disable-line
|
icon: KubeClusterCategoryIcon,
|
||||||
};
|
};
|
||||||
public spec: CatalogCategorySpec = {
|
public spec: CatalogCategorySpec = {
|
||||||
group: "entity.k8slens.dev",
|
group: "entity.k8slens.dev",
|
||||||
|
|||||||
@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { action, computed, observable, makeObservable } from "mobx";
|
import { action, computed, observable, makeObservable } from "mobx";
|
||||||
import type { Disposer } from "../utils";
|
|
||||||
import { strictSet, iter, getOrInsertMap } from "../utils";
|
|
||||||
import { once } from "lodash";
|
import { once } from "lodash";
|
||||||
|
import { iter, getOrInsertMap, strictSet } from "../utils";
|
||||||
|
import type { Disposer } from "../utils";
|
||||||
import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
|
||||||
|
|
||||||
export type CategoryFilter = (category: CatalogCategory) => any;
|
export type CategoryFilter = (category: CatalogCategory) => any;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -4,18 +4,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import esbuild from "esbuild";
|
import esbuild from "esbuild";
|
||||||
|
import type { Options as TSLoaderOptions } from "ts-loader";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function returning webpack ts/tsx loader
|
* A function returning webpack ts/tsx loader
|
||||||
*
|
|
||||||
* depends on env LENS_DEV_USE_ESBUILD_LOADER to use esbuild-loader (faster) or good-old ts-loader
|
* depends on env LENS_DEV_USE_ESBUILD_LOADER to use esbuild-loader (faster) or good-old ts-loader
|
||||||
*
|
|
||||||
* @param testRegExp - the regex for webpack to conditional find the files
|
|
||||||
* @returns ts/tsx webpack loader configuration object
|
* @returns ts/tsx webpack loader configuration object
|
||||||
*/
|
*/
|
||||||
const getTSLoader = (
|
const getTSLoader = (options: Partial<TSLoaderOptions> = {}, testRegExp?: RegExp) => {
|
||||||
testRegExp: RegExp, transpileOnly = true,
|
testRegExp ??= /\.tsx?$/; // by default covers react/jsx-stuff
|
||||||
) => {
|
options.transpileOnly ??= true;
|
||||||
|
|
||||||
if (process.env.LENS_DEV_USE_ESBUILD_LOADER === "true") {
|
if (process.env.LENS_DEV_USE_ESBUILD_LOADER === "true") {
|
||||||
console.info(`\n🚀 using esbuild-loader for ts(x)`);
|
console.info(`\n🚀 using esbuild-loader for ts(x)`);
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ const getTSLoader = (
|
|||||||
loader: "esbuild-loader",
|
loader: "esbuild-loader",
|
||||||
options: {
|
options: {
|
||||||
loader: "tsx",
|
loader: "tsx",
|
||||||
target: "es2015",
|
target: "ES2019", // supported by >= electron@14
|
||||||
implementation: esbuild,
|
implementation: esbuild,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -35,9 +34,7 @@ const getTSLoader = (
|
|||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
use: {
|
use: {
|
||||||
loader: "ts-loader",
|
loader: "ts-loader",
|
||||||
options: {
|
options,
|
||||||
transpileOnly,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -312,14 +312,14 @@ export abstract class KubeObjectStore<T extends KubeObject> extends ItemStore<T>
|
|||||||
return this.api.create(params, data);
|
return this.api.create(params, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
create = async (params: { name: string; namespace?: string }, data?: Partial<T>): Promise<T> => {
|
async create(params: { name: string; namespace?: string }, data?: Partial<T>): Promise<T> {
|
||||||
const newItem = await this.createItem(params, data);
|
const newItem = await this.createItem(params, data);
|
||||||
const items = this.sortItems([...this.items, newItem]);
|
const items = this.sortItems([...this.items, newItem]);
|
||||||
|
|
||||||
this.items.replace(items);
|
this.items.replace(items);
|
||||||
|
|
||||||
return newItem;
|
return newItem;
|
||||||
};
|
}
|
||||||
|
|
||||||
private postUpdate(rawItem: KubeJsonApiData): T {
|
private postUpdate(rawItem: KubeJsonApiData): T {
|
||||||
const newItem = new this.api.objectConstructor(rawItem);
|
const newItem = new this.api.objectConstructor(rawItem);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -38,7 +38,6 @@ export const mainDir = path.join(contextDir, "src/main");
|
|||||||
export const rendererDir = path.join(contextDir, "src/renderer");
|
export const rendererDir = path.join(contextDir, "src/renderer");
|
||||||
export const htmlTemplate = path.resolve(rendererDir, "template.html");
|
export const htmlTemplate = path.resolve(rendererDir, "template.html");
|
||||||
export const sassCommonVars = path.resolve(rendererDir, "components/vars.scss");
|
export const sassCommonVars = path.resolve(rendererDir, "components/vars.scss");
|
||||||
export const webpackDevServerPort = 9009;
|
|
||||||
|
|
||||||
// Special runtime paths
|
// Special runtime paths
|
||||||
defineGlobal("__static", {
|
defineGlobal("__static", {
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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 { action, computed, IComputedValue, IObservableArray, makeObservable, observable } from "mobx";
|
import { action, computed, type IComputedValue, type IObservableArray, makeObservable, observable } from "mobx";
|
||||||
import { CatalogCategoryRegistry, catalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor } from "../../common/catalog";
|
import { CatalogCategoryRegistry, catalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor } from "../../common/catalog";
|
||||||
import { iter } from "../../common/utils";
|
import { iter } from "../../common/utils";
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -28,7 +28,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 || [])],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import * as Mobx from "mobx";
|
|||||||
import * as LensExtensionsCommonApi from "../extensions/common-api";
|
import * as LensExtensionsCommonApi from "../extensions/common-api";
|
||||||
import * as LensExtensionsMainApi from "../extensions/main-api";
|
import * as LensExtensionsMainApi from "../extensions/main-api";
|
||||||
import { app, autoUpdater, dialog, powerMonitor } from "electron";
|
import { app, autoUpdater, dialog, powerMonitor } from "electron";
|
||||||
import { appName, isIntegrationTesting, isMac, isWindows, productName } from "../common/vars";
|
import { appName, isIntegrationTesting, isMac, isWindows, productName, isDevelopment } from "../common/vars";
|
||||||
import { LensProxy } from "./lens-proxy";
|
import { LensProxy } from "./lens-proxy";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import { ClusterManager } from "./cluster-manager";
|
import { ClusterManager } from "./cluster-manager";
|
||||||
@ -176,7 +176,7 @@ di.runSetups().then(() => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
logger.info("🔌 Starting LensProxy");
|
logger.info("🔌 Starting LensProxy");
|
||||||
await lensProxy.listen();
|
await lensProxy.listen(); // lensProxy.port available
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
dialog.showErrorBox("Lens Error", `Could not start proxy: ${error?.message || "unknown error"}`);
|
||||||
|
|
||||||
@ -228,6 +228,15 @@ di.runSetups().then(() => {
|
|||||||
logger.info("🖥️ Starting WindowManager");
|
logger.info("🖥️ Starting WindowManager");
|
||||||
const windowManager = WindowManager.createInstance();
|
const windowManager = WindowManager.createInstance();
|
||||||
|
|
||||||
|
// Override main content view url to local webpack-dev-server to support HMR / live-reload
|
||||||
|
if (isDevelopment) {
|
||||||
|
const { createDevServer } = await import("../../webpack.dev-server");
|
||||||
|
const devServer = createDevServer(lensProxy.port);
|
||||||
|
|
||||||
|
await devServer.start();
|
||||||
|
windowManager.mainContentUrl = `http://localhost:${devServer.options.port}`;
|
||||||
|
}
|
||||||
|
|
||||||
const menuItems = di.inject(electronMenuItemsInjectable);
|
const menuItems = di.inject(electronMenuItemsInjectable);
|
||||||
const trayMenuItems = di.inject(trayMenuItemsInjectable);
|
const trayMenuItems = di.inject(trayMenuItemsInjectable);
|
||||||
|
|
||||||
|
|||||||
@ -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,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 { 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 path from "path";
|
import path from "path";
|
||||||
@ -10,6 +10,8 @@ import { isDevelopment, isWindows } from "../../common/vars";
|
|||||||
import directoryForBundledBinariesInjectable from "../../common/app-paths/directory-for-bundled-binaries/directory-for-bundled-binaries.injectable";
|
import directoryForBundledBinariesInjectable from "../../common/app-paths/directory-for-bundled-binaries/directory-for-bundled-binaries.injectable";
|
||||||
|
|
||||||
const createKubeAuthProxyInjectable = getInjectable({
|
const createKubeAuthProxyInjectable = getInjectable({
|
||||||
|
id: "create-kube-auth-proxy",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const binaryName = isWindows ? "lens-k8s-proxy.exe" : "lens-k8s-proxy";
|
const binaryName = isWindows ? "lens-k8s-proxy.exe" : "lens-k8s-proxy";
|
||||||
const proxyPath = isDevelopment ? path.join("client", process.platform, process.arch) : process.arch;
|
const proxyPath = isDevelopment ? path.join("client", process.platform, process.arch) : process.arch;
|
||||||
@ -20,8 +22,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>;
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import logger from "../logger";
|
|||||||
import { exitApp } from "../exit-app";
|
import { exitApp } from "../exit-app";
|
||||||
import { broadcastMessage } from "../../common/ipc";
|
import { broadcastMessage } from "../../common/ipc";
|
||||||
import { openBrowser } from "../../common/utils";
|
import { openBrowser } from "../../common/utils";
|
||||||
import * as packageJson from "../../../package.json";
|
import packageJson from "../../../package.json";
|
||||||
import { preferencesURL, extensionsURL, addClusterURL, catalogURL, welcomeURL } from "../../common/routes";
|
import { preferencesURL, extensionsURL, addClusterURL, catalogURL, welcomeURL } from "../../common/routes";
|
||||||
import { checkForUpdates, isAutoUpdateEnabled } from "../app-updater";
|
import { checkForUpdates, isAutoUpdateEnabled } from "../app-updater";
|
||||||
import type { MenuRegistration } from "./menu-registration";
|
import type { MenuRegistration } from "./menu-registration";
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import type http from "http";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import { readFile } from "fs-extra";
|
import { readFile } from "fs-extra";
|
||||||
import type { Cluster } from "../common/cluster/cluster";
|
import type { Cluster } from "../common/cluster/cluster";
|
||||||
import { apiPrefix, appName, publicPath, isDevelopment, webpackDevServerPort } from "../common/vars";
|
import { apiPrefix, appName, publicPath } from "../common/vars";
|
||||||
import { HelmApiRoute, KubeconfigRoute, MetricsRoute, PortForwardRoute, ResourceApplierApiRoute, VersionRoute } from "./routes";
|
import { HelmApiRoute, KubeconfigRoute, MetricsRoute, PortForwardRoute, ResourceApplierApiRoute, VersionRoute } from "./routes";
|
||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ export class Router {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static async handleStaticFile({ params, response, raw: { req }}: LensApiRequest): Promise<void> {
|
protected static async handleStaticFile({ params, response }: LensApiRequest): Promise<void> {
|
||||||
let filePath = params.path;
|
let filePath = params.path;
|
||||||
|
|
||||||
for (let retryCount = 0; retryCount < 5; retryCount += 1) {
|
for (let retryCount = 0; retryCount < 5; retryCount += 1) {
|
||||||
@ -124,19 +124,6 @@ export class Router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filename = path.basename(req.url);
|
|
||||||
// redirect requests to [appName].js, [appName].html /sockjs-node/ to webpack-dev-server (for hot-reload support)
|
|
||||||
const toWebpackDevServer = filename.includes(appName) || filename.includes("hot-update") || req.url.includes("sockjs-node");
|
|
||||||
|
|
||||||
if (isDevelopment && toWebpackDevServer) {
|
|
||||||
const redirectLocation = `http://localhost:${webpackDevServerPort}${req.url}`;
|
|
||||||
|
|
||||||
response.statusCode = 307;
|
|
||||||
response.setHeader("Location", redirectLocation);
|
|
||||||
|
|
||||||
return response.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await readFile(asset);
|
const data = await readFile(asset);
|
||||||
|
|
||||||
response.setHeader("Content-Type", getMimeType(asset));
|
response.setHeader("Content-Type", getMimeType(asset));
|
||||||
|
|||||||
@ -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);
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user