mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Linter fixes
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
1489264953
commit
8c8701f8a6
@ -1,3 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
import type { AsyncFnMock } from "@async-fn/jest";
|
import type { AsyncFnMock } from "@async-fn/jest";
|
||||||
import asyncFn from "@async-fn/jest";
|
import asyncFn from "@async-fn/jest";
|
||||||
import type { DiContainer } from "@ogre-tools/injectable";
|
import type { DiContainer } from "@ogre-tools/injectable";
|
||||||
@ -35,11 +39,11 @@ function createNamespace(name: string, labels?: Record<string, string>, annotati
|
|||||||
selfLink: `/api/v1/namespaces/${name}`,
|
selfLink: `/api/v1/namespaces/${name}`,
|
||||||
uid: `${name}-1`,
|
uid: `${name}-1`,
|
||||||
labels: {
|
labels: {
|
||||||
...labels
|
...labels,
|
||||||
},
|
},
|
||||||
annotations: {
|
annotations: {
|
||||||
...annotations
|
...annotations,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -232,7 +236,9 @@ describe("<NamespaceTreeView />", () => {
|
|||||||
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
|
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
|
||||||
const minusButton = levelB.querySelector("[data-testid='minus-square']");
|
const minusButton = levelB.querySelector("[data-testid='minus-square']");
|
||||||
|
|
||||||
fireEvent.click(minusButton!);
|
if (minusButton) {
|
||||||
|
fireEvent.click(minusButton);
|
||||||
|
}
|
||||||
|
|
||||||
expect(result.baseElement).toMatchSnapshot();
|
expect(result.baseElement).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
@ -242,11 +248,15 @@ describe("<NamespaceTreeView />", () => {
|
|||||||
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
|
const levelB = result.getByTestId("namespace-level-deep-child-b-1");
|
||||||
const minusButton = levelB.querySelector("[data-testid='minus-square']");
|
const minusButton = levelB.querySelector("[data-testid='minus-square']");
|
||||||
|
|
||||||
fireEvent.click(minusButton!);
|
if (minusButton) {
|
||||||
|
fireEvent.click(minusButton);
|
||||||
|
}
|
||||||
|
|
||||||
const plusButton = levelB.querySelector("[data-testid='plus-square']");
|
const plusButton = levelB.querySelector("[data-testid='plus-square']");
|
||||||
|
|
||||||
fireEvent.click(plusButton!);
|
if (plusButton) {
|
||||||
|
fireEvent.click(plusButton);
|
||||||
|
}
|
||||||
|
|
||||||
expect(result.baseElement).toMatchSnapshot();
|
expect(result.baseElement).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
import { SvgIcon, withStyles } from "@material-ui/core";
|
import { SvgIcon, withStyles } from "@material-ui/core";
|
||||||
import { TreeItem, TreeItemProps, TreeView } from "@material-ui/lab";
|
import type { TreeItemProps } from "@material-ui/lab";
|
||||||
|
import { TreeItem, TreeView } from "@material-ui/lab";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@ -32,7 +37,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
|
|||||||
|
|
||||||
function renderChildren(parent: Namespace) {
|
function renderChildren(parent: Namespace) {
|
||||||
const children = hierarchicalNamespaces.filter(ns =>
|
const children = hierarchicalNamespaces.filter(ns =>
|
||||||
ns.getLabels().find(label => label === `${parent.getName()}.tree.hnc.x-k8s.io/depth=1`)
|
ns.getLabels().find(label => label === `${parent.getName()}.tree.hnc.x-k8s.io/depth=1`),
|
||||||
);
|
);
|
||||||
|
|
||||||
return children.map(child => (
|
return children.map(child => (
|
||||||
@ -41,7 +46,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
|
|||||||
nodeId={`namespace-${child.getId()}`}
|
nodeId={`namespace-${child.getId()}`}
|
||||||
data-testid={`namespace-${child.getId()}`}
|
data-testid={`namespace-${child.getId()}`}
|
||||||
onIconClick={(evt) =>{
|
onIconClick={(evt) =>{
|
||||||
toggleNode(`namespace-${child.getId()}`)
|
toggleNode(`namespace-${child.getId()}`);
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
}}
|
}}
|
||||||
label={(
|
label={(
|
||||||
@ -97,7 +102,7 @@ function NonInjectableNamespaceTreeView({ root, namespaceStore, getDetailsUrl }:
|
|||||||
</StyledTreeItem>
|
</StyledTreeItem>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MinusSquare() {
|
function MinusSquare() {
|
||||||
@ -126,7 +131,7 @@ function CloseSquare() {
|
|||||||
|
|
||||||
const StyledTreeItem = withStyles((theme) => ({
|
const StyledTreeItem = withStyles((theme) => ({
|
||||||
iconContainer: {
|
iconContainer: {
|
||||||
'& .close': {
|
"& .close": {
|
||||||
opacity: 0.3,
|
opacity: 0.3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
import styles from "./subnamespace-badge.module.scss";
|
import styles from "./subnamespace-badge.module.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user