Skip to content

Commit

Permalink
fix: 当一级菜单分组下所有标签页都隐藏,则隐藏分组标签
Browse files Browse the repository at this point in the history
  • Loading branch information
tingfuyeh committed Sep 6, 2024
1 parent 4014f39 commit 8efbc46
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ export default function root() {
<Menu collapsable theme='dark' title={MenuConfig.title}>
{MenuConfig.subMenus.map(o => {
if (o.subMenus) {
const allHidden = o.subMenus.every(subMenuItem => {
const currentFeature = feature?.find(item => item.name === subMenuItem.featureKey)
return currentFeature?.display === FeatureDisplayType.hidden
})
if (allHidden) {
return <noscript />
}
return (
<Menu.Group key={o.id} title={o.title}>
{o.subMenus.map(item => recursiveRenderMenuItem(item))}
Expand Down
4 changes: 3 additions & 1 deletion web/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const MenuConfig: MenuItemConfig = {
icon: 'static/img/route-monitor.svg',
featureKey: 'config',
subMenus: null,
}
},
],
},
{
Expand All @@ -105,12 +105,14 @@ export const MenuConfig: MenuItemConfig = {
icon: null,
subMenus: [
{
featureKey: 'metricBase',
id: 'registry-monitor',
title: '注册配置监控',
icon: 'static/img/circuit-monitor.svg',
subMenus: null,
},
{
featureKey: 'metricService',
id: 'service-monitor',
title: '服务调用监控',
icon: 'static/img/circuit-monitor.svg',
Expand Down

0 comments on commit 8efbc46

Please sign in to comment.