Move menu management and settings to user dropdown menu
- Relocate Menu Management and Settings from sidebar to user dropdown menu in header - Remove Profile menu item from user dropdown (not currently used) - Remove Menu Management and Settings from default sidebar menu items - Update menu filtering logic to reflect new menu structure - Improve UX by following common SaaS design patterns - Free up sidebar space for core business functionality
This commit is contained in:
parent
7ecc6277bc
commit
1d20385e96
@ -148,26 +148,41 @@ const breadcrumbItems = computed(() => {
|
|||||||
return items
|
return items
|
||||||
})
|
})
|
||||||
|
|
||||||
const userMenuOptions = computed(() => [
|
const userMenuOptions = computed(() => {
|
||||||
{
|
const options: any[] = [
|
||||||
label: t('Profile'),
|
// 菜单管理和设置对所有用户可见
|
||||||
key: 'profile',
|
{
|
||||||
icon: () => h(Icon, { icon: 'tabler:user' })
|
label: t('Menu Management'),
|
||||||
},
|
key: 'menu-manager',
|
||||||
{
|
icon: () => h(Icon, { icon: 'tabler:menu-2' })
|
||||||
label: t('Logout'),
|
},
|
||||||
key: 'logout',
|
{
|
||||||
icon: () => h(Icon, { icon: 'tabler:logout' })
|
label: t('Settings'),
|
||||||
}
|
key: 'settings',
|
||||||
])
|
icon: () => h(Icon, { icon: 'tabler:settings' })
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'divider'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('Logout'),
|
||||||
|
key: 'logout',
|
||||||
|
icon: () => h(Icon, { icon: 'tabler:logout' })
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
return options
|
||||||
|
})
|
||||||
|
|
||||||
const handleUserMenuSelect = async (key: string) => {
|
const handleUserMenuSelect = async (key: string) => {
|
||||||
if (key === 'logout') {
|
if (key === 'logout') {
|
||||||
await authStore.logout()
|
await authStore.logout()
|
||||||
message.success(t('Logged out'))
|
message.success(t('Logged out'))
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
} else if (key === 'profile') {
|
} else if (key === 'menu-manager') {
|
||||||
router.push('/profile')
|
router.push({ name: 'MenuManager' })
|
||||||
|
} else if (key === 'settings') {
|
||||||
|
router.push({ name: 'Settings' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,9 +73,7 @@ function getDefaultMenus(): AppMenuItem[] {
|
|||||||
{ id: 'app-marketplace', key: 'AppMarketplace', label: 'App Marketplace', icon: 'tabler:shopping-cart', type: 'route', routeName: 'AppMarketplace', parentId: 'dev-group', order: 7.5 },
|
{ id: 'app-marketplace', key: 'AppMarketplace', label: 'App Marketplace', icon: 'tabler:shopping-cart', type: 'route', routeName: 'AppMarketplace', parentId: 'dev-group', order: 7.5 },
|
||||||
{ id: 'node-marketplace', key: 'NodeMarketplace', label: 'Node Marketplace', icon: 'carbon:add-child-node', type: 'route', routeName: 'NodeMarketplace', parentId: 'dev-group', order: 8 },
|
{ id: 'node-marketplace', key: 'NodeMarketplace', label: 'Node Marketplace', icon: 'carbon:add-child-node', type: 'route', routeName: 'NodeMarketplace', parentId: 'dev-group', order: 8 },
|
||||||
{ id: 'agent-marketplace', key: 'AgentMarketplace', label: 'Agent Marketplace', icon: 'hugeicons:robotic', type: 'route', routeName: 'AgentMarketplace', parentId: 'dev-group', order: 8.5 },
|
{ id: 'agent-marketplace', key: 'AgentMarketplace', label: 'Agent Marketplace', icon: 'hugeicons:robotic', type: 'route', routeName: 'AgentMarketplace', parentId: 'dev-group', order: 8.5 },
|
||||||
{ id: 'tool-marketplace', key: 'ToolMarketplace', label: 'Tool Marketplace', icon: 'tabler:tool', type: 'route', routeName: 'ToolMarketplace', parentId: 'dev-group', order: 8.7 },
|
{ id: 'tool-marketplace', key: 'ToolMarketplace', label: 'Tool Marketplace', icon: 'tabler:tool', type: 'route', routeName: 'ToolMarketplace', parentId: 'dev-group', order: 8.7 }
|
||||||
{ id: 'menuManager', key: 'MenuManager', label: 'Menu Management', icon: 'tabler:menu-2', type: 'route', routeName: 'MenuManager', order: 11 },
|
|
||||||
{ id: 'settings', key: 'Settings', label: 'Settings', icon: 'tabler:settings', routeName: 'Settings', order: 12, type: 'route' }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,8 +187,8 @@ export const useMenuStore = defineStore('menu', () => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
// 只允许显示的根菜单:工具、开发
|
||||||
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
const allowedRootMenus = ['tools', 'dev-group']
|
||||||
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,8 +174,8 @@ const filteredItems = computed(() => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
// 只允许显示的根菜单:工具、开发
|
||||||
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
const allowedRootMenus = ['tools', 'dev-group']
|
||||||
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user