mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Replace all internal uses of utilities with new packages
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
6a65704ddc
commit
1dc177f21c
410 files changed
+962
-757
No files matched your search
@@ -10,7 +10,7 @@ import type { Cluster } from "../../../common/cluster/cluster";
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import directoryForTempInjectable from "../../../common/app-paths/directory-for-temp/directory-for-temp.injectable";
|
||||
import { iter, strictGet } from "../../../common/utils";
|
||||
import { iter, strictGet } from "@k8slens/utilities";
|
||||
import type { ComputeKubeconfigDiff } from "../kubeconfig-sync/compute-diff.injectable";
|
||||
import computeKubeconfigDiffInjectable from "../kubeconfig-sync/compute-diff.injectable";
|
||||
import type { ConfigToModels } from "../kubeconfig-sync/config-to-models.injectable";
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import type { Readable } from "stream";
|
||||
import type { CatalogEntity } from "../../../common/catalog";
|
||||
import type { Cluster } from "../../../common/cluster/cluster";
|
||||
import createReadFileStreamInjectable from "../../../common/fs/create-read-file-stream.injectable";
|
||||
import type { Disposer } from "../../../common/utils";
|
||||
import { bytesToUnits, noop } from "../../../common/utils";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import { bytesToUnits, noop } from "@k8slens/utilities";
|
||||
import computeKubeconfigDiffInjectable from "./compute-diff.injectable";
|
||||
import kubeconfigSyncLoggerInjectable from "./logger.injectable";
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
import type { IComputedValue, ObservableMap } from "mobx";
|
||||
import { action, observable, computed, makeObservable, observe } from "mobx";
|
||||
import type { CatalogEntity } from "../../../common/catalog";
|
||||
import type { Disposer } from "../../../common/utils";
|
||||
import { iter } from "../../../common/utils";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
import type { KubeconfigSyncValue } from "../../../common/user-store";
|
||||
import type { Logger } from "../../../common/logger";
|
||||
import type { WatchKubeconfigFileChanges } from "./watch-file-changes.injectable";
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ import type { Cluster } from "../../../common/cluster/cluster";
|
||||
import statInjectable from "../../../common/fs/stat.injectable";
|
||||
import type { Watcher } from "../../../common/fs/watch/watch.injectable";
|
||||
import watchInjectable from "../../../common/fs/watch/watch.injectable";
|
||||
import type { Disposer } from "../../../common/utils";
|
||||
import { getOrInsertWith, iter } from "../../../common/utils";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import { getOrInsertWith, iter } from "@k8slens/utilities";
|
||||
import diffChangedKubeconfigInjectable from "./diff-changed-kubeconfig.injectable";
|
||||
import kubeconfigSyncLoggerInjectable from "./logger.injectable";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { WeblinkStore } from "../../common/weblinks-store/weblink-store";
|
||||
import { WebLink } from "../../common/catalog-entities";
|
||||
import type { CatalogEntityRegistry } from "../catalog";
|
||||
import got from "got";
|
||||
import type { Disposer } from "../../common/utils";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import { random } from "lodash";
|
||||
|
||||
async function validateLink(link: WebLink) {
|
||||
|
||||
+2
-1
@@ -6,10 +6,11 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { reaction } from "mobx";
|
||||
import ipcMainInjectionToken from "../../common/ipc/ipc-main-injection-token";
|
||||
import { catalogInitChannel } from "../../common/ipc/catalog";
|
||||
import { disposer, toJS } from "../../common/utils";
|
||||
import { disposer } from "@k8slens/utilities";
|
||||
import { getStartableStoppable } from "../../common/utils/get-startable-stoppable";
|
||||
import catalogEntityRegistryInjectable from "../catalog/entity-registry.injectable";
|
||||
import catalogSyncBroadcasterInjectable from "./broadcaster.injectable";
|
||||
import { toJS } from "../../common/utils";
|
||||
|
||||
const catalogSyncToRendererInjectable = getInjectable({
|
||||
id: "catalog-sync-to-renderer",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { action, computed, type IComputedValue, type IObservableArray, makeObservable, observable } from "mobx";
|
||||
import type { CatalogEntity } from "../../common/catalog";
|
||||
import type { HasCategoryForEntity } from "../../common/catalog/has-category-for-entity.injectable";
|
||||
import { iter } from "../../common/utils";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
|
||||
interface Dependencies {
|
||||
readonly hasCategoryForEntity: HasCategoryForEntity;
|
||||
|
||||
@@ -8,7 +8,7 @@ import { groupBy, reduce } from "lodash";
|
||||
import { filter, map } from "lodash/fp";
|
||||
import type { ClusterMetadata } from "../../common/cluster-types";
|
||||
import type { Cluster } from "../../common/cluster/cluster";
|
||||
import { hasDefinedTupleValue, isDefined, object } from "../../common/utils";
|
||||
import { hasDefinedTupleValue, isDefined, object } from "@k8slens/utilities";
|
||||
import type { ClusterDetectionResult, ClusterMetadataDetector } from "./token";
|
||||
import { clusterMetadataDetectorInjectionToken } from "./token";
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ import { clusterListNamespaceForbiddenChannel } from "../../common/ipc/cluster";
|
||||
import type { Logger } from "../../common/logger";
|
||||
import type { KubeApiResource } from "../../common/rbac";
|
||||
import { formatKubeApiResource } from "../../common/rbac";
|
||||
import { disposer, isDefined, isRequestError } from "../../common/utils";
|
||||
import { withConcurrencyLimit } from "../../common/utils/with-concurrency-limit";
|
||||
import { disposer, isDefined, isRequestError, withConcurrencyLimit } from "@k8slens/utilities";
|
||||
import type { ClusterPrometheusHandler } from "./prometheus-handler/prometheus-handler";
|
||||
import type { BroadcastConnectionUpdate } from "./broadcast-connection-update.injectable";
|
||||
import type { KubeAuthProxyServer } from "./kube-auth-proxy-server.injectable";
|
||||
|
||||
@@ -7,7 +7,7 @@ import "../../common/ipc/cluster";
|
||||
import type { IObservableValue, ObservableSet } from "mobx";
|
||||
import { action, makeObservable, observe, reaction, toJS } from "mobx";
|
||||
import type { Cluster } from "../../common/cluster/cluster";
|
||||
import { isErrnoException } from "../../common/utils";
|
||||
import { isErrnoException } from "@k8slens/utilities";
|
||||
import { isKubernetesCluster, KubernetesCluster, LensKubernetesClusterStatus } from "../../common/catalog-entities/kubernetes-cluster";
|
||||
import { ipcMainOn } from "../../common/ipc";
|
||||
import { once } from "lodash";
|
||||
|
||||
@@ -8,7 +8,7 @@ import loggerInjectable from "../../common/logger.injectable";
|
||||
import type { KubeApiResource } from "../../common/rbac";
|
||||
import type { Cluster } from "../../common/cluster/cluster";
|
||||
import { requestApiVersionsInjectionToken } from "./request-api-versions";
|
||||
import { withConcurrencyLimit } from "../../common/utils/with-concurrency-limit";
|
||||
import { withConcurrencyLimit } from "@k8slens/utilities/src/with-concurrency-limit";
|
||||
import requestKubeApiResourcesForInjectable from "./request-kube-api-resources-for.injectable";
|
||||
import type { AsyncResult } from "../../common/utils/async-result";
|
||||
import { backoffCaller } from "../../common/utils/backoff-caller";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import type { V1APIGroupList } from "@kubernetes/client-node";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { chain } from "../../common/utils/iter";
|
||||
import { chain } from "@k8slens/utilities/src/iter";
|
||||
import k8sRequestInjectable from "../k8s-request.injectable";
|
||||
import { requestApiVersionsInjectionToken } from "./request-api-versions";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { clusterStoreMigrationInjectionToken } from "../../../common/cluster-sto
|
||||
import type { ClusterModel } from "../../../common/cluster-types";
|
||||
import readJsonSyncInjectable from "../../../common/fs/read-json-sync.injectable";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
import { isErrnoException } from "../../../common/utils";
|
||||
import { isErrnoException } from "@k8slens/utilities";
|
||||
|
||||
interface Pre500WorkspaceStoreModel {
|
||||
workspaces: {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import type { ClusterModel, ClusterPreferences, ClusterPrometheusPreferences } from "../../../common/cluster-types";
|
||||
import { moveSync, removeSync } from "fs-extra";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import { isDefined } from "../../../common/utils";
|
||||
import { isDefined } from "@k8slens/utilities";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import { getGlobalOverrideForFunction } from "../../../common/test-utils/get-global-override-for-function";
|
||||
import { getGlobalOverrideForFunction } from "../../../../../utility-features/test-utils/src/get-global-override-for-function";
|
||||
import showOpenDialogInjectable from "./show-open-dialog.injectable";
|
||||
|
||||
export default getGlobalOverrideForFunction(showOpenDialogInjectable);
|
||||
@@ -6,7 +6,7 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { Cluster } from "../common/cluster/cluster";
|
||||
import { FormData } from "@k8slens/node-fetch";
|
||||
import type { RequestMetricsParams } from "../common/k8s-api/endpoints/metrics.api/request-metrics.injectable";
|
||||
import { object } from "../common/utils";
|
||||
import { object } from "@k8slens/utilities";
|
||||
import k8sRequestInjectable from "./k8s-request.injectable";
|
||||
|
||||
export type GetMetrics = (cluster: Cluster, prometheusPath: string, queryParams: RequestMetricsParams & { query: string }) => Promise<unknown>;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
import listHelmChartsInjectable from "../helm-service/list-helm-charts.injectable";
|
||||
import getActiveHelmRepositoriesInjectable from "../repositories/get-active-helm-repositories/get-active-helm-repositories.injectable";
|
||||
import type { AsyncResult } from "../../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
import type { HelmRepo } from "../../../common/helm/helm-repo";
|
||||
import { sortBySemverVersion } from "../../../common/utils";
|
||||
import { sortBySemverVersion } from "@k8slens/utilities";
|
||||
import helmChartManagerInjectable from "../helm-chart-manager.injectable";
|
||||
|
||||
describe("Helm Service tests", () => {
|
||||
let listHelmCharts: () => Promise<any>;
|
||||
let getActiveHelmRepositoriesMock: jest.Mock<Promise<AsyncResult<HelmRepo[]>>>;
|
||||
let getActiveHelmRepositoriesMock: jest.Mock<AsyncResult<HelmRepo[]>>;
|
||||
|
||||
beforeEach(() => {
|
||||
const di = getDiForUnitTesting();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import * as yaml from "js-yaml";
|
||||
import { iter, put, sortBySemverVersion } from "../../common/utils";
|
||||
import { iter, put, sortBySemverVersion } from "@k8slens/utilities";
|
||||
import type { HelmRepo } from "../../common/helm/helm-repo";
|
||||
import type { HelmChartManagerCache } from "./helm-chart-manager-cache.injectable";
|
||||
import type { Logger } from "../../common/logger";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { JsonObject } from "type-fest";
|
||||
import { json } from "../../../../../common/utils";
|
||||
import { json } from "@k8slens/utilities";
|
||||
import yaml from "js-yaml";
|
||||
import execFileWithInputInjectable from "./exec-file-with-input/exec-file-with-input.injectable";
|
||||
import { getErrorMessage } from "../../../../../common/utils/get-error-message";
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { AsyncResult } from "../../../../../../common/utils/async-result";
|
||||
import nonPromiseExecFileInjectable from "./non-promise-exec-file.injectable";
|
||||
import { isNumber } from "../../../../../../common/utils";
|
||||
import { isNumber } from "@k8slens/utilities";
|
||||
import assert from "assert";
|
||||
import type { ChildProcess } from "child_process";
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { Cluster } from "../../../common/cluster/cluster";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
import { isObject, json } from "../../../common/utils";
|
||||
import kubeconfigManagerInjectable from "../../kubeconfig-manager/kubeconfig-manager.injectable";
|
||||
import { isObject, json } from "@k8slens/utilities";
|
||||
import execHelmInjectable from "../exec-helm/exec-helm.injectable";
|
||||
import getHelmReleaseResourcesInjectable from "./get-helm-release-resources/get-helm-release-resources.injectable";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import assert from "assert";
|
||||
import { object } from "../../../common/utils";
|
||||
import { object } from "@k8slens/utilities";
|
||||
import getActiveHelmRepositoriesInjectable from "../repositories/get-active-helm-repositories/get-active-helm-repositories.injectable";
|
||||
import type { HelmRepo } from "../../../common/helm/helm-repo";
|
||||
import helmChartManagerInjectable from "../helm-chart-manager.injectable";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import execHelmInjectable from "./exec-helm/exec-helm.injectable";
|
||||
import { isObject, json, toCamelCase } from "../../common/utils";
|
||||
import { toCamelCase, isObject } from "@k8slens/utilities";
|
||||
|
||||
export type ListHelmReleases = (pathToKubeconfig: string, namespace?: string) => Promise<Record<string, any>[]>;
|
||||
|
||||
@@ -34,7 +34,7 @@ const listHelmReleasesInjectable = getInjectable({
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
const output = json.parse(result.response);
|
||||
const output = JSON.parse(result.response);
|
||||
|
||||
if (!Array.isArray(output) || output.length == 0) {
|
||||
return [];
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import readYamlFileInjectable from "../../../../common/fs/read-yaml-file.injecta
|
||||
import getHelmEnvInjectable from "../../get-helm-env/get-helm-env.injectable";
|
||||
import execHelmInjectable from "../../exec-helm/exec-helm.injectable";
|
||||
import loggerInjectable from "../../../../common/logger.injectable";
|
||||
import type { AsyncResult } from "../../../../common/utils/async-result";
|
||||
import type { AsyncResult } from "@k8slens/utilities";
|
||||
|
||||
interface HelmRepositoryFromYaml {
|
||||
name: string;
|
||||
@@ -38,7 +38,7 @@ const getActiveHelmRepositoriesInjectable = getInjectable({
|
||||
|
||||
const getRepositories = getRepositoriesFor(readYamlFile);
|
||||
|
||||
return async (): Promise<AsyncResult<HelmRepo[]>> => {
|
||||
return async (): AsyncResult<HelmRepo[]> => {
|
||||
const envResult = await getHelmEnv();
|
||||
|
||||
if (!envResult.callWasSuccessful) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { defaultHotbarCells, getEmptyHotbar } from "../../../common/hotbars/type
|
||||
import { getLegacyGlobalDiForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import catalogCatalogEntityInjectable from "../../../common/catalog-entities/general-catalog-entities/implementations/catalog-catalog-entity.injectable";
|
||||
import { isDefined, isErrnoException } from "../../../common/utils";
|
||||
import { isDefined, isErrnoException } from "@k8slens/utilities";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { hotbarStoreMigrationInjectionToken } from "../../../common/hotbars/migrations-token";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { KubeConfig } from "@kubernetes/client-node";
|
||||
import { dumpConfigYaml } from "../../common/kube-helpers";
|
||||
import { isErrnoException } from "../../common/utils";
|
||||
import { isErrnoException } from "@k8slens/utilities";
|
||||
import type { PartialDeep } from "type-fest";
|
||||
import type { Logger } from "../../common/logger";
|
||||
import type { JoinPaths } from "../../common/path/join-paths.injectable";
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import fs from "fs";
|
||||
import { promiseExecFile } from "../../common/utils/promise-exec";
|
||||
import { ensureDir, pathExists } from "fs-extra";
|
||||
import * as lockFile from "proper-lockfile";
|
||||
import { SemVer, coerce } from "semver";
|
||||
@@ -18,6 +17,9 @@ import type { GetDirnameOfPath } from "../../common/path/get-dirname.injectable"
|
||||
import type { GetBasenameOfPath } from "../../common/path/get-basename.injectable";
|
||||
import type { NormalizedPlatform } from "../../common/vars/normalized-platform.injectable";
|
||||
import type { Logger } from "../../common/logger";
|
||||
import type { ExecFile } from "../../common/fs/exec-file.injectable";
|
||||
import { hasTypedProperty, isObject, isString, json } from "@k8slens/utilities";
|
||||
import type { Unlink } from "../../common/fs/unlink.injectable";
|
||||
|
||||
const initScriptVersionString = "# lens-initscript v3";
|
||||
|
||||
@@ -40,6 +42,8 @@ export interface KubectlDependencies {
|
||||
joinPaths: JoinPaths;
|
||||
getDirnameOfPath: GetDirnameOfPath;
|
||||
getBasenameOfPath: GetBasenameOfPath;
|
||||
execFile: ExecFile;
|
||||
unlink: Unlink;
|
||||
}
|
||||
|
||||
export class Kubectl {
|
||||
@@ -145,38 +149,64 @@ export class Kubectl {
|
||||
public async checkBinary(path: string, checkVersion = true) {
|
||||
const exists = await pathExists(path);
|
||||
|
||||
if (exists) {
|
||||
try {
|
||||
const args = [
|
||||
"version",
|
||||
"--client",
|
||||
"--output", "json",
|
||||
];
|
||||
const { stdout } = await promiseExecFile(path, args);
|
||||
const output = JSON.parse(stdout);
|
||||
|
||||
if (!checkVersion) {
|
||||
return true;
|
||||
}
|
||||
let version: string = output.clientVersion.gitVersion;
|
||||
|
||||
if (version[0] === "v") {
|
||||
version = version.slice(1);
|
||||
}
|
||||
|
||||
if (version === this.kubectlVersion) {
|
||||
this.dependencies.logger.debug(`Local kubectl is version ${this.kubectlVersion}`);
|
||||
|
||||
return true;
|
||||
}
|
||||
this.dependencies.logger.error(`Local kubectl is version ${version}, expected ${this.kubectlVersion}, unlinking`);
|
||||
} catch (error) {
|
||||
this.dependencies.logger.error(`Local kubectl failed to run properly (${error}), unlinking`);
|
||||
}
|
||||
await fs.promises.unlink(this.path);
|
||||
if (!exists) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
const args = [
|
||||
"version",
|
||||
"--client",
|
||||
"--output", "json",
|
||||
];
|
||||
const execResult = await this.dependencies.execFile(path, args);
|
||||
|
||||
if (!execResult.callWasSuccessful) {
|
||||
this.dependencies.logger.error(`Local kubectl failed to run properly (${execResult.error}), unlinking`);
|
||||
await this.dependencies.unlink(this.path);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const parseResult = json.parse(execResult.response);
|
||||
|
||||
if (!parseResult.callWasSuccessful) {
|
||||
this.dependencies.logger.error(`Local kubectl failed to run properly (${parseResult.error}), unlinking`);
|
||||
await this.dependencies.unlink(this.path);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkVersion) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const { response: output } = parseResult;
|
||||
|
||||
if (
|
||||
!isObject(output)
|
||||
|| !hasTypedProperty(output, "clientVersion", isObject)
|
||||
|| !hasTypedProperty(output.clientVersion, "gitVersion", isString)
|
||||
) {
|
||||
this.dependencies.logger.error(`Local kubectl failed to return correct shaped response, unlinking`);
|
||||
await this.dependencies.unlink(this.path);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const version = output.clientVersion.gitVersion;
|
||||
|
||||
switch (output.clientVersion.gitVersion) {
|
||||
case this.kubectlVersion:
|
||||
case `v${this.kubectlVersion}`:
|
||||
this.dependencies.logger.debug(`Local kubectl is version ${this.kubectlVersion}`);
|
||||
|
||||
return true;
|
||||
default:
|
||||
this.dependencies.logger.error(`Local kubectl is version ${version}, expected ${this.kubectlVersion}, unlinking`);
|
||||
await this.dependencies.unlink(this.path);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected async checkBundled(): Promise<boolean> {
|
||||
@@ -266,7 +296,7 @@ export class Kubectl {
|
||||
await fs.promises.chmod(this.path, 0o755);
|
||||
this.dependencies.logger.debug("kubectl binary download finished");
|
||||
} catch (error) {
|
||||
await fs.promises.unlink(this.path).catch(noop);
|
||||
await this.dependencies.unlink(this.path).catch(noop);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getOrInsertMap } from "../../../../common/utils";
|
||||
import { getOrInsertMap } from "@k8slens/utilities";
|
||||
import type { ClusterId } from "../../../../common/cluster-types";
|
||||
import { ipcMainHandle } from "../../../../common/ipc";
|
||||
import crypto from "crypto";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { navigateToUrlInjectionToken } from "../../common/front-end-routing/navigate-to-url-injection-token";
|
||||
import { navigateToRouteInjectionToken } from "../../common/front-end-routing/navigate-to-route-injection-token";
|
||||
import { buildURL } from "../../common/utils/buildUrl";
|
||||
import { buildURL } from "@k8slens/utilities/src/buildUrl";
|
||||
|
||||
const navigateToRouteInjectable = getInjectable({
|
||||
id: "navigate-to-route",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { CoreV1Api } from "@kubernetes/client-node";
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import { isRequestError } from "../../common/utils";
|
||||
import { isRequestError } from "@k8slens/utilities";
|
||||
|
||||
export interface PrometheusService extends PrometheusServiceInfo {
|
||||
kind: string;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as uuid from "uuid";
|
||||
|
||||
import { ProtocolHandlerExtension, ProtocolHandlerInternal, ProtocolHandlerInvalid } from "../../../common/protocol-handler";
|
||||
import { delay, noop } from "../../../common/utils";
|
||||
import { delay, noop } from "@k8slens/utilities";
|
||||
import type { ExtensionsStore, IsEnabledExtensionDescriptor } from "../../../extensions/extensions-store/extensions-store";
|
||||
import type { LensProtocolRouterMain } from "../lens-protocol-router-main/lens-protocol-router-main";
|
||||
import { getDiForUnitTesting } from "../../getDiForUnitTesting";
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import type { LensExtension } from "../../../extensions/lens-extension";
|
||||
import { observable, when, makeObservable } from "mobx";
|
||||
import type { LensProtocolRouterDependencies, RouteAttempt } from "../../../common/protocol-handler";
|
||||
import { ProtocolHandlerInvalid } from "../../../common/protocol-handler";
|
||||
import { disposer, noop } from "../../../common/utils";
|
||||
import { disposer, noop } from "@k8slens/utilities";
|
||||
import type { BroadcastMessage } from "../../../common/ipc/broadcast-message.injectable";
|
||||
|
||||
export interface FallbackHandler {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { ServerResponse } from "http";
|
||||
import loggerInjectable from "../../common/logger.injectable";
|
||||
import { object } from "../../common/utils";
|
||||
import { object } from "@k8slens/utilities";
|
||||
import type { LensApiRequest, Route } from "./route";
|
||||
import { contentTypes } from "./router-content-types";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ClusterMetadataKey } from "../../../common/cluster-types";
|
||||
import type { Cluster } from "../../../common/cluster/cluster";
|
||||
import { clusterRoute } from "../../router/route";
|
||||
import { isObject } from "lodash";
|
||||
import { isRequestError, object } from "../../../common/utils";
|
||||
import { isRequestError, object } from "@k8slens/utilities";
|
||||
import type { GetMetrics } from "../../get-metrics.injectable";
|
||||
import getMetricsInjectable from "../../get-metrics.injectable";
|
||||
import loggerInjectable from "../../../common/logger.injectable";
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import type { ClusterId } from "../../../common/cluster-types";
|
||||
import { isDefined } from "../../../common/utils";
|
||||
import { isDefined } from "@k8slens/utilities";
|
||||
import mainExtensionsInjectable from "../../../extensions/main-extensions.injectable";
|
||||
import catalogEntityRegistryInjectable from "../../catalog/entity-registry.injectable";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { clearKubeconfigEnvVars } from "../utils/clear-kube-env-vars";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import type * as pty from "node-pty";
|
||||
import { getOrInsertWith } from "../../common/utils";
|
||||
import { getOrInsertWith } from "@k8slens/utilities";
|
||||
import { type TerminalMessage, TerminalChannels } from "../../common/terminal/channels";
|
||||
import type { Logger } from "../../common/logger";
|
||||
import type { ComputeShellEnvironment } from "../../features/shell-sync/main/compute-shell-environment.injectable";
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import ipcMainInjectionToken from "../../../../common/ipc/ipc-main-injection-token";
|
||||
import { bundledExtensionsLoaded } from "../../../../common/ipc/extension-handling";
|
||||
import { delay } from "../../../../common/utils";
|
||||
import { delay } from "@k8slens/utilities";
|
||||
|
||||
const waitUntilBundledExtensionsAreLoadedInjectable = getInjectable({
|
||||
id: "wait-until-bundled-extensions-are-loaded",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { iter } from "../../../common/utils";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
import clusterFramesInjectable from "../../../common/cluster-frames.injectable";
|
||||
import showApplicationWindowInjectable from "./show-application-window.injectable";
|
||||
import getCurrentApplicationWindowInjectable from "./application-window/get-current-application-window.injectable";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { iter } from "../../../common/utils";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
import clusterFramesInjectable from "../../../common/cluster-frames.injectable";
|
||||
import { IpcRendererNavigationEvents } from "../../../common/ipc/navigation-events";
|
||||
import showApplicationWindowInjectable from "./show-application-window.injectable";
|
||||
|
||||
@@ -15,7 +15,7 @@ import { withErrorSuppression } from "../../../common/utils/with-error-suppressi
|
||||
import type { WithErrorLoggingFor } from "../../../common/utils/with-error-logging/with-error-logging.injectable";
|
||||
import withErrorLoggingInjectable from "../../../common/utils/with-error-logging/with-error-logging.injectable";
|
||||
import getRandomIdInjectable from "../../../common/utils/get-random-id.injectable";
|
||||
import { isBoolean, isString } from "../../../common/utils";
|
||||
import { isBoolean, isString } from "@k8slens/utilities";
|
||||
|
||||
const trayMenuItemRegistratorInjectable = getInjectable({
|
||||
id: "tray-menu-item-registrator",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { ClusterStoreModel } from "../../../common/cluster-store/cluster-store";
|
||||
import type { KubeconfigSyncEntry, UserPreferencesModel } from "../../../common/user-store";
|
||||
import { isErrnoException } from "../../../common/utils";
|
||||
import { isErrnoException } from "@k8slens/utilities";
|
||||
import directoryForUserDataInjectable from "../../../common/app-paths/directory-for-user-data/directory-for-user-data.injectable";
|
||||
import directoryForKubeConfigsInjectable from "../../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
|
||||
import joinPathsInjectable from "../../../common/path/join-paths.injectable";
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import type { IpcMainInvokeEvent } from "electron";
|
||||
import type { Disposer } from "../../../../common/utils";
|
||||
import type { Disposer } from "@k8slens/utilities";
|
||||
import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token";
|
||||
import type { RequestChannelListener } from "./listener-tokens";
|
||||
import ipcMainInjectionToken from "../../../../common/ipc/ipc-main-injection-token";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { disposer } from "../../../../common/utils";
|
||||
import { disposer } from "@k8slens/utilities";
|
||||
import type { RequestChannel } from "../../../../common/utils/channel/request-channel-listener-injection-token";
|
||||
import { getStartableStoppable } from "../../../../common/utils/get-startable-stoppable";
|
||||
import enlistRequestChannelListenerInjectable from "./enlist-request-channel-listener.injectable";
|
||||
|
||||
Reference in new issue
Block a user