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
@@ -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;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class LogsDialog extends React.Component<Props> {
|
||||
if (copyToClipboard(this.logsElem)) {
|
||||
Notifications.ok(_i18n._(t`Logs copied to clipboard.`));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { title, logs, ...dialogProps } = this.props;
|
||||
|
||||
@@ -22,7 +22,7 @@ interface Props {
|
||||
|
||||
@observer
|
||||
export class CreateResource extends React.Component<Props> {
|
||||
@observable error = ""
|
||||
@observable error = "";
|
||||
|
||||
get tabId() {
|
||||
return this.props.tab.id;
|
||||
@@ -35,7 +35,7 @@ export class CreateResource extends React.Component<Props> {
|
||||
onChange = (value: string, error?: string) => {
|
||||
createResourceStore.setData(this.tabId, value);
|
||||
this.error = error;
|
||||
}
|
||||
};
|
||||
|
||||
create = async () => {
|
||||
if (this.error) return;
|
||||
@@ -63,7 +63,7 @@ export class CreateResource extends React.Component<Props> {
|
||||
);
|
||||
Notifications.ok(successMessage);
|
||||
return successMessage;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { tabId, data, error, create, onChange } = this;
|
||||
|
||||
@@ -42,13 +42,13 @@ export class Dock extends React.Component<Props> {
|
||||
if (selectedTab.pinned) close();
|
||||
else closeTab(selectedTab.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onChangeTab = (tab: IDockTab) => {
|
||||
const { open, selectTab } = dockStore;
|
||||
open();
|
||||
selectTab(tab.id);
|
||||
}
|
||||
};
|
||||
|
||||
@autobind()
|
||||
renderTab(tab: IDockTab) {
|
||||
|
||||
@@ -62,7 +62,7 @@ export class EditResource extends React.Component<Props> {
|
||||
onChange = (draft: string, error?: string) => {
|
||||
this.error = error;
|
||||
this.saveDraft(draft);
|
||||
}
|
||||
};
|
||||
|
||||
save = async () => {
|
||||
if (this.error) {
|
||||
@@ -79,7 +79,7 @@ export class EditResource extends React.Component<Props> {
|
||||
<Trans>{resourceType} <b>{resourceName}</b> updated.</Trans>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { tabId, resource, tabData, error, onChange, save } = this;
|
||||
|
||||
@@ -21,7 +21,7 @@ export class EditorPanel extends React.Component<Props> {
|
||||
|
||||
public editor: AceEditor;
|
||||
|
||||
@observable yamlError = ""
|
||||
@observable yamlError = "";
|
||||
|
||||
componentDidMount() {
|
||||
// validate and run callback with optional error
|
||||
@@ -44,23 +44,23 @@ export class EditorPanel extends React.Component<Props> {
|
||||
|
||||
onTabChange = () => {
|
||||
this.editor.focus();
|
||||
}
|
||||
};
|
||||
|
||||
onResize = () => {
|
||||
this.editor.resize();
|
||||
this.editor.focus();
|
||||
}
|
||||
};
|
||||
|
||||
onCursorPosChange = (pos: Ace.Point) => {
|
||||
EditorPanel.cursorPos.setData(this.props.tabId, pos);
|
||||
}
|
||||
};
|
||||
|
||||
onChange = (value: string) => {
|
||||
this.validate(value);
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(value, this.yamlError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { value, tabId } = this.props;
|
||||
|
||||
@@ -38,7 +38,7 @@ export class InfoPanel extends Component<Props> {
|
||||
showSubmitClose: true,
|
||||
showInlineInfo: true,
|
||||
showNotifications: true,
|
||||
}
|
||||
};
|
||||
|
||||
@observable error = "";
|
||||
@observable waiting = false;
|
||||
@@ -66,16 +66,16 @@ export class InfoPanel extends Component<Props> {
|
||||
} finally {
|
||||
this.waiting = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
submitAndClose = async () => {
|
||||
await this.submit();
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
close = () => {
|
||||
dockStore.closeTab(this.props.tabId);
|
||||
}
|
||||
};
|
||||
|
||||
renderErrorIcon() {
|
||||
if (!this.props.showInlineInfo || !this.errorInfo) {
|
||||
|
||||
@@ -103,7 +103,7 @@ export class InstallChart extends Component<Props> {
|
||||
return (
|
||||
<p><Trans>Chart Release <b>{details.release.name}</b> successfully created.</Trans></p>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { tabId, chartData, values, versions, install } = this;
|
||||
|
||||
@@ -78,7 +78,7 @@ export class PodLogsStore extends DockTabStore<IPodLogsData> {
|
||||
this.refresher.stop();
|
||||
this.logs.set(tabId, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function is used to refreser/stream-like requests.
|
||||
@@ -94,7 +94,7 @@ export class PodLogsStore extends DockTabStore<IPodLogsData> {
|
||||
});
|
||||
// Add newly received logs to bottom
|
||||
this.logs.set(tabId, [...oldLogs, ...logs]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Main logs loading function adds necessary data to payload and makes
|
||||
@@ -119,7 +119,7 @@ export class PodLogsStore extends DockTabStore<IPodLogsData> {
|
||||
logs.pop(); // Remove last empty element
|
||||
return logs;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets newLogSince separator timestamp to split old logs from new ones
|
||||
|
||||
@@ -79,13 +79,13 @@ export class PodLogs extends React.Component<Props> {
|
||||
this.ready = false;
|
||||
await podLogsStore.load(this.tabId);
|
||||
this.ready = true;
|
||||
}
|
||||
};
|
||||
|
||||
reload = async () => {
|
||||
podLogsStore.clearLogs(this.tabId);
|
||||
this.lastLineIsShown = true;
|
||||
await this.load();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function loads more logs (usually after user scrolls to top) and sets proper
|
||||
@@ -101,7 +101,7 @@ export class PodLogs extends React.Component<Props> {
|
||||
// Set scroll position back to place where preloading started
|
||||
this.logsElement.current.scrollTop = (podLogsStore.lines - lines) * lineHeight;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A function for various actions after search is happened
|
||||
@@ -167,7 +167,7 @@ export class PodLogs extends React.Component<Props> {
|
||||
this.showJumpToBottom = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@action
|
||||
scrollToBottom = () => {
|
||||
@@ -177,7 +177,7 @@ export class PodLogs extends React.Component<Props> {
|
||||
this.showJumpToBottom = false;
|
||||
// Showing horizontal scrollbar after VirtualList settles down
|
||||
setTimeout(() => this.hideHorizontalScroll = false, 500);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A function is called by VirtualList for rendering each of the row
|
||||
@@ -221,7 +221,7 @@ export class PodLogs extends React.Component<Props> {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
renderJumpToBottom() {
|
||||
if (!this.logsElement) return null;
|
||||
|
||||
@@ -132,39 +132,39 @@ export class Terminal {
|
||||
|
||||
focus = () => {
|
||||
this.xterm.focus();
|
||||
}
|
||||
};
|
||||
|
||||
onApiData = (data: string) => {
|
||||
this.xterm.write(data);
|
||||
}
|
||||
};
|
||||
|
||||
onData = (data: string) => {
|
||||
if (!this.api.isReady) return;
|
||||
this.api.sendCommand(data);
|
||||
}
|
||||
};
|
||||
|
||||
onScroll = () => {
|
||||
this.scrollPos = this.viewport.scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
onClear = () => {
|
||||
this.xterm.clear();
|
||||
}
|
||||
};
|
||||
|
||||
onResize = () => {
|
||||
this.fitLazy();
|
||||
this.focus();
|
||||
}
|
||||
};
|
||||
|
||||
onActivate = () => {
|
||||
this.fit();
|
||||
setTimeout(() => this.focus(), 250); // delay used to prevent focus on active tab
|
||||
this.viewport.scrollTop = this.scrollPos; // restore last scroll position
|
||||
}
|
||||
};
|
||||
|
||||
onClickLink = (evt: MouseEvent, link: string) => {
|
||||
window.open(link, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
keyHandler = (evt: KeyboardEvent): boolean => {
|
||||
const { code, ctrlKey, type } = evt;
|
||||
@@ -190,7 +190,7 @@ export class Terminal {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Terminal.init();
|
||||
@@ -62,7 +62,7 @@ export class UpgradeChart extends React.Component<Props> {
|
||||
onChange = (value: string, error?: string) => {
|
||||
upgradeChartStore.values.setData(this.tabId, value);
|
||||
this.error = error;
|
||||
}
|
||||
};
|
||||
|
||||
upgrade = async () => {
|
||||
if (this.error) return;
|
||||
@@ -79,13 +79,13 @@ export class UpgradeChart extends React.Component<Props> {
|
||||
<Trans>Release <b>{releaseName}</b> successfully upgraded to version <b>{version}</b></Trans>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
formatVersionLabel = ({ value }: SelectOption<IChartVersion>) => {
|
||||
const chartName = this.release.getChart();
|
||||
const { repo, version } = value;
|
||||
return `${repo}/${chartName}-${version}`;
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { tabId, release, value, error, onChange, upgrade, versions, version } = this;
|
||||
|
||||
@@ -13,11 +13,11 @@ interface State {
|
||||
open?: boolean;
|
||||
}
|
||||
export class DrawerParamToggler extends React.Component<DrawerParamTogglerProps, State> {
|
||||
public state: State = {}
|
||||
public state: State = {};
|
||||
|
||||
toggle = () => {
|
||||
this.setState({ open: !this.state.open });
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { label, children } = this.props;
|
||||
|
||||
@@ -30,9 +30,9 @@ const defaultProps: Partial<DrawerProps> = {
|
||||
export class Drawer extends React.Component<DrawerProps> {
|
||||
static defaultProps = defaultProps as object;
|
||||
|
||||
private mouseDownTarget: HTMLElement
|
||||
private contentElem: HTMLElement
|
||||
private scrollElem: HTMLElement
|
||||
private mouseDownTarget: HTMLElement;
|
||||
private contentElem: HTMLElement;
|
||||
private scrollElem: HTMLElement;
|
||||
private scrollPos = new Map<string, number>();
|
||||
|
||||
private stopListenLocation = history.listen(() => {
|
||||
@@ -57,13 +57,13 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
if (!this.scrollElem) return;
|
||||
const key = history.location.key;
|
||||
this.scrollPos.set(key, this.scrollElem.scrollTop);
|
||||
}
|
||||
};
|
||||
|
||||
restoreScrollPos = () => {
|
||||
if (!this.scrollElem) return;
|
||||
const key = history.location.key;
|
||||
this.scrollElem.scrollTop = this.scrollPos.get(key) || 0;
|
||||
}
|
||||
};
|
||||
|
||||
onEscapeKey = (evt: KeyboardEvent) => {
|
||||
if (!this.props.open) {
|
||||
@@ -72,7 +72,7 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
if (evt.code === "Escape") {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onClickOutside = (evt: MouseEvent) => {
|
||||
const { contentElem, mouseDownTarget, close, props: { open } } = this;
|
||||
@@ -85,18 +85,18 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
close();
|
||||
}
|
||||
this.mouseDownTarget = null;
|
||||
}
|
||||
};
|
||||
|
||||
onMouseDown = (evt: MouseEvent) => {
|
||||
if (this.props.open) {
|
||||
this.mouseDownTarget = evt.target as HTMLElement;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
close = () => {
|
||||
const { open, onClose } = this.props;
|
||||
if (open) onClose();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { open, position, title, animation, children, toolbar, size, usePortal } = this.props;
|
||||
|
||||
@@ -25,7 +25,7 @@ export class ErrorBoundary extends React.Component<Props, State> {
|
||||
resetOnNavigate = reaction(
|
||||
() => navigation.getPath(),
|
||||
() => this.setState({ error: null, errorInfo: null })
|
||||
)
|
||||
);
|
||||
|
||||
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||
this.setState({ error, errorInfo });
|
||||
@@ -33,7 +33,7 @@ export class ErrorBoundary extends React.Component<Props, State> {
|
||||
|
||||
back = () => {
|
||||
navigation.goBack();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { error, errorInfo } = this.state;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class FileInput extends React.Component<Props> {
|
||||
|
||||
selectFiles = () => {
|
||||
this.input.click(); // opens system dialog for selecting files
|
||||
}
|
||||
};
|
||||
|
||||
protected onChange = async (evt: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const fileList = Array.from(evt.target.files);
|
||||
@@ -49,7 +49,7 @@ export class FileInput extends React.Component<Props> {
|
||||
selectedFiles = await Promise.all(readingFiles);
|
||||
}
|
||||
this.props.onSelectFiles(...selectedFiles);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { onSelectFiles, readAsText, ...props } = this.props;
|
||||
|
||||
@@ -31,7 +31,7 @@ export type InputProps<T = string> = Omit<InputElementProps, "onChange" | "onSub
|
||||
validators?: InputValidator | InputValidator[];
|
||||
onChange?(value: T, evt: React.ChangeEvent<InputElement>): void;
|
||||
onSubmit?(value: T): void;
|
||||
}
|
||||
};
|
||||
|
||||
interface State {
|
||||
focused?: boolean;
|
||||
@@ -59,7 +59,7 @@ export class Input extends React.Component<InputProps, State> {
|
||||
dirty: !!this.props.dirty,
|
||||
valid: true,
|
||||
errors: [],
|
||||
}
|
||||
};
|
||||
|
||||
setValue(value: string) {
|
||||
if (value !== this.getValue()) {
|
||||
|
||||
@@ -15,25 +15,25 @@ export class SearchInputUrl extends React.Component<Props> {
|
||||
@observable inputVal = ""; // fix: use empty string to avoid react warnings
|
||||
|
||||
@disposeOnUnmount
|
||||
updateInput = autorun(() => this.inputVal = getSearch())
|
||||
updateUrl = debounce((val: string) => setSearch(val), 250)
|
||||
updateInput = autorun(() => this.inputVal = getSearch());
|
||||
updateUrl = debounce((val: string) => setSearch(val), 250);
|
||||
|
||||
setValue = (value: string) => {
|
||||
this.inputVal = value;
|
||||
this.updateUrl(value);
|
||||
}
|
||||
};
|
||||
|
||||
clear = () => {
|
||||
this.setValue("");
|
||||
this.updateUrl.flush();
|
||||
}
|
||||
};
|
||||
|
||||
onChange = (val: string, evt: React.ChangeEvent<any>) => {
|
||||
this.setValue(val);
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(val, evt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { inputVal } = this;
|
||||
|
||||
@@ -40,11 +40,11 @@ export class SearchInput extends React.Component<Props> {
|
||||
if (this.props.onClear) {
|
||||
this.props.onClear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onChange = (val: string, evt: React.ChangeEvent<any>) => {
|
||||
this.props.onChange(val, evt);
|
||||
}
|
||||
};
|
||||
|
||||
onKeyDown = (evt: React.KeyboardEvent<any>) => {
|
||||
if (this.props.onKeyDown) {
|
||||
@@ -56,7 +56,7 @@ export class SearchInput extends React.Component<Props> {
|
||||
this.clear();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@autobind()
|
||||
focus(evt: KeyboardEvent) {
|
||||
|
||||
@@ -154,7 +154,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
|
||||
}
|
||||
return items;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@computed get isReady() {
|
||||
const { isReady, store } = this.props;
|
||||
|
||||
@@ -18,10 +18,10 @@ export class PageFiltersList extends React.Component<Props> {
|
||||
get filters() {
|
||||
return pageFilters.activeFilters;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
reset = () => pageFilters.reset()
|
||||
remove = (filter: Filter) => pageFilters.removeFilter(filter)
|
||||
reset = () => pageFilters.reset();
|
||||
remove = (filter: Filter) => pageFilters.removeFilter(filter);
|
||||
|
||||
renderContent() {
|
||||
const { filters } = this.props;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class PageFiltersSelect extends React.Component<Props> {
|
||||
static defaultProps: Props = {
|
||||
allowEmpty: true,
|
||||
disableFilters: {},
|
||||
}
|
||||
};
|
||||
|
||||
@computed get groupedOptions() {
|
||||
const options: GroupSelectOption<SelectOptionFilter>[] = [];
|
||||
@@ -65,7 +65,7 @@ export class PageFiltersSelect extends React.Component<Props> {
|
||||
{selected && <Icon small material="check" className="box right"/>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
private onSelect = (option: SelectOptionFilter) => {
|
||||
const { type, value, selected } = option;
|
||||
@@ -77,7 +77,7 @@ export class PageFiltersSelect extends React.Component<Props> {
|
||||
else {
|
||||
removeFilter(filter);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { groupedOptions, formatLabel, onSelect, options } = this;
|
||||
|
||||
@@ -60,7 +60,7 @@ export class KubeObjectDetails extends React.Component {
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
render() {
|
||||
const { object, isLoading, loadingError, isCrdInstance } = this;
|
||||
|
||||
@@ -25,7 +25,7 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
||||
else {
|
||||
showDetails(item.selfLink);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, ...layoutProps } = this.props;
|
||||
|
||||
@@ -46,11 +46,11 @@ export class KubeConfigDialog extends React.Component<Props> {
|
||||
|
||||
close = () => {
|
||||
KubeConfigDialog.close();
|
||||
}
|
||||
};
|
||||
|
||||
onOpen = () => {
|
||||
this.loadConfig();
|
||||
}
|
||||
};
|
||||
|
||||
async loadConfig() {
|
||||
const config = await this.data.loader().catch(err => {
|
||||
@@ -64,11 +64,11 @@ export class KubeConfigDialog extends React.Component<Props> {
|
||||
if (this.config && copyToClipboard(this.configTextArea)) {
|
||||
Notifications.ok(<Trans>Config copied to clipboard</Trans>);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
download = () => {
|
||||
downloadFile("config", this.config, "text/yaml");
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { isOpen, data = {} } = KubeConfigDialog;
|
||||
|
||||
@@ -26,7 +26,7 @@ export class MainLayout extends React.Component<MainLayoutProps> {
|
||||
|
||||
@observable isPinned = this.storage.get().pinnedSidebar;
|
||||
@observable isAccessible = true;
|
||||
@observable sidebarWidth = this.storage.get().sidebarWidth
|
||||
@observable sidebarWidth = this.storage.get().sidebarWidth;
|
||||
|
||||
@disposeOnUnmount syncPinnedStateWithStorage = reaction(
|
||||
() => this.isPinned,
|
||||
@@ -49,7 +49,7 @@ export class MainLayout extends React.Component<MainLayoutProps> {
|
||||
return {
|
||||
"--sidebar-width": `${this.sidebarWidth}px`,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@autobind()
|
||||
adjustWidth(newWidth: number): void {
|
||||
|
||||
@@ -51,7 +51,7 @@ export class PageLayout extends React.Component<PageLayoutProps> {
|
||||
evt.stopPropagation();
|
||||
this.back(evt);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class MenuActions extends React.Component<MenuActionsProps> {
|
||||
get removeConfirmationMessage() {
|
||||
return _i18n._(t`Remove item?`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public id = uniqueId("menu_actions_");
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export type RadioProps = React.HTMLProps<any> & {
|
||||
checked?: boolean;
|
||||
disabled?: boolean;
|
||||
onChange?(value: React.ChangeEvent<HTMLInputElement>): void;
|
||||
}
|
||||
};
|
||||
|
||||
export class Radio extends React.Component<RadioProps> {
|
||||
private elem: HTMLElement;
|
||||
@@ -52,7 +52,7 @@ export class Radio extends React.Component<RadioProps> {
|
||||
if (!checked && onChange) {
|
||||
onChange(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onKeyDown = (e: React.KeyboardEvent<any>) => {
|
||||
const SPACE_KEY = e.keyCode === 32;
|
||||
@@ -61,7 +61,7 @@ export class Radio extends React.Component<RadioProps> {
|
||||
this.elem.click();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, label, checked, children, ...inputProps } = this.props;
|
||||
|
||||
@@ -143,7 +143,7 @@ function directionDelta(P1: number, P2: number, M: number): number | false {
|
||||
}
|
||||
|
||||
export class ResizingAnchor extends React.PureComponent<Props> {
|
||||
@observable lastMouseEvent?: MouseEvent
|
||||
@observable lastMouseEvent?: MouseEvent;
|
||||
@observable.ref ref?: React.RefObject<HTMLDivElement>;
|
||||
|
||||
static defaultProps = {
|
||||
@@ -160,8 +160,8 @@ export class ResizingAnchor extends React.PureComponent<Props> {
|
||||
maxExtent: Number.POSITIVE_INFINITY,
|
||||
minExtent: 0,
|
||||
placement: ResizeSide.LEADING,
|
||||
}
|
||||
static IS_RESIZING = "resizing"
|
||||
};
|
||||
static IS_RESIZING = "resizing";
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
@@ -191,7 +191,7 @@ export class ResizingAnchor extends React.PureComponent<Props> {
|
||||
|
||||
this.lastMouseEvent = undefined;
|
||||
onStart();
|
||||
}
|
||||
};
|
||||
|
||||
calculateDelta(from: Position, to: Position): number | false {
|
||||
const node = this.ref.current;
|
||||
@@ -259,7 +259,7 @@ export class ResizingAnchor extends React.PureComponent<Props> {
|
||||
} else if (previousExtent >= maxExtent && maxExtent >= unboundedExtent) {
|
||||
onMaxExtentSubceed();
|
||||
}
|
||||
}, 100)
|
||||
}, 100);
|
||||
|
||||
@action
|
||||
onDragEnd = (_event: MouseEvent) => {
|
||||
@@ -267,7 +267,7 @@ export class ResizingAnchor extends React.PureComponent<Props> {
|
||||
document.removeEventListener("mousemove", this.onDrag);
|
||||
document.removeEventListener("mouseup", this.onDragEnd);
|
||||
document.body.classList.remove(ResizingAnchor.IS_RESIZING);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { disabled, direction, placement, onDoubleClick } = this.props;
|
||||
|
||||
@@ -22,7 +22,7 @@ export type IResourceMetricsValue<T extends KubeObject = any, P = any> = {
|
||||
object: T;
|
||||
tabId: number;
|
||||
params?: P;
|
||||
}
|
||||
};
|
||||
|
||||
export const ResourceMetricsContext = createContext<IResourceMetricsValue>(null);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export class Select extends React.Component<SelectProps> {
|
||||
autoConvertOptions: true,
|
||||
menuPortalTarget: document.body,
|
||||
menuPlacement: "auto",
|
||||
}
|
||||
};
|
||||
|
||||
@computed get theme() {
|
||||
return this.props.themeName || themeStore.activeTheme.type;
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface TableHeadProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
export class TableHead extends React.Component<TableHeadProps> {
|
||||
static defaultProps: TableHeadProps = {
|
||||
sticky: true,
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, sticky, nowrap, showTopLine, children, ...headProps } = this.props;
|
||||
|
||||
@@ -16,7 +16,7 @@ import { ItemObject } from "../../item.store";
|
||||
|
||||
export type TableSortBy = string;
|
||||
export type TableOrderBy = "asc" | "desc" | string;
|
||||
export type TableSortParams = { sortBy: TableSortBy; orderBy: TableOrderBy }
|
||||
export type TableSortParams = { sortBy: TableSortBy; orderBy: TableOrderBy };
|
||||
export type TableSortCallback<D = any> = (data: D) => string | number | (string | number)[];
|
||||
|
||||
export interface TableProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
@@ -51,7 +51,7 @@ export class Table extends React.Component<TableProps> {
|
||||
rowPadding: "8px",
|
||||
rowLineHeight: "17px",
|
||||
sortSyncWithUrl: true,
|
||||
}
|
||||
};
|
||||
|
||||
@observable sortParamsLocal = this.props.sortByDefault;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ interface TabsContextValue<D = any> {
|
||||
onChange?(value: D): void;
|
||||
}
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
export interface TabsProps<D = any> extends TabsContextValue<D>, Omit<DOMAttributes<HTMLElement>, "onChange"> {
|
||||
className?: string;
|
||||
|
||||
@@ -71,7 +71,7 @@ export class VirtualList extends Component<Props, State> {
|
||||
this.setState({
|
||||
height: parentHeight,
|
||||
});
|
||||
}, 250)
|
||||
}, 250);
|
||||
|
||||
getItemSize = (index: number) => this.props.rowHeights[index];
|
||||
|
||||
@@ -81,11 +81,11 @@ export class VirtualList extends Component<Props, State> {
|
||||
const index = items.findIndex(item => item.getId() == selectedItemId);
|
||||
if (index === -1) return;
|
||||
this.listRef.current.scrollToItem(index, "start");
|
||||
})
|
||||
});
|
||||
|
||||
scrollToItem = (index: number, align: Align) => {
|
||||
this.listRef.current.scrollToItem(index, align);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { width, className, items, getRow, onScroll, outerRef } = this.props;
|
||||
|
||||
@@ -136,7 +136,7 @@ export class WizardStep extends React.Component<WizardStepProps, WizardStepState
|
||||
|
||||
static defaultProps: WizardStepProps = {
|
||||
scrollable: true,
|
||||
}
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
this.unmounting = true;
|
||||
@@ -146,7 +146,7 @@ export class WizardStep extends React.Component<WizardStepProps, WizardStepState
|
||||
const { isFirst, prev, done } = this.props;
|
||||
if (isFirst() && done) done();
|
||||
else prev();
|
||||
}
|
||||
};
|
||||
|
||||
next = () => {
|
||||
const next = this.props.next;
|
||||
@@ -167,7 +167,7 @@ export class WizardStep extends React.Component<WizardStepProps, WizardStepState
|
||||
else {
|
||||
nextStep();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
submit = () => {
|
||||
if (!this.form.noValidate) {
|
||||
@@ -175,7 +175,7 @@ export class WizardStep extends React.Component<WizardStepProps, WizardStepState
|
||||
if (!valid) return;
|
||||
}
|
||||
this.next();
|
||||
}
|
||||
};
|
||||
|
||||
renderLoading() {
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user