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
@@ -15,6 +15,7 @@ interface Props {
|
||||
export class LoginLayout extends React.Component<Props> {
|
||||
render() {
|
||||
const { className, header, title, footer, children } = this.props;
|
||||
|
||||
return (
|
||||
<section className={cssNames("LoginLayout flex", className)}>
|
||||
<div className="header">{header}</div>
|
||||
|
||||
@@ -59,9 +59,11 @@ export class MainLayout extends React.Component<MainLayoutProps> {
|
||||
render() {
|
||||
const { className, headerClass, footer, footerClass, children } = this.props;
|
||||
const cluster = getHostedCluster();
|
||||
|
||||
if (!cluster) {
|
||||
return null; // fix: skip render when removing active (visible) cluster
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cssNames("MainLayout", className)} style={this.getSidebarSize() as any}>
|
||||
<header className={cssNames("flex gaps align-center", headerClass)}>
|
||||
|
||||
@@ -47,6 +47,7 @@ export class PageLayout extends React.Component<PageLayoutProps> {
|
||||
if (!this.props.provideBackButtonNavigation) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.code === "Escape") {
|
||||
evt.stopPropagation();
|
||||
this.back(evt);
|
||||
@@ -59,6 +60,7 @@ export class PageLayout extends React.Component<PageLayoutProps> {
|
||||
contentGaps, showOnTop, children, ...elemProps
|
||||
} = this.props;
|
||||
const className = cssNames("PageLayout", { top: showOnTop }, this.props.className);
|
||||
|
||||
return (
|
||||
<div {...elemProps} className={className}>
|
||||
<div className={cssNames("header flex gaps align-center", headerClass)}>
|
||||
|
||||
@@ -32,6 +32,7 @@ import { Spinner } from "../spinner";
|
||||
import { ClusterPageMenuRegistration, clusterPageMenuRegistry, clusterPageRegistry, getExtensionPageUrl } from "../../../extensions/registries";
|
||||
|
||||
const SidebarContext = React.createContext<SidebarContextValue>({ pinned: false });
|
||||
|
||||
type SidebarContextValue = {
|
||||
pinned: boolean;
|
||||
};
|
||||
@@ -64,6 +65,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
routePath: String(crdResourcesRoute.path),
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<SidebarNavItem
|
||||
key={group}
|
||||
@@ -84,6 +86,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
|
||||
clusterPageMenuRegistry.getSubItems(menu).forEach((subItem) => {
|
||||
const subPage = clusterPageRegistry.getByPageMenuTarget(subItem.target);
|
||||
|
||||
if (subPage) {
|
||||
routes.push({
|
||||
routePath: subPage.routePath,
|
||||
@@ -94,6 +97,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
@@ -103,8 +107,10 @@ export class Sidebar extends React.Component<Props> {
|
||||
const tabRoutes = this.getTabLayoutRoutes(menuItem);
|
||||
let pageUrl: string;
|
||||
let isActive = false;
|
||||
|
||||
if (registeredPage) {
|
||||
const { extensionId, id: pageId } = registeredPage;
|
||||
|
||||
pageUrl = getExtensionPageUrl({ extensionId, pageId, params: menuItem.target.params });
|
||||
isActive = isActiveRoute(registeredPage.routePath);
|
||||
} else if (tabRoutes.length > 0) {
|
||||
@@ -113,6 +119,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarNavItem
|
||||
key={`registered-item-${index}`}
|
||||
@@ -129,6 +136,7 @@ export class Sidebar extends React.Component<Props> {
|
||||
render() {
|
||||
const { toggle, isPinned, className } = this.props;
|
||||
const query = namespaceStore.getContextParams();
|
||||
|
||||
return (
|
||||
<SidebarContext.Provider value={{ pinned: isPinned }}>
|
||||
<div className={cssNames("Sidebar flex column", className, { pinned: isPinned })}>
|
||||
@@ -262,6 +270,7 @@ interface SidebarNavItemProps {
|
||||
|
||||
const navItemStorage = createStorage<[string, boolean][]>("sidebar_menu_item", []);
|
||||
const navItemState = observable.map<string, boolean>(navItemStorage.get());
|
||||
|
||||
reaction(() => [...navItemState], (value) => navItemStorage.set(value));
|
||||
|
||||
@observer
|
||||
@@ -283,10 +292,12 @@ class SidebarNavItem extends React.Component<SidebarNavItemProps> {
|
||||
|
||||
render() {
|
||||
const { isHidden, isActive, subMenus = [], icon, text, url, children, className, testId } = this.props;
|
||||
|
||||
if (isHidden) {
|
||||
return null;
|
||||
}
|
||||
const extendedView = (subMenus.length > 0 || children) && this.context.pinned;
|
||||
|
||||
if (extendedView) {
|
||||
return (
|
||||
<div className={cssNames("SidebarNavItem", className)} data-test-id={testId}>
|
||||
@@ -310,6 +321,7 @@ class SidebarNavItem extends React.Component<SidebarNavItemProps> {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<NavLink className={cssNames("SidebarNavItem", className)} to={url} isActive={() => isActive}>
|
||||
{icon}
|
||||
|
||||
@@ -12,10 +12,12 @@ export class SubHeader extends React.Component<SubHeaderProps> {
|
||||
render() {
|
||||
const { withLine, compact, children } = this.props;
|
||||
let { className } = this.props;
|
||||
|
||||
className = cssNames("SubHeader", {
|
||||
withLine,
|
||||
compact,
|
||||
}, className);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{children}
|
||||
|
||||
@@ -12,9 +12,11 @@ export class SubTitle extends React.Component<Props> {
|
||||
render() {
|
||||
const { compact, title, children } = this.props;
|
||||
let { className } = this.props;
|
||||
|
||||
className = cssNames("SubTitle", className, {
|
||||
compact,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{title} {children}
|
||||
|
||||
@@ -28,12 +28,14 @@ export const TabLayout = observer(({ className, contentClass, tabs = [], childre
|
||||
const currentLocation = navigation.location.pathname;
|
||||
const hasTabs = tabs.length > 0;
|
||||
const startTabUrl = hasTabs ? (tabs.find(tab => tab.default) || tabs[0])?.url : null;
|
||||
|
||||
return (
|
||||
<div className={cssNames("TabLayout", className)}>
|
||||
{hasTabs && (
|
||||
<Tabs center onChange={(url) => navigate(url)}>
|
||||
{tabs.map(({ title, routePath, url = routePath, exact }) => {
|
||||
const isActive = !!matchPath(currentLocation, { path: routePath, exact });
|
||||
|
||||
return <Tab key={url} label={title} value={url} active={isActive}/>;
|
||||
})}
|
||||
</Tabs>
|
||||
|
||||
@@ -20,6 +20,7 @@ export class WizardLayout extends React.Component<WizardLayoutProps> {
|
||||
className, contentClass, infoPanelClass, infoPanel, header, headerClass, centered,
|
||||
children, ...props
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div {...props} className={cssNames("WizardLayout", { centered }, className)}>
|
||||
{header && (
|
||||
|
||||
Reference in new issue
Block a user