Browse Source

[Feature][UI Next] Fixed menu sidebar display issues (#7872)

labbomb 3 years ago
parent
commit
f3f1f40f57

+ 1 - 1
dolphinscheduler-ui-next/src/layouts/content/index.tsx

@@ -54,12 +54,12 @@ const Content = defineComponent({
       state.sideMenuOptions =
         state.menuOptions.filter((menu: { key: string }) => menu.key === key)[0]
           .children || []
-      state.isShowSide = state.sideMenuOptions.length !== 0
     }
 
     const getSideMenuOptions = (item: any) => {
       menuStore.setMenuKey(item.key)
       genSideMenu(state)
+      state.isShowSide = item.isShowSide
     }
 
     return {

+ 8 - 1
dolphinscheduler-ui-next/src/layouts/content/use-dataList.ts

@@ -77,11 +77,13 @@ export function useDataList() {
         label: t('menu.home'),
         key: 'home',
         icon: renderIcon(HomeOutlined),
+        isShowSide: false
       },
       {
         label: t('menu.project'),
         key: 'project',
         icon: renderIcon(ProfileOutlined),
+        isShowSide: false,
         children: [
           {
             label: t('menu.workflow_monitoring'),
@@ -122,6 +124,7 @@ export function useDataList() {
         label: t('menu.resources'),
         key: 'resources',
         icon: renderIcon(FolderOutlined),
+        isShowSide: true,
         children: [
           {
             label: t('menu.file_manage'),
@@ -149,11 +152,13 @@ export function useDataList() {
         label: t('menu.datasource'),
         key: 'datasource',
         icon: renderIcon(DatabaseOutlined),
+        isShowSide: false
       },
       {
         label: t('menu.monitor'),
         key: 'monitor',
         icon: renderIcon(DesktopOutlined),
+        isShowSide: true,
         children: [
           {
             label: t('menu.service_manage'),
@@ -191,6 +196,7 @@ export function useDataList() {
         label: t('menu.security'),
         key: 'security',
         icon: renderIcon(SafetyCertificateOutlined),
+        isShowSide: true,
         children: [
           {
             label: t('menu.tenant_manage'),
@@ -239,11 +245,12 @@ export function useDataList() {
 
   const changeHeaderMenuOptions = (state: any) => {
     state.headerMenuOptions = state.menuOptions.map(
-      (item: { label: string; key: string; icon: any }) => {
+      (item: { label: string; key: string; icon: any, isShowSide: boolean }) => {
         return {
           label: item.label,
           key: item.key,
           icon: item.icon,
+          isShowSide: item.isShowSide
         }
       }
     )

+ 1 - 1
dolphinscheduler-ui-next/src/store/locales/locales.ts

@@ -19,7 +19,7 @@ import { defineStore } from 'pinia'
 import { LocalesStore, Locales } from './types'
 
 export const useLocalesStore = defineStore({
-  id: 'language',
+  id: 'locales',
   state: (): LocalesStore => ({
     locales: 'zh_CN',
   }),