You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/02/21 08:02:05 UTC
[incubator-devlake] branch main updated: feat(config-ui): remove blueprint from the main menu (#4471)
This is an automated email from the ASF dual-hosted git repository.
likyh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 6755365dc feat(config-ui): remove blueprint from the main menu (#4471)
6755365dc is described below
commit 6755365dccdf8f918ec7f131aed1dc67181a4f6c
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Feb 21 16:02:00 2023 +0800
feat(config-ui): remove blueprint from the main menu (#4471)
---
config-ui/src/layouts/base/base.tsx | 57 ++++++++++++++++++----------------
config-ui/src/layouts/base/use-menu.ts | 36 ++++++++++++---------
2 files changed, 53 insertions(+), 40 deletions(-)
diff --git a/config-ui/src/layouts/base/base.tsx b/config-ui/src/layouts/base/base.tsx
index 39274860f..51afa45d5 100644
--- a/config-ui/src/layouts/base/base.tsx
+++ b/config-ui/src/layouts/base/base.tsx
@@ -53,32 +53,37 @@ export const BaseLayout = ({ children }: Props) => {
<S.Sider>
<Logo />
<Menu className="menu">
- {menu.map((it) => (
- <MenuItem
- key={it.key}
- className="menu-item"
- text={it.title}
- icon={it.icon}
- active={pathname.includes(it.path)}
- onClick={() => handlePushPath(it)}
- >
- {it.children?.map((cit) => (
- <MenuItem
- key={cit.key}
- className="sub-menu-item"
- text={
- <S.SiderMenuItem>
- <span>{cit.title}</span>
- {cit.isBeta && <Tag intent={Intent.WARNING}>beta</Tag>}
- </S.SiderMenuItem>
- }
- icon={cit.icon ?? <img src={cit.iconUrl} width={16} alt="" />}
- active={pathname.includes(cit.path)}
- onClick={() => handlePushPath(cit)}
- />
- ))}
- </MenuItem>
- ))}
+ {menu.map((it) => {
+ const paths = [it.path, ...(it.children ?? []).map((cit) => cit.path)];
+ const active = !!paths.find((path) => pathname.includes(path));
+ return (
+ <MenuItem
+ key={it.key}
+ className="menu-item"
+ text={it.title}
+ icon={it.icon}
+ active={active}
+ onClick={() => handlePushPath(it)}
+ >
+ {it.children?.map((cit) => (
+ <MenuItem
+ key={cit.key}
+ className="sub-menu-item"
+ text={
+ <S.SiderMenuItem>
+ <span>{cit.title}</span>
+ {cit.isBeta && <Tag intent={Intent.WARNING}>beta</Tag>}
+ </S.SiderMenuItem>
+ }
+ icon={cit.icon ?? <img src={cit.iconUrl} width={16} alt="" />}
+ active={pathname.includes(cit.path)}
+ disabled={cit.disabled}
+ onClick={() => handlePushPath(cit)}
+ />
+ ))}
+ </MenuItem>
+ );
+ })}
</Menu>
<div className="copyright">
<div>Apache 2.0 License</div>
diff --git a/config-ui/src/layouts/base/use-menu.ts b/config-ui/src/layouts/base/use-menu.ts
index cbc6631fe..ed3737875 100644
--- a/config-ui/src/layouts/base/use-menu.ts
+++ b/config-ui/src/layouts/base/use-menu.ts
@@ -30,6 +30,7 @@ export type MenuItemType = {
children?: MenuItemType[];
target?: boolean;
isBeta?: boolean;
+ disabled?: boolean;
};
export const useMenu = () => {
@@ -64,26 +65,33 @@ export const useMenu = () => {
isBeta: it.isBeta,
})),
},
- {
- key: 'blueprint',
- title: 'Blueprints',
- icon: 'timeline-events',
- path: '/blueprints',
- children: [
- {
- key: 'create-blueprint',
- title: 'Create Blueprint',
- icon: 'git-pull',
- path: '/blueprints/create',
- },
- ],
- },
{
key: 'transformation',
title: 'Transformation',
icon: 'function',
path: '/transformations',
},
+ {
+ key: 'advanced',
+ title: 'Advanced',
+ icon: 'pulse',
+ // path: '/advanced',
+ children: [
+ {
+ key: 'blueprints',
+ title: 'Blueprints',
+ icon: '',
+ path: '/blueprints',
+ },
+ {
+ key: 'pipelines',
+ title: 'Pipelines',
+ icon: '',
+ path: '/pipelines',
+ disabled: true,
+ },
+ ],
+ },
{
key: 'dashboard',
title: 'Dashboard',