feat: restore lightweight admin modules
This commit is contained in:
@@ -11,28 +11,9 @@ import { BasicLayout, IFrameView } from '#/layouts';
|
||||
import { $t } from '#/locales';
|
||||
import { useAppContextStore } from '#/store/app-context';
|
||||
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
import { isLightMenuName } from './light-menu';
|
||||
|
||||
const lightMenuNames = new Set([
|
||||
'AIAgent',
|
||||
'AIKnowledgeDetail',
|
||||
'AIModelConfig',
|
||||
'AIPlatform',
|
||||
'AIWorkflow',
|
||||
'AIWorkflowRuns',
|
||||
'AnnouncementList',
|
||||
'AnnouncementManage',
|
||||
'Codex',
|
||||
'ControlCenter',
|
||||
'KnowledgeBase',
|
||||
'Message',
|
||||
'MessageList',
|
||||
'SystemManagement',
|
||||
'SystemMenu',
|
||||
'SystemPermission',
|
||||
'SystemRole',
|
||||
'UserManagement',
|
||||
]);
|
||||
const forbiddenComponent = () => import('#/views/_core/fallback/forbidden.vue');
|
||||
|
||||
function normalizeViewPath(path: string) {
|
||||
const normalizedPath = path.replace(/^(\.\/|\.\.\/)+/, '');
|
||||
@@ -85,7 +66,7 @@ function normalizeBackendRoute<
|
||||
}
|
||||
|
||||
function isLightMenuRoute(route: { name?: string }) {
|
||||
return !route.name || lightMenuNames.has(route.name);
|
||||
return isLightMenuName(route.name);
|
||||
}
|
||||
|
||||
function filterAvailableRoutes<
|
||||
@@ -102,12 +83,16 @@ function filterAvailableRoutes<
|
||||
layoutMap: ComponentRecordType,
|
||||
): T[] {
|
||||
return routes
|
||||
.filter(isLightMenuRoute)
|
||||
.map((route) => {
|
||||
const normalizedRoute = normalizeBackendRoute(route);
|
||||
const children = normalizedRoute.children
|
||||
? filterAvailableRoutes(normalizedRoute.children, pageMap, layoutMap)
|
||||
: undefined;
|
||||
const routeAllowed = isLightMenuRoute(normalizedRoute);
|
||||
|
||||
if (!routeAllowed && !children?.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (
|
||||
!normalizedRoute.component &&
|
||||
@@ -117,6 +102,12 @@ function filterAvailableRoutes<
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!routeAllowed && children?.length) {
|
||||
const groupRoute = { ...normalizedRoute, children };
|
||||
delete groupRoute.component;
|
||||
return groupRoute;
|
||||
}
|
||||
|
||||
if (!hasPageComponent(normalizedRoute.component, pageMap, layoutMap)) {
|
||||
if (!children?.length) return undefined;
|
||||
|
||||
@@ -135,15 +126,24 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
||||
'../views/_core/agent-chat/**/*.vue',
|
||||
'../views/_core/announcement/index.vue',
|
||||
'../views/_core/announcement/list.vue',
|
||||
'../views/_core/account-settings/index.vue',
|
||||
'../views/_core/authentication/login.vue',
|
||||
'../views/_core/authentication/oauth-callback.vue',
|
||||
'../views/_core/dept/index.vue',
|
||||
'../views/_core/dict/index.vue',
|
||||
'../views/_core/fallback/**/*.vue',
|
||||
'../views/_core/file-manager/index.vue',
|
||||
'../views/_core/file-preview/index.vue',
|
||||
'../views/_core/login-log/index.vue',
|
||||
'../views/_core/menu/index.vue',
|
||||
'../views/_core/message/index.vue',
|
||||
'../views/_core/page-render/index.vue',
|
||||
'../views/_core/permission/index.vue',
|
||||
'../views/_core/post/index.vue',
|
||||
'../views/_core/role/index.vue',
|
||||
'../views/_core/server-monitor/index.vue',
|
||||
'../views/_core/system-config/index.vue',
|
||||
'../views/_core/ui-config/index.vue',
|
||||
'../views/_core/user/index.vue',
|
||||
'../views/ai-platform/agent/editor/index.vue',
|
||||
'../views/ai-platform/agent/index.vue',
|
||||
|
||||
Reference in New Issue
Block a user