1
0
mirror of https://github.com/lensapp/lens.git synced 2024-11-10 10:36:25 +03:00

Use @typescript-eslint/semi.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti 2020-11-19 18:12:28 +02:00
parent 0b182ccf6f
commit 460dfe4d2b
179 changed files with 556 additions and 554 deletions

View File

@ -49,7 +49,8 @@ module.exports = {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-interface": "off",
"indent": ["error", 2],
"semi": ["error", "always"],
"semi": "off",
"@typescript-eslint/semi": ["error"],
},
},
{
@ -78,7 +79,8 @@ module.exports = {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-function": "off",
"indent": ["error", 2],
"semi": ["error", "always"],
"semi": "off",
"@typescript-eslint/semi": ["error"],
},
}
]

View File

@ -7,10 +7,10 @@ import { ensureDir, pathExists } from "fs-extra";
import path from "path";
class KubectlDownloader {
public kubectlVersion: string
protected url: string
public kubectlVersion: string;
protected url: string;
protected path: string;
protected dirname: string
protected dirname: string;
constructor(clusterVersion: string, platform: string, arch: string, target: string) {
this.kubectlVersion = clusterVersion;

View File

@ -4,6 +4,6 @@ export type AppEvent = {
name: string;
action: string;
params?: object;
}
};
export const appEventBus = new EventEmitter<[AppEvent]>();

View File

@ -4,7 +4,7 @@ export type KubeResource =
"namespaces" | "nodes" | "events" | "resourcequotas" |
"services" | "secrets" | "configmaps" | "ingresses" | "networkpolicies" | "persistentvolumes" | "storageclasses" |
"pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" |
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets"
"endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets";
export interface KubeApiResource {
resource: KubeResource; // valid resource name

View File

@ -31,7 +31,7 @@ export interface UserPreferences {
}
export class UserStore extends BaseStore<UserStoreModel> {
static readonly defaultTheme: ThemeId = "lens-dark"
static readonly defaultTheme: ThemeId = "lens-dark";
private constructor() {
super({
@ -42,7 +42,7 @@ export class UserStore extends BaseStore<UserStoreModel> {
this.handleOnLoad();
}
@observable lastSeenAppVersion = "0.0.0"
@observable lastSeenAppVersion = "0.0.0";
@observable kubeConfigPath = kubeConfigDefaultPath; // used in add-cluster page for providing context
@observable seenContexts = observable.set<string>();
@observable newContexts = observable.set<string>();
@ -113,7 +113,7 @@ export class UserStore extends BaseStore<UserStoreModel> {
logger.error(err);
this.resetKubeConfigPath();
}
}
};
@action
markNewContextsAsSeen() {

View File

@ -25,11 +25,11 @@ export interface WorkspaceState {
}
export class Workspace implements WorkspaceModel, WorkspaceState {
@observable id: WorkspaceId
@observable name: string
@observable description?: string
@observable ownerRef?: string
@observable enabled: boolean
@observable id: WorkspaceId;
@observable name: string;
@observable description?: string;
@observable ownerRef?: string;
@observable enabled: boolean;
constructor(data: WorkspaceModel) {
Object.assign(this, data);
@ -72,7 +72,7 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
}
export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
static readonly defaultId: WorkspaceId = "default"
static readonly defaultId: WorkspaceId = "default";
private constructor() {
super({

View File

@ -26,7 +26,7 @@ export abstract class ClusterFeature {
installed: false,
latestVersion: null,
canUpgrade: false
}
};
abstract async install(cluster: Cluster): Promise<void>;

View File

@ -18,7 +18,7 @@ export function extensionPackagesRoot() {
export class ExtensionLoader {
protected extensions = observable.map<LensExtensionId, InstalledExtension>();
protected instances = observable.map<LensExtensionId, LensExtension>();
protected readonly requestExtensionsChannel = "extensions:loaded"
protected readonly requestExtensionsChannel = "extensions:loaded";
@observable isLoaded = false;
whenLoaded = when(() => this.isLoaded);

View File

@ -16,19 +16,19 @@ export interface InstalledExtension {
type Dependencies = {
[name: string]: string;
}
};
type PackageJson = {
dependencies: Dependencies;
}
};
export class ExtensionManager {
protected bundledFolderPath: string
protected bundledFolderPath: string;
protected packagesJson: PackageJson = {
dependencies: {}
}
};
get extensionPackagesRoot() {
return extensionPackagesRoot();

View File

@ -3,7 +3,7 @@ import * as path from "path";
import { LensExtension } from "./lens-extension";
export abstract class ExtensionStore<T> extends BaseStore<T> {
protected extension: LensExtension
protected extension: LensExtension;
async loadExtension(extension: LensExtension) {
this.extension = extension;

View File

@ -5,7 +5,7 @@ import { WindowManager } from "../main/window-manager";
import { getExtensionPageUrl } from "./registries/page-registry";
export class LensMainExtension extends LensExtension {
@observable.shallow appMenus: MenuRegistration[] = []
@observable.shallow appMenus: MenuRegistration[] = [];
async navigate<P extends object>(pageId?: string, params?: P, frameId?: number) {
const windowManager = WindowManager.getInstance<WindowManager>();

View File

@ -4,16 +4,16 @@ import { LensExtension } from "./lens-extension";
import { getExtensionPageUrl } from "./registries/page-registry";
export class LensRendererExtension extends LensExtension {
@observable.shallow globalPages: PageRegistration[] = []
@observable.shallow clusterPages: PageRegistration[] = []
@observable.shallow globalPageMenus: PageMenuRegistration[] = []
@observable.shallow clusterPageMenus: PageMenuRegistration[] = []
@observable.shallow kubeObjectStatusTexts: KubeObjectStatusRegistration[] = []
@observable.shallow appPreferences: AppPreferenceRegistration[] = []
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = []
@observable.shallow statusBarItems: StatusBarRegistration[] = []
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = []
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = []
@observable.shallow globalPages: PageRegistration[] = [];
@observable.shallow clusterPages: PageRegistration[] = [];
@observable.shallow globalPageMenus: PageMenuRegistration[] = [];
@observable.shallow clusterPageMenus: PageMenuRegistration[] = [];
@observable.shallow kubeObjectStatusTexts: KubeObjectStatusRegistration[] = [];
@observable.shallow appPreferences: AppPreferenceRegistration[] = [];
@observable.shallow clusterFeatures: ClusterFeatureRegistration[] = [];
@observable.shallow statusBarItems: StatusBarRegistration[] = [];
@observable.shallow kubeObjectDetailItems: KubeObjectDetailRegistration[] = [];
@observable.shallow kubeObjectMenuItems: KubeObjectMenuRegistration[] = [];
async navigate<P extends object>(pageId?: string, params?: P) {
const { navigate } = await import("../renderer/navigation");

View File

@ -2,7 +2,7 @@ export type KubeObjectStatus = {
level: KubeObjectStatusLevel;
text: string;
timestamp?: string;
}
};
export enum KubeObjectStatusLevel {
INFO = 1,

View File

@ -2,7 +2,7 @@ import { autoUpdater } from "electron-updater";
import logger from "./logger";
export class AppUpdater {
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24 // once a day
static readonly defaultUpdateIntervalMs = 1000 * 60 * 60 * 24; // once a day
static checkForUpdates() {
return autoUpdater.checkForUpdatesAndNotify();

View File

@ -4,11 +4,11 @@ import { Cluster } from "../cluster";
export type ClusterDetectionResult = {
value: string | number | boolean
accuracy: number
}
};
export class BaseClusterDetector {
cluster: Cluster
key: string
cluster: Cluster;
key: string;
constructor(cluster: Cluster) {
this.cluster = cluster;

View File

@ -3,7 +3,7 @@ import { createHash } from "crypto";
import { ClusterMetadataKey } from "../cluster";
export class ClusterIdDetector extends BaseClusterDetector {
key = ClusterMetadataKey.CLUSTER_ID
key = ClusterMetadataKey.CLUSTER_ID;
public async detect() {
let id: string;

View File

@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class DistributionDetector extends BaseClusterDetector {
key = ClusterMetadataKey.DISTRIBUTION
version: string
key = ClusterMetadataKey.DISTRIBUTION;
version: string;
public async detect() {
this.version = await this.getKubernetesVersion();

View File

@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class LastSeenDetector extends BaseClusterDetector {
key = ClusterMetadataKey.LAST_SEEN
key = ClusterMetadataKey.LAST_SEEN;
public async detect() {
if (!this.cluster.accessible) return null;

View File

@ -2,7 +2,7 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class NodesCountDetector extends BaseClusterDetector {
key = ClusterMetadataKey.NODES_COUNT
key = ClusterMetadataKey.NODES_COUNT;
public async detect() {
if (!this.cluster.accessible) return null;

View File

@ -2,8 +2,8 @@ import { BaseClusterDetector } from "./base-cluster-detector";
import { ClusterMetadataKey } from "../cluster";
export class VersionDetector extends BaseClusterDetector {
key = ClusterMetadataKey.VERSION
value: string
key = ClusterMetadataKey.VERSION;
value: string;
public async detect() {
const version = await this.getKubernetesVersion();

View File

@ -32,7 +32,7 @@ export enum ClusterMetadataKey {
export type ClusterRefreshOptions = {
refreshMetadata?: boolean
}
};
export interface ClusterState {
initialized: boolean;
@ -50,7 +50,7 @@ export interface ClusterState {
export class Cluster implements ClusterModel, ClusterState {
public id: ClusterId;
public kubeCtl: Kubectl
public kubeCtl: Kubectl;
public contextHandler: ContextHandler;
public ownerRef: string;
protected kubeconfigManager: KubeconfigManager;

View File

@ -12,10 +12,10 @@ import { KubeAuthProxy } from "./kube-auth-proxy";
export class ContextHandler {
public proxyPort: number;
public clusterUrl: UrlWithStringQuery;
protected kubeAuthProxy: KubeAuthProxy
protected apiTarget: httpProxy.ServerOptions
protected prometheusProvider: string
protected prometheusPath: string
protected kubeAuthProxy: KubeAuthProxy;
protected apiTarget: httpProxy.ServerOptions;
protected prometheusProvider: string;
protected prometheusPath: string;
constructor(protected cluster: Cluster) {
this.clusterUrl = url.parse(cluster.apiUrl);

View File

@ -7,11 +7,11 @@ import { helmCli } from "./helm-cli";
type CachedYaml = {
entries: any; // todo: types
}
};
export class HelmChartManager {
protected cache: any = {}
protected repo: HelmRepo
protected cache: any = {};
protected repo: HelmRepo;
constructor(repo: HelmRepo){
this.cache = HelmRepoManager.cache;

View File

@ -10,7 +10,7 @@ import logger from "../logger";
export type HelmEnv = Record<string, string> & {
HELM_REPOSITORY_CACHE?: string;
HELM_REPOSITORY_CONFIG?: string;
}
};
export interface HelmRepoConfig {
repositories: HelmRepo[]
@ -29,11 +29,11 @@ export interface HelmRepo {
}
export class HelmRepoManager extends Singleton {
static cache = {} // todo: remove implicit updates in helm-chart-manager.ts
static cache = {}; // todo: remove implicit updates in helm-chart-manager.ts
protected repos: HelmRepo[];
protected helmEnv: HelmEnv
protected initialized: boolean
protected helmEnv: HelmEnv;
protected initialized: boolean;
async loadAvailableRepos(): Promise<HelmRepo[]> {
const res = await customRequestPromise({

View File

@ -12,13 +12,13 @@ export interface KubeAuthProxyLog {
}
export class KubeAuthProxy {
public lastError: string
public lastError: string;
protected cluster: Cluster
protected env: NodeJS.ProcessEnv = null
protected proxyProcess: ChildProcess
protected port: number
protected kubectl: Kubectl
protected cluster: Cluster;
protected env: NodeJS.ProcessEnv = null;
protected proxyProcess: ChildProcess;
protected port: number;
protected kubectl: Kubectl;
constructor(cluster: Cluster, port: number, env: NodeJS.ProcessEnv) {
this.env = env;

View File

@ -8,7 +8,7 @@ import { dumpConfigYaml, loadConfig } from "../common/kube-helpers";
import logger from "./logger";
export class KubeconfigManager {
protected configDir = app.getPath("temp")
protected configDir = app.getPath("temp");
protected tempFile: string;
private constructor(protected cluster: Cluster, protected contextHandler: ContextHandler, protected port: number) { }

View File

@ -54,18 +54,18 @@ export function bundledKubectlPath(): string {
}
export class Kubectl {
public kubectlVersion: string
protected directory: string
protected url: string
protected path: string
protected dirname: string
public kubectlVersion: string;
protected directory: string;
protected url: string;
protected path: string;
protected dirname: string;
static get kubectlDir() {
return path.join((app || remote.app).getPath("userData"), "binaries", "kubectl");
}
public static readonly bundledKubectlVersion: string = bundledVersion
public static invalidBundle = false
public static readonly bundledKubectlVersion: string = bundledVersion;
public static invalidBundle = false;
private static bundledInstance: Kubectl;
// Returns the single bundled Kubectl instance

View File

@ -12,22 +12,22 @@ export type LensBinaryOpts = {
originalBinaryName: string;
newBinaryName?: string;
requestOpts?: request.Options;
}
};
export class LensBinary {
public binaryVersion: string
protected directory: string
protected url: string
public binaryVersion: string;
protected directory: string;
protected url: string;
protected path: string;
protected tarPath: string;
protected dirname: string
protected binaryName: string
protected platformName: string
protected arch: string
protected originalBinaryName: string
protected requestOpts: request.Options
protected logger: Console | winston.Logger
protected dirname: string;
protected binaryName: string;
protected platformName: string;
protected arch: string;
protected originalBinaryName: string;
protected requestOpts: request.Options;
protected logger: Console | winston.Logger;
constructor(opts: LensBinaryOpts) {
const baseDir = opts.baseDir;

View File

@ -12,11 +12,11 @@ import { ContextHandler } from "./context-handler";
import logger from "./logger";
export class LensProxy {
protected origin: string
protected proxyServer: http.Server
protected router: Router
protected closed = false
protected retryCounters = new Map<string, number>()
protected origin: string;
protected proxyServer: http.Server;
protected router: Router;
protected closed = false;
protected retryCounters = new Map<string, number>();
static create(port: number, clusterManager: ClusterManager) {
return new LensProxy(port, clusterManager).listen();

View File

@ -11,7 +11,7 @@ import { menuRegistry } from "../extensions/registries/menu-registry";
import logger from "./logger";
import { exitApp } from "./exit-app";
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help"
export type MenuTopId = "mac" | "file" | "edit" | "view" | "help";
export function initMenu(windowManager: WindowManager) {
return autorun(() => buildMenu(windowManager), {

View File

@ -10,8 +10,8 @@ import { appEventBus } from "../common/event-bus";
export class NodeShellSession extends ShellSession {
protected nodeName: string;
protected podId: string
protected kc: KubeConfig
protected podId: string;
protected kc: KubeConfig;
constructor(socket: WebSocket, cluster: Cluster, nodeName: string) {
super(socket, cluster);

View File

@ -10,15 +10,15 @@ jest.mock("net", () => {
listen = jest.fn(() => {
this.emit('listening');
return this;
})
});
address = () => {
newPort = Math.round(Math.random() * 10000);
return {
port: newPort
};
}
unref = jest.fn()
close = jest.fn(cb => cb())
};
unref = jest.fn();
close = jest.fn(cb => cb());
};
},
};

View File

@ -4,9 +4,9 @@ import { PrometheusService } from "./provider-registry";
import logger from "../logger";
export class PrometheusHelm extends PrometheusLens {
id = "helm"
name = "Helm"
rateAccuracy = "5m"
id = "helm";
name = "Helm";
rateAccuracy = "5m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
const labelSelector = "app=prometheus,component=server,heritage=Helm";

View File

@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusLens implements PrometheusProvider {
id = "lens"
name = "Lens"
rateAccuracy = "1m"
id = "lens";
name = "Lens";
rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {

View File

@ -3,9 +3,9 @@ import { CoreV1Api, V1Service } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusOperator implements PrometheusProvider {
rateAccuracy = "1m"
id = "operator"
name = "Prometheus Operator"
rateAccuracy = "1m";
id = "operator";
name = "Prometheus Operator";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {

View File

@ -11,7 +11,7 @@ export type PrometheusClusterQuery = {
cpuCapacity: string;
podUsage: string;
podCapacity: string;
}
};
export type PrometheusNodeQuery = {
memoryUsage: string;
@ -20,7 +20,7 @@ export type PrometheusNodeQuery = {
cpuCapacity: string;
fsSize: string;
fsUsage: string;
}
};
export type PrometheusPodQuery = {
memoryUsage: string;
@ -32,32 +32,32 @@ export type PrometheusPodQuery = {
fsUsage: string;
networkReceive: string;
networkTransmit: string;
}
};
export type PrometheusPvcQuery = {
diskUsage: string;
diskCapacity: string;
}
};
export type PrometheusIngressQuery = {
bytesSentSuccess: string;
bytesSentFailure: string;
requestDurationSeconds: string;
responseDurationSeconds: string;
}
};
export type PrometheusQueryOpts = {
[key: string]: string | any;
};
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery
export type PrometheusQuery = PrometheusNodeQuery | PrometheusClusterQuery | PrometheusPodQuery | PrometheusPvcQuery | PrometheusIngressQuery;
export type PrometheusService = {
id: string;
namespace: string;
service: string;
port: number;
}
};
export interface PrometheusProvider {
id: string;
@ -68,10 +68,10 @@ export interface PrometheusProvider {
export type PrometheusProviderList = {
[key: string]: PrometheusProvider;
}
};
export class PrometheusProviderRegistry {
private static prometheusProviders: PrometheusProviderList = {}
private static prometheusProviders: PrometheusProviderList = {};
static getProvider(type: string): PrometheusProvider {
if (!this.prometheusProviders[type]) {

View File

@ -3,9 +3,9 @@ import { CoreV1Api } from "@kubernetes/client-node";
import logger from "../logger";
export class PrometheusStacklight implements PrometheusProvider {
id = "stacklight"
name = "Stacklight"
rateAccuracy = "1m"
id = "stacklight";
name = "Stacklight";
rateAccuracy = "1m";
public async getPrometheusService(client: CoreV1Api): Promise<PrometheusService> {
try {

View File

@ -5,7 +5,7 @@ import _ from "lodash";
export type IMetricsQuery = string | string[] | {
[metricName: string]: string;
}
};
// This is used for backoff retry tracking.
const MAX_ATTEMPTS = 5;

View File

@ -8,7 +8,7 @@ import * as tcpPortUsed from "tcp-port-used";
import logger from "../logger";
class PortForward {
public static portForwards: PortForward[] = []
public static portForwards: PortForward[] = [];
static getPortforward(forward: {clusterId: string; kind: string; name: string; namespace: string; port: string}) {
return PortForward.portForwards.find((pf) => {
@ -22,14 +22,14 @@ class PortForward {
});
}
public clusterId: string
public process: ChildProcessWithoutNullStreams
public kubeConfig: string
public kind: string
public namespace: string
public name: string
public port: string
public localPort: number
public clusterId: string;
public process: ChildProcessWithoutNullStreams;
public kubeConfig: string;
public kind: string;
public namespace: string;
public name: string;
public port: string;
public localPort: number;
constructor(obj: any) {
Object.assign(this, obj);

View File

@ -6,12 +6,12 @@ import { Request } from "request";
import logger from "../logger";
class ApiWatcher {
private apiUrl: string
private response: ServerResponse
private watchRequest: Request
private watch: Watch
private processor: NodeJS.Timeout
private eventBuffer: any[] = []
private apiUrl: string;
private response: ServerResponse;
private watchRequest: Request;
private watch: Watch;
private processor: NodeJS.Timeout;
private eventBuffer: any[] = [];
constructor(apiUrl: string, kubeConfig: KubeConfig, response: ServerResponse) {
this.apiUrl = apiUrl;

View File

@ -13,11 +13,11 @@ import { appEventBus } from "../common/event-bus";
import { userStore } from "../common/user-store";
export class ShellSession extends EventEmitter {
static shellEnvs: Map<string, any> = new Map()
static shellEnvs: Map<string, any> = new Map();
protected websocket: WebSocket
protected shellProcess: pty.IPty
protected kubeconfigPath: string
protected websocket: WebSocket;
protected shellProcess: pty.IPty;
protected kubeconfigPath: string;
protected nodeShellPod: string;
protected kubectl: Kubectl;
protected kubectlBinDir: string;

View File

@ -2,9 +2,9 @@ import { RoleBinding } from "./role-binding.api";
import { KubeApi } from "../kube-api";
export class ClusterRoleBinding extends RoleBinding {
static kind = "ClusterRoleBinding"
static namespaced = false
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings"
static kind = "ClusterRoleBinding";
static namespaced = false;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings";
}
export const clusterRoleBindingApi = new KubeApi({

View File

@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class ClusterRole extends Role {
static kind = "ClusterRole"
static namespaced = false
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles"
static kind = "ClusterRole";
static namespaced = false;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/clusterroles";
}
export const clusterRoleApi = new KubeApi({

View File

@ -3,8 +3,8 @@ import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api";
export class ClusterApi extends KubeApi<Cluster> {
static kind = "Cluster"
static namespaced = true
static kind = "Cluster";
static namespaced = true;
async getMetrics(nodeNames: string[], params?: IMetricsReqParams): Promise<IClusterMetrics> {
const nodes = nodeNames.join("|");
@ -52,7 +52,7 @@ export interface IClusterMetrics<T = IMetrics> {
export class Cluster extends KubeObject {
static kind = "Cluster";
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters"
static apiBase = "/apis/cluster.k8s.io/v1alpha1/clusters";
spec: {
clusterNetwork?: {
@ -69,7 +69,7 @@ export class Cluster extends KubeObject {
profile: string;
};
};
}
};
status?: {
apiEndpoints: {
host: string;
@ -84,7 +84,7 @@ export class Cluster extends KubeObject {
};
errorMessage?: string;
errorReason?: string;
}
};
getStatus() {
if (this.metadata.deletionTimestamp) return ClusterStatus.REMOVING;

View File

@ -8,11 +8,11 @@ export interface IComponentStatusCondition {
}
export class ComponentStatus extends KubeObject {
static kind = "ComponentStatus"
static namespaced = false
static apiBase = "/api/v1/componentstatuses"
static kind = "ComponentStatus";
static namespaced = false;
static apiBase = "/api/v1/componentstatuses";
conditions: IComponentStatusCondition[]
conditions: IComponentStatusCondition[];
getTruthyConditions() {
return this.conditions.filter(c => c.status === "True");

View File

@ -7,7 +7,7 @@ import { KubeApi } from "../kube-api";
export class ConfigMap extends KubeObject {
static kind = "ConfigMap";
static namespaced = true;
static apiBase = "/api/v1/configmaps"
static apiBase = "/api/v1/configmaps";
constructor(data: KubeJsonApiData) {
super(data);
@ -16,7 +16,7 @@ export class ConfigMap extends KubeObject {
data: {
[param: string]: string;
}
};
getKeys(): string[] {
return Object.keys(this.data);

View File

@ -7,20 +7,20 @@ type AdditionalPrinterColumnsCommon = {
type: "integer" | "number" | "string" | "boolean" | "date";
priority: number;
description: string;
}
};
export type AdditionalPrinterColumnsV1 = AdditionalPrinterColumnsCommon & {
jsonPath: string;
}
};
type AdditionalPrinterColumnsV1Beta = AdditionalPrinterColumnsCommon & {
JSONPath: string;
}
};
export class CustomResourceDefinition extends KubeObject {
static kind = "CustomResourceDefinition";
static namespaced = false;
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions"
static apiBase = "/apis/apiextensions.k8s.io/v1/customresourcedefinitions";
spec: {
group: string;
@ -45,7 +45,7 @@ export class CustomResourceDefinition extends KubeObject {
webhook?: any;
};
additionalPrinterColumns?: AdditionalPrinterColumnsV1Beta[]; // removed in v1
}
};
status: {
conditions: {
lastTransitionTime: string;
@ -62,7 +62,7 @@ export class CustomResourceDefinition extends KubeObject {
listKind: string;
};
storedVersions: string[];
}
};
getResourceUrl() {
return crdResourcesURL({

View File

@ -7,12 +7,12 @@ import { KubeApi } from "../kube-api";
@autobind()
export class CronJob extends KubeObject {
static kind = "CronJob"
static namespaced = true
static apiBase = "/apis/batch/v1beta1/cronjobs"
static kind = "CronJob";
static namespaced = true;
static apiBase = "/apis/batch/v1beta1/cronjobs";
kind: string
apiVersion: string
kind: string;
apiVersion: string;
metadata: {
name: string;
namespace: string;
@ -26,7 +26,7 @@ export class CronJob extends KubeObject {
annotations: {
[key: string]: string;
};
}
};
spec: {
schedule: string;
concurrencyPolicy: string;
@ -59,10 +59,10 @@ export class CronJob extends KubeObject {
};
successfulJobsHistoryLimit: number;
failedJobsHistoryLimit: number;
}
};
status: {
lastScheduleTime?: string;
}
};
getSuspendFlag() {
return this.spec.suspend.toString();

View File

@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class DaemonSet extends WorkloadKubeObject {
static kind = "DaemonSet"
static namespaced = true
static apiBase = "/apis/apps/v1/daemonsets"
static kind = "DaemonSet";
static namespaced = true;
static apiBase = "/apis/apps/v1/daemonsets";
spec: {
selector: {
@ -51,7 +51,7 @@ export class DaemonSet extends WorkloadKubeObject {
};
};
revisionHistoryLimit: number;
}
};
status: {
currentNumberScheduled: number;
numberMisscheduled: number;
@ -61,7 +61,7 @@ export class DaemonSet extends WorkloadKubeObject {
updatedNumberScheduled: number;
numberAvailable: number;
numberUnavailable: number;
}
};
getImages() {
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);

View File

@ -48,9 +48,9 @@ export class DeploymentApi extends KubeApi<Deployment> {
@autobind()
export class Deployment extends WorkloadKubeObject {
static kind = "Deployment"
static namespaced = true
static apiBase = "/apis/apps/v1/deployments"
static kind = "Deployment";
static namespaced = true;
static apiBase = "/apis/apps/v1/deployments";
spec: {
replicas: number;
@ -151,7 +151,7 @@ export class Deployment extends WorkloadKubeObject {
maxSurge: number;
};
};
}
};
status: {
observedGeneration: number;
replicas: number;
@ -167,7 +167,7 @@ export class Deployment extends WorkloadKubeObject {
reason: string;
message: string;
}[];
}
};
getConditions(activeOnly = false) {
const { conditions } = this.status;

View File

@ -98,11 +98,11 @@ export class EndpointSubset implements IEndpointSubset {
@autobind()
export class Endpoint extends KubeObject {
static kind = "Endpoints"
static namespaced = true
static apiBase = "/api/v1/endpoints"
static kind = "Endpoints";
static namespaced = true;
static apiBase = "/api/v1/endpoints";
subsets: IEndpointSubset[]
subsets: IEndpointSubset[];
getEndpointSubsets(): EndpointSubset[] {
const subsets = this.subsets || [];

View File

@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class KubeEvent extends KubeObject {
static kind = "Event"
static namespaced = true
static apiBase = "/api/v1/events"
static kind = "Event";
static namespaced = true;
static apiBase = "/api/v1/events";
involvedObject: {
kind: string;
@ -18,20 +18,20 @@ export class KubeEvent extends KubeObject {
apiVersion: string;
resourceVersion: string;
fieldPath: string;
}
reason: string
message: string
};
reason: string;
message: string;
source: {
component: string;
host: string;
}
firstTimestamp: string
lastTimestamp: string
count: number
type: string
eventTime: null
reportingComponent: string
reportingInstance: string
};
firstTimestamp: string;
lastTimestamp: string;
count: number;
type: string;
eventTime: null;
reportingComponent: string;
reportingInstance: string;
isWarning() {
return this.type === "Warning";

View File

@ -61,27 +61,27 @@ export class HelmChart {
return new HelmChart(data);
}
apiVersion: string
name: string
version: string
repo: string
kubeVersion?: string
created: string
description?: string
digest: string
keywords?: string[]
home?: string
sources?: string[]
apiVersion: string;
name: string;
version: string;
repo: string;
kubeVersion?: string;
created: string;
description?: string;
digest: string;
keywords?: string[];
home?: string;
sources?: string[];
maintainers?: {
name: string;
email: string;
url: string;
}[]
engine?: string
icon?: string
appVersion?: string
deprecated?: boolean
tillerVersion?: string
}[];
engine?: string;
icon?: string;
appVersion?: string;
deprecated?: boolean;
tillerVersion?: string;
getId() {
return this.digest;

View File

@ -135,13 +135,13 @@ export class HelmRelease implements ItemObject {
return new HelmRelease(data);
}
appVersion: string
name: string
namespace: string
chart: string
status: string
updated: string
revision: string
appVersion: string;
name: string;
namespace: string;
chart: string;
status: string;
updated: string;
revision: string;
getId() {
return this.namespace + this.name;

View File

@ -20,7 +20,7 @@ export type IHpaMetricData<T = any> = T & {
currentAverageValue?: string;
targetAverageUtilization?: number;
targetAverageValue?: string;
}
};
export interface IHpaMetric {
[kind: string]: IHpaMetricData;
@ -41,7 +41,7 @@ export interface IHpaMetric {
export class HorizontalPodAutoscaler extends KubeObject {
static kind = "HorizontalPodAutoscaler";
static namespaced = true;
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers"
static apiBase = "/apis/autoscaling/v2beta1/horizontalpodautoscalers";
spec: {
scaleTargetRef: {
@ -52,7 +52,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
minReplicas: number;
maxReplicas: number;
metrics: IHpaMetric[];
}
};
status: {
currentReplicas: number;
desiredReplicas: number;
@ -64,7 +64,7 @@ export class HorizontalPodAutoscaler extends KubeObject {
status: string;
type: string;
}[];
}
};
getMaxPods() {
return this.spec.maxReplicas || 0;

View File

@ -31,9 +31,9 @@ export interface ILoadBalancerIngress {
}
@autobind()
export class Ingress extends KubeObject {
static kind = "Ingress"
static namespaced = true
static apiBase = "/apis/extensions/v1beta1/ingresses"
static kind = "Ingress";
static namespaced = true;
static apiBase = "/apis/extensions/v1beta1/ingresses";
spec: {
tls: {
@ -55,12 +55,12 @@ export class Ingress extends KubeObject {
serviceName: string;
servicePort: number;
};
}
};
status: {
loadBalancer: {
ingress: ILoadBalancerIngress[];
};
}
};
getRoutes() {
const { spec: { tls, rules } } = this;

View File

@ -7,9 +7,9 @@ import { JsonApiParams } from "../json-api";
@autobind()
export class Job extends WorkloadKubeObject {
static kind = "Job"
static namespaced = true
static apiBase = "/apis/batch/v1/jobs"
static kind = "Job";
static namespaced = true;
static apiBase = "/apis/batch/v1/jobs";
spec: {
parallelism?: number;
@ -56,7 +56,7 @@ export class Job extends WorkloadKubeObject {
serviceAccountName?: string;
serviceAccount?: string;
schedulerName?: string;
}
};
status: {
conditions: {
type: string;
@ -68,7 +68,7 @@ export class Job extends WorkloadKubeObject {
startTime: string;
completionTime: string;
succeeded: number;
}
};
getDesiredCompletions() {
return this.spec.completions || 0;

View File

@ -15,7 +15,7 @@ export class Namespace extends KubeObject {
status?: {
phase: string;
}
};
getStatus() {
return this.status ? this.status.phase : "-";

View File

@ -37,9 +37,9 @@ export interface IPolicyEgress {
@autobind()
export class NetworkPolicy extends KubeObject {
static kind = "NetworkPolicy"
static namespaced = true
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies"
static kind = "NetworkPolicy";
static namespaced = true;
static apiBase = "/apis/networking.k8s.io/v1/networkpolicies";
spec: {
podSelector: {
@ -51,7 +51,7 @@ export class NetworkPolicy extends KubeObject {
policyTypes: string[];
ingress: IPolicyIngress[];
egress: IPolicyEgress[];
}
};
getMatchLabels(): string[] {
if (!this.spec.podSelector || !this.spec.podSelector.matchLabels) return [];

View File

@ -30,9 +30,9 @@ export interface INodeMetrics<T = IMetrics> {
@autobind()
export class Node extends KubeObject {
static kind = "Node"
static namespaced = false
static apiBase = "/api/v1/nodes"
static kind = "Node";
static namespaced = false;
static apiBase = "/api/v1/nodes";
spec: {
podCIDR: string;
@ -43,7 +43,7 @@ export class Node extends KubeObject {
effect: string;
}[];
unschedulable?: boolean;
}
};
status: {
capacity: {
cpu: string;
@ -83,7 +83,7 @@ export class Node extends KubeObject {
names: string[];
sizeBytes: number;
}[];
}
};
getNodeConditionText() {
const { conditions } = this.status;

View File

@ -23,9 +23,9 @@ export interface IPvcMetrics<T = IMetrics> {
@autobind()
export class PersistentVolumeClaim extends KubeObject {
static kind = "PersistentVolumeClaim"
static namespaced = true
static apiBase = "/api/v1/persistentvolumeclaims"
static kind = "PersistentVolumeClaim";
static namespaced = true;
static apiBase = "/api/v1/persistentvolumeclaims";
spec: {
accessModes: string[];
@ -45,10 +45,10 @@ export class PersistentVolumeClaim extends KubeObject {
storage: string; // 8Gi
};
};
}
};
status: {
phase: string; // Pending
}
};
getPods(allPods: Pod[]): Pod[] {
const pods = allPods.filter(pod => pod.getNs() === this.getNs());

View File

@ -5,9 +5,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class PersistentVolume extends KubeObject {
static kind = "PersistentVolume"
static namespaced = false
static apiBase = "/api/v1/persistentvolumes"
static kind = "PersistentVolume";
static namespaced = false;
static apiBase = "/api/v1/persistentvolumes";
spec: {
capacity: {
@ -38,12 +38,12 @@ export class PersistentVolume extends KubeObject {
path: string;
server: string;
};
}
};
status: {
phase: string;
reason?: string;
}
};
getCapacity(inBytes = false) {
const capacity = this.spec.capacity;

View File

@ -2,19 +2,19 @@ import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api";
export class PodMetrics extends KubeObject {
static kind = "Pod"
static namespaced = true
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods"
static kind = "Pod";
static namespaced = true;
static apiBase = "/apis/metrics.k8s.io/v1beta1/pods";
timestamp: string
window: string
timestamp: string;
window: string;
containers: {
name: string;
usage: {
cpu: string;
memory: string;
};
}[]
}[];
}
export const podMetricsApi = new KubeApi({

View File

@ -12,13 +12,13 @@ export class PodDisruptionBudget extends KubeObject {
minAvailable: string;
maxUnavailable: string;
selector: { matchLabels: { [app: string]: string } };
}
};
status: {
currentHealthy: number
desiredHealthy: number
disruptionsAllowed: number
expectedPods: number
}
};
getSelectors() {
const selector = this.spec.selector;

View File

@ -171,9 +171,9 @@ export interface IPodContainerStatus {
@autobind()
export class Pod extends WorkloadKubeObject {
static kind = "Pod"
static namespaced = true
static apiBase = "/api/v1/pods"
static kind = "Pod";
static namespaced = true;
static apiBase = "/api/v1/pods";
spec: {
volumes?: {
@ -215,7 +215,7 @@ export class Pod extends WorkloadKubeObject {
tolerationSeconds: number;
}[];
affinity: IAffinity;
}
};
status: {
phase: string;
conditions: {
@ -231,7 +231,7 @@ export class Pod extends WorkloadKubeObject {
containerStatuses?: IPodContainerStatus[];
qosClass: string;
reason?: string;
}
};
getInitContainers() {
return this.spec.initContainers || [];

View File

@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class PodSecurityPolicy extends KubeObject {
static kind = "PodSecurityPolicy"
static namespaced = false
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies"
static kind = "PodSecurityPolicy";
static namespaced = false;
static apiBase = "/apis/policy/v1beta1/podsecuritypolicies";
spec: {
allowPrivilegeEscalation?: boolean;
@ -66,7 +66,7 @@ export class PodSecurityPolicy extends KubeObject {
ranges: { max: number; min: number }[];
};
volumes?: string[];
}
};
isPrivileged() {
return !!this.spec.privileged;

View File

@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class ReplicaSet extends WorkloadKubeObject {
static kind = "ReplicaSet"
static namespaced = true
static apiBase = "/apis/apps/v1/replicasets"
static kind = "ReplicaSet";
static namespaced = true;
static apiBase = "/apis/apps/v1/replicasets";
spec: {
replicas?: number;
@ -37,14 +37,14 @@ export class ReplicaSet extends WorkloadKubeObject {
terminationGracePeriodSeconds?: number;
dnsPolicy?: string;
schedulerName?: string;
}
};
status: {
replicas: number;
fullyLabeledReplicas: number;
readyReplicas: number;
availableReplicas: number;
observedGeneration: number;
}
};
getImages() {
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);

View File

@ -31,9 +31,9 @@ export interface IResourceQuotaValues {
}
export class ResourceQuota extends KubeObject {
static kind = "ResourceQuota"
static namespaced = true
static apiBase = "/api/v1/resourcequotas"
static kind = "ResourceQuota";
static namespaced = true;
static apiBase = "/api/v1/resourcequotas";
constructor(data: KubeJsonApiData) {
super(data);
@ -49,12 +49,12 @@ export class ResourceQuota extends KubeObject {
values: string[];
}[];
};
}
};
status: {
hard: IResourceQuotaValues;
used: IResourceQuotaValues;
}
};
getScopeSelector() {
const { matchExpressions = [] } = this.spec.scopeSelector || {};

View File

@ -11,16 +11,16 @@ export interface IRoleBindingSubject {
@autobind()
export class RoleBinding extends KubeObject {
static kind = "RoleBinding"
static namespaced = true
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings"
static kind = "RoleBinding";
static namespaced = true;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/rolebindings";
subjects?: IRoleBindingSubject[]
subjects?: IRoleBindingSubject[];
roleRef: {
kind: string;
name: string;
apiGroup?: string;
}
};
getSubjects() {
return this.subjects || [];

View File

@ -2,16 +2,16 @@ import { KubeObject } from "../kube-object";
import { KubeApi } from "../kube-api";
export class Role extends KubeObject {
static kind = "Role"
static namespaced = true
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles"
static kind = "Role";
static namespaced = true;
static apiBase = "/apis/rbac.authorization.k8s.io/v1/roles";
rules: {
verbs: string[];
apiGroups: string[];
resources: string[];
resourceNames?: string[];
}[]
}[];
getRules() {
return this.rules || [];

View File

@ -21,15 +21,15 @@ export interface ISecretRef {
@autobind()
export class Secret extends KubeObject {
static kind = "Secret"
static namespaced = true
static apiBase = "/api/v1/secrets"
static kind = "Secret";
static namespaced = true;
static apiBase = "/api/v1/secrets";
type: SecretType;
data: {
[prop: string]: string;
token?: string;
}
};
constructor(data: KubeJsonApiData) {
super(data);

View File

@ -21,20 +21,20 @@ export interface ISelfSubjectReviewRule {
}
export class SelfSubjectRulesReview extends KubeObject {
static kind = "SelfSubjectRulesReview"
static namespaced = false
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews"
static kind = "SelfSubjectRulesReview";
static namespaced = false;
static apiBase = "/apis/authorization.k8s.io/v1/selfsubjectrulesreviews";
spec: {
// todo: add more types from api docs
namespace?: string;
}
};
status: {
resourceRules: ISelfSubjectReviewRule[];
nonResourceRules: ISelfSubjectReviewRule[];
incomplete: boolean;
}
};
getResourceRules() {
const rules = this.status && this.status.resourceRules || [];

View File

@ -6,14 +6,14 @@ import { KubeApi } from "../kube-api";
export class ServiceAccount extends KubeObject {
static kind = "ServiceAccount";
static namespaced = true;
static apiBase = "/api/v1/serviceaccounts"
static apiBase = "/api/v1/serviceaccounts";
secrets?: {
name: string;
}[]
}[];
imagePullSecrets?: {
name: string;
}[]
}[];
getSecrets() {
return this.secrets || [];

View File

@ -31,9 +31,9 @@ export class ServicePort implements IServicePort {
@autobind()
export class Service extends KubeObject {
static kind = "Service"
static namespaced = true
static apiBase = "/api/v1/services"
static kind = "Service";
static namespaced = true;
static apiBase = "/api/v1/services";
spec: {
type: string;
@ -44,7 +44,7 @@ export class Service extends KubeObject {
selector: { [key: string]: string };
ports: ServicePort[];
externalIPs?: string[]; // https://kubernetes.io/docs/concepts/services-networking/service/#external-ips
}
};
status: {
loadBalancer?: {
@ -53,7 +53,7 @@ export class Service extends KubeObject {
hostname?: string;
}[];
};
}
};
getClusterIp() {
return this.spec.clusterIP;

View File

@ -6,9 +6,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class StatefulSet extends WorkloadKubeObject {
static kind = "StatefulSet"
static namespaced = true
static apiBase = "/apis/apps/v1/statefulsets"
static kind = "StatefulSet";
static namespaced = true;
static apiBase = "/apis/apps/v1/statefulsets";
spec: {
serviceName: string;
@ -62,7 +62,7 @@ export class StatefulSet extends WorkloadKubeObject {
};
};
}[];
}
};
status: {
observedGeneration: number;
replicas: number;
@ -70,7 +70,7 @@ export class StatefulSet extends WorkloadKubeObject {
currentRevision: string;
updateRevision: string;
collisionCount: number;
}
};
getImages() {
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", []);

View File

@ -4,9 +4,9 @@ import { KubeApi } from "../kube-api";
@autobind()
export class StorageClass extends KubeObject {
static kind = "StorageClass"
static namespaced = false
static apiBase = "/apis/storage.k8s.io/v1/storageclasses"
static kind = "StorageClass";
static namespaced = false;
static apiBase = "/apis/storage.k8s.io/v1/storageclasses";
provisioner: string; // e.g. "storage.k8s.io/v1"
mountOptions?: string[];
@ -14,7 +14,7 @@ export class StorageClass extends KubeObject {
reclaimPolicy: string;
parameters: {
[param: string]: string; // every provisioner has own set of these parameters
}
};
isDefault() {
const annotations = this.metadata.annotations || {};

View File

@ -62,14 +62,14 @@ export class KubeApi<T extends KubeObject = any> {
return () => disposers.forEach(unwatch => unwatch());
}
readonly kind: string
readonly apiBase: string
readonly apiPrefix: string
readonly apiGroup: string
readonly apiVersion: string
readonly kind: string;
readonly apiBase: string;
readonly apiPrefix: string;
readonly apiGroup: string;
readonly apiVersion: string;
readonly apiVersionPreferred?: string;
readonly apiResource: string
readonly isNamespaced: boolean
readonly apiResource: string;
readonly isNamespaced: boolean;
public objectConstructor: IKubeObjectConstructor<T>;
protected request: KubeJsonApi;

View File

@ -72,8 +72,8 @@ export class KubeObject implements ItemObject {
Object.assign(this, data);
}
apiVersion: string
kind: string
apiVersion: string;
kind: string;
metadata: IKubeObjectMetadata;
status?: any; // todo: type-safety support

View File

@ -28,7 +28,7 @@ export type TerminalApiQuery = Record<string, string> & {
id: string;
node?: string;
type?: string | "node";
}
};
export class TerminalApi extends WebSocketApi {
protected size: { Width: number; Height: number };

View File

@ -18,7 +18,7 @@ import { extensionLoader } from "../extensions/extension-loader";
type AppComponent = React.ComponentType & {
init?(): Promise<void>;
}
};
export {
React,

View File

@ -39,10 +39,10 @@ export class AddCluster extends React.Component {
@observable selectedContexts = observable.array<string>();
@observable sourceTab = KubeConfigSourceTab.FILE;
@observable kubeConfigPath = "";
@observable customConfig = ""
@observable proxyServer = ""
@observable isWaiting = false
@observable showSettings = false
@observable customConfig = "";
@observable proxyServer = "";
@observable isWaiting = false;
@observable showSettings = false;
@observable dropAreaActive = false;
componentDidMount() {
@ -117,7 +117,7 @@ export class AddCluster extends React.Component {
if (!canceled && filePaths.length) {
this.setKubeConfig(filePaths[0]);
}
}
};
@action
addClusters = () => {
@ -183,7 +183,7 @@ export class AddCluster extends React.Component {
} finally {
this.isWaiting = false;
}
}
};
renderInfo() {
return (
@ -328,13 +328,13 @@ export class AddCluster extends React.Component {
this.setKubeConfig(userStore.kubeConfigPath); // revert to previous valid path
}
}
}
};
onKubeConfigTabChange = (tabId: KubeConfigSourceTab) => {
this.sourceTab = tabId;
this.error = "";
this.refreshContexts();
}
};
protected formatContextLabel = ({ value: context }: SelectOption<string>) => {
const isNew = userStore.newContexts.has(context);

View File

@ -44,11 +44,11 @@ export class HelmCharts extends Component<Props> {
}
}));
}
}
};
hideDetails = () => {
this.showDetails(null);
}
};
render() {
return (

View File

@ -94,13 +94,13 @@ export class ReleaseDetails extends Component<Props> {
Notifications.error(err);
}
this.saving = false;
}
};
upgradeVersion = () => {
const { release, hideDetails } = this.props;
createUpgradeChartTab(release);
hideDetails();
}
};
renderValues() {
const { values, saving } = this;

View File

@ -46,7 +46,7 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
this.revisions.replace(releases);
this.revision = this.revisions[0];
this.isLoading = false;
}
};
rollback = async () => {
const revisionNumber = this.revision.revision;
@ -60,7 +60,7 @@ export class ReleaseRollbackDialog extends React.Component<Props> {
close = () => {
ReleaseRollbackDialog.close();
}
};
renderContent() {
const { revision, revisions } = this;

View File

@ -58,11 +58,11 @@ export class HelmReleases extends Component<Props> {
}
}));
}
}
};
hideDetails = () => {
this.showDetails(null);
}
};
renderRemoveDialogMessage(selectedItems: HelmRelease[]) {
const releaseNames = selectedItems.map(item => item.getName()).join(", ");

View File

@ -45,7 +45,7 @@ export class ClusterSettings extends React.Component<Props> {
await requestMain(clusterActivateHandler, this.cluster.id);
await requestMain(clusterRefreshHandler, this.cluster.id);
}
}
};
render() {
const cluster = this.cluster;

View File

@ -27,7 +27,7 @@ export class ClusterHomeDirSetting extends React.Component<Props> {
onChange = (value: string) => {
this.directory = value;
}
};
render() {
return (

View File

@ -28,7 +28,7 @@ export class ClusterNameSetting extends React.Component<Props> {
onChange = (value: string) => {
this.name = value;
}
};
render() {
return (

View File

@ -60,13 +60,13 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
port: parseInt(parsed[2]),
prefix: apiPrefix
};
}
};
onSaveProvider = () => {
this.props.cluster.preferences.prometheusProvider = this.provider ?
{ type: this.provider } :
null;
}
};
onSavePath = () => {
this.props.cluster.preferences.prometheus = this.parsePrometheusPath();

View File

@ -28,7 +28,7 @@ export class ClusterProxySetting extends React.Component<Props> {
onChange = (value: string) => {
this.proxy = value;
}
};
render() {
return (

View File

@ -18,7 +18,7 @@ export enum MetricNodeRole {
@autobind()
export class ClusterStore extends KubeObjectStore<Cluster> {
api = clusterApi
api = clusterApi;
@observable metrics: Partial<IClusterMetrics> = {};
@observable liveMetrics: Partial<IClusterMetrics> = {};

View File

@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
@autobind()
export class HPAStore extends KubeObjectStore<HorizontalPodAutoscaler> {
api = hpaApi
api = hpaApi;
}
export const hpaStore = new HPAStore();

View File

@ -47,7 +47,7 @@ export class ConfigMapDetails extends React.Component<Props> {
} finally {
this.isSaving = false;
}
}
};
render() {
const { object: configMap } = this.props;

View File

@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
@autobind()
export class ConfigMapsStore extends KubeObjectStore<ConfigMap> {
api = configMapApi
api = configMapApi;
}
export const configMapsStore = new ConfigMapsStore();

View File

@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
@autobind()
export class PodDisruptionBudgetsStore extends KubeObjectStore<PodDisruptionBudget> {
api = pdbApi
api = pdbApi;
}
export const podDisruptionBudgetsStore = new PodDisruptionBudgetsStore();

View File

@ -45,7 +45,7 @@ export class AddQuotaDialog extends React.Component<Props> {
"count/deployments.extensions": "",
};
public defaultNamespace = "default"
public defaultNamespace = "default";
@observable quotaName = "";
@observable quotaSelectValue = "";
@ -83,11 +83,11 @@ export class AddQuotaDialog extends React.Component<Props> {
if (!this.quotaSelectValue) return;
this.quotas[this.quotaSelectValue] = this.quotaInputValue;
this.quotaInputValue = "";
}
};
close = () => {
AddQuotaDialog.close();
}
};
reset = () => {
this.quotaName = "";
@ -95,7 +95,7 @@ export class AddQuotaDialog extends React.Component<Props> {
this.quotaInputValue = "";
this.namespace = this.defaultNamespace;
this.quotas = AddQuotaDialog.defaultQuotas;
}
};
addQuota = async () => {
try {
@ -113,7 +113,7 @@ export class AddQuotaDialog extends React.Component<Props> {
} catch (err) {
Notifications.error(err);
}
}
};
onInputQuota = (evt: React.KeyboardEvent) => {
switch (evt.key) {
@ -122,7 +122,7 @@ export class AddQuotaDialog extends React.Component<Props> {
evt.preventDefault(); // don't submit form
break;
}
}
};
render() {
const { ...dialogProps } = this.props;

View File

@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
@autobind()
export class ResourceQuotasStore extends KubeObjectStore<ResourceQuota> {
api = resourceQuotaApi
api = resourceQuotaApi;
}
export const resourceQuotaStore = new ResourceQuotasStore();

View File

@ -58,7 +58,7 @@ export class AddSecretDialog extends React.Component<Props> {
{ key: "kubernetes.io/service-account.uid", required: true }
],
},
}
};
get types() {
return Object.keys(this.secretTemplate) as SecretType[];
@ -72,11 +72,11 @@ export class AddSecretDialog extends React.Component<Props> {
reset = () => {
this.name = "";
this.secret = this.secretTemplate;
}
};
close = () => {
AddSecretDialog.close();
}
};
private getDataFromFields = (fields: ISecretTemplateField[] = [], processValue?: (val: string) => string) => {
return fields.reduce<any>((data, field) => {
@ -86,7 +86,7 @@ export class AddSecretDialog extends React.Component<Props> {
}
return data;
}, {});
}
};
createSecret = async () => {
const { name, namespace, type } = this;
@ -109,18 +109,18 @@ export class AddSecretDialog extends React.Component<Props> {
} catch (err) {
Notifications.error(err);
}
}
};
addField = (field: ISecretField) => {
const fields = this.secret[this.type][field] || [];
fields.push({ key: "", value: "" });
this.secret[this.type][field] = fields;
}
};
removeField = (field: ISecretField, index: number) => {
const fields = this.secret[this.type][field] || [];
fields.splice(index, 1);
}
};
renderFields(field: ISecretField) {
const fields = this.secret[this.type][field] || [];

View File

@ -49,11 +49,11 @@ export class SecretDetails extends React.Component<Props> {
Notifications.error(err);
}
this.isSaving = false;
}
};
editData = (name: string, value: string, encoded: boolean) => {
this.data[name] = encoded ? value : base64.encode(value);
}
};
render() {
const { object: secret } = this.props;

View File

@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
@autobind()
export class SecretsStore extends KubeObjectStore<Secret> {
api = secretsApi
api = secretsApi;
}
export const secretsStore = new SecretsStore();

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