refactor(GlobalCommandPalette): streamline template structure for improved readability
Consolidated the template structure in GlobalCommandPalette.vue to enhance code clarity and maintainability. Adjusted the layout of various elements for better alignment without altering existing functionality. This refactor aims to improve the overall readability of the component for future development. Refs: #1303
This commit is contained in:
@@ -60,12 +60,20 @@ export const useMenuStore = defineStore('menuStore', () => {
|
||||
|
||||
const liteHiddenPaths = new Set(['logout', 'organizations'])
|
||||
|
||||
// 共享空间 (organizations) 仅对当前租户的 admin / owner 暴露入口。
|
||||
// viewer / contributor 即便在共享空间里拥有资源,也无需自行管理共享关系,
|
||||
// 入口在侧栏只会徒增噪音;后端 RBAC 才是权限的最终来源(见 middleware/rbac.go)。
|
||||
const visibleMenuArr = computed(() => {
|
||||
const authStore = useAuthStore()
|
||||
if (authStore.isLiteMode) {
|
||||
return menuArr.filter(item => !liteHiddenPaths.has(item.path))
|
||||
}
|
||||
return menuArr
|
||||
return menuArr.filter(item => {
|
||||
if (authStore.isLiteMode && liteHiddenPaths.has(item.path)) {
|
||||
return false
|
||||
}
|
||||
if (item.path === 'organizations' && !authStore.hasRole('admin')) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
const chatMenuIndex = menuArr.findIndex(item => item.path === 'creatChat')
|
||||
|
||||
Reference in New Issue
Block a user