You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ki...@apache.org on 2022/01/20 14:25:28 UTC

[dolphinscheduler] branch dev updated: [Feature][UI Next]Improve menu bar function (#8141)

This is an automated email from the ASF dual-hosted git repository.

kirs 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 38b40e7  [Feature][UI Next]Improve menu bar function (#8141)
38b40e7 is described below

commit 38b40e7ac49390164207104a4a788639b12696c4
Author: labbomb <73...@qq.com>
AuthorDate: Thu Jan 20 22:25:16 2022 +0800

    [Feature][UI Next]Improve menu bar function (#8141)
    
    * Improve menu bar function
    
    * Improve menu bar function
---
 dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts  | 4 ++--
 dolphinscheduler-ui-next/src/store/menu/menu.ts               | 9 ++++++++-
 dolphinscheduler-ui-next/src/store/menu/types.ts              | 1 +
 dolphinscheduler-ui-next/src/views/projects/list/use-table.ts | 7 ++++++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
index 9c13ac1..20a5f54 100644
--- a/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
+++ b/dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts
@@ -44,9 +44,11 @@ import {
   SafetyOutlined,
   GroupOutlined
 } from '@vicons/antd'
+import { useMenuStore } from '@/store/menu/menu'
 
 export function useDataList() {
   const { t } = useI18n()
+  const menuStore = useMenuStore()
 
   const renderIcon = (icon: any) => {
     return () => h(NIcon, null, { default: () => h(icon) })
@@ -268,13 +270,11 @@ export function useDataList() {
         label: string
         key: string
         icon: any
-        isShowSide: boolean
       }) => {
         return {
           label: item.label,
           key: item.key,
           icon: item.icon,
-          isShowSide: item.isShowSide
         }
       }
     )
diff --git a/dolphinscheduler-ui-next/src/store/menu/menu.ts b/dolphinscheduler-ui-next/src/store/menu/menu.ts
index 0149d7c..e7787b1 100644
--- a/dolphinscheduler-ui-next/src/store/menu/menu.ts
+++ b/dolphinscheduler-ui-next/src/store/menu/menu.ts
@@ -23,7 +23,8 @@ export const useMenuStore = defineStore({
   state: (): MenuState => ({
     menuKey: 'home',
     isShowSide: false,
-    sideMenuKey: ''
+    sideMenuKey: '',
+    projectCode: ''
   }),
   persist: true,
   getters: {
@@ -35,6 +36,9 @@ export const useMenuStore = defineStore({
     },
     getSideMenuKey(): string {
       return this.sideMenuKey || ''
+    },
+    getProjectCode(): string {
+      return this.projectCode || ''
     }
   },
   actions: {
@@ -46,6 +50,9 @@ export const useMenuStore = defineStore({
     },
     setSideMenuKey(sideMenuKey: string): void {
       this.sideMenuKey = sideMenuKey
+    },
+    setProjectCode(projectCode: string): void {
+      this.projectCode = projectCode
     }
   }
 })
diff --git a/dolphinscheduler-ui-next/src/store/menu/types.ts b/dolphinscheduler-ui-next/src/store/menu/types.ts
index ddcd951..f4fbb31 100644
--- a/dolphinscheduler-ui-next/src/store/menu/types.ts
+++ b/dolphinscheduler-ui-next/src/store/menu/types.ts
@@ -19,6 +19,7 @@ interface MenuState {
   menuKey: string
   isShowSide: boolean
   sideMenuKey: string
+  projectCode: string
 }
 
 export default MenuState
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 d983d99..1f01025 100644
--- a/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
+++ b/dolphinscheduler-ui-next/src/views/projects/list/use-table.ts
@@ -26,6 +26,7 @@ import styles from './index.module.scss'
 import type { Router } from 'vue-router'
 import type { TableColumns } from 'naive-ui/es/data-table/src/interface'
 import type { ProjectRes } from '@/service/modules/projects/types'
+import { useMenuStore } from '@/store/menu/menu'
 
 export function useTable(
   updateProjectItem = (
@@ -37,6 +38,7 @@ export function useTable(
 ) {
   const { t } = useI18n()
   const router: Router = useRouter()
+  const menuStore = useMenuStore()
 
   const columns: TableColumns<any> = [
     { title: '#', key: 'index' },
@@ -48,7 +50,10 @@ export function useTable(
           'a',
           {
             class: styles.links,
-            onClick: () => router.push({ path: `/projects/${row.code}` })
+            onClick: () => {
+              menuStore.setProjectCode(row.code)
+              router.push({ path: `/projects/${row.code}` })
+            }
           },
           {
             default: () => {