1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Merge remote-tracking branch 'origin/master' into react-18-upgrade

This commit is contained in:
Roman 2022-04-07 12:21:53 +03:00
commit 1a83e0abb3
406 changed files with 1148 additions and 527 deletions

View File

@ -214,6 +214,7 @@ module.exports = {
"react-hooks/rules-of-hooks": "error", "react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "off", "react-hooks/exhaustive-deps": "off",
"no-template-curly-in-string": "error", "no-template-curly-in-string": "error",
"@typescript-eslint/consistent-type-imports": "error",
}, },
}, },
], ],

View File

@ -4,13 +4,15 @@
*/ */
import packageInfo from "../package.json"; import packageInfo from "../package.json";
import { type WriteStream } from "fs"; import { type WriteStream } from "fs";
import { FileHandle, open } from "fs/promises"; import type { FileHandle } from "fs/promises";
import { open } from "fs/promises";
import { constants, ensureDir, unlink } from "fs-extra"; import { constants, ensureDir, unlink } from "fs-extra";
import path from "path"; import path from "path";
import fetch from "node-fetch"; import fetch from "node-fetch";
import { promisify } from "util"; import { promisify } from "util";
import { pipeline as _pipeline, Transform, Writable } from "stream"; import { pipeline as _pipeline, Transform, Writable } from "stream";
import { MultiBar, SingleBar } from "cli-progress"; import type { SingleBar } from "cli-progress";
import { MultiBar } from "cli-progress";
import AbortController from "abort-controller"; import AbortController from "abort-controller";
import { extract } from "tar-stream"; import { extract } from "tar-stream";
import gunzip from "gunzip-maybe"; import gunzip from "gunzip-maybe";

View File

@ -4,7 +4,8 @@
*/ */
import React from "react"; import React from "react";
import { Common, Renderer } from "@k8slens/extensions"; import type { Common } from "@k8slens/extensions";
import { Renderer } from "@k8slens/extensions";
import { MetricsSettings } from "./src/metrics-settings"; import { MetricsSettings } from "./src/metrics-settings";
export default class ClusterMetricsFeatureExtension extends Renderer.LensExtension { export default class ClusterMetricsFeatureExtension extends Renderer.LensExtension {

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { Renderer, Common } from "@k8slens/extensions"; import type { Common } from "@k8slens/extensions";
import { Renderer } from "@k8slens/extensions";
import semver from "semver"; import semver from "semver";
import * as path from "path"; import * as path from "path";

View File

@ -3,10 +3,12 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import React from "react"; import React from "react";
import { Common, Renderer } from "@k8slens/extensions"; import type { Common } from "@k8slens/extensions";
import { Renderer } from "@k8slens/extensions";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { computed, observable, makeObservable } from "mobx"; import { computed, observable, makeObservable } from "mobx";
import { MetricsFeature, MetricsConfiguration } from "./metrics-feature"; import type { MetricsConfiguration } from "./metrics-feature";
import { MetricsFeature } from "./metrics-feature";
const { const {
K8sApi: { K8sApi: {

View File

@ -5,7 +5,8 @@
import { Renderer } from "@k8slens/extensions"; import { Renderer } from "@k8slens/extensions";
import React from "react"; import React from "react";
import { NodeMenu, NodeMenuProps } from "./src/node-menu"; import type { NodeMenuProps } from "./src/node-menu";
import { NodeMenu } from "./src/node-menu";
export default class NodeMenuRendererExtension extends Renderer.LensExtension { export default class NodeMenuRendererExtension extends Renderer.LensExtension {
kubeObjectMenuItems = [ kubeObjectMenuItems = [

View File

@ -4,9 +4,12 @@
*/ */
import { Renderer } from "@k8slens/extensions"; import { Renderer } from "@k8slens/extensions";
import { PodAttachMenu, PodAttachMenuProps } from "./src/attach-menu"; import type { PodAttachMenuProps } from "./src/attach-menu";
import { PodShellMenu, PodShellMenuProps } from "./src/shell-menu"; import { PodAttachMenu } from "./src/attach-menu";
import { PodLogsMenu, PodLogsMenuProps } from "./src/logs-menu"; import type { PodShellMenuProps } from "./src/shell-menu";
import { PodShellMenu } from "./src/shell-menu";
import type { PodLogsMenuProps } from "./src/logs-menu";
import { PodLogsMenu } from "./src/logs-menu";
import React from "react"; import React from "react";
export default class PodMenuRendererExtension extends Renderer.LensExtension { export default class PodMenuRendererExtension extends Renderer.LensExtension {

View File

@ -7,7 +7,8 @@ import { mkdirp, remove } from "fs-extra";
import * as os from "os"; import * as os from "os";
import * as path from "path"; import * as path from "path";
import * as uuid from "uuid"; import * as uuid from "uuid";
import { ElectronApplication, Frame, Page, _electron as electron } from "playwright"; import type { ElectronApplication, Frame, Page } from "playwright";
import { _electron as electron } from "playwright";
import { noop } from "lodash"; import { noop } from "lodash";
export const appPaths: Partial<Record<NodeJS.Platform, string>> = { export const appPaths: Partial<Record<NodeJS.Platform, string>> = {

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { CatalogCategory, CatalogCategoryRegistry, CatalogCategorySpec } from "../catalog"; import type { CatalogCategorySpec } from "../catalog";
import { CatalogCategory, CatalogCategoryRegistry } from "../catalog";
class TestCatalogCategoryRegistry extends CatalogCategoryRegistry { } class TestCatalogCategoryRegistry extends CatalogCategoryRegistry { }

View File

@ -4,7 +4,8 @@
*/ */
import React from "react"; import React from "react";
import { CatalogCategory, CatalogCategorySpec } from "../catalog"; import { CatalogCategory } from "../catalog";
import type { CatalogCategorySpec } from "../catalog";
class TestCatalogCategoryWithoutBadge extends CatalogCategory { class TestCatalogCategoryWithoutBadge extends CatalogCategory {
public readonly apiVersion = "catalog.k8slens.dev/v1alpha1"; public readonly apiVersion = "catalog.k8slens.dev/v1alpha1";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { appEventBus, AppEvent } from "../app-event-bus/event-bus"; import type { AppEvent } from "../app-event-bus/event-bus";
import { appEventBus } from "../app-event-bus/event-bus";
import { Console } from "console"; import { Console } from "console";
import { stdout, stderr } from "process"; import { stdout, stderr } from "process";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import type { DiContainer } from "@ogre-tools/injectable"; import type { DiContainer } from "@ogre-tools/injectable";
import { AppPaths, appPathsInjectionToken } from "./app-path-injection-token"; import type { AppPaths } from "./app-path-injection-token";
import { appPathsInjectionToken } from "./app-path-injection-token";
import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable"; import getElectronAppPathInjectable from "../../main/app-paths/get-electron-app-path/get-electron-app-path.injectable";
import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing"; import { getDisForUnitTesting } from "../../test-utils/get-dis-for-unit-testing";
import type { PathName } from "./app-path-names"; import type { PathName } from "./app-path-names";

View File

@ -7,8 +7,10 @@ import path from "path";
import type Config from "conf"; import type Config from "conf";
import type { Options as ConfOptions } from "conf/dist/source/types"; import type { Options as ConfOptions } from "conf/dist/source/types";
import { ipcMain, ipcRenderer } from "electron"; import { ipcMain, ipcRenderer } from "electron";
import { IEqualsComparer, makeObservable, reaction, runInAction } from "mobx"; import type { IEqualsComparer } from "mobx";
import { getAppVersion, Singleton, toJS, Disposer } from "./utils"; import { makeObservable, reaction, runInAction } from "mobx";
import type { Disposer } from "./utils";
import { getAppVersion, Singleton, toJS } from "./utils";
import logger from "../main/logger"; import logger from "../main/logger";
import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc"; import { broadcastMessage, ipcMainOn, ipcRendererOn } from "./ipc";
import isEqual from "lodash/isEqual"; import isEqual from "lodash/isEqual";

View File

@ -4,7 +4,8 @@
*/ */
import { navigate } from "../../renderer/navigation"; import { navigate } from "../../renderer/navigation";
import { CatalogCategory, CatalogEntity, CatalogEntityMetadata, CatalogEntitySpec, CatalogEntityStatus } from "../catalog"; import type { CatalogEntityMetadata, CatalogEntitySpec, CatalogEntityStatus } from "../catalog";
import { CatalogCategory, CatalogEntity } from "../catalog";
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry"; import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
interface GeneralEntitySpec extends CatalogEntitySpec { interface GeneralEntitySpec extends CatalogEntitySpec {

View File

@ -4,7 +4,8 @@
*/ */
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry"; import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
import { CatalogEntity, CatalogEntityActionContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus, CatalogCategory, CatalogCategorySpec } from "../catalog"; import type { CatalogEntityActionContext, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus, CatalogCategorySpec } from "../catalog";
import { CatalogEntity, CatalogCategory } from "../catalog";
import { ClusterStore } from "../cluster-store/cluster-store"; import { ClusterStore } from "../cluster-store/cluster-store";
import { broadcastMessage } from "../ipc"; import { broadcastMessage } from "../ipc";
import { app } from "electron"; import { app } from "electron";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { CatalogCategory, CatalogEntity, CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog"; import type { CatalogEntityContextMenuContext, CatalogEntityMetadata, CatalogEntityStatus } from "../catalog";
import { CatalogCategory, CatalogEntity } from "../catalog";
import { catalogCategoryRegistry } from "../catalog/catalog-category-registry"; import { catalogCategoryRegistry } from "../catalog/catalog-category-registry";
import { productName } from "../vars"; import { productName } from "../vars";
import { WeblinkStore } from "../weblink-store"; import { WeblinkStore } from "../weblink-store";

View File

@ -7,7 +7,7 @@ import { action, computed, observable, makeObservable } from "mobx";
import { once } from "lodash"; import { once } from "lodash";
import { iter, getOrInsertMap, strictSet } from "../utils"; import { iter, getOrInsertMap, strictSet } from "../utils";
import type { Disposer } from "../utils"; import type { Disposer } from "../utils";
import { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity"; import type { CatalogCategory, CatalogEntityData, CatalogEntityKindData } from "./catalog-entity";
export type CategoryFilter = (category: CatalogCategory) => any; export type CategoryFilter = (category: CatalogCategory) => any;

View File

@ -7,7 +7,8 @@ import EventEmitter from "events";
import type TypedEmitter from "typed-emitter"; import type TypedEmitter from "typed-emitter";
import { observable, makeObservable } from "mobx"; import { observable, makeObservable } from "mobx";
import { once } from "lodash"; import { once } from "lodash";
import { iter, Disposer } from "../utils"; import type { Disposer } from "../utils";
import { iter } from "../utils";
import type { CategoryColumnRegistration } from "../../renderer/components/+catalog/custom-category-columns"; import type { CategoryColumnRegistration } from "../../renderer/components/+catalog/custom-category-columns";
type ExtractEntityMetadataType<Entity> = Entity extends CatalogEntity<infer Metadata> ? Metadata : never; type ExtractEntityMetadataType<Entity> = Entity extends CatalogEntity<infer Metadata> ? Metadata : never;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { AuthorizationV1Api, KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node"; import type { KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
import { AuthorizationV1Api } from "@kubernetes/client-node";
import logger from "../logger"; import logger from "../logger";
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";

View File

@ -7,11 +7,13 @@ import { ipcMain } from "electron";
import { action, comparer, computed, makeObservable, observable, reaction, when } from "mobx"; import { action, comparer, computed, makeObservable, observable, reaction, when } from "mobx";
import { broadcastMessage } from "../ipc"; import { broadcastMessage } from "../ipc";
import type { ContextHandler } from "../../main/context-handler/context-handler"; import type { ContextHandler } from "../../main/context-handler/context-handler";
import { HttpError, KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { HttpError } from "@kubernetes/client-node";
import type { Kubectl } from "../../main/kubectl/kubectl"; import type { Kubectl } from "../../main/kubectl/kubectl";
import type { KubeconfigManager } from "../../main/kubeconfig-manager/kubeconfig-manager"; import type { KubeconfigManager } from "../../main/kubeconfig-manager/kubeconfig-manager";
import { loadConfigFromFile, loadConfigFromFileSync, validateKubeConfig } from "../kube-helpers"; import { loadConfigFromFile, loadConfigFromFileSync, validateKubeConfig } from "../kube-helpers";
import { apiResourceRecord, apiResources, KubeApiResource, KubeResource } from "../rbac"; import type { KubeApiResource, KubeResource } from "../rbac";
import { apiResourceRecord, apiResources } from "../rbac";
import logger from "../../main/logger"; import logger from "../../main/logger";
import { VersionDetector } from "../../main/cluster-detectors/version-detector"; import { VersionDetector } from "../../main/cluster-detectors/version-detector";
import { DetectorRegistry } from "../../main/cluster-detectors/detector-registry"; import { DetectorRegistry } from "../../main/cluster-detectors/detector-registry";

View File

@ -2,7 +2,8 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { CoreV1Api, KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { CoreV1Api } from "@kubernetes/client-node";
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
export type ListNamespaces = () => Promise<string[]>; export type ListNamespaces = () => Promise<string[]>;

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../route-injection-token"; import type { Route } from "../../route-injection-token";
import { routeInjectionToken } from "../../route-injection-token";
export interface CatalogPathParameters { export interface CatalogPathParameters {
group?: string; group?: string;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import catalogRouteInjectable, { CatalogPathParameters } from "./catalog-route.injectable"; import type { CatalogPathParameters } from "./catalog-route.injectable";
import catalogRouteInjectable from "./catalog-route.injectable";
import { navigateToRouteInjectionToken } from "../../navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../navigate-to-route-injection-token";
export type NavigateToCatalog = (parameters?: CatalogPathParameters) => void; export type NavigateToCatalog = (parameters?: CatalogPathParameters) => void;

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../../../route-injection-token"; import type { Route } from "../../../../route-injection-token";
import { routeInjectionToken } from "../../../../route-injection-token";
export interface CustomResourcesPathParameters { export interface CustomResourcesPathParameters {
group?: string; group?: string;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import customResourcesRouteInjectable, { CustomResourcesPathParameters } from "./custom-resources-route.injectable"; import type { CustomResourcesPathParameters } from "./custom-resources-route.injectable";
import customResourcesRouteInjectable from "./custom-resources-route.injectable";
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
const navigateToCustomResourcesInjectable = getInjectable({ const navigateToCustomResourcesInjectable = getInjectable({

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../../../route-injection-token"; import type { Route } from "../../../../route-injection-token";
import { routeInjectionToken } from "../../../../route-injection-token";
export interface HelmChartsPathParameters { export interface HelmChartsPathParameters {
repo?: string; repo?: string;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import helmChartsRouteInjectable, { HelmChartsPathParameters } from "./helm-charts-route.injectable"; import type { HelmChartsPathParameters } from "./helm-charts-route.injectable";
import helmChartsRouteInjectable from "./helm-charts-route.injectable";
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
export type NavigateToHelmCharts = (parameters?: HelmChartsPathParameters) => void; export type NavigateToHelmCharts = (parameters?: HelmChartsPathParameters) => void;

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../../../route-injection-token"; import type { Route } from "../../../../route-injection-token";
import { routeInjectionToken } from "../../../../route-injection-token";
export interface HelmReleasesPathParameters { export interface HelmReleasesPathParameters {
namespace?: string; namespace?: string;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import helmReleasesRouteInjectable, { HelmReleasesPathParameters } from "./helm-releases-route.injectable"; import type { HelmReleasesPathParameters } from "./helm-releases-route.injectable";
import helmReleasesRouteInjectable from "./helm-releases-route.injectable";
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
export type NavigateToHelmReleases = (parameters?: HelmReleasesPathParameters) => void; export type NavigateToHelmReleases = (parameters?: HelmReleasesPathParameters) => void;

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import portForwardsRouteInjectable, { PortForwardsPathParameters } from "./port-forwards-route.injectable"; import type { PortForwardsPathParameters } from "./port-forwards-route.injectable";
import portForwardsRouteInjectable from "./port-forwards-route.injectable";
import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token"; import { navigateToRouteInjectionToken } from "../../../../navigate-to-route-injection-token";
export type NavigateToPortForwards = (parameters?: PortForwardsPathParameters) => void; export type NavigateToPortForwards = (parameters?: PortForwardsPathParameters) => void;

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../../../route-injection-token"; import type { Route } from "../../../../route-injection-token";
import { routeInjectionToken } from "../../../../route-injection-token";
export interface PortForwardsPathParameters { export interface PortForwardsPathParameters {
forwardport?: string; forwardport?: string;

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx"; import { computed } from "mobx";
import { Route, routeInjectionToken } from "../../route-injection-token"; import type { Route } from "../../route-injection-token";
import { routeInjectionToken } from "../../route-injection-token";
export interface EntitySettingsPathParameters { export interface EntitySettingsPathParameters {
entityId: string; entityId: string;

View File

@ -7,15 +7,16 @@ import { action, comparer, observable, makeObservable, computed } from "mobx";
import { BaseStore } from "./base-store"; import { BaseStore } from "./base-store";
import migrations from "../migrations/hotbar-store"; import migrations from "../migrations/hotbar-store";
import { toJS } from "./utils"; import { toJS } from "./utils";
import { CatalogEntity } from "./catalog"; import type { CatalogEntity } from "./catalog";
import logger from "../main/logger"; import logger from "../main/logger";
import { broadcastMessage } from "./ipc"; import { broadcastMessage } from "./ipc";
import type {
Hotbar,
CreateHotbarData,
CreateHotbarOptions } from "./hotbar-types";
import { import {
defaultHotbarCells, defaultHotbarCells,
getEmptyHotbar, getEmptyHotbar,
Hotbar,
CreateHotbarData,
CreateHotbarOptions,
} from "./hotbar-types"; } from "./hotbar-types";
import { hotbarTooManyItemsChannel } from "./ipc/hotbar"; import { hotbarTooManyItemsChannel } from "./ipc/hotbar";
import type { GeneralEntity } from "./catalog-entities"; import type { GeneralEntity } from "./catalog-entities";

View File

@ -4,7 +4,8 @@
*/ */
import * as uuid from "uuid"; import * as uuid from "uuid";
import { tuple, Tuple } from "./utils"; import type { Tuple } from "./utils";
import { tuple } from "./utils";
export interface HotbarItem { export interface HotbarItem {
entity: { entity: {

View File

@ -10,7 +10,8 @@
import { ipcMain, ipcRenderer, webContents } from "electron"; import { ipcMain, ipcRenderer, webContents } from "electron";
import { toJS } from "../utils/toJS"; import { toJS } from "../utils/toJS";
import logger from "../../main/logger"; import logger from "../../main/logger";
import { ClusterFrameInfo, clusterFrameMap } from "../cluster-frames"; import type { ClusterFrameInfo } from "../cluster-frames";
import { clusterFrameMap } from "../cluster-frames";
import type { Disposer } from "../utils"; import type { Disposer } from "../utils";
export const broadcastMainChannel = "ipc:broadcast-main"; export const broadcastMainChannel = "ipc:broadcast-main";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { CustomResourceDefinition, CustomResourceDefinitionSpec } from "../endpoints"; import type { CustomResourceDefinitionSpec } from "../endpoints";
import { CustomResourceDefinition } from "../endpoints";
describe("Crds", () => { describe("Crds", () => {
describe("getVersion()", () => { describe("getVersion()", () => {

View File

@ -13,7 +13,8 @@ jest.mock("../api-manager", () => ({
}, },
})); }));
import { IKubeApiParsed, parseKubeApi } from "../kube-api-parse"; import type { IKubeApiParsed } from "../kube-api-parse";
import { parseKubeApi } from "../kube-api-parse";
/** /**
* [<input-url>, <expected-result>] * [<input-url>, <expected-result>]

View File

@ -10,7 +10,8 @@ import { KubeObject } from "../kube-object";
import AbortController from "abort-controller"; import AbortController from "abort-controller";
import { delay } from "../../utils/delay"; import { delay } from "../../utils/delay";
import { PassThrough } from "stream"; import { PassThrough } from "stream";
import { ApiManager, apiManager } from "../api-manager"; import type { ApiManager } from "../api-manager";
import { apiManager } from "../api-manager";
import { Ingress, Pod } from "../endpoints"; import { Ingress, Pod } from "../endpoints";
jest.mock("../api-manager"); jest.mock("../api-manager");

View File

@ -9,7 +9,8 @@ import { action, observable, makeObservable } from "mobx";
import { autoBind, iter } from "../utils"; import { autoBind, iter } from "../utils";
import type { KubeApi } from "./kube-api"; import type { KubeApi } from "./kube-api";
import type { KubeObject } from "./kube-object"; import type { KubeObject } from "./kube-object";
import { IKubeObjectRef, parseKubeApi, createKubeApiURL } from "./kube-api-parse"; import type { IKubeObjectRef } from "./kube-api-parse";
import { parseKubeApi, createKubeApiURL } from "./kube-api-parse";
export class ApiManager { export class ApiManager {
private apis = observable.map<string, KubeApi<KubeObject>>(); private apis = observable.map<string, KubeApi<KubeObject>>();

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { IMetrics, IMetricsReqParams, metricsApi } from "./metrics.api"; import type { IMetrics, IMetricsReqParams } from "./metrics.api";
import { metricsApi } from "./metrics.api";
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";

View File

@ -4,7 +4,8 @@
*/ */
import get from "lodash/get"; import get from "lodash/get";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import type { IAffinity } from "../workload-kube-object";
import { WorkloadKubeObject } from "../workload-kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { metricsApi } from "./metrics.api"; import { metricsApi } from "./metrics.api";

View File

@ -5,7 +5,8 @@
import moment from "moment"; import moment from "moment";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import type { IAffinity } from "../workload-kube-object";
import { WorkloadKubeObject } from "../workload-kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { metricsApi } from "./metrics.api"; import { metricsApi } from "./metrics.api";

View File

@ -3,9 +3,11 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { KubeObject, TypedLocalObjectReference } from "../kube-object"; import type { TypedLocalObjectReference } from "../kube-object";
import { KubeObject } from "../kube-object";
import { autoBind, hasTypedProperty, isString, iter } from "../../utils"; import { autoBind, hasTypedProperty, isString, iter } from "../../utils";
import { IMetrics, metricsApi } from "./metrics.api"; import type { IMetrics } from "./metrics.api";
import { metricsApi } from "./metrics.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";

View File

@ -5,7 +5,8 @@
import get from "lodash/get"; import get from "lodash/get";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import type { IAffinity } from "../workload-kube-object";
import { WorkloadKubeObject } from "../workload-kube-object";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { metricsApi } from "./metrics.api"; import { metricsApi } from "./metrics.api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { KubeObject, LabelSelector } from "../kube-object"; import type { LabelSelector } from "../kube-object";
import { KubeObject } from "../kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";

View File

@ -5,7 +5,8 @@
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { autoBind, cpuUnitsToNumber, iter, unitsToBytes } from "../../../renderer/utils"; import { autoBind, cpuUnitsToNumber, iter, unitsToBytes } from "../../../renderer/utils";
import { IMetrics, metricsApi } from "./metrics.api"; import type { IMetrics } from "./metrics.api";
import { metricsApi } from "./metrics.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";

View File

@ -3,9 +3,11 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { KubeObject, LabelSelector } from "../kube-object"; import type { LabelSelector } from "../kube-object";
import { KubeObject } from "../kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { IMetrics, metricsApi } from "./metrics.api"; import type { IMetrics } from "./metrics.api";
import { metricsApi } from "./metrics.api";
import type { Pod } from "./pods.api"; import type { Pod } from "./pods.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";

View File

@ -4,7 +4,8 @@
*/ */
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { KubeObject, LabelSelector } from "../kube-object"; import type { LabelSelector } from "../kube-object";
import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";

View File

@ -3,9 +3,11 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import type { IAffinity } from "../workload-kube-object";
import { WorkloadKubeObject } from "../workload-kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { IMetrics, metricsApi } from "./metrics.api"; import type { IMetrics } from "./metrics.api";
import { metricsApi } from "./metrics.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import type { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { isClusterPageContext } from "../../utils/cluster-id-url-parsing"; import { isClusterPageContext } from "../../utils/cluster-id-url-parsing";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import type { IAffinity } from "../workload-kube-object";
import { WorkloadKubeObject } from "../workload-kube-object";
import { autoBind } from "../../utils"; import { autoBind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { metricsApi } from "./metrics.api"; import { metricsApi } from "./metrics.api";

View File

@ -8,7 +8,8 @@
import { Agent as HttpAgent } from "http"; import { Agent as HttpAgent } from "http";
import { Agent as HttpsAgent } from "https"; import { Agent as HttpsAgent } from "https";
import { merge } from "lodash"; import { merge } from "lodash";
import fetch, { Response, RequestInit } from "node-fetch"; import type { Response, RequestInit } from "node-fetch";
import fetch from "node-fetch";
import { stringify } from "querystring"; import { stringify } from "querystring";
import { EventEmitter } from "../../common/event-emitter"; import { EventEmitter } from "../../common/event-emitter";
import logger from "../../common/logger"; import logger from "../../common/logger";

View File

@ -12,14 +12,17 @@ import logger from "../../main/logger";
import { apiManager } from "./api-manager"; import { apiManager } from "./api-manager";
import { apiBase, apiKube } from "./index"; import { apiBase, apiKube } from "./index";
import { createKubeApiURL, parseKubeApi } from "./kube-api-parse"; import { createKubeApiURL, parseKubeApi } from "./kube-api-parse";
import { KubeObjectConstructor, KubeObject, KubeStatus } from "./kube-object"; import type { KubeObjectConstructor } from "./kube-object";
import { KubeObject, KubeStatus } from "./kube-object";
import byline from "byline"; import byline from "byline";
import type { IKubeWatchEvent } from "./kube-watch-event"; import type { IKubeWatchEvent } from "./kube-watch-event";
import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api"; import type { KubeJsonApiData } from "./kube-json-api";
import { KubeJsonApi } from "./kube-json-api";
import { noop, WrappedAbortController } from "../utils"; import { noop, WrappedAbortController } from "../utils";
import type { RequestInit } from "node-fetch"; import type { RequestInit } from "node-fetch";
import type AbortController from "abort-controller"; import type AbortController from "abort-controller";
import { Agent, AgentOptions } from "https"; import type { AgentOptions } from "https";
import { Agent } from "https";
import type { Patch } from "rfc6902"; import type { Patch } from "rfc6902";
/** /**

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { JsonApi, JsonApiData, JsonApiError } from "./json-api"; import type { JsonApiData, JsonApiError } from "./json-api";
import { JsonApi } from "./json-api";
import type { Response } from "node-fetch"; import type { Response } from "node-fetch";
import { apiKubePrefix, isDebugging } from "../vars"; import { apiKubePrefix, isDebugging } from "../vars";
import { apiBase } from "./api-base"; import { apiBase } from "./api-base";

View File

@ -6,11 +6,14 @@
import type { ClusterContext } from "./cluster-context"; import type { ClusterContext } from "./cluster-context";
import { action, computed, makeObservable, observable, reaction, when } from "mobx"; import { action, computed, makeObservable, observable, reaction, when } from "mobx";
import { autoBind, Disposer, noop, rejectPromiseBy } from "../utils"; import type { Disposer } from "../utils";
import { KubeObject, KubeStatus } from "./kube-object"; import { autoBind, noop, rejectPromiseBy } from "../utils";
import type { KubeObject } from "./kube-object";
import { KubeStatus } from "./kube-object";
import type { IKubeWatchEvent } from "./kube-watch-event"; import type { IKubeWatchEvent } from "./kube-watch-event";
import { ItemStore } from "../item.store"; import { ItemStore } from "../item.store";
import { ensureObjectSelfLink, IKubeApiQueryParams, KubeApi } from "./kube-api"; import type { IKubeApiQueryParams, KubeApi } from "./kube-api";
import { ensureObjectSelfLink } from "./kube-api";
import { parseKubeApi } from "./kube-api-parse"; import { parseKubeApi } from "./kube-api-parse";
import type { KubeJsonApiData } from "./kube-json-api"; import type { KubeJsonApiData } from "./kube-json-api";
import type { RequestInit } from "node-fetch"; import type { RequestInit } from "node-fetch";

View File

@ -9,7 +9,8 @@ import path from "path";
import os from "os"; import os from "os";
import yaml from "js-yaml"; import yaml from "js-yaml";
import logger from "../main/logger"; import logger from "../main/logger";
import { Cluster, Context, newClusters, newContexts, newUsers, User } from "@kubernetes/client-node/dist/config_types"; import type { Cluster, Context, User } from "@kubernetes/client-node/dist/config_types";
import { newClusters, newContexts, newUsers } from "@kubernetes/client-node/dist/config_types";
import { resolvePath } from "./utils"; import { resolvePath } from "./utils";
import Joi from "joi"; import Joi from "joi";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import logger, { Logger } from "./logger"; import type { Logger } from "./logger";
import logger from "./logger";
const loggerInjectable = getInjectable({ const loggerInjectable = getInjectable({
id: "logger", id: "logger",

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { match, matchPath } from "react-router"; import type { match } from "react-router";
import { matchPath } from "react-router";
import { countBy } from "lodash"; import { countBy } from "lodash";
import { iter } from "../utils"; import { iter } from "../utils";
import { pathToRegexp } from "path-to-regexp"; import { pathToRegexp } from "path-to-regexp";

View File

@ -0,0 +1,92 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { bytesToUnits, unitsToBytes } from "../convertMemory";
describe("unitsToBytes", () => {
it("without any units, just parse as float", () => {
expect(unitsToBytes("1234")).toBe(1234);
});
it("given unrelated data, return NaN", () => {
expect(unitsToBytes("I am not a number")).toBeNaN();
});
it("given unrelated data, but has number, return that", () => {
expect(unitsToBytes("I am not a number, but this is 0.1")).toBe(0.1);
});
});
describe("bytesToUnits", () => {
it("should return N/A for invalid bytes", () => {
expect(bytesToUnits(-1)).toBe("N/A");
expect(bytesToUnits(Infinity)).toBe("N/A");
expect(bytesToUnits(NaN)).toBe("N/A");
});
it("given a number within the magnitude of 0..124, format with B", () => {
expect(bytesToUnits(100)).toBe("100.0B");
});
it("given a number within the magnitude of 1024..1024^2, format with KiB", () => {
expect(bytesToUnits(1024)).toBe("1.0KiB");
expect(bytesToUnits(2048)).toBe("2.0KiB");
expect(bytesToUnits(1900)).toBe("1.9KiB");
expect(bytesToUnits(50*1024 + 1)).toBe("50.0KiB");
});
it("given a number within the magnitude of 1024^2..1024^3, format with MiB", () => {
expect(bytesToUnits(1024**2)).toBe("1.0MiB");
expect(bytesToUnits(2048**2)).toBe("4.0MiB");
expect(bytesToUnits(1900 * 1024)).toBe("1.9MiB");
expect(bytesToUnits(50*(1024 ** 2) + 1)).toBe("50.0MiB");
});
it("given a number within the magnitude of 1024^3..1024^4, format with GiB", () => {
expect(bytesToUnits(1024**3)).toBe("1.0GiB");
expect(bytesToUnits(2048**3)).toBe("8.0GiB");
expect(bytesToUnits(1900 * 1024 ** 2)).toBe("1.9GiB");
expect(bytesToUnits(50*(1024 ** 3) + 1)).toBe("50.0GiB");
});
it("given a number within the magnitude of 1024^4..1024^5, format with TiB", () => {
expect(bytesToUnits(1024**4)).toBe("1.0TiB");
expect(bytesToUnits(2048**4)).toBe("16.0TiB");
expect(bytesToUnits(1900 * 1024 ** 3)).toBe("1.9TiB");
expect(bytesToUnits(50*(1024 ** 4) + 1)).toBe("50.0TiB");
});
it("given a number within the magnitude of 1024^5..1024^6, format with PiB", () => {
expect(bytesToUnits(1024**5)).toBe("1.0PiB");
expect(bytesToUnits(2048**5)).toBe("32.0PiB");
expect(bytesToUnits(1900 * 1024 ** 4)).toBe("1.9PiB");
expect(bytesToUnits(50*(1024 ** 5) + 1)).toBe("50.0PiB");
});
it("given a number within the magnitude of 1024^6.., format with EiB", () => {
expect(bytesToUnits(1024**6)).toBe("1.0EiB");
expect(bytesToUnits(2048**6)).toBe("64.0EiB");
expect(bytesToUnits(1900 * 1024 ** 5)).toBe("1.9EiB");
expect(bytesToUnits(50*(1024 ** 6) + 1)).toBe("50.0EiB");
expect(bytesToUnits(1024**8)).toBe("1048576.0EiB");
});
});
describe("bytesToUnits -> unitsToBytes", () => {
it("given an input, round trip to the same value, given enough precision", () => {
expect(unitsToBytes(bytesToUnits(123))).toBe(123);
expect(unitsToBytes(bytesToUnits(1024**0 + 1, { precision: 2 }))).toBe(1024**0 + 1);
expect(unitsToBytes(bytesToUnits(1024**1 + 2, { precision: 3 }))).toBe(1024**1 + 2);
expect(unitsToBytes(bytesToUnits(1024**2 + 3, { precision: 6 }))).toBe(1024**2 + 3);
expect(unitsToBytes(bytesToUnits(1024**3 + 4, { precision: 9 }))).toBe(1024**3 + 4);
expect(unitsToBytes(bytesToUnits(1024**4 + 5, { precision: 12 }))).toBe(1024**4 + 5);
expect(unitsToBytes(bytesToUnits(1024**5 + 6, { precision: 16 }))).toBe(1024**5 + 6);
expect(unitsToBytes(bytesToUnits(1024**6 + 7, { precision: 20 }))).toBe(1024**6 + 7);
});
it("given an invalid input, round trips to NaN", () => {
expect(unitsToBytes(bytesToUnits(-1))).toBeNaN();
});
});

View File

@ -4,7 +4,8 @@
*/ */
import { boundMethod, boundClass } from "autobind-decorator"; import { boundMethod, boundClass } from "autobind-decorator";
import autoBindClass, { Options } from "auto-bind"; import type { Options } from "auto-bind";
import autoBindClass from "auto-bind";
import autoBindReactClass from "auto-bind/react"; import autoBindReactClass from "auto-bind/react";
// Automatically bind methods to their class instance // Automatically bind methods to their class instance

View File

@ -3,35 +3,59 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import assert from "assert";
import * as iter from "./iter";
// Helper to convert memory from units Ki, Mi, Gi, Ti, Pi to bytes and vise versa // Helper to convert memory from units Ki, Mi, Gi, Ti, Pi to bytes and vise versa
const base = 1024; const baseMagnitude = 1024;
const suffixes = ["K", "M", "G", "T", "P", "E"]; // Equivalents: Ki, Mi, Gi, Ti, Pi, Ei const maxMagnitude = ["EiB", baseMagnitude ** 6] as const;
const magnitudes = new Map([
["B", 1] as const,
["KiB", baseMagnitude ** 1] as const,
["MiB", baseMagnitude ** 2] as const,
["GiB", baseMagnitude ** 3] as const,
["TiB", baseMagnitude ** 4] as const,
["PiB", baseMagnitude ** 5] as const,
maxMagnitude,
]);
const unitRegex = /(?<value>[0-9]+(\.[0-9]*)?)(?<suffix>(B|[KMGTPE]iB))?/;
export function unitsToBytes(value: string) { export function unitsToBytes(value: string): number {
if (!suffixes.some(suffix => value.includes(suffix))) { const unitsMatch = value.match(unitRegex);
return parseFloat(value);
if (!unitsMatch?.groups) {
return NaN;
} }
const suffix = value.replace(/[0-9]|i|\./g, ""); const parsedValue = parseFloat(unitsMatch.groups.value);
const index = suffixes.indexOf(suffix);
return parseInt( if (!unitsMatch.groups?.suffix) {
(parseFloat(value) * Math.pow(base, index + 1)).toFixed(1), return parsedValue;
); }
const magnitude = magnitudes.get(unitsMatch.groups.suffix as never);
assert(magnitude, "UnitRegex is wrong some how");
return parseInt((parsedValue * magnitude).toFixed(1));
} }
export function bytesToUnits(bytes: number, precision = 1) { export interface BytesToUnitesOptions {
const sizes = ["B", ...suffixes]; /**
const index = Math.floor(Math.log(bytes) / Math.log(base)); * The number of decimal places. MUST be an integer. MUST be in the range [0, 20].
* @default 1
*/
precision?: number;
}
if (!bytes) { export function bytesToUnits(bytes: number, { precision = 1 }: BytesToUnitesOptions = {}): string {
if (bytes <= 0 || isNaN(bytes) || !isFinite(bytes)) {
return "N/A"; return "N/A";
} }
if (index === 0) { const index = Math.floor(Math.log(bytes) / Math.log(baseMagnitude));
return `${bytes}${sizes[index]}`; const [suffix, magnitude] = iter.nth(magnitudes.entries(), index) ?? maxMagnitude;
}
return `${(bytes / (1024 ** index)).toFixed(precision)}${sizes[index]}i`; return `${(bytes / magnitude).toFixed(precision)}${suffix}`;
} }

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { action, IInterceptable, IInterceptor, IListenable, ISetWillChange, observable, ObservableMap, ObservableSet } from "mobx"; import type { IInterceptable, IInterceptor, IListenable, ISetWillChange, ObservableMap } from "mobx";
import { action, observable, ObservableSet } from "mobx";
export function makeIterableIterator<T>(iterator: Iterator<T>): IterableIterator<T> { export function makeIterableIterator<T>(iterator: Iterator<T>): IterableIterator<T> {
(iterator as IterableIterator<T>)[Symbol.iterator] = () => iterator as IterableIterator<T>; (iterator as IterableIterator<T>)[Symbol.iterator] = () => iterator as IterableIterator<T>;

View File

@ -171,6 +171,23 @@ export function join(src: Iterable<string>, connector = ","): string {
return reduce(src, (acc, cur) => `${acc}${connector}${cur}`, ""); return reduce(src, (acc, cur) => `${acc}${connector}${cur}`, "");
} }
/**
* Returns the next value after iterating over the iterable `index` times.
*
* For example: `nth(["a", "b"], 0)` will return `"a"`
* For example: `nth(["a", "b"], 1)` will return `"b"`
* For example: `nth(["a", "b"], 2)` will return `undefined`
*/
export function nth<T>(src: Iterable<T>, index: number): T | undefined {
const iteree = src[Symbol.iterator]();
while (index-- > 0) {
iteree.next();
}
return iteree.next().value;
}
/** /**
* Iterate through `src` and return `true` if `fn` returns a thruthy value for every yielded value. * Iterate through `src` and return `true` if `fn` returns a thruthy value for every yielded value.
* Otherwise, return `false`. This function short circuits. * Otherwise, return `false`. This function short circuits.

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import semver, { coerce, SemVer } from "semver"; import type { SemVer } from "semver";
import semver, { coerce } from "semver";
import * as iter from "./iter"; import * as iter from "./iter";
import type { RawHelmChart } from "../k8s-api/endpoints/helm-charts.api"; import type { RawHelmChart } from "../k8s-api/endpoints/helm-charts.api";
import logger from "../logger"; import logger from "../logger";

View File

@ -5,7 +5,8 @@
// Helper for working with tarball files (.tar, .tgz) // Helper for working with tarball files (.tar, .tgz)
// Docs: https://github.com/npm/node-tar // Docs: https://github.com/npm/node-tar
import tar, { ExtractOptions, FileStat } from "tar"; import type { ExtractOptions, FileStat } from "tar";
import tar from "tar";
import path from "path"; import path from "path";
export interface ReadFileFromTarOpts { export interface ReadFileFromTarOpts {

View File

@ -2,11 +2,12 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import type {
DiContainer,
Injectable } from "@ogre-tools/injectable";
import { import {
createContainer, createContainer,
DiContainer,
getInjectable, getInjectable,
Injectable,
} from "@ogre-tools/injectable"; } from "@ogre-tools/injectable";
import { Environments, setLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api"; import { Environments, setLegacyGlobalDiForExtensionApi } from "./legacy-global-di-for-extension-api";
import { asLegacyGlobalObjectForExtensionApiWithModifications } from "./as-legacy-global-object-for-extension-api-with-modifications"; import { asLegacyGlobalObjectForExtensionApiWithModifications } from "./as-legacy-global-object-for-extension-api-with-modifications";

View File

@ -4,8 +4,9 @@
*/ */
import type { LensExtensionConstructor } from "../../lens-extension"; import type { LensExtensionConstructor } from "../../lens-extension";
import type { InstalledExtension } from "../../extension-discovery/extension-discovery"; import type { InstalledExtension } from "../../extension-discovery/extension-discovery";
import type {
LensExtensionDependencies } from "../../lens-extension-set-dependencies";
import { import {
LensExtensionDependencies,
setLensExtensionDependencies, setLensExtensionDependencies,
} from "../../lens-extension-set-dependencies"; } from "../../lens-extension-set-dependencies";

View File

@ -9,7 +9,8 @@ import { isEqual } from "lodash";
import { action, computed, makeObservable, observable, observe, reaction, when } from "mobx"; import { action, computed, makeObservable, observable, observe, reaction, when } from "mobx";
import path from "path"; import path from "path";
import { broadcastMessage, ipcMainOn, ipcRendererOn, ipcMainHandle } from "../../common/ipc"; import { broadcastMessage, ipcMainOn, ipcRendererOn, ipcMainHandle } from "../../common/ipc";
import { Disposer, toJS } from "../../common/utils"; import type { Disposer } from "../../common/utils";
import { toJS } from "../../common/utils";
import logger from "../../main/logger"; import logger from "../../main/logger";
import type { KubernetesCluster } from "../common-api/catalog"; import type { KubernetesCluster } from "../common-api/catalog";
import type { InstalledExtension } from "../extension-discovery/extension-discovery"; import type { InstalledExtension } from "../extension-discovery/extension-discovery";

View File

@ -8,9 +8,11 @@ import { action, observable, makeObservable, computed } from "mobx";
import logger from "../main/logger"; import logger from "../main/logger";
import type { ProtocolHandlerRegistration } from "./registries"; import type { ProtocolHandlerRegistration } from "./registries";
import type { PackageJson } from "type-fest"; import type { PackageJson } from "type-fest";
import { Disposer, disposer } from "../common/utils"; import type { Disposer } from "../common/utils";
import { disposer } from "../common/utils";
import type {
LensExtensionDependencies } from "./lens-extension-set-dependencies";
import { import {
LensExtensionDependencies,
setLensExtensionDependencies, setLensExtensionDependencies,
} from "./lens-extension-set-dependencies"; } from "./lens-extension-set-dependencies";

View File

@ -7,8 +7,10 @@ import type * as registries from "./registries";
import { Disposers, LensExtension } from "./lens-extension"; import { Disposers, LensExtension } from "./lens-extension";
import type { CatalogEntity } from "../common/catalog"; import type { CatalogEntity } from "../common/catalog";
import type { Disposer } from "../common/utils"; import type { Disposer } from "../common/utils";
import { catalogEntityRegistry, EntityFilter } from "../renderer/api/catalog-entity-registry"; import type { EntityFilter } from "../renderer/api/catalog-entity-registry";
import { catalogCategoryRegistry, CategoryFilter } from "../renderer/api/catalog-category-registry"; import { catalogEntityRegistry } from "../renderer/api/catalog-entity-registry";
import type { CategoryFilter } from "../renderer/api/catalog-category-registry";
import { catalogCategoryRegistry } from "../renderer/api/catalog-category-registry";
import type { TopBarRegistration } from "../renderer/components/layout/top-bar/top-bar-registration"; import type { TopBarRegistration } from "../renderer/components/layout/top-bar/top-bar-registration";
import type { KubernetesCluster } from "../common/catalog-entities"; import type { KubernetesCluster } from "../common/catalog-entities";
import type { WelcomeMenuRegistration } from "../renderer/components/+welcome/welcome-menu-items/welcome-menu-registration"; import type { WelcomeMenuRegistration } from "../renderer/components/+welcome/welcome-menu-items/welcome-menu-registration";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { navigation, PageParam, PageParamInit } from "../../renderer/navigation"; import type { PageParamInit } from "../../renderer/navigation";
import { navigation, PageParam } from "../../renderer/navigation";
export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param"; export type { PageParamInit, PageParam } from "../../renderer/navigation/page-param";
export { navigate, isActiveRoute } from "../../renderer/navigation/helpers"; export { navigate, isActiveRoute } from "../../renderer/navigation/helpers";

View File

@ -5,7 +5,8 @@
import { UserStore } from "../../common/user-store"; import { UserStore } from "../../common/user-store";
import type { ContextHandler } from "../context-handler/context-handler"; import type { ContextHandler } from "../context-handler/context-handler";
import { PrometheusProvider, PrometheusProviderRegistry, PrometheusService } from "../prometheus"; import type { PrometheusService } from "../prometheus";
import { PrometheusProvider, PrometheusProviderRegistry } from "../prometheus";
import mockFs from "mock-fs"; import mockFs from "mock-fs";
import { getDiForUnitTesting } from "../getDiForUnitTesting"; import { getDiForUnitTesting } from "../getDiForUnitTesting";
import createContextHandlerInjectable from "../context-handler/create-context-handler.injectable"; import createContextHandlerInjectable from "../context-handler/create-context-handler.injectable";

View File

@ -38,11 +38,14 @@ jest.mock("tcp-port-used");
import type { Cluster } from "../../common/cluster/cluster"; import type { Cluster } from "../../common/cluster/cluster";
import type { KubeAuthProxy } from "../kube-auth-proxy/kube-auth-proxy"; import type { KubeAuthProxy } from "../kube-auth-proxy/kube-auth-proxy";
import { broadcastMessage } from "../../common/ipc"; import { broadcastMessage } from "../../common/ipc";
import { ChildProcess, spawn } from "child_process"; import type { ChildProcess } from "child_process";
import { spawn } from "child_process";
import { Kubectl } from "../kubectl/kubectl"; import { Kubectl } from "../kubectl/kubectl";
import { mock, MockProxy } from "jest-mock-extended"; import type { MockProxy } from "jest-mock-extended";
import { mock } from "jest-mock-extended";
import { waitUntilUsed } from "tcp-port-used"; import { waitUntilUsed } from "tcp-port-used";
import { EventEmitter, Readable } from "stream"; import type { Readable } from "stream";
import { EventEmitter } from "stream";
import { UserStore } from "../../common/user-store"; import { UserStore } from "../../common/user-store";
import { Console } from "console"; import { Console } from "console";
import { stdout, stderr } from "process"; import { stdout, stderr } from "process";

View File

@ -2,8 +2,9 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import type {
DiContainerForSetup } from "@ogre-tools/injectable";
import { import {
DiContainerForSetup,
getInjectable, getInjectable,
} from "@ogre-tools/injectable"; } from "@ogre-tools/injectable";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { fromPairs } from "lodash/fp"; import { fromPairs } from "lodash/fp";
import { pathNames, PathName } from "../../common/app-paths/app-path-names"; import type { PathName } from "../../common/app-paths/app-path-names";
import { pathNames } from "../../common/app-paths/app-path-names";
import type { AppPaths } from "../../common/app-paths/app-path-injection-token"; import type { AppPaths } from "../../common/app-paths/app-path-injection-token";
interface Dependencies { interface Dependencies {

View File

@ -3,11 +3,13 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { autoUpdater, UpdateInfo } from "electron-updater"; import type { UpdateInfo } from "electron-updater";
import { autoUpdater } from "electron-updater";
import logger from "./logger"; import logger from "./logger";
import { isPublishConfigured, isTestEnv } from "../common/vars"; import { isPublishConfigured, isTestEnv } from "../common/vars";
import { delay } from "../common/utils"; import { delay } from "../common/utils";
import { areArgsUpdateAvailableToBackchannel, AutoUpdateChecking, AutoUpdateLogPrefix, AutoUpdateNoUpdateAvailable, broadcastMessage, onceCorrect, UpdateAvailableChannel, UpdateAvailableToBackchannel } from "../common/ipc"; import type { UpdateAvailableToBackchannel } from "../common/ipc";
import { areArgsUpdateAvailableToBackchannel, AutoUpdateChecking, AutoUpdateLogPrefix, AutoUpdateNoUpdateAvailable, broadcastMessage, onceCorrect, UpdateAvailableChannel } from "../common/ipc";
import { once } from "lodash"; import { once } from "lodash";
import { ipcMain } from "electron"; import { ipcMain } from "electron";
import { nextUpdateChannel } from "./utils/update-channel"; import { nextUpdateChannel } from "./utils/update-channel";

View File

@ -3,14 +3,17 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { action, observable, IComputedValue, computed, ObservableMap, runInAction, makeObservable, observe } from "mobx"; import type { IComputedValue, ObservableMap } from "mobx";
import { action, observable, computed, runInAction, makeObservable, observe } from "mobx";
import type { CatalogEntity } from "../../../common/catalog"; import type { CatalogEntity } from "../../../common/catalog";
import { catalogEntityRegistry } from "../../catalog"; import { catalogEntityRegistry } from "../../catalog";
import { FSWatcher, watch } from "chokidar"; import type { FSWatcher } from "chokidar";
import { watch } from "chokidar";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import type stream from "stream"; import type stream from "stream";
import { bytesToUnits, Disposer, getOrInsertWith, iter, noop } from "../../../common/utils"; import type { Disposer } from "../../../common/utils";
import { bytesToUnits, getOrInsertWith, iter, noop } from "../../../common/utils";
import logger from "../../logger"; import logger from "../../logger";
import type { KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { loadConfigFromString, splitConfig } from "../../../common/kube-helpers"; import { loadConfigFromString, splitConfig } from "../../../common/kube-helpers";

View File

@ -4,8 +4,10 @@
*/ */
import { observable, reaction } from "mobx"; import { observable, reaction } from "mobx";
import { WebLink, WebLinkSpec, WebLinkStatus } from "../../../common/catalog-entities"; import type { WebLinkSpec, WebLinkStatus } from "../../../common/catalog-entities";
import { catalogCategoryRegistry, CatalogEntity, CatalogEntityMetadata } from "../../../common/catalog"; import { WebLink } from "../../../common/catalog-entities";
import type { CatalogEntityMetadata } from "../../../common/catalog";
import { catalogCategoryRegistry, CatalogEntity } from "../../../common/catalog";
import { CatalogEntityRegistry } from "../catalog-entity-registry"; import { CatalogEntityRegistry } from "../catalog-entity-registry";
class InvalidEntity extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> { class InvalidEntity extends CatalogEntity<CatalogEntityMetadata, WebLinkStatus, WebLinkSpec> {

View File

@ -4,7 +4,8 @@
*/ */
import { action, computed, type IComputedValue, type IObservableArray, makeObservable, observable } from "mobx"; import { action, computed, type IComputedValue, type IObservableArray, makeObservable, observable } from "mobx";
import { CatalogCategoryRegistry, catalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor } from "../../common/catalog"; import type { CatalogCategoryRegistry, CatalogEntity, CatalogEntityConstructor } from "../../common/catalog";
import { catalogCategoryRegistry } from "../../common/catalog";
import { iter } from "../../common/utils"; import { iter } from "../../common/utils";
export class CatalogEntityRegistry { export class CatalogEntityRegistry {

View File

@ -6,12 +6,13 @@
import "../common/ipc/cluster"; import "../common/ipc/cluster";
import type http from "http"; import type http from "http";
import { action, makeObservable, observable, observe, reaction, toJS } from "mobx"; import { action, makeObservable, observable, observe, reaction, toJS } from "mobx";
import { Cluster } from "../common/cluster/cluster"; import type { Cluster } from "../common/cluster/cluster";
import logger from "./logger"; import logger from "./logger";
import { apiKubePrefix } from "../common/vars"; import { apiKubePrefix } from "../common/vars";
import { getClusterIdFromHost, Singleton } from "../common/utils"; import { getClusterIdFromHost, Singleton } from "../common/utils";
import { catalogEntityRegistry } from "./catalog"; import { catalogEntityRegistry } from "./catalog";
import { KubernetesCluster, KubernetesClusterPrometheusMetrics, LensKubernetesClusterStatus } from "../common/catalog-entities/kubernetes-cluster"; import type { KubernetesClusterPrometheusMetrics } from "../common/catalog-entities/kubernetes-cluster";
import { KubernetesCluster, LensKubernetesClusterStatus } from "../common/catalog-entities/kubernetes-cluster";
import { ipcMainOn } from "../common/ipc"; import { ipcMainOn } from "../common/ipc";
import { once } from "lodash"; import { once } from "lodash";
import { ClusterStore } from "../common/cluster-store/cluster-store"; import { ClusterStore } from "../common/cluster-store/cluster-store";

View File

@ -8,7 +8,8 @@ import { PrometheusProviderRegistry } from "../prometheus/provider-registry";
import type { ClusterPrometheusPreferences } from "../../common/cluster-types"; import type { ClusterPrometheusPreferences } from "../../common/cluster-types";
import type { Cluster } from "../../common/cluster/cluster"; import type { Cluster } from "../../common/cluster/cluster";
import type httpProxy from "http-proxy"; import type httpProxy from "http-proxy";
import url, { UrlWithStringQuery } from "url"; import type { UrlWithStringQuery } from "url";
import url from "url";
import { CoreV1Api } from "@kubernetes/client-node"; import { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger"; import logger from "../logger";
import type { KubeAuthProxy } from "../kube-auth-proxy/kube-auth-proxy"; import type { KubeAuthProxy } from "../kube-auth-proxy/kube-auth-proxy";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { Cluster, ClusterDependencies } from "../../common/cluster/cluster"; import type { ClusterDependencies } from "../../common/cluster/cluster";
import { Cluster } from "../../common/cluster/cluster";
import directoryForKubeConfigsInjectable from "../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable"; import directoryForKubeConfigsInjectable from "../../common/app-paths/directory-for-kube-configs/directory-for-kube-configs.injectable";
import createKubeconfigManagerInjectable from "../kubeconfig-manager/create-kubeconfig-manager.injectable"; import createKubeconfigManagerInjectable from "../kubeconfig-manager/create-kubeconfig-manager.injectable";
import createKubectlInjectable from "../kubectl/create-kubectl.injectable"; import createKubectlInjectable from "../kubectl/create-kubectl.injectable";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { BrowserWindow, IpcMainInvokeEvent, Menu } from "electron"; import type { IpcMainInvokeEvent } from "electron";
import { BrowserWindow, Menu } from "electron";
import { clusterFrameMap } from "../../../common/cluster-frames"; import { clusterFrameMap } from "../../../common/cluster-frames";
import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler, clusterSetDeletingHandler, clusterClearDeletingHandler } from "../../../common/ipc/cluster"; import { clusterActivateHandler, clusterSetFrameIdHandler, clusterVisibilityHandler, clusterRefreshHandler, clusterDisconnectHandler, clusterKubectlApplyAllHandler, clusterKubectlDeleteAllHandler, clusterDeleteHandler, clusterSetDeletingHandler, clusterClearDeletingHandler } from "../../../common/ipc/cluster";
import type { ClusterId } from "../../../common/cluster-types"; import type { ClusterId } from "../../../common/cluster-types";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { BrowserWindow, dialog, OpenDialogOptions } from "electron"; import type { OpenDialogOptions } from "electron";
import { BrowserWindow, dialog } from "electron";
export async function showOpenDialog(dialogOptions: OpenDialogOptions): Promise<{ canceled: boolean; filePaths: string[] }> { export async function showOpenDialog(dialogOptions: OpenDialogOptions): Promise<{ canceled: boolean; filePaths: string[] }> {
const { canceled, filePaths } = await dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), dialogOptions); const { canceled, filePaths } = await dialog.showOpenDialog(BrowserWindow.getFocusedWindow(), dialogOptions);

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import request, { RequestPromiseOptions } from "request-promise-native"; import type { RequestPromiseOptions } from "request-promise-native";
import request from "request-promise-native";
import { apiKubePrefix } from "../common/vars"; import { apiKubePrefix } from "../common/vars";
import type { IMetricsReqParams } from "../common/k8s-api/endpoints/metrics.api"; import type { IMetricsReqParams } from "../common/k8s-api/endpoints/metrics.api";
import { LensProxy } from "./lens-proxy"; import { LensProxy } from "./lens-proxy";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { KubeAuthProxy, KubeAuthProxyDependencies } from "./kube-auth-proxy"; import type { KubeAuthProxyDependencies } from "./kube-auth-proxy";
import { KubeAuthProxy } from "./kube-auth-proxy";
import type { Cluster } from "../../common/cluster/cluster"; import type { Cluster } from "../../common/cluster/cluster";
import path from "path"; import path from "path";
import selfsigned from "selfsigned"; import selfsigned from "selfsigned";

View File

@ -10,10 +10,11 @@ import { broadcastMessage } from "../../common/ipc";
import { openBrowser } from "../../common/utils"; import { openBrowser } from "../../common/utils";
import { showAbout } from "./menu"; import { showAbout } from "./menu";
import windowManagerInjectable from "../window-manager.injectable"; import windowManagerInjectable from "../window-manager.injectable";
import { import type {
BrowserWindow, BrowserWindow,
MenuItem, MenuItem,
MenuItemConstructorOptions, MenuItemConstructorOptions } from "electron";
import {
webContents, webContents,
} from "electron"; } from "electron";
import loggerInjectable from "../../common/logger.injectable"; import loggerInjectable from "../../common/logger.injectable";

View File

@ -2,8 +2,10 @@
* Copyright (c) OpenLens Authors. All rights reserved. * Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { app, BrowserWindow, dialog, Menu } from "electron"; import type { BrowserWindow } from "electron";
import { autorun, IComputedValue } from "mobx"; import { app, dialog, Menu } from "electron";
import type { IComputedValue } from "mobx";
import { autorun } from "mobx";
import { appName, isWindows, productName } from "../../common/vars"; import { appName, isWindows, productName } from "../../common/vars";
import packageJson from "../../../package.json"; import packageJson from "../../../package.json";
import type { MenuItemOpts } from "./application-menu-items.injectable"; import type { MenuItemOpts } from "./application-menu-items.injectable";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { PrometheusProvider, PrometheusService } from "./provider-registry"; import type { PrometheusService } from "./provider-registry";
import { PrometheusProvider } from "./provider-registry";
import type { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import { inspect } from "util"; import { inspect } from "util";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { PrometheusProvider, PrometheusService } from "./provider-registry"; import type { PrometheusService } from "./provider-registry";
import { PrometheusProvider } from "./provider-registry";
import type { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import { inspect } from "util"; import { inspect } from "util";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { PrometheusProvider, PrometheusService } from "./provider-registry"; import type { PrometheusService } from "./provider-registry";
import { PrometheusProvider } from "./provider-registry";
import type { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import { inspect } from "util"; import { inspect } from "util";

View File

@ -9,7 +9,8 @@ import URLParse from "url-parse";
import type { LensExtension } from "../../../extensions/lens-extension"; import type { LensExtension } from "../../../extensions/lens-extension";
import { broadcastMessage } from "../../../common/ipc"; import { broadcastMessage } from "../../../common/ipc";
import { observable, when, makeObservable } from "mobx"; import { observable, when, makeObservable } from "mobx";
import { ProtocolHandlerInvalid, RouteAttempt } from "../../../common/protocol-handler"; import type { RouteAttempt } from "../../../common/protocol-handler";
import { ProtocolHandlerInvalid } from "../../../common/protocol-handler";
import { disposer, noop } from "../../../common/utils"; import { disposer, noop } from "../../../common/utils";
import { WindowManager } from "../../window-manager"; import { WindowManager } from "../../window-manager";
import type { ExtensionLoader } from "../../../extensions/extension-loader"; import type { ExtensionLoader } from "../../../extensions/extension-loader";

View File

@ -4,7 +4,8 @@
*/ */
import logger from "../../logger"; import logger from "../../logger";
import WebSocket, { Server as WebSocketServer } from "ws"; import type WebSocket from "ws";
import { Server as WebSocketServer } from "ws";
import type { ProxyApiRequestArgs } from "../types"; import type { ProxyApiRequestArgs } from "../types";
import { ClusterManager } from "../../cluster-manager"; import { ClusterManager } from "../../cluster-manager";
import URLParse from "url-parse"; import URLParse from "url-parse";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable, getInjectionToken } from "@ogre-tools/injectable"; import { getInjectable, getInjectionToken } from "@ogre-tools/injectable";
import { Route, Router } from "./router"; import type { Route } from "./router";
import { Router } from "./router";
import parseRequestInjectable from "./parse-request.injectable"; import parseRequestInjectable from "./parse-request.injectable";
export const routeInjectionToken = getInjectionToken<Route<any>>({ export const routeInjectionToken = getInjectionToken<Route<any>>({

View File

@ -8,7 +8,8 @@ import { apiPrefix } from "../../../common/vars";
import type { Route } from "../../router/router"; import type { Route } from "../../router/router";
import { routeInjectionToken } from "../../router/router.injectable"; import { routeInjectionToken } from "../../router/router.injectable";
import type { Cluster } from "../../../common/cluster/cluster"; import type { Cluster } from "../../../common/cluster/cluster";
import { CoreV1Api, V1Secret } from "@kubernetes/client-node"; import type { V1Secret } from "@kubernetes/client-node";
import { CoreV1Api } from "@kubernetes/client-node";
const getServiceAccountRouteInjectable = getInjectable({ const getServiceAccountRouteInjectable = getInjectable({
id: "get-service-account-route", id: "get-service-account-route",

View File

@ -7,7 +7,8 @@ import { getInjectable } from "@ogre-tools/injectable";
import { apiPrefix } from "../../../common/vars"; import { apiPrefix } from "../../../common/vars";
import type { LensApiRequest, Route } from "../../router/router"; import type { LensApiRequest, Route } from "../../router/router";
import { routeInjectionToken } from "../../router/router.injectable"; import { routeInjectionToken } from "../../router/router.injectable";
import { ClusterMetadataKey, ClusterPrometheusMetadata } from "../../../common/cluster-types"; import type { ClusterPrometheusMetadata } from "../../../common/cluster-types";
import { ClusterMetadataKey } from "../../../common/cluster-types";
import logger from "../../logger"; import logger from "../../logger";
import type { Cluster } from "../../../common/cluster/cluster"; import type { Cluster } from "../../../common/cluster/cluster";
import { getMetrics } from "../../k8s-request"; import { getMetrics } from "../../k8s-request";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import { PortForward, PortForwardArgs } from "./port-forward"; import type { PortForwardArgs } from "./port-forward";
import { PortForward } from "./port-forward";
import bundledKubectlInjectable from "../../../kubectl/bundled-kubectl.injectable"; import bundledKubectlInjectable from "../../../kubectl/bundled-kubectl.injectable";
const createPortForwardInjectable = getInjectable({ const createPortForwardInjectable = getInjectable({

View File

@ -4,7 +4,8 @@
*/ */
import logger from "../../../logger"; import logger from "../../../logger";
import { getPortFrom } from "../../../utils/get-port"; import { getPortFrom } from "../../../utils/get-port";
import { spawn, ChildProcessWithoutNullStreams } from "child_process"; import type { ChildProcessWithoutNullStreams } from "child_process";
import { spawn } from "child_process";
import * as tcpPortUsed from "tcp-port-used"; import * as tcpPortUsed from "tcp-port-used";
const internalPortRegex = /^forwarding from (?<address>.+) ->/i; const internalPortRegex = /^forwarding from (?<address>.+) ->/i;

View File

@ -6,7 +6,8 @@ import { getInjectable } from "@ogre-tools/injectable";
import { routeInjectionToken } from "../../router/router.injectable"; import { routeInjectionToken } from "../../router/router.injectable";
import type { LensApiRequest, Route } from "../../router/router"; import type { LensApiRequest, Route } from "../../router/router";
import { apiPrefix } from "../../../common/vars"; import { apiPrefix } from "../../../common/vars";
import { PortForward, PortForwardArgs } from "./functionality/port-forward"; import type { PortForwardArgs } from "./functionality/port-forward";
import { PortForward } from "./functionality/port-forward";
import logger from "../../logger"; import logger from "../../logger";
import createPortForwardInjectable from "./functionality/create-port-forward.injectable"; import createPortForwardInjectable from "./functionality/create-port-forward.injectable";

View File

@ -4,7 +4,8 @@
*/ */
import { getInjectable } from "@ogre-tools/injectable"; import { getInjectable } from "@ogre-tools/injectable";
import type { LensApiRequest, Route } from "../router/router"; import type { LensApiRequest, Route } from "../router/router";
import { contentTypes, SupportedFileExtension } from "../router/router-content-types"; import type { SupportedFileExtension } from "../router/router-content-types";
import { contentTypes } from "../router/router-content-types";
import logger from "../logger"; import logger from "../logger";
import { routeInjectionToken } from "../router/router.injectable"; import { routeInjectionToken } from "../router/router.injectable";
import { appName, publicPath } from "../../common/vars"; import { appName, publicPath } from "../../common/vars";
@ -12,7 +13,8 @@ import path from "path";
import isDevelopmentInjectable from "../../common/vars/is-development.injectable"; import isDevelopmentInjectable from "../../common/vars/is-development.injectable";
import httpProxy from "http-proxy"; import httpProxy from "http-proxy";
import readFileBufferInjectable from "../../common/fs/read-file-buffer.injectable"; import readFileBufferInjectable from "../../common/fs/read-file-buffer.injectable";
import getAbsolutePathInjectable, { GetAbsolutePath } from "../../common/path/get-absolute-path.injectable"; import type { GetAbsolutePath } from "../../common/path/get-absolute-path.injectable";
import getAbsolutePathInjectable from "../../common/path/get-absolute-path.injectable";
import type { JoinPaths } from "../../common/path/join-paths.injectable"; import type { JoinPaths } from "../../common/path/join-paths.injectable";
import joinPathsInjectable from "../../common/path/join-paths.injectable"; import joinPathsInjectable from "../../common/path/join-paths.injectable";

View File

@ -3,7 +3,8 @@
* Licensed under MIT License. See LICENSE in root directory for more information. * Licensed under MIT License. See LICENSE in root directory for more information.
*/ */
import { computed, IComputedValue } from "mobx"; import type { IComputedValue } from "mobx";
import { computed } from "mobx";
import type { ClusterId } from "../../../common/cluster-types"; import type { ClusterId } from "../../../common/cluster-types";
import type { LensMainExtension } from "../../../extensions/lens-main-extension"; import type { LensMainExtension } from "../../../extensions/lens-main-extension";
import { catalogEntityRegistry } from "../../catalog"; import { catalogEntityRegistry } from "../../catalog";

Some files were not shown because too many files have changed in this diff Show More