From 6ff0f1484102be2be0ad0e8b0439929dfd2b94f3 Mon Sep 17 00:00:00 2001 From: John Bro <42930107+john1298308460@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:27:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=93=E4=B8=9A=E7=89=88=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E9=80=89=E6=8B=A9=E6=98=BE=E7=A4=BA=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20(#4399)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zhoujunhong <1298308460@qq.com> --- backend/init/migration/migrations/v_1_10.go | 2 +- frontend/src/lang/modules/en.ts | 3 ++- frontend/src/lang/modules/tw.ts | 3 ++- frontend/src/lang/modules/zh.ts | 3 ++- frontend/src/layout/components/Sidebar/index.vue | 6 +++++- frontend/src/views/setting/panel/hidemenu/index.vue | 4 ++-- frontend/src/views/setting/panel/index.vue | 6 +++--- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/init/migration/migrations/v_1_10.go b/backend/init/migration/migrations/v_1_10.go index 8762244e8..5f2fa98f4 100644 --- a/backend/init/migration/migrations/v_1_10.go +++ b/backend/init/migration/migrations/v_1_10.go @@ -29,7 +29,7 @@ var AddDatabaseIsDelete = &gormigrate.Migration{ var AddXpackHideMenu = &gormigrate.Migration{ ID: "20240328-add-xpack-hide-menu", Migrate: func(tx *gorm.DB) error { - if err := tx.Create(&model.Setting{Key: "XpackHideMenu", Value: "{\"id\":\"1\",\"label\":\"/xpack\",\"isCheck\":false,\"title\":\"xpack.menu\",\"children\":[{\"id\":\"2\",\"title\":\"xpack.waf.name\",\"path\":\"/xpack/waf/dashboard\",\"label\":\"Dashboard\",\"isCheck\":false},{\"id\":\"3\",\"title\":\"xpack.tamper.tamper\",\"path\":\"/xpack/tamper\",\"label\":\"Tamper\",\"isCheck\":true},{\"id\":\"4\",\"title\":\"xpack.setting.setting\",\"path\":\"/xpack/setting\",\"label\":\"XSetting\",\"isCheck\":true}]}"}).Error; err != nil { + if err := tx.Create(&model.Setting{Key: "XpackHideMenu", Value: "{\"id\":\"1\",\"label\":\"/xpack\",\"isCheck\":true,\"title\":\"xpack.menu\",\"children\":[{\"id\":\"2\",\"title\":\"xpack.waf.name\",\"path\":\"/xpack/waf/dashboard\",\"label\":\"Dashboard\",\"isCheck\":true},{\"id\":\"3\",\"title\":\"xpack.tamper.tamper\",\"path\":\"/xpack/tamper\",\"label\":\"Tamper\",\"isCheck\":true},{\"id\":\"4\",\"title\":\"xpack.setting.setting\",\"path\":\"/xpack/setting\",\"label\":\"XSetting\",\"isCheck\":true}]}"}).Error; err != nil { return err } return nil diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 9e4c2f824..e89b664db 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1457,10 +1457,11 @@ const message = { currentVersion: 'Version', license: 'License', - advancedMenuShow: 'Advanced Menu Display', + advancedMenuHide: 'Advanced Menu Hide', showMainAdvancedMenu: 'If only one menu is retained, only the main advanced menu will be displayed in the sidebar', showAll: 'Show All', + hideALL: 'Hide All', ifShow: 'Whether to Show', menu: 'Menu', confirmMessage: 'The page will be refreshed to update the advanced menu list. Continue?', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 166019e2e..ea3ddc81d 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1357,9 +1357,10 @@ const message = { currentVersion: '當前運行版本:', license: '許可證', - advancedMenuShow: '高級功能選單顯示', + advancedMenuHide: '高級功能選單隱藏', showMainAdvancedMenu: '如果只保留 1 個選單,則側邊欄只會顯示高級功能主選單', showAll: '全部顯示', + hideALL: '全部隱藏', ifShow: '是否顯示', menu: '選單', confirmMessage: '即將刷新頁面更新高級功能菜單列表,是否繼續?', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 3440552fb..fdeede12e 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1359,9 +1359,10 @@ const message = { currentVersion: '当前运行版本:', license: '许可证', - advancedMenuShow: '高级功能菜单显示', + advancedMenuHide: '高级功能菜单隐藏', showMainAdvancedMenu: '如果只保留 1 个菜单,则侧边栏只会显示高级功能主菜单', showAll: '全部显示', + hideALL: '全部隐藏', ifShow: '是否显示', menu: '菜单', confirmMessage: '即将刷新页面更新高级功能菜单列表,是否继续?', diff --git a/frontend/src/layout/components/Sidebar/index.vue b/frontend/src/layout/components/Sidebar/index.vue index 919fa641f..be421aeba 100644 --- a/frontend/src/layout/components/Sidebar/index.vue +++ b/frontend/src/layout/components/Sidebar/index.vue @@ -100,7 +100,6 @@ const systemLogOut = async () => { }; function extractLabels(node: Node, result: string[]): void { - // 未勾选的才隐藏 if (node.isCheck) { result.push(node.label); } @@ -135,6 +134,11 @@ const search = async () => { } 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; diff --git a/frontend/src/views/setting/panel/hidemenu/index.vue b/frontend/src/views/setting/panel/hidemenu/index.vue index d0d41a114..da48d8b7d 100644 --- a/frontend/src/views/setting/panel/hidemenu/index.vue +++ b/frontend/src/views/setting/panel/hidemenu/index.vue @@ -2,7 +2,7 @@
{ }; const saveHideMenus = async () => { - ElMessageBox.confirm(i18n.global.t('setting.confirmMessage'), i18n.global.t('setting.advancedMenuShow'), { + ElMessageBox.confirm(i18n.global.t('setting.confirmMessage'), i18n.global.t('setting.advancedMenuHide'), { confirmButtonText: i18n.global.t('commons.button.confirm'), cancelButtonText: i18n.global.t('commons.button.cancel'), type: 'info', diff --git a/frontend/src/views/setting/panel/index.vue b/frontend/src/views/setting/panel/index.vue index b16804f56..9d085acb6 100644 --- a/frontend/src/views/setting/panel/index.vue +++ b/frontend/src/views/setting/panel/index.vue @@ -102,7 +102,7 @@ - +