mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use @typescript-eslint/semi.
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
0b182ccf6f
commit
460dfe4d2b
179 files changed
+556
-554
No files matched your search
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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", []);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,7 +15,7 @@ export class Namespace extends KubeObject {
|
||||
|
||||
status?: {
|
||||
phase: string;
|
||||
}
|
||||
};
|
||||
|
||||
getStatus() {
|
||||
return this.status ? this.status.phase : "-";
|
||||
|
||||
@@ -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 [];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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", []);
|
||||
|
||||
@@ -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 || {};
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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 || [];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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", []);
|
||||
|
||||
@@ -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 || {};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -18,7 +18,7 @@ import { extensionLoader } from "../extensions/extension-loader";
|
||||
|
||||
type AppComponent = React.ComponentType & {
|
||||
init?(): Promise<void>;
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
React,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -44,11 +44,11 @@ export class HelmCharts extends Component<Props> {
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
hideDetails = () => {
|
||||
this.showDetails(null);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(", ");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ClusterHomeDirSetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.directory = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ClusterNameSetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.name = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ClusterProxySetting extends React.Component<Props> {
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.proxy = value;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -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> = {};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -47,7 +47,7 @@ export class ConfigMapDetails extends React.Component<Props> {
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { object: configMap } = this.props;
|
||||
|
||||
@@ -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();
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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] || [];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -20,7 +20,7 @@ function initStore(crd: CustomResourceDefinition) {
|
||||
|
||||
@autobind()
|
||||
export class CRDStore extends KubeObjectStore<CustomResourceDefinition> {
|
||||
api = crdApi
|
||||
api = crdApi;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@@ -10,8 +10,8 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class EventStore extends KubeObjectStore<KubeEvent> {
|
||||
api = eventApi
|
||||
limit = 1000
|
||||
api = eventApi;
|
||||
limit = 1000;
|
||||
|
||||
protected bindWatchEventsUpdater() {
|
||||
return super.bindWatchEventsUpdater(5000);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { extensionManager } from "../../../extensions/extension-manager";
|
||||
|
||||
@observer
|
||||
export class Extensions extends React.Component {
|
||||
@observable search = ""
|
||||
@observable search = "";
|
||||
|
||||
@computed get extensions() {
|
||||
const searchText = this.search.toLowerCase();
|
||||
|
||||
@@ -33,7 +33,7 @@ export class AddNamespaceDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
AddNamespaceDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
addNamespace = async () => {
|
||||
const { namespace } = this;
|
||||
@@ -45,7 +45,7 @@ export class AddNamespaceDialog extends React.Component<Props> {
|
||||
Notifications.error(err);
|
||||
onError && onError(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { ...dialogProps } = this.props;
|
||||
|
||||
@@ -62,7 +62,7 @@ export class NamespaceSelect extends React.Component<Props> {
|
||||
{value}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, showIcons, showClusterOption, clusterOptionLabel, customizeOptions, ...selectProps } = this.props;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class EndpointStore extends KubeObjectStore<Endpoint> {
|
||||
api = endpointApi
|
||||
api = endpointApi;
|
||||
}
|
||||
|
||||
export const endpointStore = new EndpointStore();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class NetworkPolicyStore extends KubeObjectStore<NetworkPolicy> {
|
||||
api = networkPolicyApi
|
||||
api = networkPolicyApi;
|
||||
}
|
||||
|
||||
export const networkPolicyStore = new NetworkPolicyStore();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class ServiceStore extends KubeObjectStore<Service> {
|
||||
api = serviceApi
|
||||
api = serviceApi;
|
||||
}
|
||||
|
||||
export const serviceStore = new ServiceStore();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class NodesStore extends KubeObjectStore<Node> {
|
||||
api = nodesApi
|
||||
api = nodesApi;
|
||||
|
||||
@observable metrics: Partial<INodeMetrics> = {};
|
||||
@observable nodeMetrics: Partial<IClusterMetrics> = null;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class PodSecurityPoliciesStore extends KubeObjectStore<PodSecurityPolicy> {
|
||||
api = pspApi
|
||||
api = pspApi;
|
||||
}
|
||||
|
||||
export const podSecurityPoliciesStore = new PodSecurityPoliciesStore();
|
||||
|
||||
@@ -89,7 +89,7 @@ export class Preferences extends React.Component {
|
||||
this.helmLoading = true;
|
||||
await this.addRepo(repo);
|
||||
this.helmLoading = false;
|
||||
}
|
||||
};
|
||||
|
||||
formatHelmOptionLabel = ({ value: repo }: SelectOption<HelmRepo>) => {
|
||||
const isAdded = this.helmAddedRepos.has(repo.name);
|
||||
@@ -99,7 +99,7 @@ export class Preferences extends React.Component {
|
||||
{isAdded && <Icon small material="check" className="box right"/>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { preferences } = userStore;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class StorageClassStore extends KubeObjectStore<StorageClass> {
|
||||
api = storageClassApi
|
||||
api = storageClassApi;
|
||||
}
|
||||
|
||||
export const storageClassStore = new StorageClassStore();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class VolumeClaimStore extends KubeObjectStore<PersistentVolumeClaim> {
|
||||
api = pvcApi
|
||||
api = pvcApi;
|
||||
@observable metrics: IPvcMetrics = null;
|
||||
|
||||
@action
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class PersistentVolumesStore extends KubeObjectStore<PersistentVolume> {
|
||||
api = persistentVolumeApi
|
||||
api = persistentVolumeApi;
|
||||
}
|
||||
|
||||
export const volumesStore = new PersistentVolumesStore();
|
||||
|
||||
@@ -72,7 +72,7 @@ export class AddRoleBindingDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
AddRoleBindingDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
async loadData() {
|
||||
const stores = [
|
||||
@@ -96,13 +96,13 @@ export class AddRoleBindingDialog extends React.Component<Props> {
|
||||
this.bindContext = role.getNs() || "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
reset = () => {
|
||||
this.selectedRoleId = "";
|
||||
this.bindContext = "";
|
||||
this.selectedAccounts.clear();
|
||||
}
|
||||
};
|
||||
|
||||
onBindContextChange = (namespace: string) => {
|
||||
this.bindContext = namespace;
|
||||
@@ -110,7 +110,7 @@ export class AddRoleBindingDialog extends React.Component<Props> {
|
||||
if (this.bindContext && this.bindContext !== roleContext) {
|
||||
this.selectedRoleId = ""; // reset previously selected role for specific context
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
createBindings = async () => {
|
||||
const { selectedRole, bindContext: namespace, selectedBindings, bindingName, useRoleForBindingName } = this;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class RoleBindingsStore extends KubeObjectStore<RoleBinding> {
|
||||
api = clusterRoleBindingApi
|
||||
api = clusterRoleBindingApi;
|
||||
|
||||
subscribe() {
|
||||
return super.subscribe([clusterRoleBindingApi, roleBindingApi]);
|
||||
|
||||
@@ -31,11 +31,11 @@ export class AddRoleDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
AddRoleDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
reset = () => {
|
||||
this.roleName = "";
|
||||
}
|
||||
};
|
||||
|
||||
createRole = async () => {
|
||||
try {
|
||||
@@ -46,7 +46,7 @@ export class AddRoleDialog extends React.Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { ...dialogProps } = this.props;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class RolesStore extends KubeObjectStore<Role> {
|
||||
api = clusterRoleApi
|
||||
api = clusterRoleApi;
|
||||
|
||||
subscribe() {
|
||||
return super.subscribe([roleApi, clusterRoleApi]);
|
||||
|
||||
+4
-4
@@ -22,8 +22,8 @@ interface Props extends Partial<DialogProps> {
|
||||
export class CreateServiceAccountDialog extends React.Component<Props> {
|
||||
@observable static isOpen = false;
|
||||
|
||||
@observable name = ""
|
||||
@observable namespace = "default"
|
||||
@observable name = "";
|
||||
@observable namespace = "default";
|
||||
|
||||
static open() {
|
||||
CreateServiceAccountDialog.isOpen = true;
|
||||
@@ -35,7 +35,7 @@ export class CreateServiceAccountDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
CreateServiceAccountDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
createAccount = async () => {
|
||||
const { name, namespace } = this;
|
||||
@@ -47,7 +47,7 @@ export class CreateServiceAccountDialog extends React.Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { ...dialogProps } = this.props;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ export class ServiceAccountsDetails extends React.Component<Props> {
|
||||
return secretsStore.load({ name, namespace }).catch(_err => { return this.generateDummySecretObject(name); });
|
||||
});
|
||||
this.imagePullSecrets = await Promise.all(imagePullSecrets);
|
||||
})
|
||||
});
|
||||
|
||||
renderSecrets() {
|
||||
const { secrets } = this;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ interface State {
|
||||
export class ServiceAccountsSecret extends React.Component<Props, State> {
|
||||
public state: State = {
|
||||
showToken: false,
|
||||
}
|
||||
};
|
||||
|
||||
renderSecretValue() {
|
||||
const { secret } = this.props;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class ServiceAccountsStore extends KubeObjectStore<ServiceAccount> {
|
||||
api = serviceAccountsApi
|
||||
api = serviceAccountsApi;
|
||||
|
||||
protected async createItem(params: { name: string; namespace?: string }) {
|
||||
await super.createItem(params);
|
||||
|
||||
@@ -16,7 +16,7 @@ export class WhatsNew extends React.Component {
|
||||
ok = () => {
|
||||
navigate("/");
|
||||
userStore.saveLastSeenAppVersion();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const logo = require("../../components/icon/lens-logo.svg");
|
||||
|
||||
@@ -39,18 +39,18 @@ export class CronJobTriggerDialog extends Component<Props> {
|
||||
|
||||
close = () => {
|
||||
CronJobTriggerDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
onOpen = async () => {
|
||||
const { cronjob } = this;
|
||||
this.jobName = cronjob ? cronjob.getName() + "-manual-" + Math.random().toString(36).slice(2, 7) : "";
|
||||
this.jobName = this.jobName.slice(0, 63);
|
||||
this.ready = true;
|
||||
}
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
this.ready = false;
|
||||
}
|
||||
};
|
||||
|
||||
trigger = async () => {
|
||||
const { cronjob } = this;
|
||||
@@ -72,7 +72,7 @@ export class CronJobTriggerDialog extends Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
renderContents() {
|
||||
return (
|
||||
|
||||
@@ -6,7 +6,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class CronJobStore extends KubeObjectStore<CronJob> {
|
||||
api = cronJobApi
|
||||
api = cronJobApi;
|
||||
|
||||
getStatuses(cronJobs?: CronJob[]) {
|
||||
const status = { suspended: 0, scheduled: 0 };
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class DaemonSetStore extends KubeObjectStore<DaemonSet> {
|
||||
api = daemonSetApi
|
||||
api = daemonSetApi;
|
||||
|
||||
@observable metrics: IPodMetrics = null;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export class DeploymentScaleDialog extends Component<Props> {
|
||||
|
||||
close = () => {
|
||||
DeploymentScaleDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
@computed get scaleMax() {
|
||||
const { currentReplicas } = this;
|
||||
@@ -57,15 +57,15 @@ export class DeploymentScaleDialog extends Component<Props> {
|
||||
});
|
||||
this.desiredReplicas = this.currentReplicas;
|
||||
this.ready = true;
|
||||
}
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
this.ready = false;
|
||||
}
|
||||
};
|
||||
|
||||
onChange = (evt: React.ChangeEvent, value: number) => {
|
||||
this.desiredReplicas = value;
|
||||
}
|
||||
};
|
||||
|
||||
scale = async () => {
|
||||
const { deployment } = this;
|
||||
@@ -81,11 +81,11 @@ export class DeploymentScaleDialog extends Component<Props> {
|
||||
} catch (err) {
|
||||
Notifications.error(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
desiredReplicasUp = () => {
|
||||
this.desiredReplicas < this.scaleMax && this.desiredReplicas++;
|
||||
}
|
||||
};
|
||||
|
||||
desiredReplicasDown = () => {
|
||||
this.desiredReplicas > 1 && this.desiredReplicas--;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class DeploymentStore extends KubeObjectStore<Deployment> {
|
||||
api = deploymentApi
|
||||
api = deploymentApi;
|
||||
@observable metrics: IPodMetrics = null;
|
||||
|
||||
protected sortItems(items: Deployment[]) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class JobStore extends KubeObjectStore<Job> {
|
||||
api = jobApi
|
||||
api = jobApi;
|
||||
|
||||
getChildPods(job: Job): Pod[] {
|
||||
return podsStore.getPodsByOwner(job);
|
||||
|
||||
@@ -18,7 +18,7 @@ interface Props {
|
||||
|
||||
@observer
|
||||
export class OverviewWorkloadStatus extends React.Component<Props> {
|
||||
@observable elem: HTMLElement
|
||||
@observable elem: HTMLElement;
|
||||
|
||||
componentDidMount() {
|
||||
this.elem = findDOMNode(this) as HTMLElement;
|
||||
|
||||
@@ -38,7 +38,7 @@ interface OptionalProps {
|
||||
export class PodDetailsList extends React.Component<Props> {
|
||||
static defaultProps: OptionalProps = {
|
||||
showTitle: true
|
||||
}
|
||||
};
|
||||
|
||||
private metricsWatcher = interval(120, () => {
|
||||
podsStore.loadKubeMetrics(this.props.owner.getNs());
|
||||
@@ -49,7 +49,7 @@ export class PodDetailsList extends React.Component<Props> {
|
||||
[sortBy.namespace]: (pod: Pod) => pod.getNs(),
|
||||
[sortBy.cpu]: (pod: Pod) => podsStore.getPodKubeMetrics(pod).cpu,
|
||||
[sortBy.memory]: (pod: Pod) => podsStore.getPodKubeMetrics(pod).memory,
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.metricsWatcher.start(true);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class ReplicaSetStore extends KubeObjectStore<ReplicaSet> {
|
||||
api = replicaSetApi
|
||||
api = replicaSetApi;
|
||||
@observable metrics: IPodMetrics = null;
|
||||
|
||||
async loadMetrics(replicaSet: ReplicaSet) {
|
||||
|
||||
@@ -32,7 +32,7 @@ export class ReplicaSets extends React.Component<Props> {
|
||||
[sortBy.namespace]: (replicaSet: ReplicaSet) => replicaSet.getNs(),
|
||||
[sortBy.age]: (replicaSet: ReplicaSet) => replicaSet.metadata.creationTimestamp,
|
||||
[sortBy.pods]: (replicaSet: ReplicaSet) => this.getPodsLength(replicaSet),
|
||||
}
|
||||
};
|
||||
|
||||
getPodsLength(replicaSet: ReplicaSet) {
|
||||
return replicaSetStore.getChildPods(replicaSet).length;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiManager } from "../../api/api-manager";
|
||||
|
||||
@autobind()
|
||||
export class StatefulSetStore extends KubeObjectStore<StatefulSet> {
|
||||
api = statefulSetApi
|
||||
api = statefulSetApi;
|
||||
@observable metrics: IPodMetrics = null;
|
||||
|
||||
async loadMetrics(statefulSet: StatefulSet) {
|
||||
|
||||
@@ -54,7 +54,7 @@ export class Workspaces extends React.Component {
|
||||
if (workspaceStore.addWorkspace(workspace)) {
|
||||
this.clearEditing(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addWorkspace = () => {
|
||||
const workspaceId = uuid();
|
||||
@@ -63,16 +63,16 @@ export class Workspaces extends React.Component {
|
||||
name: "",
|
||||
description: ""
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
editWorkspace = (id: WorkspaceId) => {
|
||||
const workspace = workspaceStore.getById(id);
|
||||
this.editingWorkspaces.set(id, toJS(workspace));
|
||||
}
|
||||
};
|
||||
|
||||
clearEditing = (id: WorkspaceId) => {
|
||||
this.editingWorkspaces.delete(id);
|
||||
}
|
||||
};
|
||||
|
||||
removeWorkspace = (id: WorkspaceId) => {
|
||||
const workspace = workspaceStore.getById(id);
|
||||
@@ -97,7 +97,7 @@ export class Workspaces extends React.Component {
|
||||
</div>
|
||||
),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onInputKeypress = (evt: React.KeyboardEvent<any>, workspaceId: WorkspaceId) => {
|
||||
if (evt.key == 'Enter') {
|
||||
@@ -106,7 +106,7 @@ export class Workspaces extends React.Component {
|
||||
evt.currentTarget.focus();
|
||||
this.saveWorkspace(workspaceId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
||||
@@ -51,11 +51,11 @@ const defaultProps: Partial<ChartProps> = {
|
||||
export class Chart extends React.Component<ChartProps> {
|
||||
static defaultProps = defaultProps as object;
|
||||
|
||||
private canvas = React.createRef<HTMLCanvasElement>()
|
||||
private chart: ChartJS
|
||||
private canvas = React.createRef<HTMLCanvasElement>();
|
||||
private chart: ChartJS;
|
||||
// ChartJS adds _meta field to any data object passed to it.
|
||||
// We clone new data prop into currentChartData to compare props and prevProps
|
||||
private currentChartData: ChartData
|
||||
private currentChartData: ChartData;
|
||||
|
||||
componentDidMount() {
|
||||
const { showChart } = this.props;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
|
||||
import { useInterval } from "../../hooks";
|
||||
|
||||
type IMetricValues = [number, string][];
|
||||
type IChartData = { x: number; y: string }[]
|
||||
type IChartData = { x: number; y: string }[];
|
||||
|
||||
const defaultParams = {
|
||||
fetchInterval: 15,
|
||||
|
||||
@@ -50,14 +50,14 @@ export class ClusterStatus extends React.Component<Props> {
|
||||
|
||||
activateCluster = async (force = false) => {
|
||||
await requestMain(clusterActivateHandler, this.props.clusterId, force);
|
||||
}
|
||||
};
|
||||
|
||||
reconnect = async () => {
|
||||
this.authOutput = [];
|
||||
this.isReconnecting = true;
|
||||
await this.activateCluster(true);
|
||||
this.isReconnecting = false;
|
||||
}
|
||||
};
|
||||
|
||||
renderContent() {
|
||||
const { authOutput, cluster, hasErrors } = this;
|
||||
|
||||
@@ -33,11 +33,11 @@ interface Props {
|
||||
export class ClustersMenu extends React.Component<Props> {
|
||||
showCluster = (clusterId: ClusterId) => {
|
||||
navigate(clusterViewURL({ params: { clusterId } }));
|
||||
}
|
||||
};
|
||||
|
||||
addCluster = () => {
|
||||
navigate(addClusterURL());
|
||||
}
|
||||
};
|
||||
|
||||
showContextMenu = (cluster: Cluster) => {
|
||||
const { Menu, MenuItem } = remote;
|
||||
@@ -87,7 +87,7 @@ export class ClustersMenu extends React.Component<Props> {
|
||||
menu.popup({
|
||||
window: remote.getCurrentWindow()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@autobind()
|
||||
swapClusterIconOrder(result: DropResult) {
|
||||
|
||||
@@ -57,15 +57,15 @@ export class ConfirmDialog extends React.Component<ConfirmDialogProps> {
|
||||
this.isSaving = false;
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
this.isSaving = false;
|
||||
}
|
||||
};
|
||||
|
||||
close = () => {
|
||||
ConfirmDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, ...dialogProps } = this.props;
|
||||
|
||||
@@ -42,11 +42,11 @@ export class Dialog extends React.PureComponent<DialogProps, DialogState> {
|
||||
};
|
||||
|
||||
@disposeOnUnmount
|
||||
closeOnNavigate = reaction(() => navigation.getPath(), () => this.close())
|
||||
closeOnNavigate = reaction(() => navigation.getPath(), () => this.close());
|
||||
|
||||
public state: DialogState = {
|
||||
isOpen: this.props.isOpen,
|
||||
}
|
||||
};
|
||||
|
||||
get elem() {
|
||||
return findDOMNode(this) as HTMLElement;
|
||||
@@ -95,7 +95,7 @@ export class Dialog extends React.PureComponent<DialogProps, DialogState> {
|
||||
// Using document.body target to handle keydown event before Drawer does
|
||||
document.body.addEventListener('keydown', this.onEscapeKey);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
this.props.onClose();
|
||||
@@ -103,7 +103,7 @@ export class Dialog extends React.PureComponent<DialogProps, DialogState> {
|
||||
if (this.elem) this.elem.removeEventListener('click', this.onClickOutside);
|
||||
document.body.removeEventListener('keydown', this.onEscapeKey);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onEscapeKey = (evt: KeyboardEvent) => {
|
||||
const escapeKey = evt.code === "Escape";
|
||||
@@ -111,7 +111,7 @@ export class Dialog extends React.PureComponent<DialogProps, DialogState> {
|
||||
this.close();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onClickOutside = (evt: MouseEvent) => {
|
||||
const target = evt.target as HTMLElement;
|
||||
@@ -119,7 +119,7 @@ export class Dialog extends React.PureComponent<DialogProps, DialogState> {
|
||||
this.close();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { modal, animated, pinned } = this.props;
|
||||
|
||||
Loaded 100 of 179 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user