feat: restore lightweight admin modules

This commit is contained in:
2026-06-11 19:39:38 +08:00
parent 15229cc5ab
commit 1fba0aafb2
73 changed files with 13943 additions and 80 deletions
+54
View File
@@ -0,0 +1,54 @@
export const LIGHT_MENU_NAMES = new Set([
'AIAgent',
'AIKnowledgeDetail',
'AIModelConfig',
'AIPlatform',
'AIWorkflow',
'AIWorkflowRuns',
'AccountSettings',
'AnnouncementList',
'AnnouncementManage',
'Codex',
'ControlCenter',
'FileManager',
'KnowledgeBase',
'LoginLog',
'Message',
'MessageList',
'ServerMonitor',
'SystemConfigManager',
'SystemDept',
'SystemDict',
'SystemFileManager',
'SystemLoginLog',
'SystemManagement',
'SystemMenu',
'SystemPost',
'SystemPermission',
'SystemRole',
'UIConfigManager',
'UserManagement',
'userSettings',
]);
export function isLightMenuName(name?: string) {
return !name || LIGHT_MENU_NAMES.has(name);
}
export function filterLightMenuTree<
T extends { children?: T[]; name?: string },
>(routes: T[]): T[] {
return routes
.map((route) => {
const children = route.children
? filterLightMenuTree(route.children)
: undefined;
if (!isLightMenuName(route.name) && !children?.length) {
return undefined;
}
return children ? { ...route, children } : route;
})
.filter(Boolean) as T[];
}