fix: restore control center route menu
This commit is contained in:
@@ -15,14 +15,25 @@ import { isLightMenuName } from './light-menu';
|
||||
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
const LEGACY_COMPONENT_MAP: Record<string, string> = {
|
||||
'/online-dev/page-render/index': '/_core/page-render/index',
|
||||
'online-dev/page-render/index': '/_core/page-render/index',
|
||||
};
|
||||
|
||||
function normalizeViewPath(path: string) {
|
||||
const normalizedPath = path.replace(/^(\.\/|\.\.\/)+/, '');
|
||||
const mappedPath = LEGACY_COMPONENT_MAP[path] || path;
|
||||
const normalizedPath = mappedPath.replace(/^(\.\/|\.\.\/)+/, '');
|
||||
const viewPath = normalizedPath.startsWith('/')
|
||||
? normalizedPath
|
||||
: `/${normalizedPath}`;
|
||||
return viewPath.replace(/^\/views/, '');
|
||||
}
|
||||
|
||||
function normalizeRouteComponent(component?: string) {
|
||||
if (!component) return component;
|
||||
return LEGACY_COMPONENT_MAP[component] || component;
|
||||
}
|
||||
|
||||
function hasPageComponent(
|
||||
component: string | undefined,
|
||||
pageMap: ComponentRecordType,
|
||||
@@ -156,7 +167,9 @@ function filterAvailableRoutes<
|
||||
return groupRoute;
|
||||
}
|
||||
|
||||
if (!hasPageComponent(route.component, pageMap, layoutMap)) {
|
||||
const component = normalizeRouteComponent(route.component);
|
||||
|
||||
if (!hasPageComponent(component, pageMap, layoutMap)) {
|
||||
if (!children?.length) return undefined;
|
||||
|
||||
const groupRoute = { ...route, children };
|
||||
@@ -164,7 +177,12 @@ function filterAvailableRoutes<
|
||||
return groupRoute;
|
||||
}
|
||||
|
||||
return children ? { ...route, children } : route;
|
||||
const nextRoute =
|
||||
component && component !== route.component
|
||||
? { ...route, component }
|
||||
: route;
|
||||
|
||||
return children ? { ...nextRoute, children } : nextRoute;
|
||||
})
|
||||
.filter(Boolean) as T[];
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export const LIGHT_MENU_NAMES = new Set([
|
||||
'AnnouncementList',
|
||||
'AnnouncementManage',
|
||||
'CodexAgentChat',
|
||||
'ControlCenter',
|
||||
'ControlCenterLegacyRedirect',
|
||||
'Message',
|
||||
'MessageCenter',
|
||||
'MessageList',
|
||||
@@ -44,6 +46,7 @@ const LIGHT_ROUTE_PATH_PREFIXES = [
|
||||
'/ai-platform/workflow',
|
||||
'/ai-platform/workflow-runs',
|
||||
'/agent-chat',
|
||||
'/control-center',
|
||||
'/message/list',
|
||||
'/message/announcement',
|
||||
'/message/announcement-list',
|
||||
|
||||
Reference in New Issue
Block a user