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
@@ -30,6 +30,7 @@ export class KubeObjectDetails extends React.Component {
|
||||
|
||||
@computed get object() {
|
||||
const store = apiManager.getStore(this.path);
|
||||
|
||||
if (store) {
|
||||
return store.getByPath(this.path);
|
||||
}
|
||||
@@ -47,10 +48,13 @@ export class KubeObjectDetails extends React.Component {
|
||||
], async () => {
|
||||
this.loadingError = "";
|
||||
const { path, object } = this;
|
||||
|
||||
if (!object) {
|
||||
const store = apiManager.getStore(path);
|
||||
|
||||
if (store) {
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
await store.loadFromPath(path);
|
||||
} catch (err) {
|
||||
@@ -67,16 +71,20 @@ export class KubeObjectDetails extends React.Component {
|
||||
const isOpen = !!(object || isLoading || loadingError);
|
||||
let title = "";
|
||||
let details: JSX.Element[];
|
||||
|
||||
if (object) {
|
||||
const { kind, getName } = object;
|
||||
|
||||
title = `${kind}: ${getName()}`;
|
||||
details = kubeObjectDetailRegistry.getItemsForKind(object.kind, object.apiVersion).map((item, index) => {
|
||||
return <item.components.Details object={object} key={`object-details-${index}`}/>;
|
||||
});
|
||||
|
||||
if (isCrdInstance && details.length === 0) {
|
||||
details.push(<CrdResourceDetails object={object} />);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
className="KubeObjectDetails flex column"
|
||||
|
||||
@@ -29,6 +29,7 @@ export class KubeObjectListLayout extends React.Component<KubeObjectListLayoutPr
|
||||
|
||||
render() {
|
||||
const { className, ...layoutProps } = this.props;
|
||||
|
||||
return (
|
||||
<ItemListLayout
|
||||
{...layoutProps}
|
||||
|
||||
@@ -17,17 +17,21 @@ export interface KubeObjectMenuProps<T extends KubeObject = any> extends MenuAct
|
||||
export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
||||
get store() {
|
||||
const { object } = this.props;
|
||||
|
||||
if (!object) return;
|
||||
|
||||
return apiManager.getStore(object.selfLink);
|
||||
}
|
||||
|
||||
get isEditable() {
|
||||
const { editable } = this.props;
|
||||
|
||||
return editable !== undefined ? editable : !!(this.store && this.store.update);
|
||||
}
|
||||
|
||||
get isRemovable() {
|
||||
const { removable } = this.props;
|
||||
|
||||
return removable !== undefined ? removable : !!(this.store && this.store.remove);
|
||||
}
|
||||
|
||||
@@ -41,6 +45,7 @@ export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
||||
async remove() {
|
||||
hideDetails();
|
||||
const { object, removeAction } = this.props;
|
||||
|
||||
if (removeAction) await removeAction();
|
||||
else await this.store.remove(object);
|
||||
}
|
||||
@@ -50,6 +55,7 @@ export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
||||
const { object } = this.props;
|
||||
const resourceKind = object.kind;
|
||||
const resourceName = object.getName();
|
||||
|
||||
return (
|
||||
<p><Trans>Remove {resourceKind} <b>{resourceName}</b>?</Trans></p>
|
||||
);
|
||||
@@ -58,11 +64,13 @@ export class KubeObjectMenu extends React.Component<KubeObjectMenuProps> {
|
||||
render() {
|
||||
const { remove, update, renderRemoveMessage, isEditable, isRemovable } = this;
|
||||
const { className, object, editable, removable, toolbar, ...menuProps } = this.props;
|
||||
|
||||
if (!object) return null;
|
||||
|
||||
const menuItems = kubeObjectMenuRegistry.getItemsForKind(object.kind, object.apiVersion).map((item, index) => {
|
||||
return <item.components.MenuItem object={object} key={`menu-item-${index}`} toolbar={toolbar} />;
|
||||
});
|
||||
|
||||
return (
|
||||
<MenuActions
|
||||
className={cssNames("KubeObjectMenu", className)}
|
||||
|
||||
@@ -19,6 +19,7 @@ export class KubeObjectMeta extends React.Component<KubeObjectMetaProps> {
|
||||
|
||||
isHidden(field: IKubeMetaField): boolean {
|
||||
const { hideFields = KubeObjectMeta.defaultHiddenFields } = this.props;
|
||||
|
||||
return hideFields.includes(field);
|
||||
}
|
||||
|
||||
@@ -31,6 +32,7 @@ export class KubeObjectMeta extends React.Component<KubeObjectMetaProps> {
|
||||
} = object;
|
||||
|
||||
const ownerRefs = object.getOwnerRefs();
|
||||
|
||||
return (
|
||||
<>
|
||||
<DrawerItem name={<Trans>Created</Trans>} hidden={this.isHidden("creationTimestamp")}>
|
||||
@@ -72,6 +74,7 @@ export class KubeObjectMeta extends React.Component<KubeObjectMetaProps> {
|
||||
ownerRefs.map(ref => {
|
||||
const { name, kind } = ref;
|
||||
const ownerDetailsUrl = getDetailsUrl(lookupApiLink(ref, object));
|
||||
|
||||
return (
|
||||
<p key={name}>
|
||||
{kind} <Link to={ownerDetailsUrl}>{name}</Link>
|
||||
|
||||
Reference in new issue
Block a user