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
|
||||
})
|
||||
|
||||
const userMenuOptions = computed(() => [
|
||||
{
|
||||
label: t('Profile'),
|
||||
key: 'profile',
|
||||
icon: () => h(Icon, { icon: 'tabler:user' })
|
||||
},
|
||||
{
|
||||
label: t('Logout'),
|
||||
key: 'logout',
|
||||
icon: () => h(Icon, { icon: 'tabler:logout' })
|
||||
}
|
||||
])
|
||||
const userMenuOptions = computed(() => {
|
||||
const options: any[] = [
|
||||
// 菜单管理和设置对所有用户可见
|
||||
{
|
||||
label: t('Menu Management'),
|
||||
key: 'menu-manager',
|
||||
icon: () => h(Icon, { icon: 'tabler:menu-2' })
|
||||
},
|
||||
{
|
||||
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) => {
|
||||
if (key === 'logout') {
|
||||
await authStore.logout()
|
||||
message.success(t('Logged out'))
|
||||
router.push('/login')
|
||||
} else if (key === 'profile') {
|
||||
router.push('/profile')
|
||||
} else if (key === 'menu-manager') {
|
||||
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: '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: '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' }
|
||||
{ id: 'tool-marketplace', key: 'ToolMarketplace', label: 'Tool Marketplace', icon: 'tabler:tool', type: 'route', routeName: 'ToolMarketplace', parentId: 'dev-group', order: 8.7 }
|
||||
]
|
||||
}
|
||||
|
||||
@ -189,8 +187,8 @@ export const useMenuStore = defineStore('menu', () => {
|
||||
return false
|
||||
}
|
||||
|
||||
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
||||
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
||||
// 只允许显示的根菜单:工具、开发
|
||||
const allowedRootMenus = ['tools', 'dev-group']
|
||||
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -174,8 +174,8 @@ const filteredItems = computed(() => {
|
||||
return false
|
||||
}
|
||||
|
||||
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
||||
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
||||
// 只允许显示的根菜单:工具、开发
|
||||
const allowedRootMenus = ['tools', 'dev-group']
|
||||
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user