mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into monaco_editor_refactoring
# Conflicts: # src/common/user-store/user-store.ts # src/renderer/bootstrap.tsx # src/renderer/components/dock/__test__/log-tab.store.test.ts # src/renderer/utils/storageHelper.ts
This commit is contained in:
commit
21296d6d12
@ -26,11 +26,6 @@ export default {
|
||||
getLocale: jest.fn().mockRejectedValue("en"),
|
||||
getPath: jest.fn(() => "tmp"),
|
||||
},
|
||||
remote: {
|
||||
app: {
|
||||
getPath: jest.fn()
|
||||
}
|
||||
},
|
||||
dialog: jest.fn(),
|
||||
ipcRenderer: {
|
||||
on: jest.fn()
|
||||
|
||||
@ -26,7 +26,7 @@ import * as uuid from "uuid";
|
||||
import { ElectronApplication, Frame, Page, _electron as electron } from "playwright";
|
||||
import { noop } from "lodash";
|
||||
|
||||
export const AppPaths: Partial<Record<NodeJS.Platform, string>> = {
|
||||
export const appPaths: Partial<Record<NodeJS.Platform, string>> = {
|
||||
"win32": "./dist/win-unpacked/OpenLens.exe",
|
||||
"linux": "./dist/linux-unpacked/open-lens",
|
||||
"darwin": "./dist/mac/OpenLens.app/Contents/MacOS/OpenLens",
|
||||
@ -65,7 +65,7 @@ export async function start() {
|
||||
|
||||
const app = await electron.launch({
|
||||
args: ["--integration-testing"], // this argument turns off the blocking of quit
|
||||
executablePath: AppPaths[process.platform],
|
||||
executablePath: appPaths[process.platform],
|
||||
bypassCSP: true,
|
||||
env: {
|
||||
CICD,
|
||||
|
||||
27
package.json
27
package.json
@ -3,7 +3,7 @@
|
||||
"productName": "OpenLens",
|
||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"version": "5.3.0-alpha.2",
|
||||
"version": "5.3.0-alpha.6",
|
||||
"main": "static/build/main.js",
|
||||
"copyright": "© 2021 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
@ -183,8 +183,8 @@
|
||||
"@hapi/call": "^8.0.1",
|
||||
"@hapi/subtext": "^7.0.3",
|
||||
"@kubernetes/client-node": "^0.15.1",
|
||||
"@sentry/electron": "^2.5.0",
|
||||
"@sentry/integrations": "^6.10.0",
|
||||
"@sentry/electron": "^2.5.4",
|
||||
"@sentry/integrations": "^6.13.3",
|
||||
"abort-controller": "^3.0.0",
|
||||
"array-move": "^3.0.1",
|
||||
"auto-bind": "^4.0.0",
|
||||
@ -196,7 +196,7 @@
|
||||
"conf": "^7.1.2",
|
||||
"crypto-js": "^4.1.1",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-updater": "^4.6.0",
|
||||
"electron-updater": "^4.6.1",
|
||||
"electron-window-state": "^5.0.3",
|
||||
"fs-extra": "^9.0.1",
|
||||
"glob": "^7.2.0",
|
||||
@ -241,7 +241,7 @@
|
||||
"serializr": "^2.0.5",
|
||||
"shell-env": "^3.0.1",
|
||||
"spdy": "^4.0.2",
|
||||
"tar": "^6.1.10",
|
||||
"tar": "^6.1.11",
|
||||
"tcp-port-used": "^1.0.2",
|
||||
"tempy": "1.0.1",
|
||||
"url-parse": "^1.5.3",
|
||||
@ -257,8 +257,7 @@
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
|
||||
"@sentry/react": "^6.13.3",
|
||||
"@sentry/types": "^6.8.0",
|
||||
"@sentry/types": "^6.13.3",
|
||||
"@testing-library/dom": "^8.9.0",
|
||||
"@testing-library/jest-dom": "^5.14.1",
|
||||
"@testing-library/react": "^11.2.6",
|
||||
@ -276,11 +275,11 @@
|
||||
"@types/html-webpack-plugin": "^3.2.6",
|
||||
"@types/http-proxy": "^1.17.7",
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/js-yaml": "^4.0.2",
|
||||
"@types/js-yaml": "^4.0.4",
|
||||
"@types/jsdom": "^16.2.13",
|
||||
"@types/jsonpath": "^0.2.0",
|
||||
"@types/lodash": "^4.14.155",
|
||||
"@types/marked": "^2.0.4",
|
||||
"@types/marked": "^2.0.5",
|
||||
"@types/md5-file": "^4.0.2",
|
||||
"@types/mini-css-extract-plugin": "^0.9.1",
|
||||
"@types/mock-fs": "^4.13.1",
|
||||
@ -303,7 +302,7 @@
|
||||
"@types/request": "^2.48.7",
|
||||
"@types/request-promise-native": "^1.0.18",
|
||||
"@types/semver": "^7.2.0",
|
||||
"@types/sharp": "^0.28.3",
|
||||
"@types/sharp": "^0.29.2",
|
||||
"@types/spdy": "^3.4.4",
|
||||
"@types/tar": "^4.0.5",
|
||||
"@types/tcp-port-used": "^1.0.0",
|
||||
@ -326,7 +325,7 @@
|
||||
"css-loader": "^5.2.7",
|
||||
"deepdash": "^5.3.9",
|
||||
"dompurify": "^2.3.3",
|
||||
"electron": "^13.5.1",
|
||||
"electron": "13.6.0",
|
||||
"electron-builder": "^22.11.11",
|
||||
"electron-notarize": "^0.3.0",
|
||||
"esbuild": "^0.13.8",
|
||||
@ -368,7 +367,7 @@
|
||||
"react-window": "^1.8.5",
|
||||
"sass": "^1.43.2",
|
||||
"sass-loader": "^8.0.2",
|
||||
"sharp": "^0.29.1",
|
||||
"sharp": "^0.29.2",
|
||||
"style-loader": "^2.0.0",
|
||||
"tailwindcss": "^2.2.17",
|
||||
"ts-jest": "26.5.6",
|
||||
@ -376,10 +375,10 @@
|
||||
"ts-node": "^10.3.0",
|
||||
"type-fest": "^1.0.2",
|
||||
"typed-emitter": "^1.3.1",
|
||||
"typedoc": "0.22.6",
|
||||
"typedoc": "0.22.7",
|
||||
"typedoc-plugin-markdown": "^3.11.3",
|
||||
"typeface-roboto": "^1.1.13",
|
||||
"typescript": "^4.4.3",
|
||||
"typescript": "^4.4.4",
|
||||
"typescript-plugin-css-modules": "^3.4.0",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^4.46.0",
|
||||
|
||||
@ -30,6 +30,7 @@ import { Console } from "console";
|
||||
import { stdout, stderr } from "process";
|
||||
import type { ClusterId } from "../cluster-types";
|
||||
import { getCustomKubeConfigPath } from "../utils";
|
||||
import { AppPaths } from "../app-paths";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
@ -67,23 +68,26 @@ function embed(clusterId: ClusterId, contents: any): string {
|
||||
return absPath;
|
||||
}
|
||||
|
||||
jest.mock("electron", () => {
|
||||
return {
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
handle: jest.fn(),
|
||||
on: jest.fn(),
|
||||
removeAllListeners: jest.fn(),
|
||||
off: jest.fn(),
|
||||
send: jest.fn(),
|
||||
}
|
||||
};
|
||||
});
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
handle: jest.fn(),
|
||||
on: jest.fn(),
|
||||
removeAllListeners: jest.fn(),
|
||||
off: jest.fn(),
|
||||
send: jest.fn(),
|
||||
}
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("empty config", () => {
|
||||
beforeEach(async () => {
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
import { anyObject } from "jest-mock-extended";
|
||||
import mockFs from "mock-fs";
|
||||
import logger from "../../main/logger";
|
||||
import { AppPaths } from "../app-paths";
|
||||
import { ClusterStore } from "../cluster-store";
|
||||
import { HotbarStore } from "../hotbar-store";
|
||||
|
||||
@ -116,16 +117,23 @@ const awsCluster = {
|
||||
}
|
||||
};
|
||||
|
||||
jest.mock("electron", () => {
|
||||
return {
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: (): void => void 0,
|
||||
}
|
||||
};
|
||||
});
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("HotbarStore", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@ -21,16 +21,21 @@
|
||||
|
||||
import mockFs from "mock-fs";
|
||||
|
||||
jest.mock("electron", () => {
|
||||
return {
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: (): void => void 0,
|
||||
}
|
||||
};
|
||||
});
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
import { UserStore } from "../user-store";
|
||||
import { Console } from "console";
|
||||
@ -39,8 +44,10 @@ import electron from "electron";
|
||||
import { stdout, stderr } from "process";
|
||||
import { ThemeStore } from "../../renderer/theme.store";
|
||||
import type { ClusterStoreModel } from "../cluster-store";
|
||||
import { AppPaths } from "../app-paths";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
AppPaths.init();
|
||||
|
||||
describe("user store tests", () => {
|
||||
describe("for an empty config", () => {
|
||||
|
||||
117
src/common/app-paths.ts
Normal file
117
src/common/app-paths.ts
Normal file
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app, ipcMain, ipcRenderer } from "electron";
|
||||
import { observable, when } from "mobx";
|
||||
import path from "path";
|
||||
import logger from "./logger";
|
||||
import { fromEntries, toJS } from "./utils";
|
||||
import { isWindows } from "./vars";
|
||||
|
||||
export type PathName = Parameters<typeof app["getPath"]>[0];
|
||||
|
||||
const pathNames: PathName[] = [
|
||||
"home",
|
||||
"appData",
|
||||
"userData",
|
||||
"cache",
|
||||
"temp",
|
||||
"exe",
|
||||
"module",
|
||||
"desktop",
|
||||
"documents",
|
||||
"downloads",
|
||||
"music",
|
||||
"pictures",
|
||||
"videos",
|
||||
"logs",
|
||||
"crashDumps",
|
||||
];
|
||||
|
||||
if (isWindows) {
|
||||
pathNames.push("recent");
|
||||
}
|
||||
|
||||
export class AppPaths {
|
||||
private static paths = observable.box<Record<PathName, string> | undefined>();
|
||||
private static readonly ipcChannel = "get-app-paths";
|
||||
|
||||
/**
|
||||
* Initializes the local copy of the paths from electron.
|
||||
*/
|
||||
static async init(): Promise<void> {
|
||||
logger.info(`[APP-PATHS]: initializing`);
|
||||
|
||||
if (AppPaths.paths.get()) {
|
||||
return void logger.error("[APP-PATHS]: init called more than once");
|
||||
}
|
||||
|
||||
if (ipcMain) {
|
||||
AppPaths.initMain();
|
||||
} else {
|
||||
await AppPaths.initRenderer();
|
||||
}
|
||||
}
|
||||
|
||||
private static initMain(): void {
|
||||
if (process.env.CICD) {
|
||||
app.setPath("appData", process.env.CICD);
|
||||
}
|
||||
|
||||
app.setPath("userData", path.join(app.getPath("appData"), app.getName()));
|
||||
|
||||
AppPaths.paths.set(fromEntries(pathNames.map(pathName => [pathName, app.getPath(pathName)])));
|
||||
ipcMain.handle(AppPaths.ipcChannel, () => toJS(AppPaths.paths.get()));
|
||||
}
|
||||
|
||||
private static async initRenderer(): Promise<void> {
|
||||
const paths = await ipcRenderer.invoke(AppPaths.ipcChannel);
|
||||
|
||||
if (!paths || typeof paths !== "object") {
|
||||
throw Object.assign(new Error("[APP-PATHS]: ipc handler returned unexpected data"), { data: paths });
|
||||
}
|
||||
|
||||
AppPaths.paths.set(paths);
|
||||
}
|
||||
|
||||
/**
|
||||
* An alternative to `app.getPath()` for use in renderer and common.
|
||||
* This function throws if called before initialization.
|
||||
* @param name The name of the path field
|
||||
*/
|
||||
static get(name: PathName): string {
|
||||
if (!AppPaths.paths.get()) {
|
||||
throw new Error("AppPaths.init() has not been called");
|
||||
}
|
||||
|
||||
return AppPaths.paths.get()[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* An async version of `AppPaths.get()` which waits for `AppPaths.init()` to
|
||||
* be called before returning
|
||||
*/
|
||||
static async getAsync(name: PathName): Promise<string> {
|
||||
await when(() => Boolean(AppPaths.paths.get()));
|
||||
|
||||
return AppPaths.paths.get()[name];
|
||||
}
|
||||
}
|
||||
@ -30,7 +30,7 @@ import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import { isTestEnv } from "./vars";
|
||||
import { kebabCase } from "lodash";
|
||||
import { getPath } from "./utils/getPath";
|
||||
import { AppPaths } from "./app-paths";
|
||||
|
||||
export interface BaseStoreParams<T> extends ConfOptions<T> {
|
||||
syncOptions?: IReactionOptions;
|
||||
@ -93,7 +93,7 @@ export abstract class BaseStore<T> extends Singleton {
|
||||
}
|
||||
|
||||
protected cwd() {
|
||||
return getPath("userData");
|
||||
return AppPaths.get("userData");
|
||||
}
|
||||
|
||||
protected async saveToFile(model: T) {
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import * as uuid from "uuid";
|
||||
import type { Tuple } from "./utils";
|
||||
import { tuple, Tuple } from "./utils";
|
||||
|
||||
export interface HotbarItem {
|
||||
entity: {
|
||||
@ -46,7 +46,7 @@ export const defaultHotbarCells = 12; // Number is chosen to easy hit any item w
|
||||
export function getEmptyHotbar(name: string, id: string = uuid.v4()): Hotbar {
|
||||
return {
|
||||
id,
|
||||
items: Array(defaultHotbarCells).fill(null) as Tuple<HotbarItem | null, typeof defaultHotbarCells>,
|
||||
items: tuple.filled(defaultHotbarCells, null),
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ export enum PodStatus {
|
||||
EVICTED = "Evicted"
|
||||
}
|
||||
|
||||
export interface IPodContainer {
|
||||
export interface IPodContainer extends Partial<Record<PodContainerProbe, IContainerProbe>> {
|
||||
name: string;
|
||||
image: string;
|
||||
command?: string[];
|
||||
@ -136,16 +136,19 @@ export interface IPodContainer {
|
||||
readOnly: boolean;
|
||||
mountPath: string;
|
||||
}[];
|
||||
livenessProbe?: IContainerProbe;
|
||||
readinessProbe?: IContainerProbe;
|
||||
startupProbe?: IContainerProbe;
|
||||
imagePullPolicy: string;
|
||||
}
|
||||
|
||||
export type PodContainerProbe = "livenessProbe" | "readinessProbe" | "startupProbe";
|
||||
|
||||
interface IContainerProbe {
|
||||
httpGet?: {
|
||||
path?: string;
|
||||
port: number;
|
||||
|
||||
/**
|
||||
* either a port number or an IANA_SVC_NAME string referring to a port defined in the container
|
||||
*/
|
||||
port: number | string;
|
||||
scheme: string;
|
||||
host?: string;
|
||||
};
|
||||
@ -438,50 +441,64 @@ export class Pod extends WorkloadKubeObject {
|
||||
}
|
||||
|
||||
getLivenessProbe(container: IPodContainer) {
|
||||
return this.getProbe(container.livenessProbe);
|
||||
return this.getProbe(container, "livenessProbe");
|
||||
}
|
||||
|
||||
getReadinessProbe(container: IPodContainer) {
|
||||
return this.getProbe(container.readinessProbe);
|
||||
return this.getProbe(container, "readinessProbe");
|
||||
}
|
||||
|
||||
getStartupProbe(container: IPodContainer) {
|
||||
return this.getProbe(container.startupProbe);
|
||||
return this.getProbe(container, "startupProbe");
|
||||
}
|
||||
|
||||
getProbe(probeData: IContainerProbe) {
|
||||
if (!probeData) return [];
|
||||
private getProbe(container: IPodContainer, field: PodContainerProbe): string[] {
|
||||
const probe: string[] = [];
|
||||
const probeData = container[field];
|
||||
|
||||
if (!probeData) {
|
||||
return probe;
|
||||
}
|
||||
|
||||
const {
|
||||
httpGet, exec, tcpSocket, initialDelaySeconds, timeoutSeconds,
|
||||
periodSeconds, successThreshold, failureThreshold
|
||||
httpGet, exec, tcpSocket,
|
||||
initialDelaySeconds = 0,
|
||||
timeoutSeconds = 0,
|
||||
periodSeconds = 0,
|
||||
successThreshold = 0,
|
||||
failureThreshold = 0
|
||||
} = probeData;
|
||||
const probe = [];
|
||||
|
||||
// HTTP Request
|
||||
if (httpGet) {
|
||||
const { path, port, host, scheme } = httpGet;
|
||||
const { path = "", port, host = "", scheme } = httpGet;
|
||||
const resolvedPort = typeof port === "number"
|
||||
? port
|
||||
// Try and find the port number associated witht the name or fallback to the name itself
|
||||
: container.ports?.find(containerPort => containerPort.name === port)?.containerPort || port;
|
||||
|
||||
probe.push(
|
||||
"http-get",
|
||||
`${scheme.toLowerCase()}://${host || ""}:${port || ""}${path || ""}`,
|
||||
`${scheme.toLowerCase()}://${host}:${resolvedPort}${path}`,
|
||||
);
|
||||
}
|
||||
|
||||
// Command
|
||||
if (exec && exec.command) {
|
||||
if (exec?.command) {
|
||||
probe.push(`exec [${exec.command.join(" ")}]`);
|
||||
}
|
||||
|
||||
// TCP Probe
|
||||
if (tcpSocket && tcpSocket.port) {
|
||||
if (tcpSocket?.port) {
|
||||
probe.push(`tcp-socket :${tcpSocket.port}`);
|
||||
}
|
||||
|
||||
probe.push(
|
||||
`delay=${initialDelaySeconds || "0"}s`,
|
||||
`timeout=${timeoutSeconds || "0"}s`,
|
||||
`period=${periodSeconds || "0"}s`,
|
||||
`#success=${successThreshold || "0"}`,
|
||||
`#failure=${failureThreshold || "0"}`,
|
||||
`delay=${initialDelaySeconds}s`,
|
||||
`timeout=${timeoutSeconds}s`,
|
||||
`period=${periodSeconds}s`,
|
||||
`#success=${successThreshold}`,
|
||||
`#failure=${failureThreshold}`,
|
||||
);
|
||||
|
||||
return probe;
|
||||
|
||||
@ -121,30 +121,32 @@ export class ResourceStack {
|
||||
for(const filename of files) {
|
||||
const file = path.join(folderPath, filename);
|
||||
const raw = await fse.readFile(file);
|
||||
let resourceData: string;
|
||||
const data = (
|
||||
filename.endsWith(".hb")
|
||||
? hb.compile(raw.toString())(templateContext)
|
||||
: raw.toString()
|
||||
).trim();
|
||||
|
||||
if (filename.endsWith(".hb")) {
|
||||
const template = hb.compile(raw.toString());
|
||||
|
||||
resourceData = template(templateContext);
|
||||
} else {
|
||||
resourceData = raw.toString();
|
||||
if (!data) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!resourceData.trim()) continue;
|
||||
for (const entry of yaml.loadAll(data)) {
|
||||
if (typeof entry !== "object" || !entry) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const resourceArray = yaml.loadAll(resourceData.toString());
|
||||
const resource = entry as Record<string, any>;
|
||||
|
||||
resourceArray.forEach((resource) => {
|
||||
if (resource?.metadata) {
|
||||
resource.metadata.labels ||= {};
|
||||
if (typeof resource.metadata === "object") {
|
||||
resource.metadata.labels ??= {};
|
||||
resource.metadata.labels["app.kubernetes.io/name"] = this.name;
|
||||
resource.metadata.labels["app.kubernetes.io/managed-by"] = productName;
|
||||
resource.metadata.labels["app.kubernetes.io/created-by"] = "resource-stack";
|
||||
}
|
||||
|
||||
resources.push(yaml.dump(resource));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { ipcMain } from "electron";
|
||||
import { app, ipcMain } from "electron";
|
||||
import winston, { format } from "winston";
|
||||
import type Transport from "winston-transport";
|
||||
import { consoleFormat } from "winston-console-format";
|
||||
import { isDebugging, isTestEnv } from "./vars";
|
||||
import BrowserConsole from "winston-transport-browserconsole";
|
||||
import { getPath } from "./utils/getPath";
|
||||
|
||||
const logLevel = process.env.LOG_LEVEL
|
||||
? process.env.LOG_LEVEL
|
||||
@ -66,7 +65,11 @@ if (ipcMain) {
|
||||
handleExceptions: false,
|
||||
level: logLevel,
|
||||
filename: "lens.log",
|
||||
dirname: getPath("logs"),
|
||||
/**
|
||||
* SAFTEY: the `ipcMain` check above should mean that this is only
|
||||
* called in the main process
|
||||
*/
|
||||
dirname: app.getPath("logs"),
|
||||
maxsize: 16 * 1024,
|
||||
maxFiles: 16,
|
||||
tailable: true,
|
||||
|
||||
@ -31,7 +31,7 @@ import path from "path";
|
||||
import { ObservableToggleSet, toJS } from "../../renderer/utils";
|
||||
import { DESCRIPTORS, EditorConfiguration, KubeconfigSyncValue, UserPreferencesModel } from "./preferences-helpers";
|
||||
import logger from "../../main/logger";
|
||||
import { getPath } from "../utils/getPath";
|
||||
import { AppPaths } from "../app-paths";
|
||||
|
||||
export interface UserStoreModel {
|
||||
lastSeenAppVersion: string;
|
||||
@ -233,5 +233,5 @@ export class UserStore extends BaseStore<UserStoreModel> /* implements UserStore
|
||||
* @returns string
|
||||
*/
|
||||
export function getDefaultKubectlDownloadPath(): string {
|
||||
return path.join(getPath("userData"), "binaries");
|
||||
return path.join(AppPaths.get("userData"), "binaries");
|
||||
}
|
||||
|
||||
59
src/common/utils/__tests__/tuple.test.ts
Normal file
59
src/common/utils/__tests__/tuple.test.ts
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { tuple } from "../../utils";
|
||||
|
||||
describe("tuple tests", () => {
|
||||
describe("zip()", () => {
|
||||
it("should yield 0 times and return 1 tuple of empty arrays when given empty array", () => {
|
||||
expect(tuple.zip([]).next()).toEqual({
|
||||
done: true,
|
||||
value: [[]],
|
||||
});
|
||||
});
|
||||
|
||||
it("should yield 1 times and return 2 tuple of empty arrays when given one element array tuples", () => {
|
||||
const i = tuple.zip([1], [2]);
|
||||
|
||||
expect(i.next()).toEqual({
|
||||
done: false,
|
||||
value: [1, 2]
|
||||
});
|
||||
expect(i.next()).toEqual({
|
||||
done: true,
|
||||
value: [[], []],
|
||||
});
|
||||
});
|
||||
|
||||
it("should yield 1 times and return 2 tuple of partial arrays when given one element array tuples", () => {
|
||||
const i = tuple.zip([1], [2, 3]);
|
||||
|
||||
expect(i.next()).toEqual({
|
||||
done: false,
|
||||
value: [1, 2]
|
||||
});
|
||||
expect(i.next()).toEqual({
|
||||
done: true,
|
||||
value: [[], [3]],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -19,26 +19,11 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
export type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
||||
type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sources The source arrays
|
||||
* @yields A tuple of the next element from each of the sources
|
||||
* @returns The tuple of all the sources as soon as at least one of the sources is exausted
|
||||
* A inference typed version of `Array(length).fill(value)`
|
||||
* @param length The number of entries
|
||||
* @param value The value of each of the indices
|
||||
*/
|
||||
export function* zipStrict<T, N extends number>(...sources: Tuple<T[], N>): Iterator<Tuple<T, N>, Tuple<T[], N>> {
|
||||
const maxSafeLength = sources.reduce((prev, cur) => Math.min(prev, cur.length), Number.POSITIVE_INFINITY);
|
||||
|
||||
if (!isFinite(maxSafeLength)) {
|
||||
// There are no sources, thus just return
|
||||
return [] as Tuple<T[], N>;
|
||||
}
|
||||
|
||||
for (let i = 0; i < maxSafeLength; i += 1) {
|
||||
yield sources.map(source => source[i]) as Tuple<T, N>;
|
||||
}
|
||||
|
||||
return sources.map(source => source.slice(maxSafeLength)) as Tuple<T[], N>;
|
||||
export function filled<T>(length: number, value: T): T[] {
|
||||
return Array(length).fill(value);
|
||||
}
|
||||
|
||||
@ -46,6 +46,11 @@ export function getClusterFrameUrl(clusterId: ClusterId) {
|
||||
* Get the result of `getClusterIdFromHost` from the current `location.host`
|
||||
*/
|
||||
export function getHostedClusterId(): ClusterId | undefined {
|
||||
// catch being called in main
|
||||
if (typeof location === "undefined") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getClusterIdFromHost(location.host);
|
||||
}
|
||||
|
||||
|
||||
@ -32,19 +32,21 @@ export * from "./base64";
|
||||
export * from "./camelCase";
|
||||
export * from "./cloneJson";
|
||||
export * from "./cluster-id-url-parsing";
|
||||
export * from "./convertCpu";
|
||||
export * from "./convertMemory";
|
||||
export * from "./debouncePromise";
|
||||
export * from "./defineGlobal";
|
||||
export * from "./delay";
|
||||
export * from "./disposer";
|
||||
export * from "./downloadFile";
|
||||
export * from "./formatDuration";
|
||||
export * from "./escapeRegExp";
|
||||
export * from "./extended-map";
|
||||
export * from "./getPath";
|
||||
export * from "./formatDuration";
|
||||
export * from "./getRandId";
|
||||
export * from "./hash-set";
|
||||
export * from "./local-kubeconfig";
|
||||
export * from "./n-fircate";
|
||||
export * from "./objects";
|
||||
export * from "./openExternal";
|
||||
export * from "./paths";
|
||||
export * from "./reject-promise";
|
||||
@ -56,10 +58,13 @@ export * from "./toggle-set";
|
||||
export * from "./toJS";
|
||||
export * from "./type-narrowing";
|
||||
export * from "./types";
|
||||
export * from "./convertMemory";
|
||||
export * from "./convertCpu";
|
||||
|
||||
import * as iter from "./iter";
|
||||
import * as array from "./array";
|
||||
import * as tuple from "./tuple";
|
||||
|
||||
export { iter, array };
|
||||
export {
|
||||
iter,
|
||||
array,
|
||||
tuple,
|
||||
};
|
||||
|
||||
@ -21,11 +21,11 @@
|
||||
|
||||
import path from "path";
|
||||
import * as uuid from "uuid";
|
||||
import { AppPaths } from "../app-paths";
|
||||
import type { ClusterId } from "../cluster-types";
|
||||
import { getPath } from "./getPath";
|
||||
|
||||
export function storedKubeConfigFolder(): string {
|
||||
return path.resolve(getPath("userData"), "kubeconfigs");
|
||||
return path.resolve(AppPaths.get("userData"), "kubeconfigs");
|
||||
}
|
||||
|
||||
export function getCustomKubeConfigPath(clusterId: ClusterId = uuid.v4()): string {
|
||||
|
||||
@ -19,19 +19,10 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app, ipcMain } from "electron";
|
||||
|
||||
const remote = ipcMain ? null : require("@electron/remote");
|
||||
|
||||
/**
|
||||
* calls getPath either on app or on the remote's app
|
||||
*
|
||||
* @deprecated Use a different method for accessing the getPath function
|
||||
* A better typed version of `Object.fromEntries` where the keys are known to
|
||||
* be a specific subset
|
||||
*/
|
||||
export function getPath(name: Parameters<typeof app["getPath"]>[0]): string {
|
||||
if (app) {
|
||||
return app.getPath(name);
|
||||
}
|
||||
|
||||
return remote.app.getPath(name);
|
||||
export function fromEntries<T, Key extends string>(entries: Iterable<readonly [Key, T]>): { [k in Key]: T } {
|
||||
return Object.fromEntries(entries) as { [k in Key]: T };
|
||||
}
|
||||
54
src/common/utils/tuple.ts
Normal file
54
src/common/utils/tuple.ts
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { array } from "../utils";
|
||||
|
||||
/**
|
||||
* A strict N-tuple of type T
|
||||
*/
|
||||
export type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
|
||||
type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
|
||||
|
||||
/**
|
||||
* Iterates over `sources` yielding full tuples until one of the tuple arrays
|
||||
* is empty. Then it returns a tuple with the rest of each of tuples
|
||||
* @param sources The source arrays
|
||||
* @yields A tuple of the next element from each of the sources
|
||||
* @returns The tuple of all the sources as soon as at least one of the sources is exausted
|
||||
*/
|
||||
export function* zip<T, N extends number>(...sources: Tuple<T[], N>): Iterator<Tuple<T, N>, Tuple<T[], N>> {
|
||||
const maxSafeLength = Math.min(...sources.map(source => source.length));
|
||||
|
||||
for (let i = 0; i < maxSafeLength; i += 1) {
|
||||
yield sources.map(source => source[i]) as Tuple<T, N>;
|
||||
}
|
||||
|
||||
return sources.map(source => source.slice(maxSafeLength)) as Tuple<T[], N>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a `length` tuple filled with copies of `value`
|
||||
* @param length The size of the tuple
|
||||
* @param value The value for each of the tuple entries
|
||||
*/
|
||||
export function filled<T, L extends number>(length: L, value: T): Tuple<T, L> {
|
||||
return array.filled(length, value) as Tuple<T, L>;
|
||||
}
|
||||
@ -26,6 +26,7 @@ import path from "path";
|
||||
import { ExtensionDiscovery } from "../extension-discovery";
|
||||
import os from "os";
|
||||
import { Console } from "console";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
jest.setTimeout(60_000);
|
||||
|
||||
@ -41,11 +42,22 @@ jest.mock("../extension-installer", () => ({
|
||||
}));
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
console = new Console(process.stdout, process.stderr); // fix mockFS
|
||||
const mockedWatch = watch as jest.MockedFunction<typeof watch>;
|
||||
|
||||
|
||||
@ -24,9 +24,10 @@ import { EventEmitter } from "events";
|
||||
import { isEqual } from "lodash";
|
||||
import { action, computed, makeObservable, observable, observe, reaction, when } from "mobx";
|
||||
import path from "path";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
import { ClusterStore } from "../common/cluster-store";
|
||||
import { broadcastMessage, ipcMainOn, ipcRendererOn, requestMain, ipcMainHandle } from "../common/ipc";
|
||||
import { Disposer, getHostedClusterId, Singleton, toJS, getPath } from "../common/utils";
|
||||
import { Disposer, getHostedClusterId, Singleton, toJS } from "../common/utils";
|
||||
import logger from "../main/logger";
|
||||
import type { InstalledExtension } from "./extension-discovery";
|
||||
import { ExtensionsStore } from "./extensions-store";
|
||||
@ -36,7 +37,7 @@ import type { LensRendererExtension } from "./lens-renderer-extension";
|
||||
import * as registries from "./registries";
|
||||
|
||||
export function extensionPackagesRoot() {
|
||||
return path.join(getPath("userData"));
|
||||
return path.join(AppPaths.get("userData"));
|
||||
}
|
||||
|
||||
const logModule = "[EXTENSIONS-LOADER]";
|
||||
|
||||
@ -29,13 +29,26 @@ import { stderr, stdout } from "process";
|
||||
import { TerminalStore } from "../../../renderer/components/dock/terminal.store";
|
||||
import { ThemeStore } from "../../../renderer/theme.store";
|
||||
import { UserStore } from "../../../common/user-store";
|
||||
import { AppPaths } from "../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
let ext: LensExtension = null;
|
||||
|
||||
@ -23,12 +23,22 @@ import { UserStore } from "../../common/user-store";
|
||||
import { ContextHandler } from "../context-handler";
|
||||
import { PrometheusProvider, PrometheusProviderRegistry, PrometheusService } from "../prometheus";
|
||||
import mockFs from "mock-fs";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
enum ServiceResult {
|
||||
@ -76,6 +86,8 @@ function getHandler() {
|
||||
}) as any);
|
||||
}
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("ContextHandler", () => {
|
||||
beforeEach(() => {
|
||||
mockFs({
|
||||
|
||||
@ -19,15 +19,6 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const logger = {
|
||||
silly: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
log: jest.fn(),
|
||||
info: jest.fn(),
|
||||
error: jest.fn(),
|
||||
crit: jest.fn(),
|
||||
};
|
||||
|
||||
jest.mock("winston", () => ({
|
||||
format: {
|
||||
colorize: jest.fn(),
|
||||
@ -35,26 +26,27 @@ jest.mock("winston", () => ({
|
||||
simple: jest.fn(),
|
||||
label: jest.fn(),
|
||||
timestamp: jest.fn(),
|
||||
printf: jest.fn()
|
||||
printf: jest.fn(),
|
||||
padLevels: jest.fn(),
|
||||
ms: jest.fn(),
|
||||
},
|
||||
createLogger: jest.fn().mockReturnValue(logger),
|
||||
createLogger: jest.fn().mockReturnValue({
|
||||
silly: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
log: jest.fn(),
|
||||
info: jest.fn(),
|
||||
error: jest.fn(),
|
||||
crit: jest.fn(),
|
||||
}),
|
||||
transports: {
|
||||
Console: jest.fn(),
|
||||
File: jest.fn(),
|
||||
}
|
||||
}));
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getPath: () => "tmp",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("../../common/ipc");
|
||||
jest.mock("child_process");
|
||||
jest.mock("tcp-port-used");
|
||||
//jest.mock("../utils/get-port");
|
||||
|
||||
import { Cluster } from "../cluster";
|
||||
import { KubeAuthProxy } from "../kube-auth-proxy";
|
||||
@ -68,6 +60,7 @@ import { UserStore } from "../../common/user-store";
|
||||
import { Console } from "console";
|
||||
import { stdout, stderr } from "process";
|
||||
import mockFs from "mock-fs";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
console = new Console(stdout, stderr);
|
||||
|
||||
@ -75,6 +68,23 @@ const mockBroadcastIpc = broadcastMessage as jest.MockedFunction<typeof broadcas
|
||||
const mockSpawn = spawn as jest.MockedFunction<typeof spawn>;
|
||||
const mockWaitUntilUsed = waitUntilUsed as jest.MockedFunction<typeof waitUntilUsed>;
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
AppPaths.init();
|
||||
|
||||
describe("kube auth proxy tests", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
|
||||
@ -28,12 +28,6 @@ const logger = {
|
||||
crit: jest.fn(),
|
||||
};
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getPath: () => `/tmp`,
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("winston", () => ({
|
||||
format: {
|
||||
colorize: jest.fn(),
|
||||
@ -41,7 +35,9 @@ jest.mock("winston", () => ({
|
||||
simple: jest.fn(),
|
||||
label: jest.fn(),
|
||||
timestamp: jest.fn(),
|
||||
printf: jest.fn()
|
||||
padLevels: jest.fn(),
|
||||
ms: jest.fn(),
|
||||
printf: jest.fn(),
|
||||
},
|
||||
createLogger: jest.fn().mockReturnValue(logger),
|
||||
transports: {
|
||||
@ -58,6 +54,25 @@ import fse from "fs-extra";
|
||||
import { loadYaml } from "@kubernetes/client-node";
|
||||
import { Console } from "console";
|
||||
import * as path from "path";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
console = new Console(process.stdout, process.stderr); // fix mockFS
|
||||
|
||||
@ -111,7 +126,7 @@ describe("kubeconfig manager tests", () => {
|
||||
const kubeConfManager = new KubeconfigManager(cluster, contextHandler);
|
||||
|
||||
expect(logger.error).not.toBeCalled();
|
||||
expect(await kubeConfManager.getPath()).toBe(`${path.sep}tmp${path.sep}kubeconfig-foo`);
|
||||
expect(await kubeConfManager.getPath()).toBe(`tmp${path.sep}kubeconfig-foo`);
|
||||
// this causes an intermittent "ENXIO: no such device or address, read" error
|
||||
// const file = await fse.readFile(await kubeConfManager.getPath());
|
||||
const file = fse.readFileSync(await kubeConfManager.getPath());
|
||||
|
||||
@ -19,8 +19,27 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
import { Router } from "../router";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("Router", () => {
|
||||
it("blocks path traversal attacks", async () => {
|
||||
const response: any = {
|
||||
|
||||
@ -25,9 +25,10 @@ import { isDevelopment, isPublishConfigured, isTestEnv } from "../common/vars";
|
||||
import { delay } from "../common/utils";
|
||||
import { areArgsUpdateAvailableToBackchannel, AutoUpdateLogPrefix, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc";
|
||||
import { once } from "lodash";
|
||||
import { ipcMain } from "electron";
|
||||
import { app, ipcMain } from "electron";
|
||||
import { nextUpdateChannel } from "./utils/update-channel";
|
||||
import { UserStore } from "../common/user-store";
|
||||
import { WindowManager } from "./window-manager";
|
||||
|
||||
let installVersion: null | string = null;
|
||||
|
||||
@ -39,7 +40,11 @@ function handleAutoUpdateBackChannel(event: Electron.IpcMainEvent, ...[arg]: Upd
|
||||
if (arg.doUpdate) {
|
||||
if (arg.now) {
|
||||
logger.info(`${AutoUpdateLogPrefix}: User chose to update now`);
|
||||
autoUpdater.quitAndInstall(true, true);
|
||||
setImmediate(() => {
|
||||
app.removeAllListeners("window-all-closed");
|
||||
WindowManager.getInstance().destroy();
|
||||
autoUpdater.quitAndInstall(true, true);
|
||||
});
|
||||
} else {
|
||||
logger.info(`${AutoUpdateLogPrefix}: User chose to update on quit`);
|
||||
autoUpdater.autoInstallOnAppQuit = true;
|
||||
|
||||
@ -28,13 +28,26 @@ import mockFs from "mock-fs";
|
||||
import fs from "fs";
|
||||
import { ClusterStore } from "../../../common/cluster-store";
|
||||
import { ClusterManager } from "../../cluster-manager";
|
||||
import { AppPaths } from "../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getPath: () => "/foo",
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("kubeconfig-sync.source tests", () => {
|
||||
beforeEach(() => {
|
||||
mockFs();
|
||||
|
||||
@ -114,7 +114,7 @@ export class ContextHandler {
|
||||
await this.ensureServer();
|
||||
const path = this.clusterUrl.path !== "/" ? this.clusterUrl.path : "";
|
||||
|
||||
return `http://127.0.0.1:${this.kubeAuthProxy.port}${path}`;
|
||||
return `http://127.0.0.1:${this.kubeAuthProxy.port}${this.kubeAuthProxy.apiPrefix}${path}`;
|
||||
}
|
||||
|
||||
async getApiTarget(isLongRunningRequest = false): Promise<httpProxy.ServerOptions> {
|
||||
|
||||
@ -27,7 +27,7 @@ import path from "path";
|
||||
import { BaseStore } from "../common/base-store";
|
||||
import type { LensExtensionId } from "../extensions/lens-extension";
|
||||
import { toJS } from "../common/utils";
|
||||
import { getPath } from "../common/utils/getPath";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
|
||||
interface FSProvisionModel {
|
||||
extensions: Record<string, string>; // extension names to paths
|
||||
@ -55,7 +55,7 @@ export class FilesystemProvisionerStore extends BaseStore<FSProvisionModel> {
|
||||
if (!this.registeredExtensions.has(extensionName)) {
|
||||
const salt = randomBytes(32).toString("hex");
|
||||
const hashedName = SHA256(`${extensionName}/${salt}`).toString();
|
||||
const dirPath = path.resolve(getPath("userData"), "extension_data", hashedName);
|
||||
const dirPath = path.resolve(AppPaths.get("userData"), "extension_data", hashedName);
|
||||
|
||||
this.registeredExtensions.set(extensionName, dirPath);
|
||||
}
|
||||
|
||||
@ -63,13 +63,12 @@ import { ensureDir } from "fs-extra";
|
||||
import { Router } from "./router";
|
||||
import { initMenu } from "./menu";
|
||||
import { initTray } from "./tray";
|
||||
import * as path from "path";
|
||||
import { kubeApiRequest, shellApiRequest } from "./proxy-functions";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
|
||||
const onCloseCleanup = disposer();
|
||||
const onQuitCleanup = disposer();
|
||||
|
||||
const workingDir = path.join(app.getPath("appData"), appName);
|
||||
|
||||
SentryInit();
|
||||
app.setName(appName);
|
||||
@ -82,12 +81,7 @@ if (app.setAsDefaultProtocolClient("lens")) {
|
||||
logger.info("📟 Protocol client register failed ❗");
|
||||
}
|
||||
|
||||
if (process.env.CICD) {
|
||||
app.setPath("appData", process.env.CICD);
|
||||
app.setPath("userData", path.join(process.env.CICD, appName));
|
||||
} else {
|
||||
app.setPath("userData", workingDir);
|
||||
}
|
||||
AppPaths.init();
|
||||
|
||||
if (process.env.LENS_DISABLE_GPU) {
|
||||
app.disableHardwareAcceleration();
|
||||
@ -127,7 +121,7 @@ app.on("second-instance", (event, argv) => {
|
||||
});
|
||||
|
||||
app.on("ready", async () => {
|
||||
logger.info(`🚀 Starting ${productName} from "${app.getPath("exe")}"`);
|
||||
logger.info(`🚀 Starting ${productName} from "${AppPaths.get("exe")}"`);
|
||||
logger.info("🐚 Syncing shell environment");
|
||||
await shellSync();
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app, BrowserWindow, dialog, IpcMainInvokeEvent } from "electron";
|
||||
import { BrowserWindow, dialog, IpcMainInvokeEvent } from "electron";
|
||||
import { KubernetesCluster } from "../../common/catalog-entities";
|
||||
import { clusterFrameMap } from "../../common/cluster-frames";
|
||||
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler, clusterSetDeletingHandler, clusterClearDeletingHandler } from "../../common/cluster-ipc";
|
||||
@ -34,6 +34,7 @@ import { ResourceApplier } from "../resource-applier";
|
||||
import { WindowManager } from "../window-manager";
|
||||
import path from "path";
|
||||
import { remove } from "fs-extra";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
export function initIpcMainHandlers() {
|
||||
ipcMainHandle(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
|
||||
@ -99,7 +100,7 @@ export function initIpcMainHandlers() {
|
||||
|
||||
try {
|
||||
// remove the local storage file
|
||||
const localStorageFilePath = path.resolve(app.getPath("userData"), "lens-local-storage", `${cluster.id}.json`);
|
||||
const localStorageFilePath = path.resolve(AppPaths.get("userData"), "lens-local-storage", `${cluster.id}.json`);
|
||||
|
||||
await remove(localStorageFilePath);
|
||||
} catch {}
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
import { waitUntilUsed } from "tcp-port-used";
|
||||
import { randomBytes } from "crypto";
|
||||
import { broadcastMessage } from "../common/ipc";
|
||||
import type { Cluster } from "./cluster";
|
||||
import { Kubectl } from "./kubectl";
|
||||
@ -38,6 +39,7 @@ const startingServeRegex = /^starting to serve on (?<address>.+)/i;
|
||||
|
||||
export class KubeAuthProxy {
|
||||
public lastError: string;
|
||||
public readonly apiPrefix: string;
|
||||
|
||||
public get port(): number {
|
||||
return this._port;
|
||||
@ -56,6 +58,7 @@ export class KubeAuthProxy {
|
||||
this.env = env;
|
||||
this.cluster = cluster;
|
||||
this.kubectl = Kubectl.bundled();
|
||||
this.apiPrefix = `/${randomBytes(8).toString("hex")}`;
|
||||
}
|
||||
|
||||
get acceptHosts() {
|
||||
@ -78,7 +81,8 @@ export class KubeAuthProxy {
|
||||
"--kubeconfig", `${this.cluster.kubeConfigPath}`,
|
||||
"--context", `${this.cluster.contextName}`,
|
||||
"--accept-hosts", this.acceptHosts,
|
||||
"--reject-paths", "^[^/]"
|
||||
"--reject-paths", "^[^/]",
|
||||
"--api-prefix", this.apiPrefix
|
||||
];
|
||||
|
||||
if (process.env.DEBUG_PROXY === "true") {
|
||||
@ -112,7 +116,7 @@ export class KubeAuthProxy {
|
||||
});
|
||||
|
||||
await waitUntilUsed(this.port, 500, 10000);
|
||||
|
||||
|
||||
this.ready = true;
|
||||
}
|
||||
|
||||
|
||||
@ -22,15 +22,15 @@
|
||||
import type { KubeConfig } from "@kubernetes/client-node";
|
||||
import type { Cluster } from "./cluster";
|
||||
import type { ContextHandler } from "./context-handler";
|
||||
import { app } from "electron";
|
||||
import path from "path";
|
||||
import fs from "fs-extra";
|
||||
import { dumpConfigYaml } from "../common/kube-helpers";
|
||||
import logger from "./logger";
|
||||
import { LensProxy } from "./lens-proxy";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
|
||||
export class KubeconfigManager {
|
||||
protected configDir = app.getPath("temp");
|
||||
protected configDir = AppPaths.get("temp");
|
||||
protected tempFile: string = null;
|
||||
|
||||
constructor(protected cluster: Cluster, protected contextHandler: ContextHandler) { }
|
||||
|
||||
@ -31,8 +31,8 @@ import { customRequest } from "../common/request";
|
||||
import { getBundledKubectlVersion } from "../common/utils/app-version";
|
||||
import { isDevelopment, isWindows, isTestEnv } from "../common/vars";
|
||||
import { SemVer } from "semver";
|
||||
import { getPath } from "../common/utils/getPath";
|
||||
import { defaultPackageMirror, packageMirrors } from "../common/user-store/preferences-helpers";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
|
||||
const bundledVersion = getBundledKubectlVersion();
|
||||
const kubectlMap: Map<string, string> = new Map([
|
||||
@ -81,7 +81,7 @@ export class Kubectl {
|
||||
protected dirname: string;
|
||||
|
||||
static get kubectlDir() {
|
||||
return path.join(getPath("userData"), "binaries", "kubectl");
|
||||
return path.join(AppPaths.get("userData"), "binaries", "kubectl");
|
||||
}
|
||||
|
||||
public static readonly bundledKubectlVersion: string = bundledVersion;
|
||||
|
||||
@ -200,10 +200,6 @@ export class LensProxy extends Singleton {
|
||||
const proxyTarget = await this.getProxyTarget(req, cluster.contextHandler);
|
||||
|
||||
if (proxyTarget) {
|
||||
// allow to fetch apis in "clusterId.localhost:port" from "localhost:port"
|
||||
// this should be safe because we have already validated cluster uuid
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
|
||||
return this.proxy.web(req, res, proxyTarget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,16 +29,28 @@ import { ExtensionLoader } from "../../../extensions/extension-loader";
|
||||
import { ExtensionsStore } from "../../../extensions/extensions-store";
|
||||
import { LensProtocolRouterMain } from "../router";
|
||||
import mockFs from "mock-fs";
|
||||
import { AppPaths } from "../../../common/app-paths";
|
||||
|
||||
jest.mock("../../../common/ipc");
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
function throwIfDefined(val: any): void {
|
||||
if (val != null) {
|
||||
throw val;
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import _ from "lodash";
|
||||
import type { LensApiRequest } from "../router";
|
||||
import { respondJson } from "../utils/http-responses";
|
||||
import type { Cluster } from "../cluster";
|
||||
@ -33,8 +32,7 @@ export type IMetricsQuery = string | string[] | {
|
||||
};
|
||||
|
||||
// This is used for backoff retry tracking.
|
||||
const MAX_ATTEMPTS = 5;
|
||||
const ATTEMPTS = [...(_.fill(Array(MAX_ATTEMPTS - 1), false)), true];
|
||||
const ATTEMPTS = [false, false, false, false, true];
|
||||
|
||||
// prometheus metrics loader
|
||||
async function loadMetrics(promQueries: string[], cluster: Cluster, prometheusPath: string, queryParams: Record<string, string>): Promise<any[]> {
|
||||
|
||||
@ -34,6 +34,7 @@ interface PortForwardArgs {
|
||||
name: string;
|
||||
port: number;
|
||||
forwardPort: number;
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
const internalPortRegex = /^forwarding from (?<address>.+) ->/i;
|
||||
@ -47,7 +48,8 @@ class PortForward {
|
||||
pf.kind == forward.kind &&
|
||||
pf.name == forward.name &&
|
||||
pf.namespace == forward.namespace &&
|
||||
pf.port == forward.port
|
||||
pf.port == forward.port &&
|
||||
(!forward.protocol || pf.protocol == forward.protocol)
|
||||
));
|
||||
}
|
||||
|
||||
@ -58,6 +60,7 @@ class PortForward {
|
||||
public name: string;
|
||||
public port: number;
|
||||
public forwardPort: number;
|
||||
public protocol: string;
|
||||
|
||||
constructor(public kubeConfig: string, args: PortForwardArgs) {
|
||||
this.clusterId = args.clusterId;
|
||||
@ -66,6 +69,7 @@ class PortForward {
|
||||
this.name = args.name;
|
||||
this.port = args.port;
|
||||
this.forwardPort = args.forwardPort;
|
||||
this.protocol = args.protocol ?? "http";
|
||||
}
|
||||
|
||||
public async start() {
|
||||
@ -90,6 +94,10 @@ class PortForward {
|
||||
}
|
||||
});
|
||||
|
||||
this.process.stderr.on("data", (data) => {
|
||||
logger.warn(`[PORT-FORWARD-ROUTE]: kubectl port-forward process stderr: ${data}`);
|
||||
});
|
||||
|
||||
const internalPort = await getPortFrom(this.process.stdout, {
|
||||
lineRegex: internalPortRegex,
|
||||
});
|
||||
@ -119,21 +127,21 @@ export class PortForwardRoute {
|
||||
const { namespace, resourceType, resourceName } = params;
|
||||
const port = Number(query.get("port"));
|
||||
const forwardPort = Number(query.get("forwardPort"));
|
||||
const protocol = query.get("protocol");
|
||||
|
||||
try {
|
||||
let portForward = PortForward.getPortforward({
|
||||
clusterId: cluster.id, kind: resourceType, name: resourceName,
|
||||
namespace, port, forwardPort,
|
||||
namespace, port, forwardPort, protocol,
|
||||
});
|
||||
|
||||
let thePort = 0;
|
||||
|
||||
if (forwardPort > 0 && forwardPort < 65536) {
|
||||
thePort = forwardPort;
|
||||
}
|
||||
|
||||
if (!portForward) {
|
||||
logger.info(`Creating a new port-forward ${namespace}/${resourceType}/${resourceName}:${port}`);
|
||||
|
||||
const thePort = 0 < forwardPort && forwardPort < 65536
|
||||
? forwardPort
|
||||
: 0;
|
||||
|
||||
portForward = new PortForward(await cluster.getProxyKubeconfigPath(), {
|
||||
clusterId: cluster.id,
|
||||
kind: resourceType,
|
||||
@ -141,6 +149,7 @@ export class PortForwardRoute {
|
||||
name: resourceName,
|
||||
port,
|
||||
forwardPort: thePort,
|
||||
protocol,
|
||||
});
|
||||
|
||||
const started = await portForward.start();
|
||||
@ -169,10 +178,11 @@ export class PortForwardRoute {
|
||||
const { namespace, resourceType, resourceName } = params;
|
||||
const port = Number(query.get("port"));
|
||||
const forwardPort = Number(query.get("forwardPort"));
|
||||
const protocol = query.get("protocol");
|
||||
|
||||
const portForward = PortForward.getPortforward({
|
||||
clusterId: cluster.id, kind: resourceType, name: resourceName,
|
||||
namespace, port, forwardPort
|
||||
namespace, port, forwardPort, protocol,
|
||||
});
|
||||
|
||||
respondJson(response, { port: portForward?.forwardPort ?? null });
|
||||
@ -189,6 +199,7 @@ export class PortForwardRoute {
|
||||
name: f.name,
|
||||
port: f.port,
|
||||
forwardPort: f.forwardPort,
|
||||
protocol: f.protocol,
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@ -23,12 +23,12 @@
|
||||
// convert file path cluster icons to their base64 encoded versions
|
||||
|
||||
import path from "path";
|
||||
import { app } from "electron";
|
||||
import fse from "fs-extra";
|
||||
import { loadConfigFromFileSync } from "../../common/kube-helpers";
|
||||
import { MigrationDeclaration, migrationLog } from "../helpers";
|
||||
import type { ClusterModel } from "../../common/cluster-types";
|
||||
import { getCustomKubeConfigPath, storedKubeConfigFolder } from "../../common/utils";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
interface Pre360ClusterModel extends ClusterModel {
|
||||
kubeConfig: string;
|
||||
@ -37,7 +37,7 @@ interface Pre360ClusterModel extends ClusterModel {
|
||||
export default {
|
||||
version: "3.6.0-beta.1",
|
||||
run(store) {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const userDataPath = AppPaths.get("userData");
|
||||
const storedClusters: Pre360ClusterModel[] = store.get("clusters") ?? [];
|
||||
const migratedClusters: ClusterModel[] = [];
|
||||
|
||||
|
||||
@ -20,10 +20,10 @@
|
||||
*/
|
||||
|
||||
import path from "path";
|
||||
import { app } from "electron";
|
||||
import fse from "fs-extra";
|
||||
import type { ClusterModel } from "../../common/cluster-types";
|
||||
import type { MigrationDeclaration } from "../helpers";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
interface Pre500WorkspaceStoreModel {
|
||||
workspaces: {
|
||||
@ -35,7 +35,7 @@ interface Pre500WorkspaceStoreModel {
|
||||
export default {
|
||||
version: "5.0.0-beta.10",
|
||||
run(store) {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const userDataPath = AppPaths.get("userData");
|
||||
|
||||
try {
|
||||
const workspaceData: Pre500WorkspaceStoreModel = fse.readJsonSync(path.join(userDataPath, "lens-workspace-store.json"));
|
||||
|
||||
@ -23,8 +23,8 @@ import type { ClusterModel, ClusterPreferences, ClusterPrometheusPreferences } f
|
||||
import { MigrationDeclaration, migrationLog } from "../helpers";
|
||||
import { generateNewIdFor } from "../utils";
|
||||
import path from "path";
|
||||
import { app } from "electron";
|
||||
import { moveSync, removeSync } from "fs-extra";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
function mergePrometheusPreferences(left: ClusterPrometheusPreferences, right: ClusterPrometheusPreferences): ClusterPrometheusPreferences {
|
||||
if (left.prometheus && left.prometheusProvider) {
|
||||
@ -106,7 +106,7 @@ function moveStorageFolder({ folder, newId, oldId }: { folder: string, newId: st
|
||||
export default {
|
||||
version: "5.0.0-beta.13",
|
||||
run(store) {
|
||||
const folder = path.resolve(app.getPath("userData"), "lens-local-storage");
|
||||
const folder = path.resolve(AppPaths.get("userData"), "lens-local-storage");
|
||||
|
||||
const oldClusters: ClusterModel[] = store.get("clusters") ?? [];
|
||||
const clusters = new Map<string, ClusterModel>();
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app } from "electron";
|
||||
import fse from "fs-extra";
|
||||
import { isNull } from "lodash";
|
||||
import path from "path";
|
||||
import * as uuid from "uuid";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
import type { ClusterStoreModel } from "../../common/cluster-store";
|
||||
import { defaultHotbarCells, getEmptyHotbar, Hotbar, HotbarItem } from "../../common/hotbar-types";
|
||||
import { catalogEntity } from "../../main/catalog-sources/general";
|
||||
@ -48,7 +48,7 @@ export default {
|
||||
run(store) {
|
||||
const rawHotbars = store.get("hotbars");
|
||||
const hotbars: Hotbar[] = Array.isArray(rawHotbars) ? rawHotbars.filter(h => h && typeof h === "object") : [];
|
||||
const userDataPath = app.getPath("userData");
|
||||
const userDataPath = AppPaths.get("userData");
|
||||
|
||||
// Hotbars might be empty, if some of the previous migrations weren't run
|
||||
if (hotbars.length === 0) {
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app } from "electron";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
@ -27,14 +26,16 @@ import type { ClusterStoreModel } from "../../common/cluster-store";
|
||||
import type { KubeconfigSyncEntry, UserPreferencesModel } from "../../common/user-store";
|
||||
import { MigrationDeclaration, migrationLog } from "../helpers";
|
||||
import { isLogicalChildPath, storedKubeConfigFolder } from "../../common/utils";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
export default {
|
||||
version: "5.0.3-beta.1",
|
||||
run(store) {
|
||||
try {
|
||||
const { syncKubeconfigEntries = [], ...preferences }: UserPreferencesModel = store.get("preferences") ?? {};
|
||||
const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(app.getPath("userData"), "lens-cluster-store.json"), "utf-8")) ?? {};
|
||||
const extensionDataDir = path.resolve(app.getPath("userData"), "extension_data");
|
||||
const userData = AppPaths.get("userData");
|
||||
const { clusters = [] }: ClusterStoreModel = JSON.parse(readFileSync(path.resolve(userData, "lens-cluster-store.json"), "utf-8")) ?? {};
|
||||
const extensionDataDir = path.resolve(userData, "extension_data");
|
||||
const syncPaths = new Set(syncKubeconfigEntries.map(s => s.filePath));
|
||||
|
||||
syncPaths.add(path.join(os.homedir(), ".kube"));
|
||||
|
||||
@ -19,12 +19,12 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { app } from "electron";
|
||||
import fse from "fs-extra";
|
||||
import path from "path";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
export function fileNameMigration() {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const userDataPath = AppPaths.get("userData");
|
||||
const configJsonPath = path.join(userDataPath, "config.json");
|
||||
const lensUserStoreJsonPath = path.join(userDataPath, "lens-user-store.json");
|
||||
|
||||
|
||||
@ -35,8 +35,6 @@ import { ClusterStore } from "../common/cluster-store";
|
||||
import { UserStore } from "../common/user-store";
|
||||
import { ExtensionDiscovery } from "../extensions/extension-discovery";
|
||||
import { ExtensionLoader } from "../extensions/extension-loader";
|
||||
import { App } from "./components/app";
|
||||
import { LensApp } from "./lens-app";
|
||||
import { HelmRepoManager } from "../main/helm/helm-repo-manager";
|
||||
import { ExtensionInstallationStateStore } from "./components/+extensions/extension-install.store";
|
||||
import { DefaultProps } from "./mui-base-theme";
|
||||
@ -49,6 +47,11 @@ import { FilesystemProvisionerStore } from "../main/extension-filesystem";
|
||||
import { ThemeStore } from "./theme.store";
|
||||
import { SentryInit } from "../common/sentry";
|
||||
import { TerminalStore } from "./components/dock/terminal.store";
|
||||
import { AppPaths } from "../common/app-paths";
|
||||
|
||||
if (process.isMainFrame) {
|
||||
SentryInit();
|
||||
}
|
||||
|
||||
configurePackages();
|
||||
|
||||
@ -67,9 +70,12 @@ type AppComponent = React.ComponentType & {
|
||||
init?(rootElem: HTMLElement): Promise<void>;
|
||||
};
|
||||
|
||||
export async function bootstrap(App: AppComponent) {
|
||||
export async function bootstrap(comp: () => Promise<AppComponent>) {
|
||||
await AppPaths.init();
|
||||
const rootElem = document.getElementById("app");
|
||||
|
||||
UserStore.createInstance();
|
||||
|
||||
await attachChromeDebugger();
|
||||
rootElem.classList.toggle("is-mac", isMac);
|
||||
|
||||
@ -88,10 +94,6 @@ export async function bootstrap(App: AppComponent) {
|
||||
ExtensionLoader.createInstance().init();
|
||||
ExtensionDiscovery.createInstance().init();
|
||||
|
||||
UserStore.createInstance();
|
||||
|
||||
SentryInit();
|
||||
|
||||
// ClusterStore depends on: UserStore
|
||||
const cs = ClusterStore.createInstance();
|
||||
|
||||
@ -116,9 +118,10 @@ export async function bootstrap(App: AppComponent) {
|
||||
cs.registerIpcListener();
|
||||
|
||||
// init app's dependencies if any
|
||||
if (App.init) {
|
||||
await App.init(rootElem);
|
||||
}
|
||||
const App = await comp();
|
||||
|
||||
await App.init(rootElem);
|
||||
|
||||
render(<>
|
||||
{isMac && <div id="draggable-top" />}
|
||||
{DefaultProps(App)}
|
||||
@ -126,7 +129,11 @@ export async function bootstrap(App: AppComponent) {
|
||||
}
|
||||
|
||||
// run
|
||||
bootstrap(process.isMainFrame ? LensApp : App);
|
||||
bootstrap(
|
||||
async () => process.isMainFrame
|
||||
? (await import("./lens-app")).LensApp
|
||||
: (await import("./components/app")).App
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -31,26 +31,30 @@ import { CatalogEntityRegistry } from "../../../renderer/api/catalog-entity-regi
|
||||
import { CatalogEntityDetailRegistry } from "../../../extensions/registries";
|
||||
import { CatalogEntityItem } from "./catalog-entity-item";
|
||||
import { CatalogEntityStore } from "./catalog-entity.store";
|
||||
import { AppPaths } from "../../../common/app-paths";
|
||||
|
||||
mockWindow();
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
// avoid TypeError: Cannot read property 'getPath' of undefined
|
||||
jest.mock("@electron/remote", () => {
|
||||
return {
|
||||
app: {
|
||||
getPath: () => {
|
||||
// avoid TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
|
||||
return "";
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
AppPaths.init();
|
||||
|
||||
jest.mock("./hotbar-toggle-menu-item", () => {
|
||||
return {
|
||||
HotbarToggleMenuItem: () => <div>menu item</div>
|
||||
};
|
||||
});
|
||||
jest.mock("./hotbar-toggle-menu-item", () => ({
|
||||
HotbarToggleMenuItem: () => <div>menu item</div>
|
||||
}));
|
||||
|
||||
class MockCatalogEntity extends CatalogEntity {
|
||||
public apiVersion = "api";
|
||||
|
||||
@ -37,7 +37,7 @@ import { CatalogAddButton } from "./catalog-add-button";
|
||||
import type { RouteComponentProps } from "react-router";
|
||||
import { Notifications } from "../notifications";
|
||||
import { MainLayout } from "../layout/main-layout";
|
||||
import { createAppStorage, cssNames, prevDefault } from "../../utils";
|
||||
import { createStorage, cssNames, prevDefault } from "../../utils";
|
||||
import { makeCss } from "../../../common/utils/makeCss";
|
||||
import { CatalogEntityDetails } from "./catalog-entity-details";
|
||||
import { browseCatalogTab, catalogURL, CatalogViewRouteParam } from "../../../common/routes";
|
||||
@ -47,7 +47,7 @@ import { RenderDelay } from "../render-delay/render-delay";
|
||||
import { Icon } from "../icon";
|
||||
import { HotbarToggleMenuItem } from "./hotbar-toggle-menu-item";
|
||||
|
||||
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", browseCatalogTab);
|
||||
export const previousActiveTab = createStorage("catalog-previous-active-tab", browseCatalogTab);
|
||||
|
||||
enum sortBy {
|
||||
name = "name",
|
||||
@ -74,7 +74,7 @@ export class Catalog extends React.Component<Props> {
|
||||
this.catalogEntityStore = props.catalogEntityStore;
|
||||
}
|
||||
static defaultProps = {
|
||||
catalogEntityStore: new CatalogEntityStore(),
|
||||
catalogEntityStore: new CatalogEntityStore(),
|
||||
};
|
||||
|
||||
get routeActiveTab(): string {
|
||||
|
||||
@ -31,6 +31,7 @@ import { ExtensionInstallationStateStore } from "../extension-install.store";
|
||||
import { Extensions } from "../extensions";
|
||||
import mockFs from "mock-fs";
|
||||
import { mockWindow } from "../../../../../__mocks__/windowMock";
|
||||
import { AppPaths } from "../../../../common/app-paths";
|
||||
|
||||
mockWindow();
|
||||
|
||||
@ -38,23 +39,39 @@ jest.setTimeout(30000);
|
||||
jest.mock("fs-extra");
|
||||
jest.mock("../../notifications");
|
||||
|
||||
jest.mock("../../../../common/utils", () => ({
|
||||
...jest.requireActual<any>("../../../../common/utils"),
|
||||
downloadFile: jest.fn(() => ({
|
||||
promise: Promise.resolve()
|
||||
jest.mock("../../../../common/utils/downloadFile", () => ({
|
||||
downloadFile: jest.fn(({ url }) => ({
|
||||
promise: Promise.resolve(),
|
||||
url,
|
||||
cancel: () => {},
|
||||
})),
|
||||
downloadJson: jest.fn(({ url }) => ({
|
||||
promise: Promise.resolve({}),
|
||||
url,
|
||||
cancel: () => { },
|
||||
})),
|
||||
extractTar: jest.fn(() => Promise.resolve())
|
||||
}));
|
||||
|
||||
jest.mock("../../../../common/utils/tar");
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: (): void => void 0,
|
||||
}
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
describe("Extensions", () => {
|
||||
beforeEach(async () => {
|
||||
mockFs({
|
||||
|
||||
@ -47,7 +47,7 @@ import { Notice } from "./notice";
|
||||
import { SettingLayout } from "../layout/setting-layout";
|
||||
import { docsUrl } from "../../../common/vars";
|
||||
import { dialog } from "../../remote-helpers";
|
||||
import { getPath } from "../../../common/utils/getPath";
|
||||
import { AppPaths } from "../../../common/app-paths";
|
||||
|
||||
function getMessageFromError(error: any): string {
|
||||
if (!error || typeof error !== "object") {
|
||||
@ -469,7 +469,7 @@ const supportedFormats = ["tar", "tgz"];
|
||||
|
||||
async function installFromSelectFileDialog() {
|
||||
const { canceled, filePaths } = await dialog.showOpenDialog({
|
||||
defaultPath: getPath("downloads"),
|
||||
defaultPath: AppPaths.get("downloads"),
|
||||
properties: ["openFile", "multiSelections"],
|
||||
message: `Select extensions to install (formats: ${supportedFormats.join(", ")}), `,
|
||||
buttonLabel: "Use configuration",
|
||||
|
||||
@ -23,7 +23,7 @@ import "./port-forward-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import type { PortForwardItem } from "../../port-forward";
|
||||
import { portForwardAddress, PortForwardItem } from "../../port-forward";
|
||||
import { Drawer, DrawerItem } from "../drawer";
|
||||
import { cssNames } from "../../utils";
|
||||
import { podsApi, serviceApi } from "../../../common/k8s-api/endpoints";
|
||||
@ -80,6 +80,9 @@ export class PortForwardDetails extends React.Component<Props> {
|
||||
<DrawerItem name="Local Port">
|
||||
{portForward.getForwardPort()}
|
||||
</DrawerItem>
|
||||
<DrawerItem name="Protocol">
|
||||
{portForward.getProtocol()}
|
||||
</DrawerItem>
|
||||
<DrawerItem name="Status">
|
||||
<span className={cssNames("status", portForward.getStatus().toLowerCase())}>{portForward.getStatus()}</span>
|
||||
</DrawerItem>
|
||||
@ -96,7 +99,7 @@ export class PortForwardDetails extends React.Component<Props> {
|
||||
className="PortForwardDetails"
|
||||
usePortal={true}
|
||||
open={!!portForward}
|
||||
title="Port Forward"
|
||||
title={`Port Forward: ${portForwardAddress(portForward)}`}
|
||||
onClose={hideDetails}
|
||||
toolbar={toolbar}
|
||||
>
|
||||
|
||||
@ -57,7 +57,7 @@ export class PortForwardMenu extends React.Component<Props> {
|
||||
<span className="title">Open</span>
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() => PortForwardDialog.open(portForward)}>
|
||||
<Icon material="edit" tooltip="Change port" interactive={toolbar} />
|
||||
<Icon material="edit" tooltip="Change port or protocol" interactive={toolbar} />
|
||||
<span className="title">Edit</span>
|
||||
</MenuItem>
|
||||
</>
|
||||
|
||||
@ -37,6 +37,7 @@ enum columnId {
|
||||
kind = "kind",
|
||||
port = "port",
|
||||
forwardPort = "forwardPort",
|
||||
protocol = "protocol",
|
||||
status = "status",
|
||||
}
|
||||
|
||||
@ -102,6 +103,7 @@ export class PortForwards extends React.Component<Props> {
|
||||
[columnId.kind]: item => item.getKind(),
|
||||
[columnId.port]: item => item.getPort(),
|
||||
[columnId.forwardPort]: item => item.getForwardPort(),
|
||||
[columnId.protocol]: item => item.getProtocol(),
|
||||
[columnId.status]: item => item.getStatus(),
|
||||
}}
|
||||
searchFilters={[
|
||||
@ -114,6 +116,7 @@ export class PortForwards extends React.Component<Props> {
|
||||
{ title: "Kind", className: "kind", sortBy: columnId.kind, id: columnId.kind },
|
||||
{ title: "Pod Port", className: "port", sortBy: columnId.port, id: columnId.port },
|
||||
{ title: "Local Port", className: "forwardPort", sortBy: columnId.forwardPort, id: columnId.forwardPort },
|
||||
{ title: "Protocol", className: "protocol", sortBy: columnId.protocol, id: columnId.protocol },
|
||||
{ title: "Status", className: "status", sortBy: columnId.status, id: columnId.status },
|
||||
]}
|
||||
renderTableContents={item => [
|
||||
@ -122,6 +125,7 @@ export class PortForwards extends React.Component<Props> {
|
||||
item.getKind(),
|
||||
item.getPort(),
|
||||
item.getForwardPort(),
|
||||
item.getProtocol(),
|
||||
{ title: item.getStatus(), className: item.getStatus().toLowerCase() },
|
||||
]}
|
||||
renderItemMenu={pf => (
|
||||
|
||||
@ -28,7 +28,7 @@ import { observable, makeObservable, reaction } from "mobx";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Notifications } from "../notifications";
|
||||
import { Button } from "../button";
|
||||
import { addPortForward, getPortForward, openPortForward, PortForwardDialog, portForwardStore, removePortForward } from "../../port-forward";
|
||||
import { addPortForward, getPortForward, openPortForward, PortForwardDialog, portForwardStore, predictProtocol, removePortForward } from "../../port-forward";
|
||||
import type { ForwardedPort } from "../../port-forward";
|
||||
import { Spinner } from "../spinner";
|
||||
|
||||
@ -87,6 +87,7 @@ export class ServicePortComponent extends React.Component<Props> {
|
||||
namespace: service.getNs(),
|
||||
port: port.port,
|
||||
forwardPort: this.forwardPort,
|
||||
protocol: predictProtocol(port.name),
|
||||
};
|
||||
|
||||
this.waiting = true;
|
||||
@ -100,7 +101,7 @@ export class ServicePortComponent extends React.Component<Props> {
|
||||
this.isPortForwarded = true;
|
||||
}
|
||||
} catch (error) {
|
||||
Notifications.error("Error occurred starting port-forward, the local port may not be available");
|
||||
Notifications.error(`Error occurred starting port-forward, the local port may not be available or the ${portForward.kind} ${portForward.name} may not be reachable`);
|
||||
this.checkExistingPortForwarding();
|
||||
} finally {
|
||||
this.waiting = false;
|
||||
@ -143,6 +144,7 @@ export class ServicePortComponent extends React.Component<Props> {
|
||||
namespace: service.getNs(),
|
||||
port: port.port,
|
||||
forwardPort: this.forwardPort,
|
||||
protocol: predictProtocol(port.name),
|
||||
};
|
||||
|
||||
PortForwardDialog.open(portForward, { openInBrowser: true });
|
||||
|
||||
@ -49,7 +49,7 @@ export class ServiceAccountsSecret extends React.Component<Props, State> {
|
||||
<>
|
||||
{!showToken && (
|
||||
<>
|
||||
<span className="asterisks">{Array(16).fill("•").join("")}</span>
|
||||
<span className="asterisks">{"•".repeat(16)}</span>
|
||||
<Icon
|
||||
small material="lock_open"
|
||||
tooltip="Show value"
|
||||
|
||||
@ -28,7 +28,7 @@ import { observable, makeObservable, reaction } from "mobx";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Notifications } from "../notifications";
|
||||
import { Button } from "../button";
|
||||
import { addPortForward, getPortForward, openPortForward, PortForwardDialog, portForwardStore, removePortForward } from "../../port-forward";
|
||||
import { addPortForward, getPortForward, openPortForward, PortForwardDialog, portForwardStore, predictProtocol, removePortForward } from "../../port-forward";
|
||||
import type { ForwardedPort } from "../../port-forward";
|
||||
import { Spinner } from "../spinner";
|
||||
|
||||
@ -91,6 +91,7 @@ export class PodContainerPort extends React.Component<Props> {
|
||||
namespace: pod.getNs(),
|
||||
port: port.containerPort,
|
||||
forwardPort: this.forwardPort,
|
||||
protocol: predictProtocol(port.name),
|
||||
};
|
||||
|
||||
this.waiting = true;
|
||||
@ -104,7 +105,7 @@ export class PodContainerPort extends React.Component<Props> {
|
||||
this.isPortForwarded = true;
|
||||
}
|
||||
} catch (error) {
|
||||
Notifications.error("Error occurred starting port-forward, the local port may not be available");
|
||||
Notifications.error(`Error occurred starting port-forward, the local port may not be available or the ${portForward.kind} ${portForward.name} may not be reachable`);
|
||||
this.checkExistingPortForwarding();
|
||||
} finally {
|
||||
this.waiting = false;
|
||||
@ -149,6 +150,7 @@ export class PodContainerPort extends React.Component<Props> {
|
||||
namespace: pod.getNs(),
|
||||
port: port.containerPort,
|
||||
forwardPort: this.forwardPort,
|
||||
protocol: predictProtocol(port.name),
|
||||
};
|
||||
|
||||
PortForwardDialog.open(portForward, { openInBrowser: true });
|
||||
|
||||
@ -27,13 +27,26 @@ import selectEvent from "react-select-event";
|
||||
|
||||
import { Cluster } from "../../../../main/cluster";
|
||||
import { DeleteClusterDialog } from "../delete-cluster-dialog";
|
||||
import { AppPaths } from "../../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
const kubeconfig = `
|
||||
apiVersion: v1
|
||||
clusters:
|
||||
|
||||
@ -30,12 +30,24 @@ import { noop } from "../../../utils";
|
||||
import { ThemeStore } from "../../../theme.store";
|
||||
import { TerminalStore } from "../terminal.store";
|
||||
import { UserStore } from "../../../../common/user-store";
|
||||
import { AppPaths } from "../../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
AppPaths.init();
|
||||
|
||||
const initialTabs: DockTab[] = [
|
||||
{ id: "terminal", kind: TabKind.TERMINAL, title: "Terminal", pinned: false, },
|
||||
|
||||
@ -31,13 +31,26 @@ import { dockerPod, deploymentPod1 } from "./pod.mock";
|
||||
import { ThemeStore } from "../../../theme.store";
|
||||
import { UserStore } from "../../../../common/user-store";
|
||||
import mockFs from "mock-fs";
|
||||
import { AppPaths } from "../../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
const getComponent = (tabData: LogTabData) => {
|
||||
return (
|
||||
<LogResourceSelector
|
||||
|
||||
@ -32,7 +32,7 @@ import type { Align, ListOnScrollProps } from "react-window";
|
||||
|
||||
import { SearchStore, searchStore } from "../../../common/search-store";
|
||||
import { UserStore } from "../../../common/user-store";
|
||||
import { boundMethod, cssNames } from "../../utils";
|
||||
import { array, boundMethod, cssNames } from "../../utils";
|
||||
import { Spinner } from "../spinner";
|
||||
import { VirtualList } from "../virtual-list";
|
||||
import { logStore } from "./log.store";
|
||||
@ -234,7 +234,7 @@ export class LogList extends React.Component<Props> {
|
||||
render() {
|
||||
const { isLoading } = this.props;
|
||||
const isInitLoading = isLoading && !this.logs.length;
|
||||
const rowHeights = new Array(this.logs.length).fill(this.lineHeight);
|
||||
const rowHeights = array.filled(this.logs.length, this.lineHeight);
|
||||
|
||||
if (isInitLoading) {
|
||||
return (
|
||||
|
||||
@ -135,11 +135,10 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
if (open) onClose();
|
||||
};
|
||||
|
||||
copyK8sObjName = () => {
|
||||
const { title } = this.props;
|
||||
const k8sObjName = title.toString().split(": ")[1];
|
||||
copyTitle = (title: string) => {
|
||||
const k8sObjName = title.split(":")[1] || title; // copy whole if no :
|
||||
|
||||
clipboard.writeText(k8sObjName);
|
||||
clipboard.writeText(k8sObjName.trim());
|
||||
this.setState({isCopied: true});
|
||||
setTimeout(() => {
|
||||
this.setState({isCopied: false});
|
||||
@ -163,8 +162,8 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
<div className="drawer-title flex align-center">
|
||||
<div className="drawer-title-text flex gaps align-center">
|
||||
{title}
|
||||
{typeof title == "string" && (
|
||||
<Icon material={copyIcon} tooltip={copyTooltip} onClick={this.copyK8sObjName}/>
|
||||
{title && typeof title == "string" && (
|
||||
<Icon material={copyIcon} tooltip={copyTooltip} onClick={() => this.copyTitle(title)}/>
|
||||
)}
|
||||
</div>
|
||||
{toolbar}
|
||||
|
||||
@ -21,54 +21,68 @@
|
||||
|
||||
import "./error-boundary.scss";
|
||||
|
||||
import React from "react";
|
||||
import React, { ErrorInfo } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Button } from "../button";
|
||||
import { navigation } from "../../navigation";
|
||||
import { issuesTrackerUrl, slackUrl } from "../../../common/vars";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { observer } from "mobx-react";
|
||||
|
||||
interface Props {
|
||||
}
|
||||
|
||||
interface State {
|
||||
error?: Error;
|
||||
errorInfo?: ErrorInfo;
|
||||
}
|
||||
|
||||
@observer
|
||||
export class ErrorBoundary extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Sentry.ErrorBoundary
|
||||
fallback={({ error, componentStack, resetError }) => {
|
||||
const slackLink = <a href={slackUrl} rel="noreferrer" target="_blank">Slack</a>;
|
||||
const githubLink = <a href={issuesTrackerUrl} rel="noreferrer" target="_blank">GitHub</a>;
|
||||
const pageUrl = location.pathname;
|
||||
export class ErrorBoundary extends React.Component<Props, State> {
|
||||
public state: State = {};
|
||||
|
||||
return (
|
||||
<div className="flex ErrorBoundary column gaps">
|
||||
<h5>
|
||||
App crash at <span className="contrast">{pageUrl}</span>
|
||||
</h5>
|
||||
<p>
|
||||
To help us improve the product please report bugs to {slackLink} community or {githubLink} issues tracker.
|
||||
</p>
|
||||
<div className="wrapper">
|
||||
<code className="block">
|
||||
<p className="contrast">Component stack:</p>
|
||||
{componentStack}
|
||||
</code>
|
||||
<code className="box grow">
|
||||
<p className="contrast">Error stack:</p> <br/>
|
||||
{error.stack}
|
||||
</code>
|
||||
</div>
|
||||
<Button
|
||||
className="box self-flex-start"
|
||||
primary label="Back"
|
||||
onClick={() => {
|
||||
resetError();
|
||||
navigation.goBack();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}>
|
||||
{this.props.children}
|
||||
</Sentry.ErrorBoundary>
|
||||
);
|
||||
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||
this.setState({ error, errorInfo });
|
||||
}
|
||||
|
||||
back = () => {
|
||||
this.setState({ error: null, errorInfo: null });
|
||||
navigation.goBack();
|
||||
};
|
||||
|
||||
render() {
|
||||
const { error, errorInfo } = this.state;
|
||||
|
||||
if (error) {
|
||||
const slackLink = <a href={slackUrl} rel="noreferrer" target="_blank">Slack</a>;
|
||||
const githubLink = <a href={issuesTrackerUrl} rel="noreferrer" target="_blank">Github</a>;
|
||||
const pageUrl = location.pathname;
|
||||
|
||||
return (
|
||||
<div className="ErrorBoundary flex column gaps">
|
||||
<h5>
|
||||
App crash at <span className="contrast">{pageUrl}</span>
|
||||
</h5>
|
||||
<p>
|
||||
To help us improve the product please report bugs to {slackLink} community or {githubLink} issues tracker.
|
||||
</p>
|
||||
<div className="wrapper">
|
||||
<code className="block">
|
||||
<p className="contrast">Component stack:</p>
|
||||
{errorInfo.componentStack}
|
||||
</code>
|
||||
<code className="block">
|
||||
<p className="contrast">Error stack:</p>
|
||||
{error.stack}
|
||||
</code>
|
||||
</div>
|
||||
<Button
|
||||
className="box self-flex-start"
|
||||
primary label="Back"
|
||||
onClick={this.back}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,14 +27,26 @@ import { ThemeStore } from "../../../theme.store";
|
||||
import { UserStore } from "../../../../common/user-store";
|
||||
import { Notifications } from "../../notifications";
|
||||
import mockFs from "mock-fs";
|
||||
import { AppPaths } from "../../../../common/app-paths";
|
||||
|
||||
jest.mock("electron", () => ({
|
||||
app: {
|
||||
getVersion: () => "99.99.99",
|
||||
getName: () => "lens",
|
||||
setName: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
getPath: () => "tmp",
|
||||
getLocale: () => "en",
|
||||
setLoginItemSettings: jest.fn(),
|
||||
},
|
||||
ipcMain: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
AppPaths.init();
|
||||
|
||||
const mockHotbars: {[id: string]: any} = {
|
||||
"1": {
|
||||
id: "1",
|
||||
|
||||
@ -45,6 +45,8 @@ import { HotbarIcon } from "../hotbar/hotbar-icon";
|
||||
import { makeObservable, observable } from "mobx";
|
||||
import type { CatalogEntityContextMenuContext } from "../../../common/catalog";
|
||||
import { HotbarStore } from "../../../common/hotbar-store";
|
||||
import { broadcastMessage } from "../../../common/ipc";
|
||||
import { IpcRendererNavigationEvents } from "../../navigation/events";
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@ -55,7 +57,13 @@ export class Sidebar extends React.Component<Props> {
|
||||
static displayName = "Sidebar";
|
||||
@observable private contextMenu: CatalogEntityContextMenuContext = {
|
||||
menuItems: [],
|
||||
navigate,
|
||||
navigate: (url: string, forceMainFrame = true) => {
|
||||
if (forceMainFrame) {
|
||||
broadcastMessage(IpcRendererNavigationEvents.NAVIGATE_IN_APP, url);
|
||||
} else {
|
||||
navigate(url);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import type { TableSortCallback } from "./table";
|
||||
import { array, Ordering, rectifyOrdering, sortCompare } from "../../utils";
|
||||
import { Ordering, rectifyOrdering, sortCompare, tuple } from "../../utils";
|
||||
|
||||
export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T> | undefined, orderByRaw: string): T[] {
|
||||
if (typeof sortingCallback !== "function") {
|
||||
@ -40,7 +40,7 @@ export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T
|
||||
|
||||
const leftSortBy = [left.sortBy].flat();
|
||||
const rightSortBy = [right.sortBy].flat();
|
||||
const zipIter = array.zipStrict(leftSortBy, rightSortBy);
|
||||
const zipIter = tuple.zip(leftSortBy, rightSortBy);
|
||||
let r = zipIter.next();
|
||||
|
||||
for (; r.done === false; r = zipIter.next()) {
|
||||
|
||||
@ -22,3 +22,4 @@
|
||||
export * from "./port-forward.store";
|
||||
export * from "./port-forward-item";
|
||||
export * from "./port-forward-dialog";
|
||||
export * from "./port-forward-utils";
|
||||
|
||||
@ -44,7 +44,8 @@ interface PortForwardDialogOpenOptions {
|
||||
const dialogState = observable.object({
|
||||
isOpen: false,
|
||||
data: null as ForwardedPort,
|
||||
openInBrowser: false
|
||||
useHttps: false,
|
||||
openInBrowser: false,
|
||||
});
|
||||
|
||||
@observer
|
||||
@ -60,6 +61,7 @@ export class PortForwardDialog extends Component<Props> {
|
||||
static open(portForward: ForwardedPort, options: PortForwardDialogOpenOptions = { openInBrowser: false }) {
|
||||
dialogState.isOpen = true;
|
||||
dialogState.data = portForward;
|
||||
dialogState.useHttps = portForward.protocol === "https";
|
||||
dialogState.openInBrowser = options.openInBrowser;
|
||||
}
|
||||
|
||||
@ -96,6 +98,8 @@ export class PortForwardDialog extends Component<Props> {
|
||||
try {
|
||||
let port: number;
|
||||
|
||||
portForward.protocol = dialogState.useHttps ? "https" : "http";
|
||||
|
||||
if (currentPort) {
|
||||
port = await modifyPortForward(portForward, desiredPort);
|
||||
} else {
|
||||
@ -108,7 +112,7 @@ export class PortForwardDialog extends Component<Props> {
|
||||
openPortForward(portForward);
|
||||
}
|
||||
} catch (err) {
|
||||
Notifications.error("Error occurred starting port-forward, the local port may not be available");
|
||||
Notifications.error(`Error occurred starting port-forward, the local port may not be available or the ${portForward.kind} ${portForward.name} may not be reachable`);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
@ -131,6 +135,13 @@ export class PortForwardDialog extends Component<Props> {
|
||||
onChange={this.changePort}
|
||||
/>
|
||||
</div>
|
||||
<Checkbox
|
||||
data-testid="port-forward-https"
|
||||
theme="light"
|
||||
label="https"
|
||||
value={dialogState.useHttps}
|
||||
onChange={value => dialogState.useHttps = value}
|
||||
/>
|
||||
<Checkbox
|
||||
data-testid="port-forward-open"
|
||||
theme="light"
|
||||
|
||||
@ -30,6 +30,7 @@ export interface ForwardedPort {
|
||||
name: string;
|
||||
port: number;
|
||||
forwardPort: number;
|
||||
protocol?: string;
|
||||
}
|
||||
|
||||
export class PortForwardItem implements ItemObject {
|
||||
@ -39,6 +40,7 @@ export class PortForwardItem implements ItemObject {
|
||||
name: string;
|
||||
port: number;
|
||||
forwardPort: number;
|
||||
protocol: string;
|
||||
|
||||
constructor(pf: ForwardedPort) {
|
||||
this.clusterId = pf.clusterId;
|
||||
@ -47,6 +49,7 @@ export class PortForwardItem implements ItemObject {
|
||||
this.name = pf.name;
|
||||
this.port = pf.port;
|
||||
this.forwardPort = pf.forwardPort;
|
||||
this.protocol = pf.protocol ?? "http";
|
||||
|
||||
autoBind(this);
|
||||
}
|
||||
@ -79,6 +82,10 @@ export class PortForwardItem implements ItemObject {
|
||||
return this.forwardPort;
|
||||
}
|
||||
|
||||
getProtocol() {
|
||||
return this.protocol;
|
||||
}
|
||||
|
||||
getStatus() {
|
||||
return "Active"; // to-do allow port-forward-items to be stopped (without removing them)
|
||||
}
|
||||
|
||||
53
src/renderer/port-forward/port-forward-utils.ts
Normal file
53
src/renderer/port-forward/port-forward-utils.ts
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OpenLens Authors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
import { openExternal } from "../utils";
|
||||
import { Notifications } from "../components/notifications";
|
||||
import type { ForwardedPort } from "./port-forward-item";
|
||||
import logger from "../../common/logger";
|
||||
|
||||
export function portForwardAddress(portForward: ForwardedPort) {
|
||||
return `${portForward.protocol ?? "http"}://localhost:${portForward.forwardPort}`;
|
||||
}
|
||||
|
||||
export function openPortForward(portForward: ForwardedPort) {
|
||||
const browseTo = portForwardAddress(portForward);
|
||||
|
||||
openExternal(browseTo)
|
||||
.catch(error => {
|
||||
logger.error(`failed to open in browser: ${error}`, {
|
||||
clusterId: portForward.clusterId,
|
||||
port: portForward.port,
|
||||
kind: portForward.kind,
|
||||
namespace: portForward.namespace,
|
||||
name: portForward.name,
|
||||
});
|
||||
Notifications.error(`Failed to open ${browseTo} in browser`);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
export function predictProtocol(name: string) {
|
||||
return name === "https" ? "https" : "http";
|
||||
}
|
||||
|
||||
@ -22,11 +22,10 @@
|
||||
|
||||
import { makeObservable, observable, reaction } from "mobx";
|
||||
import { ItemStore } from "../../common/item.store";
|
||||
import { autoBind, createStorage, disposer, getHostedClusterId, openExternal } from "../utils";
|
||||
import { autoBind, createStorage, disposer, getHostedClusterId } from "../utils";
|
||||
import { ForwardedPort, PortForwardItem } from "./port-forward-item";
|
||||
import { apiBase } from "../api";
|
||||
import { waitUntilFree } from "tcp-port-used";
|
||||
import { Notifications } from "../components/notifications";
|
||||
import logger from "../../common/logger";
|
||||
|
||||
export class PortForwardStore extends ItemStore<PortForwardItem> {
|
||||
@ -88,7 +87,7 @@ export class PortForwardStore extends ItemStore<PortForwardItem> {
|
||||
if (index === -1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return this.getItems()[index];
|
||||
}
|
||||
}
|
||||
@ -105,8 +104,10 @@ export async function addPortForward(portForward: ForwardedPort): Promise<number
|
||||
let response: PortForwardResult;
|
||||
|
||||
try {
|
||||
response = await apiBase.post<PortForwardResult>(`/pods/port-forward/${portForward.namespace}/${portForward.kind}/${portForward.name}?port=${portForward.port}&forwardPort=${portForward.forwardPort}`);
|
||||
|
||||
const protocol = portForward.protocol ?? "http";
|
||||
|
||||
response = await apiBase.post<PortForwardResult>(`/pods/port-forward/${portForward.namespace}/${portForward.kind}/${portForward.name}?port=${portForward.port}&forwardPort=${portForward.forwardPort}&protocol=${protocol}`);
|
||||
|
||||
if (response?.port && response.port != +portForward.forwardPort) {
|
||||
logger.warn(`specified ${portForward.forwardPort} got ${response.port}`);
|
||||
}
|
||||
@ -119,11 +120,19 @@ export async function addPortForward(portForward: ForwardedPort): Promise<number
|
||||
return response?.port;
|
||||
}
|
||||
|
||||
function getProtocolQuery(protocol: string) {
|
||||
if (protocol) {
|
||||
return `&protocol=${protocol}`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
export async function getPortForward(portForward: ForwardedPort): Promise<number> {
|
||||
let response: PortForwardResult;
|
||||
|
||||
try {
|
||||
response = await apiBase.get<PortForwardResult>(`/pods/port-forward/${portForward.namespace}/${portForward.kind}/${portForward.name}?port=${portForward.port}&forwardPort=${portForward.forwardPort}`);
|
||||
response = await apiBase.get<PortForwardResult>(`/pods/port-forward/${portForward.namespace}/${portForward.kind}/${portForward.name}?port=${portForward.port}&forwardPort=${portForward.forwardPort}${getProtocolQuery(portForward.protocol)}`);
|
||||
} catch (error) {
|
||||
logger.warn("Error getting port-forward:", error, portForward);
|
||||
throw(error);
|
||||
@ -168,22 +177,4 @@ export async function getPortForwards(): Promise<ForwardedPort[]> {
|
||||
}
|
||||
}
|
||||
|
||||
export function openPortForward(portForward: ForwardedPort) {
|
||||
const browseTo = `http://localhost:${portForward.forwardPort}`;
|
||||
|
||||
openExternal(browseTo)
|
||||
.catch(error => {
|
||||
logger.error(`failed to open in browser: ${error}`, {
|
||||
clusterId: portForward.clusterId,
|
||||
port: portForward.port,
|
||||
kind: portForward.kind,
|
||||
namespace: portForward.namespace,
|
||||
name: portForward.name,
|
||||
});
|
||||
Notifications.error(`Failed to open ${browseTo} in browser`);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
export const portForwardStore = new PortForwardStore();
|
||||
|
||||
@ -26,7 +26,6 @@ import { comparer, observable, reaction, toJS, when } from "mobx";
|
||||
import fse from "fs-extra";
|
||||
import { StorageHelper } from "./storageHelper";
|
||||
import logger from "../../main/logger";
|
||||
import { getHostedClusterId, getPath } from "../../common/utils";
|
||||
import { isTestEnv } from "../../common/vars";
|
||||
|
||||
const storage = observable({
|
||||
@ -37,55 +36,48 @@ const storage = observable({
|
||||
|
||||
/**
|
||||
* Creates a helper for saving data under the "key" intended for window.localStorage
|
||||
* @param key
|
||||
* @param defaultValue
|
||||
* @param key The descriptor of the data
|
||||
* @param defaultValue The default value of the data, must be JSON serializable
|
||||
*/
|
||||
export function createStorage<T>(key: string, defaultValue: T) {
|
||||
return createAppStorage(key, defaultValue, getHostedClusterId());
|
||||
}
|
||||
|
||||
export function createAppStorage<T>(key: string, defaultValue: T, clusterId?: string | undefined) {
|
||||
const { logPrefix } = StorageHelper;
|
||||
const folder = path.resolve(getPath("userData"), "lens-local-storage");
|
||||
const fileName = `${clusterId ?? "app"}.json`;
|
||||
const filePath = path.resolve(folder, fileName);
|
||||
|
||||
if (!storage.initialized) {
|
||||
init(); // called once per cluster-view
|
||||
}
|
||||
|
||||
function init() {
|
||||
storage.initialized = true;
|
||||
|
||||
// read previously saved state (if any)
|
||||
fse.readJson(filePath)
|
||||
.then(data => storage.data = data)
|
||||
.catch(() => null) // ignore empty / non-existing / invalid json files
|
||||
.finally(() => {
|
||||
(async () => {
|
||||
const filePath = await StorageHelper.getLocalStoragePath();
|
||||
|
||||
try {
|
||||
storage.data = await fse.readJson(filePath);
|
||||
} catch {} finally {
|
||||
if (!isTestEnv) {
|
||||
logger.info(`${logPrefix} loading finished for ${filePath}`);
|
||||
}
|
||||
|
||||
storage.loaded = true;
|
||||
}
|
||||
|
||||
// bind auto-saving data changes to %storage-file.json
|
||||
reaction(() => toJS(storage.data), saveFile, {
|
||||
delay: 250, // lazy, avoid excessive writes to fs
|
||||
equals: comparer.structural, // save only when something really changed
|
||||
});
|
||||
|
||||
// bind auto-saving data changes to %storage-file.json
|
||||
reaction(() => toJS(storage.data), saveFile, {
|
||||
delay: 250, // lazy, avoid excessive writes to fs
|
||||
equals: comparer.structural, // save only when something really changed
|
||||
});
|
||||
async function saveFile(state: Record<string, any> = {}) {
|
||||
logger.info(`${logPrefix} saving ${filePath}`);
|
||||
|
||||
async function saveFile(state: Record<string, any> = {}) {
|
||||
logger.info(`${logPrefix} saving ${filePath}`);
|
||||
|
||||
try {
|
||||
await fse.ensureDir(folder, { mode: 0o755 });
|
||||
await fse.writeJson(filePath, state, { spaces: 2 });
|
||||
} catch (error) {
|
||||
logger.error(`${logPrefix} saving failed: ${error}`, {
|
||||
json: state, jsonFilePath: filePath
|
||||
});
|
||||
try {
|
||||
await fse.ensureDir(path.dirname(filePath), { mode: 0o755 });
|
||||
await fse.writeJson(filePath, state, { spaces: 2 });
|
||||
} catch (error) {
|
||||
logger.error(`${logPrefix} saving failed: ${error}`, {
|
||||
json: state, jsonFilePath: filePath
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})()
|
||||
.catch(error => logger.error(`${logPrefix} Failed to initialize storage: ${error}`));
|
||||
}
|
||||
|
||||
return new StorageHelper<T>(key, {
|
||||
|
||||
@ -24,7 +24,9 @@ import { action, comparer, IReactionDisposer, IReactionOptions, makeObservable,
|
||||
import produce, { Draft, isDraft } from "immer";
|
||||
import { isEqual, isPlainObject } from "lodash";
|
||||
import logger from "../../main/logger";
|
||||
import { disposer } from "../../common/utils";
|
||||
import { getHostedClusterId, disposer } from "../../common/utils";
|
||||
import path from "path";
|
||||
import { AppPaths } from "../../common/app-paths";
|
||||
|
||||
export interface StorageAdapter<T> {
|
||||
[metadata: string]: any;
|
||||
@ -42,6 +44,10 @@ export interface StorageHelperOptions<T> {
|
||||
}
|
||||
|
||||
export class StorageHelper<T> {
|
||||
static async getLocalStoragePath() {
|
||||
return path.resolve(await AppPaths.getAsync("userData"), "lens-local-storage", `${getHostedClusterId() || "app"}.json`);
|
||||
}
|
||||
|
||||
static logPrefix = "[StorageHelper]:";
|
||||
readonly storage: StorageAdapter<T>;
|
||||
public dispose = disposer();
|
||||
|
||||
190
yarn.lock
190
yarn.lock
@ -963,16 +963,6 @@
|
||||
schema-utils "^2.6.5"
|
||||
source-map "^0.7.3"
|
||||
|
||||
"@sentry/browser@6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e"
|
||||
integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ==
|
||||
dependencies:
|
||||
"@sentry/core" "6.13.3"
|
||||
"@sentry/types" "6.13.3"
|
||||
"@sentry/utils" "6.13.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/browser@6.7.1":
|
||||
version "6.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.7.1.tgz#e01144a08984a486ecc91d7922cc457e9c9bd6b7"
|
||||
@ -983,17 +973,6 @@
|
||||
"@sentry/utils" "6.7.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221"
|
||||
integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.13.3"
|
||||
"@sentry/minimal" "6.13.3"
|
||||
"@sentry/types" "6.13.3"
|
||||
"@sentry/utils" "6.13.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@6.7.1":
|
||||
version "6.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.7.1.tgz#c3aaa6415d06bec65ac446b13b84f073805633e3"
|
||||
@ -1005,10 +984,10 @@
|
||||
"@sentry/utils" "6.7.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/electron@^2.5.0":
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/electron/-/electron-2.5.0.tgz#4168ff04ee01cb5a99ce042f3435660a510c634d"
|
||||
integrity sha512-OiJWi9BKtlj4UeoaCArVXIvfW808fgW1GLmeiC7wD7B64ALHSYSwu8tkqZK+IMVhPmQN04AUyoYXrZohfJ7sOg==
|
||||
"@sentry/electron@^2.5.4":
|
||||
version "2.5.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/electron/-/electron-2.5.4.tgz#337b2f7e228e805a3e4eb3611c7b12c6cf87c618"
|
||||
integrity sha512-tCCK+P581TmdjsDpHBQz7qYcldzGdUk1Fd6FPxPy1JKGzeY4uf/uSLKzR80Lzs5kTpEZFOwiMHSA8yjwFp5qoA==
|
||||
dependencies:
|
||||
"@sentry/browser" "6.7.1"
|
||||
"@sentry/core" "6.7.1"
|
||||
@ -1018,15 +997,6 @@
|
||||
"@sentry/utils" "6.7.1"
|
||||
tslib "^2.2.0"
|
||||
|
||||
"@sentry/hub@6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f"
|
||||
integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw==
|
||||
dependencies:
|
||||
"@sentry/types" "6.13.3"
|
||||
"@sentry/utils" "6.13.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/hub@6.7.1":
|
||||
version "6.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.7.1.tgz#d46d24deec67f0731a808ca16796e6765b371bc1"
|
||||
@ -1036,23 +1006,14 @@
|
||||
"@sentry/utils" "6.7.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/integrations@^6.10.0":
|
||||
version "6.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.10.0.tgz#f8f9e7efd55ec44d0408bd4493df1c9ceabaaa63"
|
||||
integrity sha512-NMtB0jjFYFZRxyjYu2dWLThk9YPIwqhi4hYywmWkbv4/ILzi5Rwnh+aqNW6yrj8qG4b9itNMh3YvEzmf0aqauw==
|
||||
dependencies:
|
||||
"@sentry/types" "6.10.0"
|
||||
"@sentry/utils" "6.10.0"
|
||||
localforage "^1.8.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@6.13.3":
|
||||
"@sentry/integrations@^6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e"
|
||||
integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw==
|
||||
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-6.13.3.tgz#9d80229de6e815c53fa52ca2422a0d13820b8d4e"
|
||||
integrity sha512-iC8LkbBTxlRo9FNxRqFfEm85FrELltc3E9gFsFSBkCnf7S/3nDCDW+mJX92KpRk97Wqid6/JwlXttKz8lsdF2A==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.13.3"
|
||||
"@sentry/types" "6.13.3"
|
||||
"@sentry/utils" "6.13.3"
|
||||
localforage "^1.8.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@6.7.1":
|
||||
@ -1079,18 +1040,6 @@
|
||||
lru_map "^0.3.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/react@^6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a"
|
||||
integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw==
|
||||
dependencies:
|
||||
"@sentry/browser" "6.13.3"
|
||||
"@sentry/minimal" "6.13.3"
|
||||
"@sentry/types" "6.13.3"
|
||||
"@sentry/utils" "6.13.3"
|
||||
hoist-non-react-statics "^3.3.2"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/tracing@6.7.1":
|
||||
version "6.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.7.1.tgz#b11f0c17a6c5dc14ef44733e5436afb686683268"
|
||||
@ -1102,12 +1051,7 @@
|
||||
"@sentry/utils" "6.7.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/types@6.10.0":
|
||||
version "6.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.10.0.tgz#6b1f44e5ed4dbc2710bead24d1b32fb08daf04e1"
|
||||
integrity sha512-M7s0JFgG7/6/yNVYoPUbxzaXDhnzyIQYRRJJKRaTD77YO4MHvi4Ke8alBWqD5fer0cPIfcSkBqa9BLdqRqcMWw==
|
||||
|
||||
"@sentry/types@6.13.3", "@sentry/types@^6.8.0":
|
||||
"@sentry/types@6.13.3", "@sentry/types@^6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2"
|
||||
integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A==
|
||||
@ -1117,14 +1061,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.7.1.tgz#c8263e1886df5e815570c4668eb40a1cfaa1c88b"
|
||||
integrity sha512-9AO7HKoip2MBMNQJEd6+AKtjj2+q9Ze4ooWUdEvdOVSt5drg7BGpK221/p9JEOyJAZwEPEXdcMd3VAIMiOb4MA==
|
||||
|
||||
"@sentry/utils@6.10.0":
|
||||
version "6.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.10.0.tgz#839a099fa0a1f0ca0893c7ce8c55ba0608c1d80f"
|
||||
integrity sha512-F9OczOcZMFtazYVZ6LfRIe65/eOfQbiAedIKS0li4npuMz0jKYRbxrjd/U7oLiNQkPAp4/BujU4m1ZIwq6a+tg==
|
||||
dependencies:
|
||||
"@sentry/types" "6.10.0"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/utils@6.13.3":
|
||||
version "6.13.3"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926"
|
||||
@ -1596,10 +1532,10 @@
|
||||
jest-diff "^26.0.0"
|
||||
pretty-format "^26.0.0"
|
||||
|
||||
"@types/js-yaml@^4.0.1", "@types/js-yaml@^4.0.2":
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.2.tgz#4117a7a378593a218e9d6f0ef44ce6d5d9edf7fa"
|
||||
integrity sha512-KbeHS/Y4R+k+5sWXEYzAZKuB1yQlZtEghuhRxrVRLaqhtoG5+26JwQsa4HyS3AWX8v1Uwukma5HheduUDskasA==
|
||||
"@types/js-yaml@^4.0.1", "@types/js-yaml@^4.0.4":
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.4.tgz#cc38781257612581a1a0eb25f1709d2b06812fce"
|
||||
integrity sha512-AuHubXUmg0AzkXH0Mx6sIxeY/1C110mm/EkE/gB1sTRz3h2dao2W/63q42SlVST+lICxz5Oki2hzYA6+KnnieQ==
|
||||
|
||||
"@types/jsdom@^16.2.13":
|
||||
version "16.2.13"
|
||||
@ -1642,10 +1578,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.155.tgz#e2b4514f46a261fd11542e47519c20ebce7bc23a"
|
||||
integrity sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==
|
||||
|
||||
"@types/marked@^2.0.4":
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.4.tgz#34a0ea548afe6e0c01095229d47b48b2af650613"
|
||||
integrity sha512-L9VRSe0Id8xbPL99mUo/4aKgD7ZoRwFZqUQScNKHi2pFjF9ZYSMNShUHD6VlMT6J/prQq0T1mxuU25m3R7dFzg==
|
||||
"@types/marked@^2.0.5":
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-2.0.5.tgz#453e27f1e97199d45bb25297b0dd2b9bbc1e05ea"
|
||||
integrity sha512-shRZ7XnYFD/8n8zSjKvFdto1QNSf4tONZIlNEZGrJe8GsOE8DL/hG1Hbl8gZlfLnjS7+f5tZGIaTgfpyW38h4w==
|
||||
|
||||
"@types/md5-file@^4.0.2":
|
||||
version "4.0.2"
|
||||
@ -1961,10 +1897,10 @@
|
||||
"@types/mime" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/sharp@^0.28.3":
|
||||
version "0.28.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/sharp/-/sharp-0.28.3.tgz#0e57ede34d3e334632ab7a68a6af070aa0f51ceb"
|
||||
integrity sha512-y3mxUj3jukIWgdu9CrSTSCo5HruTzDxdjn5SqdIEALdTszkcot9r8HX/7q9FMx3YjuXifTD0OI+d4wA6Pogqmw==
|
||||
"@types/sharp@^0.29.2":
|
||||
version "0.29.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/sharp/-/sharp-0.29.2.tgz#b4e932e982e258d1013236c8b4bcc14f9883c9a3"
|
||||
integrity sha512-tIbMvtPa8kMyFMKNhpsPT1HO3CgXLuiCAA8bxHAGAZLyALpYvYc4hUu3pu0+3oExQA5LwvHrWp+OilgXCYVQgg==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
@ -3427,10 +3363,10 @@ builder-util-runtime@8.8.1:
|
||||
debug "^4.3.2"
|
||||
sax "^1.2.4"
|
||||
|
||||
builder-util-runtime@8.9.0:
|
||||
version "8.9.0"
|
||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.9.0.tgz#5d8e7ef101c0bf8a54fec3a70f0c551e8fdd58c2"
|
||||
integrity sha512-XT7asdRMiSqUj/7EtvSW1mzVARvnhj0Nv4Ei4kD0p8GrKMFJt1Nadm4XwD+PrI2+srrtU+l8JMoBgSe4LX8EmQ==
|
||||
builder-util-runtime@8.9.1:
|
||||
version "8.9.1"
|
||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.9.1.tgz#25f066b3fbc20b3e6236a9b956b1ebb0e33ff66a"
|
||||
integrity sha512-c8a8J3wK6BIVLW7ls+7TRK9igspTbzWmUqxFbgK0m40Ggm6efUbxtWVCGIjc+dtchyr5qAMAUL6iEGRdS/6vwg==
|
||||
dependencies:
|
||||
debug "^4.3.2"
|
||||
sax "^1.2.4"
|
||||
@ -5184,13 +5120,13 @@ electron-publish@22.13.1:
|
||||
lazy-val "^1.0.5"
|
||||
mime "^2.5.2"
|
||||
|
||||
electron-updater@^4.6.0:
|
||||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.6.0.tgz#17fc25a16d28f749cd3980430461bf7e6927d925"
|
||||
integrity sha512-evvAwfDn100sIBZ/GLDpcWtWfaug48RGxVuYiSp0foKQkaXJGFyqYy5ADyt+HPML/mSTMPBvUq55cLEW45BroQ==
|
||||
electron-updater@^4.6.1:
|
||||
version "4.6.1"
|
||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.6.1.tgz#80ca805c4f51b2e682aac29d18fed75d6a533d32"
|
||||
integrity sha512-YsU1mHqXLrXXmBMsxhxy24PrbaB8rnpZDPmFa2gOkTYk/Ch13+R0fjsRSpPYvqtskVVY0ux8fu+HnUkVkqc7og==
|
||||
dependencies:
|
||||
"@types/semver" "^7.3.6"
|
||||
builder-util-runtime "8.9.0"
|
||||
builder-util-runtime "8.9.1"
|
||||
fs-extra "^10.0.0"
|
||||
js-yaml "^4.1.0"
|
||||
lazy-val "^1.0.5"
|
||||
@ -5206,10 +5142,10 @@ electron-window-state@^5.0.3:
|
||||
jsonfile "^4.0.0"
|
||||
mkdirp "^0.5.1"
|
||||
|
||||
electron@^13.5.1:
|
||||
version "13.5.1"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-13.5.1.tgz#76c02c39be228532f886a170b472cbd3d93f0d0f"
|
||||
integrity sha512-ZyxhIhmdaeE3xiIGObf0zqEyCyuIDqZQBv9NKX8w5FNzGm87j4qR0H1+GQg6vz+cA1Nnv1x175Zvimzc0/UwEQ==
|
||||
electron@13.6.0:
|
||||
version "13.6.0"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-13.6.0.tgz#c61e516f7a087dec711c6fddd945a808cfa115d8"
|
||||
integrity sha512-VDOUmRwa4eQ+5iXE+XHKXKX+2yk8Ey5uBe3nH9Hj6zNPUBY2S0EOClw7U90Ve2lLHXiQ6DnguNmDgOZKJLcHFQ==
|
||||
dependencies:
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^14.6.2"
|
||||
@ -9401,10 +9337,10 @@ marked@^2.1.3:
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-2.1.3.tgz#bd017cef6431724fd4b27e0657f5ceb14bff3753"
|
||||
integrity sha512-/Q+7MGzaETqifOMWYEA7HVMaZb4XbcRfaOzcSsHZEith83KGlvaSG33u0SKu89Mj5h+T8V2hM+8O45Qc5XTgwA==
|
||||
|
||||
marked@^3.0.4:
|
||||
version "3.0.6"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-3.0.6.tgz#d268f7229717ff55f81ff759c519d23c90def40e"
|
||||
integrity sha512-a1hY8eqdP9JgmsaO0MYYhO9Li2nfY/5pAj+gWU5r41Lze6AV4Xty1cseLWDcOYimJnaVfQAomaA6NK+z2IyR+w==
|
||||
marked@^3.0.8:
|
||||
version "3.0.8"
|
||||
resolved "https://registry.yarnpkg.com/marked/-/marked-3.0.8.tgz#2785f0dc79cbdc6034be4bb4f0f0a396bd3f8aeb"
|
||||
integrity sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==
|
||||
|
||||
matcher@^3.0.0:
|
||||
version "3.0.0"
|
||||
@ -9907,7 +9843,7 @@ node-addon-api@^1.6.3:
|
||||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-1.7.2.tgz#3df30b95720b53c24e59948b49532b662444f54d"
|
||||
integrity sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==
|
||||
|
||||
node-addon-api@^4.1.0:
|
||||
node-addon-api@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.2.0.tgz#117cbb5a959dff0992e1c586ae0393573e4d2a87"
|
||||
integrity sha512-eazsqzwG2lskuzBqCGPi7Ac2UgOoMz8JVOXVhTvvPDYhthvNpefx8jWD8Np7Gv+2Sz0FlPWZk0nJV0z598Wn8Q==
|
||||
@ -12593,14 +12529,14 @@ shallow-clone@^3.0.0:
|
||||
dependencies:
|
||||
kind-of "^6.0.2"
|
||||
|
||||
sharp@^0.29.1:
|
||||
version "0.29.1"
|
||||
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.29.1.tgz#f60b50f24f399464a24187c86bd2da41aae50b85"
|
||||
integrity sha512-DpgdAny9TuS+oWCQ7MRS8XyY9x6q1+yW3a5wNx0J3HrGuB/Jot/8WcT+lElHY9iJu2pwtegSGxqMaqFiMhs4rQ==
|
||||
sharp@^0.29.2:
|
||||
version "0.29.2"
|
||||
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.29.2.tgz#e8c003cd9cb321585b32dbda6eed3baa7d6f2308"
|
||||
integrity sha512-XWRdiYLIJ3tDUejRyG24KERnJzMfIoyiJBntd2S6/uj3NEeNgRFRLgiBlvPxMa8aml14dKKD98yHinSNKp1xzQ==
|
||||
dependencies:
|
||||
color "^4.0.1"
|
||||
detect-libc "^1.0.3"
|
||||
node-addon-api "^4.1.0"
|
||||
node-addon-api "^4.2.0"
|
||||
prebuild-install "^6.1.4"
|
||||
semver "^7.3.5"
|
||||
simple-get "^3.1.0"
|
||||
@ -12654,10 +12590,10 @@ shellwords@^0.1.1:
|
||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
||||
|
||||
shiki@^0.9.11:
|
||||
version "0.9.11"
|
||||
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.9.11.tgz#07d75dab2abb6dc12a01f79a397cb1c391fa22d8"
|
||||
integrity sha512-tjruNTLFhU0hruCPoJP0y+B9LKOmcqUhTpxn7pcJB3fa+04gFChuEmxmrUfOJ7ZO6Jd+HwMnDHgY3lv3Tqonuw==
|
||||
shiki@^0.9.12:
|
||||
version "0.9.12"
|
||||
resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.9.12.tgz#70cbc8c1bb78ff7b356f84a7eecdb040efddd247"
|
||||
integrity sha512-VXcROdldv0/Qu0w2XvzU4IrvTeBNs/Kj/FCmtcEXGz7Tic/veQzliJj6tEiAgoKianhQstpYmbPDStHU5Opqcw==
|
||||
dependencies:
|
||||
jsonc-parser "^3.0.0"
|
||||
onigasm "^2.2.5"
|
||||
@ -13456,10 +13392,10 @@ tar@^4.4.10, tar@^4.4.12, tar@^4.4.19:
|
||||
safe-buffer "^5.2.1"
|
||||
yallist "^3.1.1"
|
||||
|
||||
tar@^6.0.2, tar@^6.1.10:
|
||||
version "6.1.10"
|
||||
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.10.tgz#8a320a74475fba54398fa136cd9883aa8ad11175"
|
||||
integrity sha512-kvvfiVvjGMxeUNB6MyYv5z7vhfFRwbwCXJAeL0/lnbrttBVqcMOnpHUf0X42LrPMR8mMpgapkJMchFH4FSHzNA==
|
||||
tar@^6.0.2, tar@^6.1.11:
|
||||
version "6.1.11"
|
||||
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
|
||||
integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
|
||||
dependencies:
|
||||
chownr "^2.0.0"
|
||||
fs-minipass "^2.0.0"
|
||||
@ -13928,16 +13864,16 @@ typedoc-plugin-markdown@^3.11.3:
|
||||
dependencies:
|
||||
handlebars "^4.7.7"
|
||||
|
||||
typedoc@0.22.6:
|
||||
version "0.22.6"
|
||||
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.6.tgz#1122f83a6eb5cd7dbb26d1924de1f9de9e8c7c7e"
|
||||
integrity sha512-ePbJqOaz0GNkU2ehRwFwBpLD4Gp6m7jbJfHysXmDdjVKc1g8DFJ83r/LOZ9TZrkC661vgpoIY3FjSPEtUilHNA==
|
||||
typedoc@0.22.7:
|
||||
version "0.22.7"
|
||||
resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.22.7.tgz#e5e095ab14676296f4b12ac3355321eae650e447"
|
||||
integrity sha512-ndxxp+tU1Wczvdxp4u2/PvT1qjD6hdFdSdehpORHjE+JXmMkl2bftXCR0upHmsnesBG7VCcr8vfgloGHIH8glQ==
|
||||
dependencies:
|
||||
glob "^7.2.0"
|
||||
lunr "^2.3.9"
|
||||
marked "^3.0.4"
|
||||
marked "^3.0.8"
|
||||
minimatch "^3.0.4"
|
||||
shiki "^0.9.11"
|
||||
shiki "^0.9.12"
|
||||
|
||||
typeface-roboto@^1.1.13:
|
||||
version "1.1.13"
|
||||
@ -13963,10 +13899,10 @@ typescript-plugin-css-modules@^3.4.0:
|
||||
stylus "^0.54.8"
|
||||
tsconfig-paths "^3.9.0"
|
||||
|
||||
typescript@^4.4.3:
|
||||
version "4.4.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.3.tgz#bdc5407caa2b109efd4f82fe130656f977a29324"
|
||||
integrity sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==
|
||||
typescript@^4.4.4:
|
||||
version "4.4.4"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
|
||||
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
|
||||
|
||||
uglify-js@^3.1.4:
|
||||
version "3.9.4"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user