You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by so...@apache.org on 2022/03/21 07:19:34 UTC
[dolphinscheduler] branch dev updated: [Fix][UI Next][V1.0.0-Alpha] Menu error (#9036)
This is an automated email from the ASF dual-hosted git repository.
songjian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new d91711b [Fix][UI Next][V1.0.0-Alpha] Menu error (#9036)
d91711b is described below
commit d91711b3222044e619daeaef780bb3498bb83085
Author: Devosend <de...@gmail.com>
AuthorDate: Mon Mar 21 15:19:27 2022 +0800
[Fix][UI Next][V1.0.0-Alpha] Menu error (#9036)
* modify the sidebar menu control mode
* modify side menu
* store last path
* fix security auth error
* fix resource e2e
* fix resource manage e2e bug
---
.../e2e/pages/resource/ResourcePage.java | 7 +--
.../layouts/content/components/navbar/index.tsx | 30 +++++++++----
.../layouts/content/components/sidebar/index.tsx | 4 +-
.../src/layouts/content/index.tsx | 37 ++++++++--------
.../src/layouts/content/use-dataList.ts | 17 ++++----
dolphinscheduler-ui-next/src/router/index.ts | 7 +--
.../src/router/modules/data-quality.ts | 2 +
.../src/router/modules/datasource.ts | 1 +
.../src/router/modules/monitor.ts | 5 +++
.../src/router/modules/projects.ts | 19 ++++++++
.../src/router/modules/resources.ts | 17 ++++++++
.../src/router/modules/security.ts | 9 ++++
dolphinscheduler-ui-next/src/router/routes.ts | 1 +
dolphinscheduler-ui-next/src/store/menu/menu.ts | 51 ----------------------
.../use-menuClick.ts => store/route/route.ts} | 34 ++++++++-------
.../src/store/{menu => route}/types.ts | 8 ++--
.../src/views/login/use-login.ts | 8 ++--
.../src/views/projects/list/use-table.ts | 3 --
.../src/views/resource/file/index.tsx | 2 +-
19 files changed, 136 insertions(+), 126 deletions(-)
diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java
index 8009775..68c6556 100644
--- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java
+++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java
@@ -47,20 +47,21 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem {
public <T extends ResourcePage.Tab> T goToTab(Class<T> tab) {
if (tab == FileManagePage.class) {
+ new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/file-manage"));
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(fileManageTab));
- fileManageTab.click();
+ ((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab());
return tab.cast(new FileManagePage(driver));
}
if (tab == UdfManagePage.class) {
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(udfManageTab));
- udfManageTab.click();
+ ((JavascriptExecutor) driver).executeScript("arguments[0].click();", udfManageTab());
return tab.cast(new UdfManagePage(driver));
}
if (tab == FunctionManagePage.class) {
new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(functionManageTab));
- functionManageTab.click();
+ ((JavascriptExecutor) driver).executeScript("arguments[0].click();", functionManageTab());
return tab.cast(new FunctionManagePage(driver));
}
diff --git a/dolphinscheduler-ui-next/src/layouts/content/components/navbar/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/components/navbar/index.tsx
index 71b0ca2..96a7702 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/components/navbar/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/components/navbar/index.tsx
@@ -15,7 +15,8 @@
* limitations under the License.
*/
-import { defineComponent, PropType } from 'vue'
+import { defineComponent, PropType, ref, watch } from 'vue'
+import { useRoute, useRouter } from 'vue-router'
import styles from './index.module.scss'
import { NMenu } from 'naive-ui'
import Logo from '../logo'
@@ -23,8 +24,6 @@ import Locales from '../locales'
import Timezone from '../timezone'
import User from '../user'
import Theme from '../theme'
-import { useMenuClick } from './use-menuClick'
-import { useMenuStore } from '@/store/menu/menu'
const Navbar = defineComponent({
name: 'Navbar',
@@ -46,11 +45,24 @@ const Navbar = defineComponent({
default: []
}
},
- emits: ['handleMenuClick'],
- setup(props, ctx) {
- const { handleMenuClick } = useMenuClick(ctx)
- const menuStore = useMenuStore()
- return { handleMenuClick, menuStore }
+ setup() {
+ const route = useRoute()
+ const router = useRouter()
+
+ const menuKey = ref(route.meta.activeMenu as string)
+
+ const handleMenuClick = (key: string) => {
+ router.push({ path: `/${key}` })
+ }
+
+ watch(
+ () => route.path,
+ () => {
+ menuKey.value = route.meta.activeMenu as string
+ }
+ )
+
+ return { handleMenuClick, menuKey }
},
render() {
return (
@@ -58,7 +70,7 @@ const Navbar = defineComponent({
<Logo />
<div class={styles.nav}>
<NMenu
- value={this.menuStore.getMenuKey}
+ value={this.menuKey}
mode='horizontal'
options={this.headerMenuOptions}
onUpdateValue={this.handleMenuClick}
diff --git a/dolphinscheduler-ui-next/src/layouts/content/components/sidebar/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/components/sidebar/index.tsx
index 5dec929..782b966 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/components/sidebar/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/components/sidebar/index.tsx
@@ -18,7 +18,6 @@
import { defineComponent, ref, PropType } from 'vue'
import { NLayoutSider, NMenu } from 'naive-ui'
import { useMenuClick } from './use-menuClick'
-import { useMenuStore } from '@/store/menu/menu'
const Sidebar = defineComponent({
name: 'Sidebar',
@@ -33,7 +32,6 @@ const Sidebar = defineComponent({
}
},
setup() {
- const menuStore = useMenuStore()
const collapsedRef = ref(false)
const defaultExpandedKeys = [
'workflow',
@@ -46,7 +44,7 @@ const Sidebar = defineComponent({
const { handleMenuClick } = useMenuClick()
- return { collapsedRef, defaultExpandedKeys, handleMenuClick, menuStore }
+ return { collapsedRef, defaultExpandedKeys, handleMenuClick }
},
render() {
return (
diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
index c531e67..45edeb9 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
@@ -20,8 +20,8 @@ import { NLayout, NLayoutContent, NLayoutHeader, useMessage } from 'naive-ui'
import NavBar from './components/navbar'
import SideBar from './components/sidebar'
import { useDataList } from './use-dataList'
-import { useMenuStore } from '@/store/menu/menu'
import { useLocalesStore } from '@/store/locales/locales'
+import { useRouteStore } from '@/store/route/route'
import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
@@ -31,9 +31,9 @@ const Content = defineComponent({
window.$message = useMessage()
const route = useRoute()
- const menuStore = useMenuStore()
const { locale } = useI18n()
const localesStore = useLocalesStore()
+ const routeStore = useRouteStore()
const {
state,
changeMenuOption,
@@ -51,16 +51,11 @@ const Content = defineComponent({
})
const getSideMenu = (state: any) => {
- const key = menuStore.getMenuKey
+ const key = route.meta.activeMenu
state.sideMenuOptions =
state.menuOptions.filter((menu: { key: string }) => menu.key === key)[0]
?.children || state.menuOptions
- state.isShowSide = menuStore.getShowSideStatus
- }
-
- const getSideMenuOptions = (item: any) => {
- menuStore.setMenuKey(item.key)
- getSideMenu(state)
+ state.isShowSide = route.meta.showSide
}
watch(useI18n().locale, () => {
@@ -74,17 +69,26 @@ const Content = defineComponent({
() => route.path,
() => {
if (route.path !== '/login') {
- state.isShowSide = menuStore.getShowSideStatus
+ routeStore.setLastRoute(route.path)
+
+ state.isShowSide = route.meta.showSide as boolean
if (route.matched[1].path === '/projects/:projectCode') {
changeMenuOption(state)
- getSideMenu(state)
}
- sideKeyRef.value = route.matched[1].path.includes(':projectCode')
- ? route.matched[1].path.replace(
+
+ getSideMenu(state)
+
+ const currentSide = (
+ route.meta.activeSide
+ ? route.meta.activeSide
+ : route.matched[1].path
+ ) as string
+ sideKeyRef.value = currentSide.includes(':projectCode')
+ ? currentSide.replace(
':projectCode',
- menuStore.getProjectCode
+ route.params.projectCode as string
)
- : route.matched[1].path
+ : currentSide
}
},
{ immediate: true }
@@ -92,9 +96,7 @@ const Content = defineComponent({
return {
...toRefs(state),
- menuStore,
changeMenuOption,
- getSideMenuOptions,
sideKeyRef
}
},
@@ -104,7 +106,6 @@ const Content = defineComponent({
<NLayoutHeader style='height: 65px'>
<NavBar
class='tab-horizontal'
- onHandleMenuClick={this.getSideMenuOptions}
headerMenuOptions={this.headerMenuOptions}
localesOptions={this.localesOptions}
timezoneOptions={this.timezoneOptions}
diff --git a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
index 62d455c..7f18b70 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
+++ b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
@@ -48,14 +48,14 @@ import {
BarsOutlined,
CloudServerOutlined
} from '@vicons/antd'
-import { useMenuStore } from '@/store/menu/menu'
+import { useRoute } from 'vue-router'
import { useUserStore } from '@/store/user/user'
import { timezoneList } from '@/utils/timezone'
import type { UserInfoRes } from '@/service/modules/users/types'
export function useDataList() {
const { t } = useI18n()
- const menuStore = useMenuStore()
+ const route = useRoute()
const userStore = useUserStore()
const renderIcon = (icon: any) => {
@@ -87,6 +87,7 @@ export function useDataList() {
})
const changeMenuOption = (state: any) => {
+ const projectCode = route.params.projectCode || ''
state.menuOptions = [
{
label: t('menu.home'),
@@ -100,7 +101,7 @@ export function useDataList() {
children: [
{
label: t('menu.project_overview'),
- key: `/projects/${menuStore.getProjectCode}`,
+ key: `/projects/${projectCode}`,
icon: renderIcon(FundProjectionScreenOutlined)
},
{
@@ -110,15 +111,15 @@ export function useDataList() {
children: [
{
label: t('menu.workflow_relation'),
- key: `/projects/${menuStore.getProjectCode}/workflow/relation`
+ key: `/projects/${projectCode}/workflow/relation`
},
{
label: t('menu.workflow_definition'),
- key: `/projects/${menuStore.getProjectCode}/workflow-definition`
+ key: `/projects/${projectCode}/workflow-definition`
},
{
label: t('menu.workflow_instance'),
- key: `/projects/${menuStore.getProjectCode}/workflow/instances`
+ key: `/projects/${projectCode}/workflow/instances`
}
]
},
@@ -129,11 +130,11 @@ export function useDataList() {
children: [
{
label: t('menu.task_definition'),
- key: `/projects/${menuStore.getProjectCode}/task/definitions`
+ key: `/projects/${projectCode}/task/definitions`
},
{
label: t('menu.task_instance'),
- key: `/projects/${menuStore.getProjectCode}/task/instances`
+ key: `/projects/${projectCode}/task/instances`
}
]
}
diff --git a/dolphinscheduler-ui-next/src/router/index.ts b/dolphinscheduler-ui-next/src/router/index.ts
index b905b6e..381578a 100644
--- a/dolphinscheduler-ui-next/src/router/index.ts
+++ b/dolphinscheduler-ui-next/src/router/index.ts
@@ -22,8 +22,6 @@ import {
RouteLocationNormalized
} from 'vue-router'
import routes from './routes'
-
-import { useMenuStore } from '@/store/menu/menu'
import { useUserStore } from '@/store/user/user'
import type { UserInfoRes } from '@/service/modules/users/types'
@@ -40,6 +38,7 @@ const router = createRouter({
interface metaData {
title?: string
+ activeMenu?: string
showSide?: boolean
auth?: Array<string>
}
@@ -54,14 +53,12 @@ router.beforeEach(
next: NavigationGuardNext
) => {
NProgress.start()
- const menuStore = useMenuStore()
const userStore = useUserStore()
const metaData: metaData = to.meta
- menuStore.setShowSideStatus(metaData.showSide || false)
if (
metaData.auth?.includes('ADMIN_USER') &&
(userStore.getUserInfo as UserInfoRes).userType !== 'ADMIN_USER' &&
- menuStore.getMenuKey === 'security'
+ metaData.activeMenu === 'security'
) {
to.fullPath = '/security/token-manage'
next({ name: 'token-manage' })
diff --git a/dolphinscheduler-ui-next/src/router/modules/data-quality.ts b/dolphinscheduler-ui-next/src/router/modules/data-quality.ts
index 67ccc0a..71c0f19 100644
--- a/dolphinscheduler-ui-next/src/router/modules/data-quality.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/data-quality.ts
@@ -35,6 +35,7 @@ export default {
component: components['data-quality-task-result'],
meta: {
title: '数据质量-task-result',
+ activeMenu: 'data-quality',
showSide: true,
auth: []
}
@@ -45,6 +46,7 @@ export default {
component: components['data-quality-rule'],
meta: {
title: '数据质量-rule',
+ activeMenu: 'data-quality',
showSide: true,
auth: []
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/datasource.ts b/dolphinscheduler-ui-next/src/router/modules/datasource.ts
index 1c39c5d..555227d 100644
--- a/dolphinscheduler-ui-next/src/router/modules/datasource.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/datasource.ts
@@ -34,6 +34,7 @@ export default {
component: components['datasource-list'],
meta: {
title: '数据源中心',
+ activeMenu: 'datasource',
showSide: false,
auth: []
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/monitor.ts b/dolphinscheduler-ui-next/src/router/modules/monitor.ts
index 9a45b33..e2fa40b 100644
--- a/dolphinscheduler-ui-next/src/router/modules/monitor.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/monitor.ts
@@ -35,6 +35,7 @@ export default {
component: components['monitor-servers-master'],
meta: {
title: '服务管理-Master',
+ activeMenu: 'monitor',
showSide: true,
auth: []
}
@@ -45,6 +46,7 @@ export default {
component: components['monitor-servers-worker'],
meta: {
title: '服务管理-Worker',
+ activeMenu: 'monitor',
showSide: true,
auth: []
}
@@ -55,6 +57,7 @@ export default {
component: components['monitor-servers-db'],
meta: {
title: '服务管理-DB',
+ activeMenu: 'monitor',
showSide: true,
auth: []
}
@@ -65,6 +68,7 @@ export default {
component: components['monitor-statistics-statistics'],
meta: {
title: '统计管理-Statistics',
+ activeMenu: 'monitor',
showSide: true,
auth: []
}
@@ -75,6 +79,7 @@ export default {
component: components['monitor-statistics-audit-log'],
meta: {
title: '审计日志-AuditLog',
+ activeMenu: 'monitor',
showSide: true,
auth: []
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/projects.ts b/dolphinscheduler-ui-next/src/router/modules/projects.ts
index afc401d..39f0b14 100644
--- a/dolphinscheduler-ui-next/src/router/modules/projects.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/projects.ts
@@ -37,6 +37,7 @@ export default {
component: components['projects-list'],
meta: {
title: '项目',
+ activeMenu: 'projects',
showSide: false,
auth: []
}
@@ -47,6 +48,7 @@ export default {
component: components['projects-overview'],
meta: {
title: '项目概览',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -57,6 +59,7 @@ export default {
component: components['projects-workflow-relation'],
meta: {
title: '工作流关系',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -67,6 +70,7 @@ export default {
component: components['projects-workflow-definition'],
meta: {
title: '工作流定义',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -77,6 +81,8 @@ export default {
component: components['projects-workflow-definition-timing'],
meta: {
title: '定时管理',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow-definition',
showSide: true,
auth: []
}
@@ -87,6 +93,8 @@ export default {
component: components['projects-workflow-definition-create'],
meta: {
title: '创建工作流定义',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow-definition',
showSide: true,
auth: []
}
@@ -97,6 +105,8 @@ export default {
component: components['projects-workflow-definition-detail'],
meta: {
title: '工作流定义详情',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow-definition',
showSide: true,
auth: []
}
@@ -107,6 +117,7 @@ export default {
component: components['projects-workflow-instance'],
meta: {
title: '工作流实例',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -117,6 +128,8 @@ export default {
component: components['projects-workflow-instance-detail'],
meta: {
title: '工作流实例详情',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow/instances',
showSide: true,
auth: []
}
@@ -127,6 +140,8 @@ export default {
component: components['projects-workflow-instance-gantt'],
meta: {
title: '工作流实例甘特图',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow/instances',
showSide: true,
auth: []
}
@@ -137,6 +152,7 @@ export default {
component: components['projects-task-definition'],
meta: {
title: '任务定义',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -147,6 +163,7 @@ export default {
component: components['projects-task-instance'],
meta: {
title: '任务实例',
+ activeMenu: 'projects',
showSide: true,
auth: []
}
@@ -157,6 +174,8 @@ export default {
component: components['projects-workflow-definition-tree'],
meta: {
title: '工作流定义树形图',
+ activeMenu: 'projects',
+ activeSide: '/projects/:projectCode/workflow-definition',
showSide: true,
auth: []
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/resources.ts b/dolphinscheduler-ui-next/src/router/modules/resources.ts
index 7ec2ab1..cc47e58 100644
--- a/dolphinscheduler-ui-next/src/router/modules/resources.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/resources.ts
@@ -35,6 +35,7 @@ export default {
component: components['resource-file'],
meta: {
title: '文件管理',
+ activeMenu: 'resource',
showSide: true,
auth: []
}
@@ -45,6 +46,8 @@ export default {
component: components['resource-file-create'],
meta: {
title: '文件创建',
+ activeMenu: 'resource',
+ activeSide: '/resource/file-manage',
showSide: true,
auth: []
}
@@ -55,6 +58,8 @@ export default {
component: components['resource-file-edit'],
meta: {
title: '文件编辑',
+ activeMenu: 'resource',
+ activeSide: '/resource/file-manage',
showSide: true,
auth: []
}
@@ -65,6 +70,8 @@ export default {
component: components['resource-file'],
meta: {
title: '文件管理',
+ activeMenu: 'resource',
+ activeSide: '/resource/file-manage',
showSide: true,
auth: []
}
@@ -75,6 +82,8 @@ export default {
component: components['resource-file-edit'],
meta: {
title: '文件详情',
+ activeMenu: 'resource',
+ activeSide: '/resource/file-manage',
showSide: true,
auth: []
}
@@ -85,6 +94,8 @@ export default {
component: components['resource-file-create'],
meta: {
title: '文件创建',
+ activeMenu: 'resource',
+ activeSide: '/resource/file-manage',
showSide: true,
auth: []
}
@@ -95,6 +106,7 @@ export default {
component: components['resource-udf-resource'],
meta: {
title: '资源管理',
+ activeMenu: 'resource',
showSide: true,
auth: []
}
@@ -105,6 +117,8 @@ export default {
component: components['resource-udf-resource'],
meta: {
title: '资源管理',
+ activeMenu: 'resource',
+ activeSide: '/resource/resource-manage',
showSide: true,
auth: []
}
@@ -115,6 +129,7 @@ export default {
component: components['resource-udf-function'],
meta: {
title: '函数管理',
+ activeMenu: 'resource',
showSide: true,
auth: []
}
@@ -125,6 +140,7 @@ export default {
component: components['resource-task-group-option'],
meta: {
title: '任务组配置',
+ activeMenu: 'resource',
showSide: true,
auth: []
}
@@ -135,6 +151,7 @@ export default {
component: components['resource-task-group-queue'],
meta: {
title: '任务组队列',
+ activeMenu: 'resource',
showSide: true,
auth: []
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/security.ts b/dolphinscheduler-ui-next/src/router/modules/security.ts
index 7190f3b..039a5fb 100644
--- a/dolphinscheduler-ui-next/src/router/modules/security.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/security.ts
@@ -35,6 +35,7 @@ export default {
component: components['security-tenant-manage'],
meta: {
title: '租户管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -45,6 +46,7 @@ export default {
component: components['security-user-manage'],
meta: {
title: '用户管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -55,6 +57,7 @@ export default {
component: components['security-alarm-group-manage'],
meta: {
title: '告警组管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -65,6 +68,7 @@ export default {
component: components['security-worker-group-manage'],
meta: {
title: 'Worker分组管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -75,6 +79,7 @@ export default {
component: components['security-yarn-queue-manage'],
meta: {
title: 'Yarn队列管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -85,6 +90,7 @@ export default {
component: components['security-environment-manage'],
meta: {
title: '环境管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -95,6 +101,7 @@ export default {
component: components['security-token-manage'],
meta: {
title: '令牌管理管理',
+ activeMenu: 'security',
showSide: true,
auth: []
}
@@ -105,6 +112,7 @@ export default {
component: components['security-alarm-instance-manage'],
meta: {
title: '告警实例管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
@@ -115,6 +123,7 @@ export default {
component: components['security-k8s-namespace-manage'],
meta: {
title: 'K8S命名空间管理',
+ activeMenu: 'security',
showSide: true,
auth: ['ADMIN_USER']
}
diff --git a/dolphinscheduler-ui-next/src/router/routes.ts b/dolphinscheduler-ui-next/src/router/routes.ts
index a7af8f9..7a36ac8 100644
--- a/dolphinscheduler-ui-next/src/router/routes.ts
+++ b/dolphinscheduler-ui-next/src/router/routes.ts
@@ -45,6 +45,7 @@ const basePage: RouteRecordRaw[] = [
component: components['home'],
meta: {
title: '首页',
+ activeMenu: 'home',
auth: []
}
},
diff --git a/dolphinscheduler-ui-next/src/store/menu/menu.ts b/dolphinscheduler-ui-next/src/store/menu/menu.ts
deleted file mode 100644
index c619bba..0000000
--- a/dolphinscheduler-ui-next/src/store/menu/menu.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { defineStore } from 'pinia'
-import MenuState from './types'
-
-export const useMenuStore = defineStore({
- id: 'menu',
- state: (): MenuState => ({
- menuKey: 'home',
- isShowSide: false,
- projectCode: ''
- }),
- persist: true,
- getters: {
- getMenuKey(): string {
- return this.menuKey
- },
- getShowSideStatus(): boolean {
- return this.isShowSide || false
- },
- getProjectCode(): string {
- return this.projectCode || ''
- }
- },
- actions: {
- setMenuKey(menuKey: string): void {
- this.menuKey = menuKey
- },
- setShowSideStatus(isShowSide: boolean): void {
- this.isShowSide = isShowSide
- },
- setProjectCode(projectCode: string): void {
- this.projectCode = projectCode
- }
- }
-})
diff --git a/dolphinscheduler-ui-next/src/layouts/content/components/navbar/use-menuClick.ts b/dolphinscheduler-ui-next/src/store/route/route.ts
similarity index 63%
rename from dolphinscheduler-ui-next/src/layouts/content/components/navbar/use-menuClick.ts
rename to dolphinscheduler-ui-next/src/store/route/route.ts
index 7f9adb6..006e6b6 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/components/navbar/use-menuClick.ts
+++ b/dolphinscheduler-ui-next/src/store/route/route.ts
@@ -15,21 +15,23 @@
* limitations under the License.
*/
-import { useRouter } from 'vue-router'
-import type { Router } from 'vue-router'
-import { MenuOption } from 'naive-ui'
-import { SetupContext } from 'vue'
+import { defineStore } from 'pinia'
+import RouteState from './types'
-export function useMenuClick(ctx: SetupContext<'handleMenuClick'[]>) {
- const router: Router = useRouter()
-
- const handleMenuClick = (key: string, item: MenuOption) => {
- // console.log(key, item)
- ctx.emit('handleMenuClick', item)
- router.push({ path: `/${key}` })
- }
-
- return {
- handleMenuClick
+export const useRouteStore = defineStore({
+ id: 'route',
+ state: (): RouteState => ({
+ lastRoute: 'home'
+ }),
+ persist: true,
+ getters: {
+ getLastRoute(): string {
+ return this.lastRoute
+ }
+ },
+ actions: {
+ setLastRoute(lastRoute: string): void {
+ this.lastRoute = lastRoute
+ }
}
-}
+})
diff --git a/dolphinscheduler-ui-next/src/store/menu/types.ts b/dolphinscheduler-ui-next/src/store/route/types.ts
similarity index 88%
rename from dolphinscheduler-ui-next/src/store/menu/types.ts
rename to dolphinscheduler-ui-next/src/store/route/types.ts
index 25fa634..13019f9 100644
--- a/dolphinscheduler-ui-next/src/store/menu/types.ts
+++ b/dolphinscheduler-ui-next/src/store/route/types.ts
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-interface MenuState {
- menuKey: string
- isShowSide: boolean
- projectCode: string
+interface RouteState {
+ lastRoute: string
}
-export default MenuState
+export default RouteState
diff --git a/dolphinscheduler-ui-next/src/views/login/use-login.ts b/dolphinscheduler-ui-next/src/views/login/use-login.ts
index b449dc7..6647ec1 100644
--- a/dolphinscheduler-ui-next/src/views/login/use-login.ts
+++ b/dolphinscheduler-ui-next/src/views/login/use-login.ts
@@ -22,13 +22,13 @@ import { useUserStore } from '@/store/user/user'
import type { Router } from 'vue-router'
import type { SessionIdRes } from '@/service/modules/login/types'
import type { UserInfoRes } from '@/service/modules/users/types'
-import { useMenuStore } from '@/store/menu/menu'
+import { useRouteStore } from '@/store/route/route'
import { useTimezoneStore } from '@/store/timezone/timezone'
export function useLogin(state: any) {
const router: Router = useRouter()
const userStore = useUserStore()
- const menuStore = useMenuStore()
+ const routeStore = useRouteStore()
const timezoneStore = useTimezoneStore()
const handleLogin = () => {
@@ -45,9 +45,9 @@ export function useLogin(state: any) {
: Intl.DateTimeFormat().resolvedOptions().timeZone
await timezoneStore.setTimezone(timezone)
- const key = menuStore.getMenuKey
+ const path = routeStore.lastRoute
- router.push({ path: key || 'home' })
+ router.push({ path: path || 'home' })
}
})
}
diff --git a/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts b/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
index 29fa348..61ef412 100644
--- a/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
@@ -24,7 +24,6 @@ import { parseTime } from '@/utils/common'
import { deleteProject } from '@/service/modules/projects'
import { format } from 'date-fns'
import { useRouter } from 'vue-router'
-import { useMenuStore } from '@/store/menu/menu'
import {
NButton,
NEllipsis,
@@ -40,7 +39,6 @@ import { DeleteOutlined, EditOutlined } from '@vicons/antd'
export function useTable() {
const { t } = useI18n()
const router: Router = useRouter()
- const menuStore = useMenuStore()
const handleEdit = (row: any) => {
variables.showModalRef = true
@@ -82,7 +80,6 @@ export function useTable() {
ButtonLink,
{
onClick: () => {
- menuStore.setProjectCode(row.code)
router.push({ path: `/projects/${row.code}` })
}
},
diff --git a/dolphinscheduler-ui-next/src/views/resource/file/index.tsx b/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
index 8f5fa30..86e739a 100644
--- a/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
+++ b/dolphinscheduler-ui-next/src/views/resource/file/index.tsx
@@ -192,7 +192,7 @@ export default defineComponent({
const initBreadcrumb = async (dirs: string[]) => {
let index = 0
- for (let dir of dirs) {
+ for (const dir of dirs) {
const newDir = dirs.slice(0, index + 1).join('/')
if (newDir) {
const id = 0