From e094f625d4c70c950231a033efdbd56abd08d1a1 Mon Sep 17 00:00:00 2001
From: labbomb <739955946@qq.com>
Date: Fri, 28 Jan 2022 14:52:49 +0800
Subject: [PATCH] Fix the routing problem of project management module (#8236)
---
.../src/layouts/content/index.tsx | 32 ++++++++++++-------
.../src/layouts/content/use-dataList.ts | 12 +++----
.../src/router/modules/projects.ts | 3 +-
3 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/dolphinscheduler-ui-next/src/layouts/content/index.tsx b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
index 35ff9664c9..462b744df5 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/index.tsx
+++ b/dolphinscheduler-ui-next/src/layouts/content/index.tsx
@@ -40,7 +40,7 @@ const Content = defineComponent({
changeHeaderMenuOptions,
changeUserDropdown
} = useDataList()
- const sideKey = ref()
+ const sideKeyRef = ref()
locale.value = localesStore.getLocales
@@ -58,15 +58,6 @@ const Content = defineComponent({
changeUserDropdown(state)
})
- watch(
- () => route.path,
- () => {
- state.isShowSide = menuStore.getShowSideStatus
- sideKey.value = route.matched[1]?.path
- },
- { immediate: true }
- )
-
const getSideMenu = (state: any) => {
const key = menuStore.getMenuKey
state.sideMenuOptions =
@@ -80,12 +71,29 @@ const Content = defineComponent({
getSideMenu(state)
}
+ watch(
+ () => route.path,
+ () => {
+ state.isShowSide = menuStore.getShowSideStatus
+ route.matched[1].path.includes(':projectCode')
+ if (route.matched[1].path === '/projects/:projectCode') {
+ changeMenuOption(state)
+ getSideMenu(state)
+ }
+ sideKeyRef.value =
+ route.matched[1].path.includes(':projectCode')
+ ? route.matched[1].path.replace(':projectCode', menuStore.getProjectCode)
+ : route.matched[1].path
+ },
+ {immediate: true}
+ )
+
return {
...toRefs(state),
menuStore,
changeMenuOption,
getSideMenuOptions,
- sideKey
+ sideKeyRef
}
},
render() {
@@ -103,7 +111,7 @@ const Content = defineComponent({
{this.isShowSide && (
)}
diff --git a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
index e018e6213c..cd3b9e2d68 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
+++ b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
@@ -100,30 +100,30 @@ export function useDataList() {
children: [
{
label: t('menu.workflow_relation'),
- key: `/projects/workflow-relation`
+ key: `/projects/${menuStore.getProjectCode}/workflow/relation`
},
{
label: t('menu.workflow_definition'),
- key: `/projects/workflow-definition`
+ key: `/projects/${menuStore.getProjectCode}/workflow/definitions`
},
{
label: t('menu.workflow_instance'),
- key: `/projects/workflow-instance`
+ key: `/projects/${menuStore.getProjectCode}/workflow/instances`
}
]
},
{
label: t('menu.task'),
- key: 'workflow',
+ key: 'task',
icon: renderIcon(SettingOutlined),
children: [
{
label: t('menu.task_definition'),
- key: `/projects/task-definition`
+ key: `/projects/${menuStore.getProjectCode}/task/definitions`
},
{
label: t('menu.task_instance'),
- key: `/projects/task-instance`
+ key: `/projects/${menuStore.getProjectCode}/task/instances`
}
]
}
diff --git a/dolphinscheduler-ui-next/src/router/modules/projects.ts b/dolphinscheduler-ui-next/src/router/modules/projects.ts
index fae4fad153..d594ac8b0d 100644
--- a/dolphinscheduler-ui-next/src/router/modules/projects.ts
+++ b/dolphinscheduler-ui-next/src/router/modules/projects.ts
@@ -29,10 +29,11 @@ export default {
title: '项目管理',
showSide: false
},
+ redirect: { name: 'projects-list' },
component: () => import('@/layouts/content'),
children: [
{
- path: '',
+ path: '/projects/list',
name: 'projects-list',
component: components['projects-list'],
meta: {