mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -38,6 +38,7 @@ export class AddNamespaceDialog extends React.Component<Props> {
|
||||
addNamespace = async () => {
|
||||
const { namespace } = this;
|
||||
const { onSuccess, onError } = this.props;
|
||||
|
||||
try {
|
||||
await namespaceStore.create({ name: namespace }).then(onSuccess);
|
||||
this.close();
|
||||
@@ -51,6 +52,7 @@ export class AddNamespaceDialog extends React.Component<Props> {
|
||||
const { ...dialogProps } = this.props;
|
||||
const { namespace } = this;
|
||||
const header = <h5><Trans>Create Namespace</Trans></h5>;
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
{...dialogProps}
|
||||
|
||||
@@ -22,6 +22,7 @@ interface Props extends KubeObjectDetailsProps<Namespace> {
|
||||
export class NamespaceDetails extends React.Component<Props> {
|
||||
@computed get quotas() {
|
||||
const namespace = this.props.object.getName();
|
||||
|
||||
return resourceQuotaStore.getAllByNs(namespace);
|
||||
}
|
||||
|
||||
@@ -31,8 +32,10 @@ export class NamespaceDetails extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { object: namespace } = this.props;
|
||||
|
||||
if (!namespace) return;
|
||||
const status = namespace.getStatus();
|
||||
|
||||
return (
|
||||
<div className="NamespaceDetails">
|
||||
<KubeObjectMeta object={namespace}/>
|
||||
|
||||
@@ -46,16 +46,20 @@ export class NamespaceSelect extends React.Component<Props> {
|
||||
@computed get options(): SelectOption[] {
|
||||
const { customizeOptions, showClusterOption, clusterOptionLabel } = this.props;
|
||||
let options: SelectOption[] = namespaceStore.items.map(ns => ({ value: ns.getName() }));
|
||||
|
||||
options = customizeOptions ? customizeOptions(options) : options;
|
||||
|
||||
if (showClusterOption) {
|
||||
options.unshift({ value: null, label: clusterOptionLabel });
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
formatOptionLabel = (option: SelectOption) => {
|
||||
const { showIcons } = this.props;
|
||||
const { value, label } = option;
|
||||
|
||||
return label || (
|
||||
<>
|
||||
{showIcons && <Icon small material="layers" />}
|
||||
@@ -66,6 +70,7 @@ export class NamespaceSelect extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { className, showIcons, showClusterOption, clusterOptionLabel, customizeOptions, ...selectProps } = this.props;
|
||||
|
||||
return (
|
||||
<Select
|
||||
className={cssNames("NamespaceSelect", className)}
|
||||
@@ -83,8 +88,10 @@ export class NamespaceSelectFilter extends React.Component {
|
||||
render() {
|
||||
const { contextNs, hasContext, toggleContext } = namespaceStore;
|
||||
let placeholder = <Trans>All namespaces</Trans>;
|
||||
|
||||
if (contextNs.length == 1) placeholder = <Trans>Namespace: {contextNs[0]}</Trans>;
|
||||
if (contextNs.length >= 2) placeholder = <Trans>Namespaces: {contextNs.join(", ")}</Trans>;
|
||||
|
||||
return (
|
||||
<NamespaceSelect
|
||||
placeholder={placeholder}
|
||||
@@ -95,6 +102,7 @@ export class NamespaceSelectFilter extends React.Component {
|
||||
onChange={([{ value }]: SelectOption[]) => toggleContext(value)}
|
||||
formatOptionLabel={({ value: namespace }: SelectOption) => {
|
||||
const isSelected = hasContext(namespace);
|
||||
|
||||
return (
|
||||
<div className="flex gaps align-center">
|
||||
<FilterIcon type={FilterType.NAMESPACE} />
|
||||
|
||||
@@ -15,6 +15,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
|
||||
get initNamespaces() {
|
||||
const fromUrl = navigation.searchParams.getAsArray("namespaces");
|
||||
|
||||
return fromUrl.length ? fromUrl : this.storage.get();
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
|
||||
// restore context namespaces
|
||||
const { initNamespaces: namespaces } = this;
|
||||
|
||||
this.setContext(namespaces);
|
||||
this.updateUrl(namespaces);
|
||||
|
||||
@@ -46,8 +48,10 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
protected async loadItems(namespaces?: string[]) {
|
||||
if (!isAllowedResource("namespaces")) {
|
||||
if (namespaces) return namespaces.map(this.getDummyNamespace);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
if (namespaces) {
|
||||
return Promise.all(namespaces.map(name => this.api.get({ name })));
|
||||
} else {
|
||||
@@ -74,6 +78,7 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
|
||||
hasContext(namespace: string | string[]) {
|
||||
const context = Array.isArray(namespace) ? namespace : [namespace];
|
||||
|
||||
return context.every(namespace => this.contextNs.includes(namespace));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user