Clean lightweight admin menus
This commit is contained in:
@@ -13,6 +13,42 @@ import { useAppContextStore } from '#/store/app-context';
|
||||
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
const lightMenuNames = new Set([
|
||||
'AIAgent',
|
||||
'AIKnowledgeDetail',
|
||||
'AIPlatform',
|
||||
'AIWorkflow',
|
||||
'AIWorkflowRuns',
|
||||
'AnnouncementList',
|
||||
'AnnouncementManage',
|
||||
'Application',
|
||||
'Codex',
|
||||
'ControlCenter',
|
||||
'FileManager',
|
||||
'KnowledgeBase',
|
||||
'LoginLog',
|
||||
'Message',
|
||||
'MessageList',
|
||||
'OrgNode',
|
||||
'StartChat',
|
||||
'SubAppAIAgentEditor',
|
||||
'SubAppAIKnowledgeDetail',
|
||||
'SubAppAIWorkflowEditor',
|
||||
'SubAppAIWorkflowRuns',
|
||||
'SystemConfigManager',
|
||||
'SystemDept',
|
||||
'SystemDict',
|
||||
'SystemManagement',
|
||||
'SystemMenu',
|
||||
'SystemPermission',
|
||||
'SystemPost',
|
||||
'SystemRole',
|
||||
'UIConfigManager',
|
||||
'UserManagement',
|
||||
'userCenter',
|
||||
'userSettings',
|
||||
]);
|
||||
|
||||
function normalizeViewPath(path: string) {
|
||||
const normalizedPath = path.replace(/^(\.\/|\.\.\/)+/, '');
|
||||
const viewPath = normalizedPath.startsWith('/')
|
||||
@@ -58,6 +94,10 @@ function normalizeBackendRoute<T extends { component?: string; name?: string; pa
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function isLightMenuRoute(route: { name?: string }) {
|
||||
return !route.name || lightMenuNames.has(route.name);
|
||||
}
|
||||
|
||||
function filterAvailableRoutes<
|
||||
T extends {
|
||||
children?: T[];
|
||||
@@ -72,6 +112,7 @@ function filterAvailableRoutes<
|
||||
layoutMap: ComponentRecordType,
|
||||
): T[] {
|
||||
return routes
|
||||
.filter(isLightMenuRoute)
|
||||
.map((route) => {
|
||||
const normalizedRoute = normalizeBackendRoute(route);
|
||||
const children = normalizedRoute.children
|
||||
|
||||
Reference in New Issue
Block a user