feat: restore original admin shell quality
This commit is contained in:
@@ -31,10 +31,65 @@ export const LIGHT_MENU_NAMES = new Set([
|
||||
'userSettings',
|
||||
]);
|
||||
|
||||
const LIGHT_ROUTE_PATH_PREFIXES = [
|
||||
'/account-settings',
|
||||
'/ai-platform/agent',
|
||||
'/ai-platform/knowledge',
|
||||
'/ai-platform/model',
|
||||
'/ai-platform/workflow',
|
||||
'/ai-platform/workflow-runs',
|
||||
'/announcement',
|
||||
'/codex',
|
||||
'/dept',
|
||||
'/dict',
|
||||
'/file-manager',
|
||||
'/login-log',
|
||||
'/menu',
|
||||
'/message',
|
||||
'/page-render/main_home',
|
||||
'/permission',
|
||||
'/post',
|
||||
'/role',
|
||||
'/server-monitor',
|
||||
'/system-config',
|
||||
'/ui-config',
|
||||
'/user',
|
||||
];
|
||||
|
||||
export function isLightMenuName(name?: string) {
|
||||
return !name || LIGHT_MENU_NAMES.has(name);
|
||||
}
|
||||
|
||||
function normalizePath(path?: string) {
|
||||
if (!path) return '';
|
||||
return path.split('?')[0]?.replace(/\/$/, '') || '';
|
||||
}
|
||||
|
||||
export function isLightTabRoute(route: {
|
||||
fullPath?: string;
|
||||
matched?: Array<{ name?: unknown; path?: string }>;
|
||||
name?: unknown;
|
||||
path?: string;
|
||||
}) {
|
||||
if (typeof route.name === 'string' && LIGHT_MENU_NAMES.has(route.name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
route.matched?.some(
|
||||
(item) =>
|
||||
typeof item.name === 'string' && LIGHT_MENU_NAMES.has(item.name),
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const path = normalizePath(route.fullPath || route.path);
|
||||
return LIGHT_ROUTE_PATH_PREFIXES.some(
|
||||
(prefix) => path === prefix || path.startsWith(`${prefix}/`),
|
||||
);
|
||||
}
|
||||
|
||||
export function filterLightMenuTree<
|
||||
T extends { children?: T[]; name?: string },
|
||||
>(routes: T[]): T[] {
|
||||
|
||||
Reference in New Issue
Block a user