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

Turn on several TSC options

- noUnusedLocals
- noImplicitReturns
- importsNotUsedAsValues: error

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-05-14 11:10:42 -04:00
parent c594844b9b
commit 439f7e33eb
271 changed files with 612 additions and 605 deletions

View File

@ -8,7 +8,7 @@
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
cluster and vice versa. cluster and vice versa.
*/ */
import { Application } from "spectron"; import type { Application } from "spectron";
import * as utils from "../helpers/utils"; import * as utils from "../helpers/utils";
import { listHelmRepositories } from "../helpers/utils"; import { listHelmRepositories } from "../helpers/utils";
import { fail } from "assert"; import { fail } from "assert";

View File

@ -4,7 +4,7 @@
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
cluster and vice versa. cluster and vice versa.
*/ */
import { Application } from "spectron"; import type { Application } from "spectron";
import * as utils from "../helpers/utils"; import * as utils from "../helpers/utils";
import { minikubeReady, waitForMinikubeDashboard } from "../helpers/minikube"; import { minikubeReady, waitForMinikubeDashboard } from "../helpers/minikube";
import { exec } from "child_process"; import { exec } from "child_process";

View File

@ -1,4 +1,4 @@
import { Application } from "spectron"; import type { Application } from "spectron";
import * as utils from "../helpers/utils"; import * as utils from "../helpers/utils";
jest.setTimeout(60000); jest.setTimeout(60000);

View File

@ -1,5 +1,5 @@
import { spawnSync } from "child_process"; import { spawnSync } from "child_process";
import { Application } from "spectron"; import type { Application } from "spectron";
export function minikubeReady(testNamespace: string): boolean { export function minikubeReady(testNamespace: string): boolean {
// determine if minikube is running // determine if minikube is running

View File

@ -21,7 +21,7 @@
import path from "path"; import path from "path";
import Config from "conf"; import Config from "conf";
import { Options as ConfOptions } from "conf/dist/source/types"; import type { Options as ConfOptions } from "conf/dist/source/types";
import { app, ipcMain, IpcMainEvent, ipcRenderer, IpcRendererEvent, remote } from "electron"; import { app, ipcMain, IpcMainEvent, ipcRenderer, IpcRendererEvent, remote } from "electron";
import { IReactionOptions, observable, reaction, runInAction, when } from "mobx"; import { IReactionOptions, observable, reaction, runInAction, when } from "mobx";
import Singleton from "./utils/singleton"; import Singleton from "./utils/singleton";

View File

@ -20,7 +20,7 @@
*/ */
import { action, computed, observable, IComputedValue, IObservableArray } from "mobx"; import { action, computed, observable, IComputedValue, IObservableArray } from "mobx";
import { CatalogEntity } from "./catalog-entity"; import type { CatalogEntity } from "./catalog-entity";
import { iter } from "../utils"; import { iter } from "../utils";
export class CatalogEntityRegistry { export class CatalogEntityRegistry {

View File

@ -34,11 +34,9 @@ export const clusterKubectlApplyAllHandler = "cluster:kubectl-apply-all";
if (ipcMain) { if (ipcMain) {
handleRequest(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => { handleRequest(clusterActivateHandler, (event, clusterId: ClusterId, force = false) => {
const cluster = ClusterStore.getInstance().getById(clusterId); return ClusterStore.getInstance()
.getById(clusterId)
if (cluster) { ?.activate(force);
return cluster.activate(force);
}
}); });
handleRequest(clusterSetFrameIdHandler, (event: IpcMainInvokeEvent, clusterId: ClusterId) => { handleRequest(clusterSetFrameIdHandler, (event: IpcMainInvokeEvent, clusterId: ClusterId) => {
@ -46,15 +44,14 @@ if (ipcMain) {
if (cluster) { if (cluster) {
clusterFrameMap.set(cluster.id, { frameId: event.frameId, processId: event.processId }); clusterFrameMap.set(cluster.id, { frameId: event.frameId, processId: event.processId });
cluster.pushState();
return cluster.pushState();
} }
}); });
handleRequest(clusterRefreshHandler, (event, clusterId: ClusterId) => { handleRequest(clusterRefreshHandler, (event, clusterId: ClusterId) => {
const cluster = ClusterStore.getInstance().getById(clusterId); return ClusterStore.getInstance()
.getById(clusterId)
if (cluster) return cluster.refresh({ refreshMetadata: true }); ?.refresh({ refreshMetadata: true });
}); });
handleRequest(clusterDisconnectHandler, (event, clusterId: ClusterId) => { handleRequest(clusterDisconnectHandler, (event, clusterId: ClusterId) => {

View File

@ -30,9 +30,9 @@ import logger from "../main/logger";
import { appEventBus } from "./event-bus"; import { appEventBus } from "./event-bus";
import { dumpConfigYaml } from "./kube-helpers"; import { dumpConfigYaml } from "./kube-helpers";
import { saveToAppFiles } from "./utils/saveToAppFiles"; import { saveToAppFiles } from "./utils/saveToAppFiles";
import { KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { handleRequest, requestMain, subscribeToBroadcast, unsubscribeAllFromBroadcast } from "./ipc"; import { handleRequest, requestMain, subscribeToBroadcast, unsubscribeAllFromBroadcast } from "./ipc";
import { ResourceType } from "../renderer/components/cluster-settings/components/cluster-metrics-setting"; import type { ResourceType } from "../renderer/components/cluster-settings/components/cluster-metrics-setting";
import { disposer, noop } from "./utils"; import { disposer, noop } from "./utils";
export interface ClusterIconUpload { export interface ClusterIconUpload {

View File

@ -53,12 +53,11 @@ export class EventEmitter<D extends [...any[]]> {
emit(...data: D) { emit(...data: D) {
[...this.listeners].every(([callback, options]) => { [...this.listeners].every(([callback, options]) => {
if (options.once) this.removeListener(callback); if (options.once) {
const result = callback(...data); this.removeListener(callback);
}
if (result === false) return; // break cycle return callback(...data) !== false;
return true;
}); });
} }
} }

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { EventEmitter } from "events"; import type { EventEmitter } from "events";
import logger from "../../main/logger"; import logger from "../../main/logger";
export type HandlerEvent<EM extends EventEmitter> = Parameters<Parameters<EM["on"]>[1]>[0]; export type HandlerEvent<EM extends EventEmitter> = Parameters<Parameters<EM["on"]>[1]>[0];

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { UpdateInfo } from "electron-updater"; import type { UpdateInfo } from "electron-updater";
export const UpdateAvailableChannel = "update-available"; export const UpdateAvailableChannel = "update-available";
export const AutoUpdateLogPrefix = "[UPDATE-CHECKER]"; export const AutoUpdateLogPrefix = "[UPDATE-CHECKER]";

View File

@ -230,7 +230,7 @@ export function getNodeWarningConditions(node: V1Node) {
* *
* Note: This function returns an error instead of throwing it, returning `undefined` if the validation passes * Note: This function returns an error instead of throwing it, returning `undefined` if the validation passes
*/ */
export function validateKubeConfig(config: KubeConfig, contextName: string, validationOpts: KubeConfigValidationOpts = {}): Error | undefined { export function validateKubeConfig(config: KubeConfig, contextName: string, validationOpts: KubeConfigValidationOpts = {}): Error | void {
try { try {
// we only receive a single context, cluster & user object here so lets validate them as this // we only receive a single context, cluster & user object here so lets validate them as this
// will be called when we add a new cluster to Lens // will be called when we add a new cluster to Lens

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import Url from "url-parse"; import type Url from "url-parse";
export enum RoutingErrorType { export enum RoutingErrorType {
INVALID_PROTOCOL = "invalid-protocol", INVALID_PROTOCOL = "invalid-protocol",
@ -52,6 +52,8 @@ export class RoutingError extends Error {
return "no extension ID"; return "no extension ID";
case RoutingErrorType.MISSING_EXTENSION: case RoutingErrorType.MISSING_EXTENSION:
return "extension not found"; return "extension not found";
default:
return `unknown error: ${this.type}`;
} }
} }
} }

View File

@ -24,12 +24,12 @@ import { countBy } from "lodash";
import { Singleton } from "../utils"; import { Singleton } from "../utils";
import { pathToRegexp } from "path-to-regexp"; import { pathToRegexp } from "path-to-regexp";
import logger from "../../main/logger"; import logger from "../../main/logger";
import Url from "url-parse"; import type Url from "url-parse";
import { RoutingError, RoutingErrorType } from "./error"; import { RoutingError, RoutingErrorType } from "./error";
import { ExtensionsStore } from "../../extensions/extensions-store"; import { ExtensionsStore } from "../../extensions/extensions-store";
import { ExtensionLoader } from "../../extensions/extension-loader"; import { ExtensionLoader } from "../../extensions/extension-loader";
import { LensExtension } from "../../extensions/lens-extension"; import type { LensExtension } from "../../extensions/lens-extension";
import { RouteHandler, RouteParams } from "../../extensions/registries/protocol-handler-registry"; import type { RouteHandler, RouteParams } from "../../extensions/registries/protocol-handler-registry";
// IPC channel for protocol actions. Main broadcasts the open-url events to this channel. // IPC channel for protocol actions. Main broadcasts the open-url events to this channel.
export const ProtocolHandlerIpcPrefix = "protocol-handler"; export const ProtocolHandlerIpcPrefix = "protocol-handler";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { AbortController } from "abort-controller"; import type { AbortController } from "abort-controller";
/** /**
* Return a promise that will be resolved after at least `timeout` ms have * Return a promise that will be resolved after at least `timeout` ms have

View File

@ -19,6 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
export type Falsey = false | 0 | "" | null | undefined;
/** /**
* Create a new type safe empty Iterable * Create a new type safe empty Iterable
* @returns An `Iterable` that yields 0 items * @returns An `Iterable` that yields 0 items
@ -57,6 +59,36 @@ export function* map<T, U>(src: Iterable<T>, fn: (from: T) => U): Iterable<U> {
} }
} }
/**
* The single layer flattening of an iterator, discarding `Falsey` values.
* @param src A type that can be iterated over
* @param fn The function that returns either an iterable over items that should be filtered out or a `Falsey` value indicating that it should be ignored
*/
export function* filterFlatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U | Falsey> | Falsey): Iterable<U> {
for (const from of src) {
if (!from) {
continue;
}
const mapping = fn(from);
if (!mapping) {
continue;
}
for (const mapped of mapping) {
if (mapped) {
yield mapped;
}
}
}
}
/**
* Returns a new iterator that yields the items that each call to `fn` would produce
* @param src A type that can be iterated over
* @param fn A function that returns an iterator
*/
export function* flatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U>): Iterable<U> { export function* flatMap<T, U>(src: Iterable<T>, fn: (from: T) => Iterable<U>): Iterable<U> {
for (const from of src) { for (const from of src) {
yield* fn(from); yield* fn(from);
@ -83,7 +115,7 @@ export function* filter<T>(src: Iterable<T>, fn: (from: T) => any): Iterable<T>
* @param src A type that can be iterated over * @param src A type that can be iterated over
* @param fn The function that is called for each value * @param fn The function that is called for each value
*/ */
export function* filterMap<T, U>(src: Iterable<T>, fn: (from: T) => U): Iterable<U> { export function* filterMap<T, U>(src: Iterable<T>, fn: (from: T) => U | Falsey): Iterable<U> {
for (const from of src) { for (const from of src) {
const res = fn(from); const res = fn(from);
@ -99,7 +131,7 @@ export function* filterMap<T, U>(src: Iterable<T>, fn: (from: T) => U): Iterable
* @param src A type that can be iterated over * @param src A type that can be iterated over
* @param fn The function that is called for each value * @param fn The function that is called for each value
*/ */
export function* filterMapStrict<T, U>(src: Iterable<T>, fn: (from: T) => U): Iterable<U> { export function* filterMapStrict<T, U>(src: Iterable<T>, fn: (from: T) => U | null | undefined): Iterable<U> {
for (const from of src) { for (const from of src) {
const res = fn(from); const res = fn(from);

View File

@ -23,7 +23,7 @@
import path from "path"; import path from "path";
import { app, remote } from "electron"; import { app, remote } from "electron";
import { ensureDirSync, writeFileSync } from "fs-extra"; import { ensureDirSync, writeFileSync } from "fs-extra";
import { WriteFileOptions } from "fs"; import type { WriteFileOptions } from "fs";
export function saveToAppFiles(filePath: string, contents: any, options?: WriteFileOptions): string { export function saveToAppFiles(filePath: string, contents: any, options?: WriteFileOptions): string {
const absPath = path.resolve((app || remote.app).getPath("userData"), filePath); const absPath = path.resolve((app || remote.app).getPath("userData"), filePath);

View File

@ -77,6 +77,8 @@ jest.mock(
], ],
]; ];
} }
return [];
}), }),
on: jest.fn( on: jest.fn(
(channel: string, listener: (event: any, ...args: any[]) => void) => { (channel: string, listener: (event: any, ...args: any[]) => void) => {

View File

@ -24,7 +24,7 @@ import path from "path";
import hb from "handlebars"; import hb from "handlebars";
import { observable } from "mobx"; import { observable } from "mobx";
import { ResourceApplier } from "../main/resource-applier"; import { ResourceApplier } from "../main/resource-applier";
import { KubernetesCluster } from "./core-api/catalog"; import type { KubernetesCluster } from "./core-api/catalog";
import logger from "../main/logger"; import logger from "../main/logger";
import { app } from "electron"; import { app } from "electron";
import { requestMain } from "../common/ipc"; import { requestMain } from "../common/ipc";

View File

@ -325,6 +325,8 @@ export class ExtensionLoader extends Singleton {
} catch (error) { } catch (error) {
logger.error(`${logModule}: can't load extension main at ${extAbsolutePath}: ${error}`, { extension, error }); logger.error(`${logModule}: can't load extension main at ${extAbsolutePath}: ${error}`, { extension, error });
} }
return null;
} }
getExtension(extId: LensExtensionId): InstalledExtension { getExtension(extId: LensExtensionId): InstalledExtension {

View File

@ -21,7 +21,7 @@
import { BaseStore } from "../common/base-store"; import { BaseStore } from "../common/base-store";
import * as path from "path"; import * as path from "path";
import { LensExtension } from "./lens-extension"; import type { LensExtension } from "./lens-extension";
export abstract class ExtensionStore<T> extends BaseStore<T> { export abstract class ExtensionStore<T> extends BaseStore<T> {
protected extension: LensExtension; protected extension: LensExtension;

View File

@ -23,7 +23,7 @@ import type { InstalledExtension } from "./extension-discovery";
import { action, observable, reaction } from "mobx"; import { action, observable, reaction } from "mobx";
import { FilesystemProvisionerStore } from "../main/extension-filesystem"; import { FilesystemProvisionerStore } from "../main/extension-filesystem";
import logger from "../main/logger"; import logger from "../main/logger";
import { ProtocolHandlerRegistration } from "./registries/protocol-handler-registry"; import type { ProtocolHandlerRegistration } from "./registries/protocol-handler-registry";
export type LensExtensionId = string; // path to manifest (package.json) export type LensExtensionId = string; // path to manifest (package.json)
export type LensExtensionConstructor = new (...args: ConstructorParameters<typeof LensExtension>) => LensExtension; export type LensExtensionConstructor = new (...args: ConstructorParameters<typeof LensExtension>) => LensExtension;

View File

@ -24,7 +24,7 @@ import { LensExtension } from "./lens-extension";
import { WindowManager } from "../main/window-manager"; import { WindowManager } from "../main/window-manager";
import { getExtensionPageUrl } from "./registries/page-registry"; import { getExtensionPageUrl } from "./registries/page-registry";
import { CatalogEntity, catalogEntityRegistry } from "../common/catalog"; import { CatalogEntity, catalogEntityRegistry } from "../common/catalog";
import { IObservableArray } from "mobx"; import type { IObservableArray } from "mobx";
export class LensMainExtension extends LensExtension { export class LensMainExtension extends LensExtension {
appMenus: MenuRegistration[] = []; appMenus: MenuRegistration[] = [];

View File

@ -26,8 +26,8 @@ import type {
import type { Cluster } from "../main/cluster"; import type { Cluster } from "../main/cluster";
import { LensExtension } from "./lens-extension"; import { LensExtension } from "./lens-extension";
import { getExtensionPageUrl } from "./registries/page-registry"; import { getExtensionPageUrl } from "./registries/page-registry";
import { CommandRegistration } from "./registries/command-registry"; import type { CommandRegistration } from "./registries/command-registry";
import { EntitySettingRegistration } from "./registries/entity-setting-registry"; import type { EntitySettingRegistration } from "./registries/entity-setting-registry";
export class LensRendererExtension extends LensExtension { export class LensRendererExtension extends LensExtension {
globalPages: PageRegistration[] = []; globalPages: PageRegistration[] = [];

View File

@ -20,7 +20,7 @@
*/ */
import type React from "react"; import type React from "react";
import { CatalogEntity } from "../../common/catalog"; import type { CatalogEntity } from "../../common/catalog";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
export interface EntitySettingViewProps { export interface EntitySettingViewProps {

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import React from "react"; import type React from "react";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
export interface KubeObjectDetailComponents { export interface KubeObjectDetailComponents {

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import React from "react"; import type React from "react";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
export interface KubeObjectMenuComponents { export interface KubeObjectMenuComponents {

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { KubeObject, KubeObjectStatus } from "../renderer-api/k8s-api"; import type { KubeObject, KubeObjectStatus } from "../renderer-api/k8s-api";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
export interface KubeObjectStatusRegistration { export interface KubeObjectStatusRegistration {

View File

@ -25,7 +25,7 @@ import React from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
import { LensExtension, sanitizeExtensionName } from "../lens-extension"; import { LensExtension, sanitizeExtensionName } from "../lens-extension";
import { PageParam, PageParamInit } from "../../renderer/navigation/page-param"; import type { PageParam, PageParamInit } from "../../renderer/navigation/page-param";
import { createPageParam } from "../../renderer/navigation/helpers"; import { createPageParam } from "../../renderer/navigation/helpers";
export interface PageRegistration { export interface PageRegistration {
@ -119,9 +119,9 @@ export class PageRegistry extends BaseRegistry<PageRegistration, RegisteredPage>
return components; return components;
} }
protected normalizeParams(params?: PageParams<string | ExtensionPageParamInit>): PageParams<PageParam> { protected normalizeParams(params?: PageParams<string | ExtensionPageParamInit>): PageParams<PageParam> | undefined {
if (!params) { if (!params) {
return; return undefined;
} }
Object.entries(params).forEach(([name, value]) => { Object.entries(params).forEach(([name, value]) => {
const paramInit: PageParamInit = typeof value === "object" const paramInit: PageParamInit = typeof value === "object"

View File

@ -21,7 +21,7 @@
// Extensions API -> Status bar customizations // Extensions API -> Status bar customizations
import React from "react"; import type React from "react";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
interface StatusBarComponents { interface StatusBarComponents {

View File

@ -56,7 +56,7 @@ import { ChildProcess, spawn } from "child_process";
import { bundledKubectlPath, Kubectl } from "../kubectl"; import { bundledKubectlPath, Kubectl } from "../kubectl";
import { mock, MockProxy } from "jest-mock-extended"; import { mock, MockProxy } from "jest-mock-extended";
import { waitUntilUsed } from "tcp-port-used"; import { waitUntilUsed } from "tcp-port-used";
import { Readable } from "stream"; import type { Readable } 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

@ -47,7 +47,7 @@ jest.mock("winston", () => ({
import { KubeconfigManager } from "../kubeconfig-manager"; import { KubeconfigManager } from "../kubeconfig-manager";
import mockFs from "mock-fs"; import mockFs from "mock-fs";
import { Cluster } from "../cluster"; import { Cluster } from "../cluster";
import { ContextHandler } from "../context-handler"; import type { ContextHandler } from "../context-handler";
import fse from "fs-extra"; import fse from "fs-extra";
import { loadYaml } from "@kubernetes/client-node"; import { loadYaml } from "@kubernetes/client-node";
import { Console } from "console"; import { Console } from "console";

View File

@ -21,9 +21,9 @@
import { reaction, toJS } from "mobx"; import { reaction, toJS } from "mobx";
import { broadcastMessage, subscribeToBroadcast, unsubscribeFromBroadcast } from "../common/ipc"; import { broadcastMessage, subscribeToBroadcast, unsubscribeFromBroadcast } from "../common/ipc";
import { CatalogEntityRegistry} from "../common/catalog"; import type { CatalogEntityRegistry} from "../common/catalog";
import "../common/catalog-entities/kubernetes-cluster"; import "../common/catalog-entities/kubernetes-cluster";
import { Disposer } from "../common/utils"; import type { Disposer } from "../common/utils";
export class CatalogPusher { export class CatalogPusher {
static init(catalog: CatalogEntityRegistry) { static init(catalog: CatalogEntityRegistry) {

View File

@ -20,9 +20,9 @@
*/ */
import { ObservableMap } from "mobx"; import { ObservableMap } from "mobx";
import { CatalogEntity } from "../../../common/catalog"; import type { CatalogEntity } from "../../../common/catalog";
import { loadFromOptions } from "../../../common/kube-helpers"; import { loadFromOptions } from "../../../common/kube-helpers";
import { Cluster } from "../../cluster"; import type { Cluster } from "../../cluster";
import { computeDiff, configToModels } from "../kubeconfig-sync"; import { computeDiff, configToModels } from "../kubeconfig-sync";
import mockFs from "mock-fs"; import mockFs from "mock-fs";
import fs from "fs"; import fs from "fs";

View File

@ -24,10 +24,10 @@ import { CatalogEntity, catalogEntityRegistry } from "../../common/catalog";
import { watch } from "chokidar"; import { watch } from "chokidar";
import fs from "fs"; import fs from "fs";
import fse from "fs-extra"; import fse from "fs-extra";
import stream from "stream"; import type stream from "stream";
import { Disposer, ExtendedObservableMap, iter, Singleton } from "../../common/utils"; import { Disposer, ExtendedObservableMap, iter, Singleton } from "../../common/utils";
import logger from "../logger"; import logger from "../logger";
import { KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { loadConfigFromString, splitConfig, validateKubeConfig } from "../../common/kube-helpers"; import { loadConfigFromString, splitConfig, validateKubeConfig } from "../../common/kube-helpers";
import { Cluster } from "../cluster"; import { Cluster } from "../cluster";
import { catalogEntityFromCluster } from "../cluster-manager"; import { catalogEntityFromCluster } from "../cluster-manager";

View File

@ -19,8 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { RequestPromiseOptions } from "request-promise-native"; import type { RequestPromiseOptions } from "request-promise-native";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { k8sRequest } from "../k8s-request"; import { k8sRequest } from "../k8s-request";
export type ClusterDetectionResult = { export type ClusterDetectionResult = {

View File

@ -20,9 +20,9 @@
*/ */
import { observable } from "mobx"; import { observable } from "mobx";
import { ClusterMetadata } from "../../common/cluster-store"; import type { ClusterMetadata } from "../../common/cluster-store";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { BaseClusterDetector, ClusterDetectionResult } from "./base-cluster-detector"; import type { BaseClusterDetector, ClusterDetectionResult } from "./base-cluster-detector";
import { ClusterIdDetector } from "./cluster-id-detector"; import { ClusterIdDetector } from "./cluster-id-detector";
import { DistributionDetector } from "./distribution-detector"; import { DistributionDetector } from "./distribution-detector";
import { LastSeenDetector } from "./last-seen-detector"; import { LastSeenDetector } from "./last-seen-detector";

View File

@ -24,7 +24,7 @@ import type http from "http";
import { ipcMain } from "electron"; import { ipcMain } from "electron";
import { action, autorun, reaction, toJS } from "mobx"; import { action, autorun, reaction, toJS } from "mobx";
import { ClusterStore, getClusterIdFromHost } from "../common/cluster-store"; import { ClusterStore, getClusterIdFromHost } from "../common/cluster-store";
import { Cluster } from "./cluster"; import type { Cluster } from "./cluster";
import logger from "./logger"; import logger from "./logger";
import { apiKubePrefix } from "../common/vars"; import { apiKubePrefix } from "../common/vars";
import { Singleton } from "../common/utils"; import { Singleton } from "../common/utils";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import type { PrometheusProvider, PrometheusService } from "./prometheus/provider-registry"; import type { PrometheusService } from "./prometheus/provider-registry";
import type { ClusterPrometheusPreferences } from "../common/cluster-store"; import type { ClusterPrometheusPreferences } from "../common/cluster-store";
import type { Cluster } from "./cluster"; import type { Cluster } from "./cluster";
import type httpProxy from "http-proxy"; import type httpProxy from "http-proxy";
@ -75,16 +75,15 @@ export class ContextHandler {
return prometheusProviders.find(p => p.id === this.prometheusProvider); return prometheusProviders.find(p => p.id === this.prometheusProvider);
} }
async getPrometheusService(): Promise<PrometheusService> { async getPrometheusService(): Promise<PrometheusService | void> {
const providers = this.prometheusProvider ? prometheusProviders.filter(provider => provider.id == this.prometheusProvider) : prometheusProviders; const providers = this.prometheusProvider ? prometheusProviders.filter(provider => provider.id == this.prometheusProvider) : prometheusProviders;
const prometheusPromises: Promise<PrometheusService>[] = providers.map(async (provider: PrometheusProvider): Promise<PrometheusService> => { const prometheusPromises: Promise<PrometheusService | void>[] = providers.map(async provider => {
const apiClient = (await this.cluster.getProxyKubeconfig()).makeApiClient(CoreV1Api); const apiClient = (await this.cluster.getProxyKubeconfig()).makeApiClient(CoreV1Api);
return await provider.getPrometheusService(apiClient); return provider.getPrometheusService(apiClient);
}); });
const resolvedPrometheusServices = await Promise.all(prometheusPromises);
return resolvedPrometheusServices.filter(n => n)[0]; return (await Promise.all(prometheusPromises)).find(Boolean);
} }
async getPrometheusPath(): Promise<string> { async getPrometheusPath(): Promise<string> {

View File

@ -26,7 +26,7 @@ import fse from "fs-extra";
import { action, observable, toJS } from "mobx"; import { action, observable, toJS } from "mobx";
import path from "path"; import path from "path";
import { BaseStore } from "../common/base-store"; import { BaseStore } from "../common/base-store";
import { LensExtensionId } from "../extensions/lens-extension"; import type { LensExtensionId } from "../extensions/lens-extension";
interface FSProvisionModel { interface FSProvisionModel {
extensions: Record<string, string>; // extension names to paths extensions: Record<string, string>; // extension names to paths

View File

@ -22,7 +22,7 @@
import { HelmRepo, HelmRepoManager } from "../helm-repo-manager"; import { HelmRepo, HelmRepoManager } from "../helm-repo-manager";
export class HelmChartManager { export class HelmChartManager {
private cache: any = {}; cache: any = {};
private repo: HelmRepo; private repo: HelmRepo;
constructor(repo: HelmRepo){ constructor(repo: HelmRepo){

View File

@ -24,7 +24,7 @@ import fse from "fs-extra";
import * as yaml from "js-yaml"; import * as yaml from "js-yaml";
import { promiseExec} from "../promise-exec"; import { promiseExec} from "../promise-exec";
import { helmCli } from "./helm-cli"; import { helmCli } from "./helm-cli";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { toCamelCase } from "../../common/utils/camelCase"; import { toCamelCase } from "../../common/utils/camelCase";
export async function listReleases(pathToKubeconfig: string, namespace?: string) { export async function listReleases(pathToKubeconfig: string, namespace?: string) {

View File

@ -20,11 +20,11 @@
*/ */
import semver from "semver"; import semver from "semver";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import logger from "../logger"; import logger from "../logger";
import { HelmRepoManager } from "./helm-repo-manager"; import { HelmRepoManager } from "./helm-repo-manager";
import { HelmChartManager } from "./helm-chart-manager"; import { HelmChartManager } from "./helm-chart-manager";
import { HelmChartList, RepoHelmChartList } from "../../renderer/api/endpoints/helm-charts.api"; import type { HelmChartList, RepoHelmChartList } from "../../renderer/api/endpoints/helm-charts.api";
import { deleteRelease, getHistory, getRelease, getValues, installChart, listReleases, rollback, upgradeRelease } from "./helm-release-manager"; import { deleteRelease, getHistory, getRelease, getValues, installChart, listReleases, rollback, upgradeRelease } from "./helm-release-manager";
class HelmService { class HelmService {

View File

@ -21,9 +21,9 @@
import request, { RequestPromiseOptions } from "request-promise-native"; import request, { RequestPromiseOptions } from "request-promise-native";
import { apiKubePrefix } from "../common/vars"; import { apiKubePrefix } from "../common/vars";
import { IMetricsReqParams } from "../renderer/api/endpoints/metrics.api"; import type { IMetricsReqParams } from "../renderer/api/endpoints/metrics.api";
import { LensProxy } from "./proxy/lens-proxy"; import { LensProxy } from "./proxy/lens-proxy";
import { Cluster } from "./cluster"; import type { Cluster } from "./cluster";
export async function k8sRequest<T = any>(cluster: Cluster, path: string, options: RequestPromiseOptions = {}): Promise<T> { export async function k8sRequest<T = any>(cluster: Cluster, path: string, options: RequestPromiseOptions = {}): Promise<T> {
const kubeProxyUrl = `http://localhost:${LensProxy.getInstance().port}${apiKubePrefix}`; const kubeProxyUrl = `http://localhost:${LensProxy.getInstance().port}${apiKubePrefix}`;

View File

@ -25,7 +25,7 @@ import request from "request";
import { ensureDir, pathExists } from "fs-extra"; import { ensureDir, pathExists } from "fs-extra";
import * as tar from "tar"; import * as tar from "tar";
import { isWindows } from "../common/vars"; import { isWindows } from "../common/vars";
import winston from "winston"; import type winston from "winston";
export type LensBinaryOpts = { export type LensBinaryOpts = {
version: string; version: string;
@ -204,7 +204,7 @@ export class LensBinary {
throw(error); throw(error);
}); });
return new Promise((resolve, reject) => { return new Promise<void>((resolve, reject) => {
file.on("close", () => { file.on("close", () => {
this.logger.debug(`${this.originalBinaryName} binary download closed`); this.logger.debug(`${this.originalBinaryName} binary download closed`);
if (!this.tarPath) fs.chmod(binaryPath, 0o755, (err) => { if (!this.tarPath) fs.chmod(binaryPath, 0o755, (err) => {

View File

@ -21,7 +21,7 @@
import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron"; import { app, BrowserWindow, dialog, ipcMain, IpcMainEvent, Menu, MenuItem, MenuItemConstructorOptions, webContents, shell } from "electron";
import { autorun } from "mobx"; import { autorun } from "mobx";
import { WindowManager } from "./window-manager"; import type { WindowManager } from "./window-manager";
import { appName, isMac, isWindows, isTestEnv, docsUrl, supportUrl, productName } from "../common/vars"; import { appName, isMac, isWindows, isTestEnv, docsUrl, supportUrl, productName } from "../common/vars";
import { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route"; import { addClusterURL } from "../renderer/components/+add-cluster/add-cluster.route";
import { preferencesURL } from "../renderer/components/+preferences/preferences.route"; import { preferencesURL } from "../renderer/components/+preferences/preferences.route";

View File

@ -20,8 +20,8 @@
*/ */
import { PrometheusLens } from "./lens"; import { PrometheusLens } from "./lens";
import { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import { PrometheusService } from "./provider-registry"; import type { PrometheusService } from "./provider-registry";
import logger from "../logger"; import logger from "../logger";
export class PrometheusHelm extends PrometheusLens { export class PrometheusHelm extends PrometheusLens {
@ -29,7 +29,7 @@ export class PrometheusHelm extends PrometheusLens {
name = "Helm"; name = "Helm";
rateAccuracy = "5m"; rateAccuracy = "5m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> { public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService | void> {
const labelSelector = "app=prometheus,component=server,heritage=Helm"; const labelSelector = "app=prometheus,component=server,heritage=Helm";
try { try {

View File

@ -19,8 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry"; import type { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry";
import { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger"; import logger from "../logger";
export class PrometheusLens implements PrometheusProvider { export class PrometheusLens implements PrometheusProvider {
@ -28,7 +28,7 @@ export class PrometheusLens implements PrometheusProvider {
name = "Lens"; name = "Lens";
rateAccuracy = "1m"; rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> { public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService | void> {
try { try {
const resp = await client.readNamespacedService("prometheus", "lens-metrics"); const resp = await client.readNamespacedService("prometheus", "lens-metrics");
const service = resp.body; const service = resp.body;
@ -44,7 +44,7 @@ export class PrometheusLens implements PrometheusProvider {
} }
} }
public getQueries(opts: PrometheusQueryOpts): PrometheusQuery { public getQueries(opts: PrometheusQueryOpts): PrometheusQuery | void {
switch(opts.category) { switch(opts.category) {
case "cluster": case "cluster":
return { return {

View File

@ -19,8 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry"; import type { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry";
import { CoreV1Api, V1Service } from "@kubernetes/client-node"; import type { CoreV1Api, V1Service } from "@kubernetes/client-node";
import logger from "../logger"; import logger from "../logger";
export class PrometheusOperator implements PrometheusProvider { export class PrometheusOperator implements PrometheusProvider {
@ -28,7 +28,7 @@ export class PrometheusOperator implements PrometheusProvider {
id = "operator"; id = "operator";
name = "Prometheus Operator"; name = "Prometheus Operator";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> { public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService | void> {
try { try {
let service: V1Service; let service: V1Service;
@ -54,7 +54,7 @@ export class PrometheusOperator implements PrometheusProvider {
} }
} }
public getQueries(opts: PrometheusQueryOpts): PrometheusQuery { public getQueries(opts: PrometheusQueryOpts): PrometheusQuery | void {
switch(opts.category) { switch(opts.category) {
case "cluster": case "cluster":
return { return {

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
export type PrometheusClusterQuery = { export type PrometheusClusterQuery = {
memoryUsage: string; memoryUsage: string;
@ -83,8 +83,8 @@ export type PrometheusService = {
export interface PrometheusProvider { export interface PrometheusProvider {
id: string; id: string;
name: string; name: string;
getQueries(opts: PrometheusQueryOpts): PrometheusQuery; getQueries(opts: PrometheusQueryOpts): PrometheusQuery | void;
getPrometheusService(client: CoreV1Api): Promise<PrometheusService>; getPrometheusService(client: CoreV1Api): Promise<PrometheusService | void>;
} }
export type PrometheusProviderList = { export type PrometheusProviderList = {

View File

@ -19,8 +19,8 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry"; import type { PrometheusProvider, PrometheusQueryOpts, PrometheusQuery, PrometheusService } from "./provider-registry";
import { CoreV1Api } from "@kubernetes/client-node"; import type { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger"; import logger from "../logger";
export class PrometheusStacklight implements PrometheusProvider { export class PrometheusStacklight implements PrometheusProvider {
@ -28,7 +28,7 @@ export class PrometheusStacklight implements PrometheusProvider {
name = "Stacklight"; name = "Stacklight";
rateAccuracy = "1m"; rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> { public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService | void> {
try { try {
const resp = await client.readNamespacedService("prometheus-server", "stacklight"); const resp = await client.readNamespacedService("prometheus-server", "stacklight");
const service = resp.body; const service = resp.body;
@ -44,7 +44,7 @@ export class PrometheusStacklight implements PrometheusProvider {
} }
} }
public getQueries(opts: PrometheusQueryOpts): PrometheusQuery { public getQueries(opts: PrometheusQueryOpts): PrometheusQuery | void {
switch(opts.category) { switch(opts.category) {
case "cluster": case "cluster":
return { return {

View File

@ -22,7 +22,7 @@
import logger from "../logger"; import logger from "../logger";
import * as proto from "../../common/protocol-handler"; import * as proto from "../../common/protocol-handler";
import Url from "url-parse"; import Url from "url-parse";
import { 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 } from "mobx"; import { observable, when } from "mobx";

View File

@ -20,13 +20,13 @@
*/ */
import net from "net"; import net from "net";
import http from "http"; import type http from "http";
import spdy from "spdy"; import spdy from "spdy";
import httpProxy from "http-proxy"; import httpProxy from "http-proxy";
import url from "url"; import url from "url";
import { apiPrefix, apiKubePrefix } from "../../common/vars"; import { apiPrefix, apiKubePrefix } from "../../common/vars";
import { Router } from "../router"; import { Router } from "../router";
import { ContextHandler } from "../context-handler"; import type { ContextHandler } from "../context-handler";
import logger from "../logger"; import logger from "../logger";
import { Singleton } from "../../common/utils"; import { Singleton } from "../../common/utils";
import { ClusterManager } from "../cluster-manager"; import { ClusterManager } from "../cluster-manager";
@ -205,13 +205,13 @@ export class LensProxy extends Singleton {
return proxy; return proxy;
} }
protected async getProxyTarget(req: http.IncomingMessage, contextHandler: ContextHandler): Promise<httpProxy.ServerOptions> { protected async getProxyTarget(req: http.IncomingMessage, contextHandler: ContextHandler): Promise<httpProxy.ServerOptions | void> {
if (req.url.startsWith(apiKubePrefix)) { if (req.url.startsWith(apiKubePrefix)) {
delete req.headers.authorization; delete req.headers.authorization;
req.url = req.url.replace(apiKubePrefix, ""); req.url = req.url.replace(apiKubePrefix, "");
const isWatchRequest = req.url.includes("watch="); const isWatchRequest = req.url.includes("watch=");
return await contextHandler.getApiTarget(isWatchRequest); return contextHandler.getApiTarget(isWatchRequest);
} }
} }

View File

@ -26,8 +26,8 @@
*/ */
import * as WebSocket from "ws"; import * as WebSocket from "ws";
import http from "http"; import type http from "http";
import net from "net"; import type net from "net";
import url from "url"; import url from "url";
import { NodeShellSession, LocalShellSession } from "../shell-session"; import { NodeShellSession, LocalShellSession } from "../shell-session";
import { ClusterManager } from "../cluster-manager"; import { ClusterManager } from "../cluster-manager";

View File

@ -20,7 +20,7 @@
*/ */
import type { Cluster } from "./cluster"; import type { Cluster } from "./cluster";
import { KubernetesObject } from "@kubernetes/client-node"; import type { KubernetesObject } from "@kubernetes/client-node";
import { exec } from "child_process"; import { exec } from "child_process";
import fs from "fs"; import fs from "fs";
import * as yaml from "js-yaml"; import * as yaml from "js-yaml";

View File

@ -21,10 +21,10 @@
import Call from "@hapi/call"; import Call from "@hapi/call";
import Subtext from "@hapi/subtext"; import Subtext from "@hapi/subtext";
import http from "http"; import type http from "http";
import path from "path"; import path from "path";
import { readFile } from "fs-extra"; import { readFile } from "fs-extra";
import { Cluster } from "./cluster"; import type { Cluster } from "./cluster";
import { apiPrefix, appName, publicPath, isDevelopment, webpackDevServerPort } from "../common/vars"; import { apiPrefix, appName, publicPath, isDevelopment, webpackDevServerPort } from "../common/vars";
import { HelmApiRoute, KubeconfigRoute, MetricsRoute, PortForwardRoute, ResourceApplierApiRoute, VersionRoute } from "./routes"; import { HelmApiRoute, KubeconfigRoute, MetricsRoute, PortForwardRoute, ResourceApplierApiRoute, VersionRoute } from "./routes";
import logger from "./logger"; import logger from "./logger";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { helmService } from "../helm/helm-service"; import { helmService } from "../helm/helm-service";
import { respondJson, respondText } from "../utils/http-responses"; import { respondJson, respondText } from "../utils/http-responses";
import logger from "../logger"; import logger from "../logger";

View File

@ -19,9 +19,9 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { respondJson } from "../utils/http-responses"; import { respondJson } from "../utils/http-responses";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { CoreV1Api, V1Secret } from "@kubernetes/client-node"; import { CoreV1Api, V1Secret } from "@kubernetes/client-node";
function generateKubeConfig(username: string, secret: V1Secret, cluster: Cluster) { function generateKubeConfig(username: string, secret: V1Secret, cluster: Cluster) {

View File

@ -20,10 +20,10 @@
*/ */
import _ from "lodash"; import _ from "lodash";
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { respondJson } from "../utils/http-responses"; import { respondJson } from "../utils/http-responses";
import { Cluster, ClusterMetadataKey } from "../cluster"; import { Cluster, ClusterMetadataKey } from "../cluster";
import { ClusterPrometheusMetadata } from "../../common/cluster-store"; import type { ClusterPrometheusMetadata } from "../../common/cluster-store";
import logger from "../logger"; import logger from "../logger";
import { getMetrics } from "../k8s-request"; import { getMetrics } from "../k8s-request";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { spawn, ChildProcessWithoutNullStreams } from "child_process"; import { spawn, ChildProcessWithoutNullStreams } from "child_process";
import { Kubectl } from "../kubectl"; import { Kubectl } from "../kubectl";
import { shell } from "electron"; import { shell } from "electron";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { respondJson, respondText } from "../utils/http-responses"; import { respondJson, respondText } from "../utils/http-responses";
import { ResourceApplier } from "../resource-applier"; import { ResourceApplier } from "../resource-applier";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { LensApiRequest } from "../router"; import type { LensApiRequest } from "../router";
import { respondJson } from "../utils/http-responses"; import { respondJson } from "../utils/http-responses";
import { getAppVersion } from "../../common/utils"; import { getAppVersion } from "../../common/utils";

View File

@ -19,11 +19,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import * as WebSocket from "ws"; import type * as WebSocket from "ws";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";
import * as k8s from "@kubernetes/client-node"; import * as k8s from "@kubernetes/client-node";
import { KubeConfig } from "@kubernetes/client-node"; import type { KubeConfig } from "@kubernetes/client-node";
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { ShellOpenError, ShellSession } from "./shell-session"; import { ShellOpenError, ShellSession } from "./shell-session";
export class NodeShellSession extends ShellSession { export class NodeShellSession extends ShellSession {

View File

@ -19,9 +19,9 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { Cluster } from "../cluster"; import type { Cluster } from "../cluster";
import { Kubectl } from "../kubectl"; import { Kubectl } from "../kubectl";
import * as WebSocket from "ws"; import type * as WebSocket from "ws";
import shellEnv from "shell-env"; import shellEnv from "shell-env";
import { app } from "electron"; import { app } from "electron";
import { clearKubeconfigEnvVars } from "../utils/clear-kube-env-vars"; import { clearKubeconfigEnvVars } from "../utils/clear-kube-env-vars";

View File

@ -25,7 +25,7 @@ import { Menu, Tray } from "electron";
import { autorun } from "mobx"; import { autorun } from "mobx";
import { showAbout } from "./menu"; import { showAbout } from "./menu";
import { checkForUpdates, isAutoUpdateEnabled } from "./app-updater"; import { checkForUpdates, isAutoUpdateEnabled } from "./app-updater";
import { WindowManager } from "./window-manager"; import type { WindowManager } from "./window-manager";
import { preferencesURL } from "../renderer/components/+preferences/preferences.route"; import { preferencesURL } from "../renderer/components/+preferences/preferences.route";
import logger from "./logger"; import logger from "./logger";
import { isDevelopment, isWindows, productName } from "../common/vars"; import { isDevelopment, isWindows, productName } from "../common/vars";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import { Readable } from "stream"; import type { Readable } from "stream";
import URLParse from "url-parse"; import URLParse from "url-parse";
interface GetPortArgs { interface GetPortArgs {

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import http from "http"; import type http from "http";
export function respondJson(res: http.ServerResponse, content: any, status = 200) { export function respondJson(res: http.ServerResponse, content: any, status = 200) {
respond(res, JSON.stringify(content), "application/json", status); respond(res, JSON.stringify(content), "application/json", status);

View File

@ -22,7 +22,7 @@
// Fix embedded kubeconfig paths under snap config // Fix embedded kubeconfig paths under snap config
import { migration } from "../migration-wrapper"; import { migration } from "../migration-wrapper";
import { ClusterModel } from "../../common/cluster-store"; import type { ClusterModel } from "../../common/cluster-store";
import { getAppVersion } from "../../common/utils/app-version"; import { getAppVersion } from "../../common/utils/app-version";
import fs from "fs"; import fs from "fs";

View File

@ -20,7 +20,7 @@
*/ */
// Cleans up a store that had the state related data stored // Cleans up a store that had the state related data stored
import { Hotbar } from "../../common/hotbar-store"; import type { Hotbar } from "../../common/hotbar-store";
import { ClusterStore } from "../../common/cluster-store"; import { ClusterStore } from "../../common/cluster-store";
import { migration } from "../migration-wrapper"; import { migration } from "../migration-wrapper";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";

View File

@ -20,7 +20,7 @@
*/ */
// Cleans up a store that had the state related data stored // Cleans up a store that had the state related data stored
import { Hotbar } from "../../common/hotbar-store"; import type { Hotbar } from "../../common/hotbar-store";
import { migration } from "../migration-wrapper"; import { migration } from "../migration-wrapper";
import * as uuid from "uuid"; import * as uuid from "uuid";

View File

@ -19,7 +19,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
import Config from "conf"; import type Config from "conf";
import { isTestEnv } from "../common/vars"; import { isTestEnv } from "../common/vars";
export interface MigrationOpts { export interface MigrationOpts {

View File

@ -20,7 +20,7 @@
*/ */
import { CustomResourceDefinition } from "../endpoints"; import { CustomResourceDefinition } from "../endpoints";
import { IKubeObjectMetadata } from "../kube-object"; import type { IKubeObjectMetadata } from "../kube-object";
describe("Crds", () => { describe("Crds", () => {
describe("getVersion", () => { describe("getVersion", () => {

View File

@ -21,7 +21,7 @@
import { navigate } from "../navigation"; import { navigate } from "../navigation";
import { commandRegistry } from "../../extensions/registries"; import { commandRegistry } from "../../extensions/registries";
import { CatalogEntity } from "../../common/catalog"; import type { CatalogEntity } from "../../common/catalog";
export { export {
CatalogCategory, CatalogCategory,

View File

@ -20,7 +20,7 @@
*/ */
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";

View File

@ -21,7 +21,7 @@
import moment from "moment"; import moment from "moment";
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { IPodContainer } from "./pods.api"; import type { IPodContainer } from "./pods.api";
import { formatDuration } from "../../utils/formatDuration"; import { formatDuration } from "../../utils/formatDuration";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";

View File

@ -20,7 +20,7 @@
*/ */
import get from "lodash/get"; import get from "lodash/get";
import { IPodContainer } from "./pods.api"; import type { IPodContainer } from "./pods.api";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import { IAffinity, WorkloadKubeObject } from "../workload-kube-object";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";

View File

@ -25,9 +25,9 @@ import { autobind, formatDuration } from "../../utils";
import capitalize from "lodash/capitalize"; import capitalize from "lodash/capitalize";
import { apiBase } from "../index"; import { apiBase } from "../index";
import { helmChartStore } from "../../components/+apps-helm-charts/helm-chart.store"; import { helmChartStore } from "../../components/+apps-helm-charts/helm-chart.store";
import { ItemObject } from "../../item.store"; import type { ItemObject } from "../../item.store";
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { JsonApiData } from "../json-api"; import type { JsonApiData } from "../json-api";
interface IReleasePayload { interface IReleasePayload {
name: string; name: string;

View File

@ -22,9 +22,9 @@
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 { IAffinity, WorkloadKubeObject } from "../workload-kube-object";
import { IPodContainer } from "./pods.api"; import type { IPodContainer } from "./pods.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { JsonApiParams } from "../json-api"; import type { JsonApiParams } from "../json-api";
@autobind() @autobind()
export class Job extends WorkloadKubeObject { export class Job extends WorkloadKubeObject {
@ -106,11 +106,7 @@ export class Job extends WorkloadKubeObject {
getCondition() { getCondition() {
// Type of Job condition could be only Complete or Failed // Type of Job condition could be only Complete or Failed
// https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#jobcondition-v1-batch // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#jobcondition-v1-batch
const { conditions } = this.status; return this.status.conditions?.find(({ status }) => status === "True");
if (!conditions) return;
return conditions.find(({ status }) => status === "True");
} }
getImages() { getImages() {

View File

@ -132,11 +132,11 @@ export function normalizeMetrics(metrics: IMetrics, frames = 60): IMetrics {
return metrics; return metrics;
} }
export function isMetricsEmpty(metrics: { [key: string]: IMetrics }) { export function isMetricsEmpty(metrics: Record<string, IMetrics>) {
return Object.values(metrics).every(metric => !metric?.data?.result?.length); return Object.values(metrics).every(metric => !metric?.data?.result?.length);
} }
export function getItemMetrics(metrics: { [key: string]: IMetrics }, itemName: string): { [key: string]: IMetrics } { export function getItemMetrics(metrics: Record<string, IMetrics>, itemName: string): Record<string, IMetrics> | void {
if (!metrics) return; if (!metrics) return;
const itemMetrics = { ...metrics }; const itemMetrics = { ...metrics };
@ -153,7 +153,7 @@ export function getItemMetrics(metrics: { [key: string]: IMetrics }, itemName: s
return itemMetrics; return itemMetrics;
} }
export function getMetricLastPoints(metrics: { [key: string]: IMetrics }) { export function getMetricLastPoints(metrics: Record<string, IMetrics>) {
const result: Partial<{ [metric: string]: number }> = {}; const result: Partial<{ [metric: string]: number }> = {};
Object.keys(metrics).forEach(metricName => { Object.keys(metrics).forEach(metricName => {

View File

@ -22,7 +22,7 @@
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { IMetrics, metricsApi } from "./metrics.api"; import { IMetrics, metricsApi } from "./metrics.api";
import { Pod } from "./pods.api"; import type { Pod } from "./pods.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
export class PersistentVolumeClaimsApi extends KubeApi<PersistentVolumeClaim> { export class PersistentVolumeClaimsApi extends KubeApi<PersistentVolumeClaim> {

View File

@ -61,7 +61,7 @@ export class PersistentVolume extends KubeObject {
}; };
}; };
status: { status?: {
phase: string; phase: string;
reason?: string; reason?: string;
}; };
@ -79,9 +79,7 @@ export class PersistentVolume extends KubeObject {
} }
getStatus() { getStatus() {
if (!this.status) return; return this.status?.phase || "-";
return this.status.phase || "-";
} }
getStorageClass(): string { getStorageClass(): string {

View File

@ -22,7 +22,7 @@
import get from "lodash/get"; import get from "lodash/get";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { WorkloadKubeObject } from "../workload-kube-object"; import { WorkloadKubeObject } from "../workload-kube-object";
import { IPodContainer, Pod } from "./pods.api"; import type { IPodContainer, Pod } from "./pods.api";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
export class ReplicaSetApi extends KubeApi<ReplicaSet> { export class ReplicaSetApi extends KubeApi<ReplicaSet> {

View File

@ -21,7 +21,7 @@
import jsYaml from "js-yaml"; import jsYaml from "js-yaml";
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { apiBase } from "../index"; import { apiBase } from "../index";
import { apiManager } from "../api-manager"; import { apiManager } from "../api-manager";

View File

@ -21,7 +21,7 @@
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";
import { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
export interface IResourceQuotaValues { export interface IResourceQuotaValues {
[quota: string]: string; [quota: string]: string;

View File

@ -20,7 +20,7 @@
*/ */
import { KubeObject } from "../kube-object"; import { KubeObject } from "../kube-object";
import { KubeJsonApiData } from "../kube-json-api"; import type { KubeJsonApiData } from "../kube-json-api";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";

View File

@ -20,7 +20,7 @@
*/ */
import get from "lodash/get"; import get from "lodash/get";
import { IPodContainer } from "./pods.api"; import type { IPodContainer } from "./pods.api";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object"; import { IAffinity, WorkloadKubeObject } from "../workload-kube-object";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { KubeApi } from "../kube-api"; import { KubeApi } from "../kube-api";

View File

@ -30,7 +30,7 @@ import { apiKube } from "./index";
import { createKubeApiURL, parseKubeApi } from "./kube-api-parse"; import { createKubeApiURL, parseKubeApi } from "./kube-api-parse";
import { IKubeObjectConstructor, KubeObject, KubeStatus } from "./kube-object"; import { IKubeObjectConstructor, KubeObject, KubeStatus } from "./kube-object";
import byline from "byline"; import byline from "byline";
import { IKubeWatchEvent } from "./kube-watch-api"; import type { IKubeWatchEvent } from "./kube-watch-api";
import { ReadableWebToNodeStream } from "../utils/readableStream"; import { ReadableWebToNodeStream } from "../utils/readableStream";
import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api"; import { KubeJsonApi, KubeJsonApiData } from "./kube-json-api";
import { noop } from "../utils"; import { noop } from "../utils";
@ -306,7 +306,7 @@ export class KubeApi<T extends KubeObject = any> {
} }
protected parseResponse(data: unknown, namespace?: string): T | T[] | null { protected parseResponse(data: unknown, namespace?: string): T | T[] | null {
if (!data) return; if (!data) return null;
const KubeObjectConstructor = this.objectConstructor; const KubeObjectConstructor = this.objectConstructor;
// process items list response, check before single item since there is overlap // process items list response, check before single item since there is overlap

View File

@ -22,11 +22,11 @@
// Base class for all kubernetes objects // Base class for all kubernetes objects
import moment from "moment"; import moment from "moment";
import { KubeJsonApiData, KubeJsonApiDataList, KubeJsonApiListMetadata, KubeJsonApiMetadata } from "./kube-json-api"; import type { KubeJsonApiData, KubeJsonApiDataList, KubeJsonApiListMetadata, KubeJsonApiMetadata } from "./kube-json-api";
import { autobind, formatDuration } from "../utils"; import { autobind, formatDuration } from "../utils";
import { ItemObject } from "../item.store"; import type { ItemObject } from "../item.store";
import { apiKube } from "./index"; import { apiKube } from "./index";
import { JsonApiParams } from "./json-api"; import type { JsonApiParams } from "./json-api";
import { resourceApplierApi } from "./endpoints/resource-applier.api"; import { resourceApplierApi } from "./endpoints/resource-applier.api";
import { hasOptionalProperty, hasTypedProperty, isObject, isString, bindPredicate, isTypedArray, isRecord } from "../../common/utils/type-narrowing"; import { hasOptionalProperty, hasTypedProperty, isObject, isString, bindPredicate, isTypedArray, isRecord } from "../../common/utils/type-narrowing";

View File

@ -28,8 +28,8 @@ import type { ClusterContext } from "../components/context";
import plimit from "p-limit"; import plimit from "p-limit";
import { comparer, IReactionDisposer, observable, reaction, when } from "mobx"; import { comparer, IReactionDisposer, observable, reaction, when } from "mobx";
import { autobind, noop } from "../utils"; import { autobind, noop } from "../utils";
import { KubeApi } from "./kube-api"; import type { KubeApi } from "./kube-api";
import { KubeJsonApiData } from "./kube-json-api"; import type { KubeJsonApiData } from "./kube-json-api";
import { isDebugging, isProduction } from "../../common/vars"; import { isDebugging, isProduction } from "../../common/vars";
export interface IKubeWatchEvent<T = KubeJsonApiData> { export interface IKubeWatchEvent<T = KubeJsonApiData> {

View File

@ -108,7 +108,7 @@ export class TerminalApi extends WebSocketApi {
@autobind() @autobind()
protected _onReady(data: string) { protected _onReady(data: string) {
if (!data) return; if (!data) return true;
this.isReady = true; this.isReady = true;
this.onReady.emit(); this.onReady.emit();
this.onData.removeListener(this._onReady); this.onData.removeListener(this._onReady);

View File

@ -22,11 +22,11 @@
import "./helm-charts.scss"; import "./helm-charts.scss";
import React, { Component } from "react"; import React, { Component } from "react";
import { RouteComponentProps } from "react-router"; import type { RouteComponentProps } from "react-router";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { helmChartsURL, IHelmChartsRouteParams } from "./helm-charts.route"; import { helmChartsURL, IHelmChartsRouteParams } from "./helm-charts.route";
import { helmChartStore } from "./helm-chart.store"; import { helmChartStore } from "./helm-chart.store";
import { HelmChart } from "../../api/endpoints/helm-charts.api"; import type { HelmChart } from "../../api/endpoints/helm-charts.api";
import { HelmChartDetails } from "./helm-chart-details"; import { HelmChartDetails } from "./helm-chart-details";
import { navigation } from "../../navigation"; import { navigation } from "../../navigation";
import { ItemListLayout } from "../item-object-list/item-list-layout"; import { ItemListLayout } from "../item-object-list/item-list-layout";

View File

@ -20,7 +20,7 @@
*/ */
import React from "react"; import React from "react";
import { HelmRelease } from "../../api/endpoints/helm-releases.api"; import type { HelmRelease } from "../../api/endpoints/helm-releases.api";
import { autobind, cssNames } from "../../utils"; import { autobind, cssNames } from "../../utils";
import { releaseStore } from "./release.store"; import { releaseStore } from "./release.store";
import { MenuActions, MenuActionsProps } from "../menu/menu-actions"; import { MenuActions, MenuActionsProps } from "../menu/menu-actions";
@ -56,7 +56,7 @@ export class HelmReleaseMenu extends React.Component<Props> {
renderContent() { renderContent() {
const { release, toolbar } = this.props; const { release, toolbar } = this.props;
if (!release) return; if (!release) return null;
const hasRollback = release && release.getRevision() > 1; const hasRollback = release && release.getRevision() > 1;
return ( return (

View File

@ -24,7 +24,7 @@ import { action, observable, reaction, when } from "mobx";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { createRelease, deleteRelease, HelmRelease, IReleaseCreatePayload, IReleaseUpdatePayload, listReleases, rollbackRelease, updateRelease } from "../../api/endpoints/helm-releases.api"; import { createRelease, deleteRelease, HelmRelease, IReleaseCreatePayload, IReleaseUpdatePayload, listReleases, rollbackRelease, updateRelease } from "../../api/endpoints/helm-releases.api";
import { ItemStore } from "../../item.store"; import { ItemStore } from "../../item.store";
import { Secret } from "../../api/endpoints"; import type { Secret } from "../../api/endpoints";
import { secretsStore } from "../+config-secrets/secrets.store"; import { secretsStore } from "../+config-secrets/secrets.store";
import { namespaceStore } from "../+namespaces/namespace.store"; import { namespaceStore } from "../+namespaces/namespace.store";
import { Notifications } from "../notifications"; import { Notifications } from "../notifications";
@ -146,8 +146,6 @@ export class ReleaseStore extends ItemStore<HelmRelease> {
} }
async removeSelectedItems() { async removeSelectedItems() {
if (!this.selectedItems.length) return;
return Promise.all(this.selectedItems.map(this.remove)); return Promise.all(this.selectedItems.map(this.remove));
} }
} }

View File

@ -24,10 +24,10 @@ import "./releases.scss";
import React, { Component } from "react"; import React, { Component } from "react";
import kebabCase from "lodash/kebabCase"; import kebabCase from "lodash/kebabCase";
import { disposeOnUnmount, observer } from "mobx-react"; import { disposeOnUnmount, observer } from "mobx-react";
import { RouteComponentProps } from "react-router"; import type { RouteComponentProps } from "react-router";
import { releaseStore } from "./release.store"; import { releaseStore } from "./release.store";
import { IReleaseRouteParams, releaseURL } from "./release.route"; import { IReleaseRouteParams, releaseURL } from "./release.route";
import { HelmRelease } from "../../api/endpoints/helm-releases.api"; import type { HelmRelease } from "../../api/endpoints/helm-releases.api";
import { ReleaseDetails } from "./release-details"; import { ReleaseDetails } from "./release-details";
import { ReleaseRollbackDialog } from "./release-rollback-dialog"; import { ReleaseRollbackDialog } from "./release-rollback-dialog";
import { navigation } from "../../navigation"; import { navigation } from "../../navigation";

View File

@ -26,7 +26,7 @@ import { Icon } from "../icon";
import { disposeOnUnmount, observer } from "mobx-react"; import { disposeOnUnmount, observer } from "mobx-react";
import { observable, reaction } from "mobx"; import { observable, reaction } from "mobx";
import { autobind } from "../../../common/utils"; import { autobind } from "../../../common/utils";
import { CatalogCategory, CatalogEntityAddMenuContext, CatalogEntityContextMenu } from "../../api/catalog-entity"; import type { CatalogCategory, CatalogEntityAddMenuContext, CatalogEntityContextMenu } from "../../api/catalog-entity";
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import { navigate } from "../../navigation"; import { navigate } from "../../navigation";

View File

@ -21,7 +21,7 @@
import { action, computed, IReactionDisposer, observable, reaction } from "mobx"; import { action, computed, IReactionDisposer, observable, reaction } from "mobx";
import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
import { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity"; import type { CatalogEntity, CatalogEntityActionContext } from "../../api/catalog-entity";
import { ItemObject, ItemStore } from "../../item.store"; import { ItemObject, ItemStore } from "../../item.store";
import { autobind } from "../../utils"; import { autobind } from "../../utils";
import { CatalogCategory } from "../../../common/catalog"; import { CatalogCategory } from "../../../common/catalog";

View File

@ -30,7 +30,7 @@ import { Table, TableCell, TableHead, TableRow } from "../table";
import { nodesStore } from "../+nodes/nodes.store"; import { nodesStore } from "../+nodes/nodes.store";
import { eventStore } from "../+events/event.store"; import { eventStore } from "../+events/event.store";
import { autobind, cssNames, prevDefault } from "../../utils"; import { autobind, cssNames, prevDefault } from "../../utils";
import { ItemObject } from "../../item.store"; import type { ItemObject } from "../../item.store";
import { Spinner } from "../spinner"; import { Spinner } from "../spinner";
import { ThemeStore } from "../../theme.store"; import { ThemeStore } from "../../theme.store";
import { lookupApiLink } from "../../api/kube-api"; import { lookupApiLink } from "../../api/kube-api";

View File

@ -23,7 +23,7 @@ import "./cluster-metrics.scss";
import React from "react"; import React from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { ChartOptions, ChartPoint } from "chart.js"; import type { ChartOptions, ChartPoint } from "chart.js";
import { clusterOverviewStore, MetricType } from "./cluster-overview.store"; import { clusterOverviewStore, MetricType } from "./cluster-overview.store";
import { BarChart } from "../chart"; import { BarChart } from "../chart";
import { bytesToUnits } from "../../utils"; import { bytesToUnits } from "../../utils";

View File

@ -100,7 +100,7 @@ export class HpaDetails extends React.Component<Props> {
render() { render() {
const { object: hpa } = this.props; const { object: hpa } = this.props;
if (!hpa) return; if (!hpa) return null;
const { scaleTargetRef } = hpa.spec; const { scaleTargetRef } = hpa.spec;
return ( return (

View File

@ -23,10 +23,10 @@ import "./hpa.scss";
import React from "react"; import React from "react";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { RouteComponentProps } from "react-router"; import type { RouteComponentProps } from "react-router";
import { KubeObjectListLayout } from "../kube-object"; import { KubeObjectListLayout } from "../kube-object";
import { IHpaRouteParams } from "./hpa.route"; import type { IHpaRouteParams } from "./hpa.route";
import { HorizontalPodAutoscaler } from "../../api/endpoints/hpa.api"; import type { HorizontalPodAutoscaler } from "../../api/endpoints/hpa.api";
import { hpaStore } from "./hpa.store"; import { hpaStore } from "./hpa.store";
import { Badge } from "../badge"; import { Badge } from "../badge";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";

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