fix: drop legacy control center menu

This commit is contained in:
2026-06-12 19:11:32 +08:00
parent 180167687f
commit 2956a6e59a
2 changed files with 9 additions and 28 deletions
+9 -27
View File
@@ -48,23 +48,6 @@ function normalizePageMap(pageMap: ComponentRecordType) {
) as ComponentRecordType;
}
function normalizeBackendRoute<
T extends {
component?: string;
name?: string;
path?: string;
query?: unknown;
},
>(route: T) {
if (route.name !== 'ControlCenter') return route;
const normalized = { ...route };
normalized.path = '/ai-platform/agent';
normalized.component = 'ai-platform/agent/index';
normalized.query = undefined;
return normalized;
}
function isLightMenuRoute(route: { name?: string }) {
return isLightMenuName(route.name);
}
@@ -84,39 +67,38 @@ function filterAvailableRoutes<
): T[] {
return routes
.map((route) => {
const normalizedRoute = normalizeBackendRoute(route);
const children = normalizedRoute.children
? filterAvailableRoutes(normalizedRoute.children, pageMap, layoutMap)
const children = route.children
? filterAvailableRoutes(route.children, pageMap, layoutMap)
: undefined;
const routeAllowed = isLightMenuRoute(normalizedRoute);
const routeAllowed = isLightMenuRoute(route);
if (!routeAllowed && !children?.length) {
return undefined;
}
if (
!normalizedRoute.component &&
normalizedRoute.children &&
!route.component &&
route.children &&
!children?.length
) {
return undefined;
}
if (!routeAllowed && children?.length) {
const groupRoute = { ...normalizedRoute, children };
const groupRoute = { ...route, children };
delete groupRoute.component;
return groupRoute;
}
if (!hasPageComponent(normalizedRoute.component, pageMap, layoutMap)) {
if (!hasPageComponent(route.component, pageMap, layoutMap)) {
if (!children?.length) return undefined;
const groupRoute = { ...normalizedRoute, children };
const groupRoute = { ...route, children };
delete groupRoute.component;
return groupRoute;
}
return children ? { ...normalizedRoute, children } : normalizedRoute;
return children ? { ...route, children } : route;
})
.filter(Boolean) as T[];
}
@@ -7,7 +7,6 @@ export const LIGHT_MENU_NAMES = new Set([
'AIWorkflowRuns',
'AnnouncementList',
'AnnouncementManage',
'ControlCenter',
'KnowledgeBase',
'SystemManagement',
'SystemMenu',