From 189ba73f51232bb36d4dfa35d4260bd518f8ba79 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Thu, 27 Feb 2025 11:04:54 +0800 Subject: [PATCH] feat: Support custom display of the global menu (#8023) --- core/app/dto/setting.go | 17 +-- core/app/service/setting.go | 15 +++ core/init/migration/helper/menu.go | 51 ++++++++ core/init/migration/migrate.go | 1 + core/init/migration/migrations/init.go | 11 ++ frontend/src/api/interface/setting.ts | 4 +- frontend/src/lang/modules/en.ts | 5 +- frontend/src/lang/modules/ja.ts | 5 +- frontend/src/lang/modules/ko.ts | 4 +- frontend/src/lang/modules/ms.ts | 4 +- frontend/src/lang/modules/pt-br.ts | 5 +- frontend/src/lang/modules/ru.ts | 5 +- frontend/src/lang/modules/zh-Hant.ts | 4 +- frontend/src/lang/modules/zh.ts | 4 +- .../src/layout/components/Sidebar/index.vue | 93 +++++--------- frontend/src/routers/modules/ai.ts | 1 + frontend/src/routers/modules/app-store.ts | 1 + frontend/src/routers/modules/container.ts | 5 +- frontend/src/routers/modules/cronjob.ts | 1 + frontend/src/routers/modules/database.ts | 3 +- frontend/src/routers/modules/host.ts | 1 + frontend/src/routers/modules/log.ts | 1 + frontend/src/routers/modules/setting.ts | 1 + frontend/src/routers/modules/terminal.ts | 1 + frontend/src/routers/modules/toolbox.ts | 1 + frontend/src/routers/modules/website.ts | 1 + frontend/src/routers/router.ts | 1 + .../views/setting/panel/hidemenu/index.vue | 120 +++++------------- frontend/src/views/setting/panel/index.vue | 64 +--------- 29 files changed, 188 insertions(+), 242 deletions(-) create mode 100644 core/init/migration/helper/menu.go diff --git a/core/app/dto/setting.go b/core/app/dto/setting.go index 1a3482ba5..9c42a762d 100644 --- a/core/app/dto/setting.go +++ b/core/app/dto/setting.go @@ -33,7 +33,7 @@ type SettingInfo struct { AppStoreLastModified string `json:"appStoreLastModified"` AppStoreSyncStatus string `json:"appStoreSyncStatus"` - XpackHideMenu string `json:"xpackHideMenu"` + HideMenu string `json:"hideMenu"` NoAuthSetting string `json:"noAuthSetting"` ProxyUrl string `json:"proxyUrl"` @@ -179,13 +179,14 @@ type Clean struct { Size uint64 `json:"size"` } -type XpackHideMenu struct { - ID string `json:"id"` - Label string `json:"label"` - IsCheck bool `json:"isCheck"` - Title string `json:"title"` - Path string `json:"path,omitempty"` - Children []XpackHideMenu `json:"children,omitempty"` +type ShowMenu struct { + ID string `json:"id"` + Label string `json:"label"` + Disabled bool `json:"disabled"` + IsShow bool `json:"isShow"` + Title string `json:"title"` + Path string `json:"path,omitempty"` + Children []ShowMenu `json:"children,omitempty"` } type ApiInterfaceConfig struct { diff --git a/core/app/service/setting.go b/core/app/service/setting.go index f8cdcf860..6e4080e43 100644 --- a/core/app/service/setting.go +++ b/core/app/service/setting.go @@ -97,6 +97,21 @@ func (u *SettingService) Update(key, value string) error { _ = settingRepo.Create("AppStoreLastModified", value) return nil } + case "HideMenu": + var menus []dto.ShowMenu + if err := json.Unmarshal([]byte(value), &menus); err != nil { + return err + } + for i := 0; i < len(menus); i++ { + if menus[i].Label == "Home-Menu" || menus[i].Label == "App-Menu" || menus[i].Label == "Setting-Menu" { + menus[i].IsShow = true + } + } + menuItem, err := json.Marshal(&menus) + if err != nil { + return err + } + value = string(menuItem) } if err := settingRepo.Update(key, value); err != nil { diff --git a/core/init/migration/helper/menu.go b/core/init/migration/helper/menu.go new file mode 100644 index 000000000..2bf17a6d5 --- /dev/null +++ b/core/init/migration/helper/menu.go @@ -0,0 +1,51 @@ +package helper + +import ( + "encoding/json" + + "github.com/1Panel-dev/1Panel/core/app/dto" +) + +func LoadMenus() string { + item := []dto.ShowMenu{ + {ID: "1", Disabled: true, Title: "menu.home", IsShow: true, Label: "Home-Menu", Path: "/"}, + {ID: "2", Disabled: true, Title: "menu.apps", IsShow: true, Label: "App-Menu", Path: "/apps/all"}, + {ID: "3", Disabled: false, Title: "menu.website", IsShow: true, Label: "Website-Menu", Path: "/websites", + Children: []dto.ShowMenu{ + {ID: "31", Disabled: false, Title: "menu.website", IsShow: true, Label: "Website", Path: "/websites"}, + {ID: "32", Disabled: false, Title: "menu.ssl", IsShow: true, Label: "SSL", Path: "/websites/ssl"}, + {ID: "33", Disabled: false, Title: "menu.runtime", IsShow: true, Label: "PHP", Path: "/websites/runtimes/php"}, + }}, + {ID: "4", Disabled: false, Title: "menu.aiTools", IsShow: true, Label: "AI-Menu", Path: "/ai/model", + Children: []dto.ShowMenu{ + {ID: "41", Disabled: false, Title: "aiTools.model.model", IsShow: true, Label: "OllamaModel", Path: "/ai/model"}, + {ID: "42", Disabled: false, Title: "aiTools.gpu.gpu", IsShow: true, Label: "GPU", Path: "/ai/gpu"}, + }}, + {ID: "5", Disabled: false, Title: "menu.database", IsShow: true, Label: "Database-Menu", Path: "/databases"}, + {ID: "6", Disabled: false, Title: "menu.container", IsShow: true, Label: "Container-Menu", Path: "/containers"}, + {ID: "7", Disabled: false, Title: "menu.system", IsShow: true, Label: "System-Menu", Path: "/hosts/files", + Children: []dto.ShowMenu{ + {ID: "71", Disabled: false, Title: "menu.files", IsShow: true, Label: "File", Path: "/hosts/files"}, + {ID: "72", Disabled: false, Title: "menu.monitor", IsShow: true, Label: "Monitorx", Path: "/hosts/monitor/monitor"}, + {ID: "74", Disabled: false, Title: "menu.firewall", IsShow: true, Label: "FirewallPort", Path: "/hosts/firewall/port"}, + {ID: "75", Disabled: false, Title: "menu.supervisor", IsShow: true, Label: "Process", Path: "/hosts/process/process"}, + {ID: "76", Disabled: false, Title: "menu.ssh", IsShow: true, Label: "SSH", Path: "/hosts/ssh/ssh"}, + }}, + {ID: "8", Disabled: false, Title: "menu.terminal", IsShow: true, Label: "Terminal-Menu", Path: "/hosts/terminal"}, + {ID: "9", Disabled: false, Title: "menu.toolbox", IsShow: true, Label: "Toolbox-Menu", Path: "/toolbox"}, + {ID: "10", Disabled: false, Title: "menu.cronjob", IsShow: true, Label: "Cronjob-Menu", Path: "/cronjobs"}, + {ID: "11", Disabled: false, Title: "xpack.menu", IsShow: true, Label: "Xpack-Menu", + Children: []dto.ShowMenu{ + {ID: "112", Disabled: false, Title: "xpack.waf.name", IsShow: true, Label: "Dashboard", Path: "/xpack/waf/dashboard"}, + {ID: "111", Disabled: false, Title: "xpack.node.nodeManagement", IsShow: true, Label: "Node", Path: "/xpack/node"}, + {ID: "113", Disabled: false, Title: "xpack.monitor.name", IsShow: true, Label: "MonitorDashboard", Path: "/xpack/monitor/dashboard"}, + {ID: "114", Disabled: false, Title: "xpack.tamper.tamper", IsShow: true, Label: "Tamper", Path: "/xpack/tamper"}, + {ID: "116", Disabled: false, Title: "xpack.alert.alert", IsShow: true, Label: "XAlertDashboard", Path: "/xpack/alert/dashboard"}, + {ID: "115", Disabled: false, Title: "xpack.setting.setting", IsShow: true, Label: "XSetting", Path: "/xpack/setting"}, + }}, + {ID: "12", Disabled: false, Title: "menu.logs", IsShow: true, Label: "Log-Menu", Path: "/logs"}, + {ID: "13", Disabled: true, Title: "menu.settings", IsShow: true, Label: "Setting-Menu", Path: "/settings"}, + } + menu, _ := json.Marshal(item) + return string(menu) +} diff --git a/core/init/migration/migrate.go b/core/init/migration/migrate.go index c854dcc1c..f2c851cc2 100644 --- a/core/init/migration/migrate.go +++ b/core/init/migration/migrate.go @@ -21,6 +21,7 @@ func Init() { migrations.UpdateSettingStatus, migrations.RemoveLocalBackup, migrations.AddMFAInterval, + migrations.UpdateXpackHideMemu, }) if err := m.Migrate(); err != nil { global.LOG.Error(err) diff --git a/core/init/migration/migrations/init.go b/core/init/migration/migrations/init.go index 7a7f0b849..51eb277b9 100644 --- a/core/init/migration/migrations/init.go +++ b/core/init/migration/migrations/init.go @@ -8,6 +8,7 @@ import ( "github.com/1Panel-dev/1Panel/core/app/model" "github.com/1Panel-dev/1Panel/core/constant" "github.com/1Panel-dev/1Panel/core/global" + "github.com/1Panel-dev/1Panel/core/init/migration/helper" "github.com/1Panel-dev/1Panel/core/utils/common" "github.com/1Panel-dev/1Panel/core/utils/encrypt" "github.com/go-gormigrate/gormigrate/v2" @@ -307,3 +308,13 @@ var AddMFAInterval = &gormigrate.Migration{ return nil }, } + +var UpdateXpackHideMemu = &gormigrate.Migration{ + ID: "20250227-update-xpack-hide-menu", + Migrate: func(tx *gorm.DB) error { + if err := tx.Model(&model.Setting{}).Where("key = ?", "XpackHideMenu").Updates(map[string]interface{}{"key": "HideMenu", "value": helper.LoadMenus()}).Error; err != nil { + return err + } + return nil + }, +} diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index 7ca713907..12bbf249a 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -48,7 +48,7 @@ export namespace Setting { weChatVars: string; dingVars: string; snapshotIgnore: string; - xpackHideMenu: string; + hideMenu: string; noAuthSetting: string; proxyUrl: string; @@ -191,7 +191,7 @@ export namespace Setting { key: string; name: string; size: number; - isCheck: boolean; + isShow: boolean; isDisable: boolean; path: string; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index b93258df8..bb3cb21a2 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1829,9 +1829,8 @@ const message = { license: 'License', bindNode: 'Bind Node', - advancedMenuHide: 'Advanced Menu Hide', - showMainAdvancedMenu: - 'If only one menu is retained, only the main advanced menu will be displayed in the sidebar', + menuSetting: 'Menu Settings', + menuSettingHelper: 'If only 1 menu is kept, the sidebar will directly display that menu.', showAll: 'Show All', hideALL: 'Hide All', ifShow: 'Whether to Show', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index ec6d57e2e..e5c9c4943 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -1694,9 +1694,8 @@ const message = { license: 'ライセンス', bindNode: 'ノードをバインド', - advancedMenuHide: '高度なメニューを非表示にします', - showMainAdvancedMenu: - 'メニューが1つしか保持されていない場合、メインの詳細メニューのみがサイドバーに表示されます', + menuSetting: 'メニュー設定', + menuSettingHelper: '1つのメニューだけを保持する場合、サイドバーにはそのメニューが直接表示されます。', showAll: 'すべてを表示します', hideALL: 'すべてを隠します', ifShow: '表示するかどうか', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 9d5a464f4..d78d65cc8 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -1667,8 +1667,8 @@ const message = { license: '라이선스', bindNode: '노드 바인딩', - advancedMenuHide: '고급 메뉴 숨기기', - showMainAdvancedMenu: '하나의 메뉴만 유지하면 사이드바에 주 고급 메뉴만 표시됩니다.', + menuSetting: '메뉴 설정', + menuSettingHelper: '메뉴를 1개만 유지하면 사이드바에 해당 메뉴가 직접 표시됩니다.', showAll: '모두 표시', hideALL: '모두 숨기기', ifShow: '표시 여부', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index f82d70ffc..21b0b5009 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -1751,8 +1751,8 @@ const message = { license: 'Lesen', bindNode: 'Ikatan Nod', - advancedMenuHide: 'Sembunyikan menu lanjutan', - showMainAdvancedMenu: 'Jika hanya satu menu dikekalkan, hanya menu lanjutan utama akan dipaparkan di bar sisi', + menuSetting: 'Tetapan Menu', + menuSettingHelper: 'Jika hanya 1 menu yang disimpan, bar sisi akan langsung menampilkan menu tersebut.', showAll: 'Papar Semua', hideALL: 'Sembunyikan Semua', ifShow: 'Sama ada untuk Dipaparkan', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 9f57250d6..ff09f21a1 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -1736,9 +1736,8 @@ const message = { license: 'Licença', bindNode: 'Vincular Nó', - advancedMenuHide: 'Ocultar menu avançado', - showMainAdvancedMenu: - 'Se apenas um menu for mantido, somente o menu avançado principal será exibido na barra lateral', + menuSetting: 'Configurações do Menu', + menuSettingHelper: 'Se apenas 1 menu for mantido, a barra lateral exibirá diretamente esse menu.', showAll: 'Mostrar Tudo', hideALL: 'Ocultar Tudo', ifShow: 'Exibir?', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 87f6f2aec..8695d2421 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -1735,9 +1735,8 @@ const message = { license: 'Лицензия', bindNode: 'Привязать Узел', - advancedMenuHide: 'Скрыть расширенное меню', - showMainAdvancedMenu: - 'Если сохранено только одно меню, в боковой панели будет отображаться только основное расширенное меню', + menuSetting: 'Настройки меню', + menuSettingHelper: 'Если оставить только 1 меню, боковая панель будет напрямую отображать это меню.', showAll: 'Показать все', hideALL: 'Скрыть все', ifShow: 'Показывать', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index 022ac7bf0..0b2863dc9 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -1697,8 +1697,8 @@ const message = { license: '許可證', bindNode: '綁定節點', - advancedMenuHide: '高級功能選單隱藏', - showMainAdvancedMenu: '如果只保留 1 個選單,則側邊欄只會顯示高級功能主選單', + menuSetting: '菜單設定', + menuSettingHelper: '如果只保留 1 個菜單,則側邊欄會直接顯示該菜單。', showAll: '全部顯示', hideALL: '全部隱藏', ifShow: '是否顯示', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 20d921e40..8afd8fd78 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1689,8 +1689,8 @@ const message = { license: '许可证', bindNode: '绑定节点', - advancedMenuHide: '高级功能菜单隐藏', - showMainAdvancedMenu: '如果只保留 1 个菜单,则侧边栏只会显示高级功能主菜单', + menuSetting: '菜单设置', + menuSettingHelper: '如果只保留 1 个菜单,则侧边栏会直接显示该菜单', showAll: '全部显示', hideALL: '全部隐藏', ifShow: '是否显示', diff --git a/frontend/src/layout/components/Sidebar/index.vue b/frontend/src/layout/components/Sidebar/index.vue index 709ff08b8..32b1d3bc0 100644 --- a/frontend/src/layout/components/Sidebar/index.vue +++ b/frontend/src/layout/components/Sidebar/index.vue @@ -117,15 +117,6 @@ const loadCurrentName = () => { }; const screenWidth = ref(0); - -interface Node { - id: string; - title: string; - path?: string; - label: string; - isCheck: boolean; - children?: Node[]; -} const listeningWindow = () => { window.onresize = () => { return (() => { @@ -204,68 +195,46 @@ const changeNode = (command: string) => { } }; -function extractLabels(node: Node, result: string[]): void { - if (node.isCheck) { - result.push(node.label); - } - if (node.children) { - for (const childNode of node.children) { - extractLabels(childNode, result); +function getCheckedLabels(menu: any, showMap: any) { + for (const item of menu) { + if (item.isShow) { + showMap[item.label] = true; + } + if (item.children) { + getCheckedLabels(item.children, showMap); } } } -function getCheckedLabels(json: Node): string[] { - let result: string[] = []; - extractLabels(json, result); - return result; -} - const search = async () => { - let checkedLabels: any[] = []; const res = await getSettingInfo(); version.value = res.data.systemVersion; - const json: Node = JSON.parse(res.data.xpackHideMenu); - checkedLabels = getCheckedLabels(json); - + const menuItem = JSON.parse(res.data.hideMenu); + const showMap = new Map(); + getCheckedLabels(menuItem, showMap); let rstMenuList: RouteRecordRaw[] = []; - menuStore.menuList.forEach((item) => { - let menuItem = JSON.parse(JSON.stringify(item)); - let menuChildren: RouteRecordRaw[] = []; - if (menuItem.path === '/xpack') { - if (checkedLabels.length) { - menuItem.children = menuItem.children.filter((child: any) => { - return !(globalStore.isIntl && child.path.includes('/xpack/alert')); - }); - menuItem.children.forEach((child: any) => { - for (const str of checkedLabels) { - if (child.name === str) { - child.hidden = false; - } - } - if (child.hidden === false) { - menuChildren.push(child); - if (checkedLabels.length === 2) { - menuItem.meta.title = child.meta.title; - } else { - menuItem.meta.title = 'xpack.menu'; - } - } - }); - menuItem.meta.hideInSidebar = false; - } - menuItem.children = menuChildren as RouteRecordRaw[]; - rstMenuList.push(menuItem); - } else { - menuItem.children.forEach((child: any) => { - if (!child.hidden) { - menuChildren.push(child); - } - }); - menuItem.children = menuChildren as RouteRecordRaw[]; - rstMenuList.push(menuItem); + for (const menu of menuStore.menuList) { + let menuItem = JSON.parse(JSON.stringify(menu)); + if (!showMap[menuItem.name]) { + continue; + } else if (menuItem.name === 'Xpack-Menu') { + menuItem.meta.hideInSidebar = false; } - }); + let itemChildren = []; + for (const item of menuItem.children) { + if (item.name === 'XAlertDashboard' && globalStore.isIntl) { + continue; + } + if (showMap[item.name]) { + itemChildren.push(item); + } + } + if (itemChildren.length === 1) { + menuItem.meta.title = itemChildren[0].meta.title; + } + menuItem.children = itemChildren; + rstMenuList.push(menuItem); + } menuStore.menuList = rstMenuList; }; diff --git a/frontend/src/routers/modules/ai.ts b/frontend/src/routers/modules/ai.ts index 2baa7c76d..a6bebc325 100644 --- a/frontend/src/routers/modules/ai.ts +++ b/frontend/src/routers/modules/ai.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const databaseRouter = { sort: 4, path: '/ai', + name: 'AI-Menu', component: Layout, redirect: '/ai/model', meta: { diff --git a/frontend/src/routers/modules/app-store.ts b/frontend/src/routers/modules/app-store.ts index 2bb33fc01..6aff20166 100644 --- a/frontend/src/routers/modules/app-store.ts +++ b/frontend/src/routers/modules/app-store.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const appStoreRouter = { sort: 2, path: '/apps', + name: 'App-Menu', component: Layout, redirect: '/apps/all', meta: { diff --git a/frontend/src/routers/modules/container.ts b/frontend/src/routers/modules/container.ts index 376f881b3..51c4739b1 100644 --- a/frontend/src/routers/modules/container.ts +++ b/frontend/src/routers/modules/container.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const containerRouter = { sort: 6, path: '/containers', + name: 'Container-Menu', component: Layout, redirect: '/containers/container', meta: { @@ -12,7 +13,7 @@ const containerRouter = { children: [ { path: '/containers', - name: 'Containers', + name: 'Container', redirect: '/containers/dashboard', component: () => import('@/views/container/index.vue'), meta: {}, @@ -30,7 +31,7 @@ const containerRouter = { }, { path: 'container', - name: 'Container', + name: 'ContainerItem', component: () => import('@/views/container/container/index.vue'), props: true, hidden: true, diff --git a/frontend/src/routers/modules/cronjob.ts b/frontend/src/routers/modules/cronjob.ts index 11e76a7d2..e2726b634 100644 --- a/frontend/src/routers/modules/cronjob.ts +++ b/frontend/src/routers/modules/cronjob.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const cronRouter = { sort: 9, path: '/cronjobs', + name: 'Cronjob-Menu', component: Layout, redirect: '/cronjobs', meta: { diff --git a/frontend/src/routers/modules/database.ts b/frontend/src/routers/modules/database.ts index f1261dc07..898fd2c17 100644 --- a/frontend/src/routers/modules/database.ts +++ b/frontend/src/routers/modules/database.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const databaseRouter = { sort: 5, path: '/databases', + name: 'Database-Menu', component: Layout, redirect: '/databases/mysql', meta: { @@ -12,7 +13,7 @@ const databaseRouter = { children: [ { path: '/databases', - name: 'Databases', + name: 'Database', redirect: '/databases/mysql', component: () => import('@/views/database/index.vue'), meta: {}, diff --git a/frontend/src/routers/modules/host.ts b/frontend/src/routers/modules/host.ts index 1305c744c..d29344622 100644 --- a/frontend/src/routers/modules/host.ts +++ b/frontend/src/routers/modules/host.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const hostRouter = { sort: 7, path: '/hosts', + name: 'System-Menu', component: Layout, redirect: '/hosts/security', meta: { diff --git a/frontend/src/routers/modules/log.ts b/frontend/src/routers/modules/log.ts index 3dfaf2b12..d69f3dd94 100644 --- a/frontend/src/routers/modules/log.ts +++ b/frontend/src/routers/modules/log.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const logsRouter = { sort: 11, path: '/logs', + name: 'Log-Menu', component: Layout, redirect: '/logs/operation', meta: { diff --git a/frontend/src/routers/modules/setting.ts b/frontend/src/routers/modules/setting.ts index d0ed4dbe2..687c85515 100644 --- a/frontend/src/routers/modules/setting.ts +++ b/frontend/src/routers/modules/setting.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const settingRouter = { sort: 12, path: '/settings', + name: 'Setting-Menu', component: Layout, redirect: '/settings/panel', meta: { diff --git a/frontend/src/routers/modules/terminal.ts b/frontend/src/routers/modules/terminal.ts index e3ac89537..d5214c85f 100644 --- a/frontend/src/routers/modules/terminal.ts +++ b/frontend/src/routers/modules/terminal.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const terminalRouter = { sort: 8, path: '/terminal', + name: 'Terminal-Menu', component: Layout, redirect: '/terminal', meta: { diff --git a/frontend/src/routers/modules/toolbox.ts b/frontend/src/routers/modules/toolbox.ts index e4cd657a0..eb50c03a5 100644 --- a/frontend/src/routers/modules/toolbox.ts +++ b/frontend/src/routers/modules/toolbox.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const toolboxRouter = { sort: 9, path: '/toolbox', + name: 'Toolbox-Menu', component: Layout, redirect: '/toolbox/supervisor', meta: { diff --git a/frontend/src/routers/modules/website.ts b/frontend/src/routers/modules/website.ts index 9001e2560..dc59c9fef 100644 --- a/frontend/src/routers/modules/website.ts +++ b/frontend/src/routers/modules/website.ts @@ -3,6 +3,7 @@ import { Layout } from '@/routers/constant'; const webSiteRouter = { sort: 3, path: '/websites', + name: 'Website-Menu', component: Layout, redirect: '/websites', meta: { diff --git a/frontend/src/routers/router.ts b/frontend/src/routers/router.ts index 62ac627fb..7ebde9a36 100644 --- a/frontend/src/routers/router.ts +++ b/frontend/src/routers/router.ts @@ -7,6 +7,7 @@ modules = { ...modules, ...xpackModules }; const homeRouter: RouteRecordRaw = { path: '/', + name: 'Home-Menu', component: Layout, redirect: '/', meta: { diff --git a/frontend/src/views/setting/panel/hidemenu/index.vue b/frontend/src/views/setting/panel/hidemenu/index.vue index 19fd22c6d..0294d8ac7 100644 --- a/frontend/src/views/setting/panel/hidemenu/index.vue +++ b/frontend/src/views/setting/panel/hidemenu/index.vue @@ -1,25 +1,19 @@