feat: restore lightweight admin modules
This commit is contained in:
@@ -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[];
|
||||
}
|
||||
Reference in New Issue
Block a user