mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
fix: Add MF
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { BrowserRouter as Router, Routes, Route, Navigate, Outlet } from 'react-router-dom';
|
||||
import Login from "@core/pages/Login.tsx"
|
||||
import BasicLayout from '@common/components/aoplatform/BasicLayout';
|
||||
import {createElement, ReactElement,ReactNode,Suspense} from 'react';
|
||||
import {createElement, ReactElement,ReactNode,Suspense, useEffect, useState} from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import {App, Skeleton} from "antd";
|
||||
import ApprovalPage from "@core/pages/approval/ApprovalPage.tsx";
|
||||
@@ -12,8 +12,13 @@ import { TeamProvider } from '@core/contexts/TeamContext.tsx';
|
||||
import SystemOutlet from '@core/pages/system/SystemOutlet.tsx';
|
||||
import { DashboardProvider } from '@core/contexts/DashboardContext.tsx';
|
||||
import { TenantManagementProvider } from '@market/contexts/TenantManagementContext.tsx';
|
||||
import React from 'react';
|
||||
import usePluginLoader from '@businessEntry/hooks/pluginLoader.ts';
|
||||
import Guide from '@core/pages/guide/Guide.tsx';
|
||||
import AiServiceOutlet from '@core/pages/aiService/AiServiceOutlet.tsx';
|
||||
import { AiServiceProvider } from '@core/contexts/AiServiceContext.tsx';
|
||||
|
||||
type RouteConfig = {
|
||||
export type RouteConfig = {
|
||||
path:string
|
||||
component?:ReactElement
|
||||
children?:(RouteConfig|false)[]
|
||||
@@ -46,52 +51,52 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'/',
|
||||
component:<Login/>,
|
||||
key: uuidv4(),
|
||||
key: 'root',
|
||||
},
|
||||
{
|
||||
path:'/login',
|
||||
component:<Login/>,
|
||||
key: uuidv4()
|
||||
key: 'login'
|
||||
},
|
||||
{
|
||||
path:'/',
|
||||
component:<ProtectedRoute/>,
|
||||
key: uuidv4(),
|
||||
key: 'layout',
|
||||
children:[
|
||||
{
|
||||
path:'approval/*',
|
||||
component:<ApprovalPage />,
|
||||
key:uuidv4()
|
||||
path:'guide/*',
|
||||
component:<Guide />,
|
||||
key:'guide'
|
||||
},
|
||||
{
|
||||
path:'team',
|
||||
component:<Outlet/>,
|
||||
key: uuidv4(),
|
||||
key: 'team',
|
||||
provider: TeamProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'teamList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: uuidv4(),
|
||||
key: 'teamList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamList.tsx'))
|
||||
},
|
||||
{
|
||||
path:'inside/:teamId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsidePage.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'teamInside',
|
||||
children:[
|
||||
{
|
||||
path:'member',
|
||||
key: uuidv4(),
|
||||
key: 'teamMember',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsideMember.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: uuidv4(),
|
||||
key: 'teamSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamConfig.tsx')),
|
||||
},
|
||||
]
|
||||
@@ -101,57 +106,57 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'service',
|
||||
component:<SystemOutlet />,
|
||||
key: uuidv4(),
|
||||
key: 'restService',
|
||||
provider: SystemProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'restServiceList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceList3',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':teamId',
|
||||
component:<Outlet/>,
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInside',
|
||||
children:[
|
||||
{
|
||||
path:'inside/:serviceId',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInside2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'api',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApi',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideApiDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'router',
|
||||
key: uuidv4(),
|
||||
path:'route',
|
||||
key: 'restServiceInsideRoute',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideRouterList')),
|
||||
},
|
||||
{
|
||||
path:'upstream',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideUpstream',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/upstream/SystemInsideUpstreamContent.tsx')),
|
||||
},
|
||||
{
|
||||
path:'document',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideDocument',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'subscriber',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideSubscriber',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideSubscriber.tsx')),
|
||||
children:[
|
||||
|
||||
@@ -159,17 +164,17 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
},
|
||||
{
|
||||
path:'approval',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApproval',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApproval.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApprovalList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApprovalList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
}
|
||||
]
|
||||
@@ -177,30 +182,30 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'topology',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemTopology.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'systemTopology',
|
||||
children:[
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'publish',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublish',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublish.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublishList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublishList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: uuidv4(),
|
||||
key: 'systemConfig',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemConfig.tsx')),
|
||||
children:[
|
||||
|
||||
@@ -211,39 +216,160 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
]
|
||||
}
|
||||
]
|
||||
},{
|
||||
},
|
||||
|
||||
{
|
||||
path:'aiservice',
|
||||
component:<AiServiceOutlet />,
|
||||
key: 'aiService',
|
||||
provider: AiServiceProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:'aiServiceList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: 'aiServiceList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key: 'aiServiceList3',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':teamId',
|
||||
component:<Outlet/>,
|
||||
key: 'aiServiceInside',
|
||||
children:[
|
||||
{
|
||||
path:'inside/:serviceId',
|
||||
key: '',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'api',
|
||||
key: 'aiServiceInsideApi',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/api/AiServiceInsideApiDocument')),
|
||||
},
|
||||
{
|
||||
|
||||
path:'route/create',
|
||||
key: 'aiServiceInsideRoute',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/api/AiServiceInsideRouterCreate')),
|
||||
},
|
||||
{
|
||||
|
||||
path:'route/:routeId',
|
||||
key: 'aiServiceInsideRoute2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/api/AiServiceInsideRouterCreate')),
|
||||
},
|
||||
{
|
||||
path:'route',
|
||||
key: 'aiServiceInsideList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/api/AiServiceInsideRouterList')),
|
||||
},
|
||||
{
|
||||
path:'document',
|
||||
key: 'aiServiceInsideDocument',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceInsideDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'subscriber',
|
||||
key: 'aiServiceInsideSubscriber',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceInsideSubscriber.tsx')),
|
||||
children:[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'approval',
|
||||
key: 'aiServiceInsideApproval',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/approval/AiServiceInsideApproval')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: 'aiServiceInsideApprovalList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/approval/AiServiceInsideApprovalList')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: 'aiServiceInsideApprovalList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/approval/AiServiceInsideApprovalList')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'publish',
|
||||
key: 'aiServiceInsidePublish',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/publish/AiServiceInsidePublish')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: 'aiServiceInsidePublishList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/publish/AiServiceInsidePublishList')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: 'aiServiceInsidePublishList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/publish/AiServiceInsidePublishList')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: 'aiServiceSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiService/AiServiceConfig.tsx')),
|
||||
children:[
|
||||
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'datasourcing',
|
||||
key: uuidv4(),
|
||||
key: 'dataSourcing',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideDashboardSetting.tsx')),
|
||||
},
|
||||
{
|
||||
path:'cluster',
|
||||
key: uuidv4(),
|
||||
key: 'cluster',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCluster.tsx')),
|
||||
},
|
||||
{
|
||||
path:'aisetting',
|
||||
key: 'aiSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiSetting/AiSettingList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'cert',
|
||||
key: uuidv4(),
|
||||
key: 'cert',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCert.tsx')),
|
||||
},
|
||||
{
|
||||
path:'serviceHub',
|
||||
component:<Outlet />,
|
||||
key:uuidv4(),
|
||||
key:'serviceHub',
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'serviceHubList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'detail/:serviceId',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubDetail',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubDetail.tsx')),
|
||||
}]
|
||||
},
|
||||
@@ -256,184 +382,173 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
path:'tenantManagement',
|
||||
component:<Outlet />,
|
||||
provider:TenantManagementProvider,
|
||||
key:uuidv4(),
|
||||
key:'tenantManagement',
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:':teamId/inside/:appId',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInside',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'service',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInsideService',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideService.tsx')),
|
||||
},
|
||||
{
|
||||
path:'authorization',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInsideAuthorization',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideAuth.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementAppSetting.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubManagementList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubManagementList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'member',
|
||||
key:uuidv4(),
|
||||
key:'member',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberPage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'memberList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'memberList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:memberGroupId',
|
||||
key:uuidv4(),
|
||||
key:'memberList3',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'role',
|
||||
key:uuidv4(),
|
||||
component:<Outlet></Outlet>,
|
||||
key:'role',
|
||||
component:<Outlet />,
|
||||
children:[
|
||||
{
|
||||
path: '',
|
||||
key: uuidv4(),
|
||||
key: 'roleList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'roleList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':roleType/config',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
},
|
||||
{
|
||||
},{
|
||||
path:':roleType/config/:roleId',
|
||||
key:uuidv4(),
|
||||
key:'roleConfig',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
},{
|
||||
path:':roleType/config',
|
||||
key:'roleConfig2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
APP_MODE === 'pro' &&{
|
||||
path:'openapi',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@openApi/pages/OpenApiList.tsx')),
|
||||
key:uuidv4(),
|
||||
},
|
||||
{
|
||||
path:'assets',
|
||||
component:<p>设计中</p>,
|
||||
key:uuidv4()
|
||||
},
|
||||
APP_MODE === 'pro' &&{
|
||||
path:'analytics',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/Dashboard.tsx')),
|
||||
key:uuidv4(),
|
||||
key:'analytics',
|
||||
children:[
|
||||
{
|
||||
path:':dashboardType',
|
||||
component:<Outlet/>,
|
||||
key:uuidv4(),
|
||||
provider:DashboardProvider,
|
||||
children:[
|
||||
{
|
||||
path:'list',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardList.tsx')),
|
||||
key:uuidv4()
|
||||
},
|
||||
{
|
||||
path:'detail/:dashboardDetailId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardDetail.tsx')),
|
||||
key:uuidv4()
|
||||
},
|
||||
]
|
||||
path:'total',
|
||||
key:'analytics2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardTotal.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'systemrunning',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@systemRunning/pages/SystemRunning.tsx')),
|
||||
key:uuidv4()
|
||||
},
|
||||
{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '../../../../common/src/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:'intelligentPlugin'
|
||||
},
|
||||
{
|
||||
path:'logsettings/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/logsettings/LogSettings.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'logSettings',
|
||||
children:[{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
key:'logSettings2'
|
||||
}]
|
||||
|
||||
},
|
||||
APP_MODE ==='pro' && {
|
||||
path:'resourcesettings/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/resourcesettings/ResourceSettings.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'resourceSettings',
|
||||
children:[{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
key:'resourceSettings2'
|
||||
}]
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
path:'userProfile/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/UserProfile.tsx')),
|
||||
key:uuidv4(),
|
||||
key:'userProfile',
|
||||
children:[{
|
||||
path:'changepsw',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/ChangePsw.tsx')),
|
||||
key:uuidv4()
|
||||
key:'changePsw'
|
||||
}]
|
||||
}
|
||||
},
|
||||
APP_MODE === 'pro' &&{
|
||||
path:'openapi',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@openApi/pages/OpenApiList.tsx')),
|
||||
key:'openApi',
|
||||
},
|
||||
{
|
||||
path:'systemrunning',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@systemRunning/pages/SystemRunning.tsx')),
|
||||
key:'systemRunning'
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
const RenderRoutes = ()=> {
|
||||
const { loadPlugins } = usePluginLoader()
|
||||
const [routeConfig , setRouteConfig] = useState<RouteConfig[]>(PUBLIC_ROUTES)
|
||||
useEffect(()=>{
|
||||
loadPlugins().then((res)=>{
|
||||
console.log('newRouteConfig',res)
|
||||
setRouteConfig(res as RouteConfig[])
|
||||
})
|
||||
},[])
|
||||
|
||||
return (
|
||||
<App className="h-full" message={{ maxCount: 1 }}>
|
||||
<Router>
|
||||
<Routes>
|
||||
{generateRoutes(PUBLIC_ROUTES)}
|
||||
</Routes>
|
||||
{generateRoutes(routeConfig)}
|
||||
</Routes>
|
||||
</Router>
|
||||
</App>
|
||||
)
|
||||
@@ -476,7 +591,7 @@ const generateRoutes = (routerConfig: RouteConfig[]) => {
|
||||
}
|
||||
|
||||
// 保护的路由组件
|
||||
function ProtectedRoute() {
|
||||
export function ProtectedRoute() {
|
||||
const {state} = useGlobalContext()
|
||||
return state.isAuthenticated? <BasicLayout project="core" /> : <Navigate to="/login" />;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
import { DashboardProvider } from '@core/contexts/DashboardContext';
|
||||
import { SystemProvider } from '@core/contexts/SystemContext';
|
||||
import { TeamProvider } from '@core/contexts/TeamContext';
|
||||
import Login from '@core/pages/Login';
|
||||
import SystemOutlet from '@core/pages/system/SystemOutlet';
|
||||
import { TenantManagementProvider } from '@market/contexts/TenantManagementContext';
|
||||
import { lazy } from 'react';
|
||||
import { Outlet, Navigate } from 'react-router-dom';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import {ProtectedRoute} from '@businessEntry/components/aoplatform/RenderRoutes';
|
||||
import Guide from '@core/pages/guide/Guide';
|
||||
|
||||
// 内置插件与对应组件/模块
|
||||
export const routerMap:Map<string, unknown> = new Map([
|
||||
['basicLayout', { type: 'component', component: <ProtectedRoute />}],
|
||||
['navHidden', { type: 'component', component: <ProtectedRoute /> }],
|
||||
['login', { type: 'component', component: <Login /> }],
|
||||
['guide',{
|
||||
type:'component',
|
||||
component:<Guide />
|
||||
}],
|
||||
['team', {type: 'module',
|
||||
component:<Outlet/>,
|
||||
key: 'team',
|
||||
provider: TeamProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: 'teamList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: 'teamList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamList.tsx'))
|
||||
},
|
||||
{
|
||||
path:'inside/:teamId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsidePage.tsx')),
|
||||
key: 'teamInside',
|
||||
children:[
|
||||
{
|
||||
path:'member',
|
||||
key: 'teamMember',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsideMember.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: 'teamSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamConfig.tsx')),
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}],
|
||||
['service', {
|
||||
type: 'module',
|
||||
path:'service',
|
||||
component:<SystemOutlet />,
|
||||
key: uuidv4(),
|
||||
provider: SystemProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':teamId',
|
||||
component:<Outlet/>,
|
||||
key: uuidv4(),
|
||||
children:[
|
||||
{
|
||||
path:'inside/:serviceId',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'api',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideApiDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'router',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideRouterList')),
|
||||
},
|
||||
{
|
||||
path:'upstream',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/upstream/SystemInsideUpstreamContent.tsx')),
|
||||
},
|
||||
{
|
||||
path:'document',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'subscriber',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideSubscriber.tsx')),
|
||||
children:[
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'approval',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApproval.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'topology',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemTopology.tsx')),
|
||||
key: uuidv4(),
|
||||
children:[
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'publish',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublish.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemConfig.tsx')),
|
||||
children:[
|
||||
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}],
|
||||
['datasourcing', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideDashboardSetting.tsx'))
|
||||
}],
|
||||
['cluster', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCluster.tsx')),
|
||||
}],
|
||||
['cert', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCert.tsx')),
|
||||
}],
|
||||
|
||||
['serviceHub', {
|
||||
type: 'module',
|
||||
component:<Outlet />,
|
||||
key:uuidv4(),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'detail/:serviceId',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubDetail.tsx')),
|
||||
}]
|
||||
}],
|
||||
|
||||
['servicecategories', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/serviceCategory/ServiceCategory.tsx')),
|
||||
}],
|
||||
|
||||
['tenantManagement', { type: 'module',
|
||||
component:<Outlet />,
|
||||
provider:TenantManagementProvider,
|
||||
key:uuidv4(),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:':teamId/inside/:appId',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'service',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideService.tsx')),
|
||||
},
|
||||
{
|
||||
path:'authorization',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideAuth.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementAppSetting.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
]}],
|
||||
['member', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberPage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:memberGroupId',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
}
|
||||
],
|
||||
}],
|
||||
['role', { type: 'module',
|
||||
component:<Outlet></Outlet>,
|
||||
children:[
|
||||
{
|
||||
path: '',
|
||||
key: uuidv4(),
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':roleType/config',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
},
|
||||
{
|
||||
path:':roleType/config/:roleId',
|
||||
key:uuidv4(),
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
}
|
||||
]
|
||||
}],
|
||||
['openapi', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@openApi/pages/OpenApiList.tsx')),
|
||||
}],
|
||||
['analytics', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/Dashboard.tsx')),
|
||||
key:uuidv4(),
|
||||
children:[
|
||||
{
|
||||
path:':dashboardType',
|
||||
component:<Outlet/>,
|
||||
key:uuidv4(),
|
||||
provider:DashboardProvider,
|
||||
children:[
|
||||
{
|
||||
path:'list',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardList.tsx')),
|
||||
key:uuidv4()
|
||||
},
|
||||
{
|
||||
path:'detail/:dashboardDetailId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardDetail.tsx')),
|
||||
key:uuidv4()
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
}],
|
||||
['systemrunning', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@systemRunning/pages/SystemRunning.tsx')),
|
||||
}],
|
||||
['userProfile', { type: 'module',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/UserProfile.tsx')),
|
||||
key:uuidv4(),
|
||||
children:[{
|
||||
path:'changepsw',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/ChangePsw.tsx')),
|
||||
key:uuidv4()
|
||||
}]}]
|
||||
])
|
||||
@@ -0,0 +1,273 @@
|
||||
import { useState } from "react";
|
||||
import { useGlobalContext } from "@common/contexts/GlobalStateContext";
|
||||
import { App } from "antd";
|
||||
import { ApiparkPluginDriver as apipark, CoreObj, generateRemoteModuleTemplate, loadRemoteModule, validateExportLifecycle } from "@businessEntry/utils/plugin";
|
||||
import { useFetch } from "@common/hooks/http";
|
||||
import { RouteConfig } from "@businessEntry/components/aoplatform/RenderRoutes";
|
||||
import { routerMap } from "@businessEntry/consts/const";
|
||||
|
||||
const usePluginLoader = () => {
|
||||
const [modules, setModules] = useState(new Map());
|
||||
const [executeList, setExecuteList] = useState([]);
|
||||
const [baseHref, setBaseHref] = useState('');
|
||||
const [redirectUrl, setRedirectUrl] = useState('');
|
||||
const {fetchData} = useFetch();
|
||||
const pluginProvider = useGlobalContext();
|
||||
const {state, dispatch,pluginEventHub,pluginSlotHubService:pluginSlotHub} = pluginProvider
|
||||
const { finalRouterConfig, setFinalRouterConfig} = useState<RouteConfig[]>([])
|
||||
const {message:messageService, modal:modalService} = App.useApp();
|
||||
|
||||
const getModule = (routerPrefix:string, specific = false) => {
|
||||
if (routerPrefix.startsWith('/')) {
|
||||
routerPrefix = routerPrefix.substring(1);
|
||||
}
|
||||
if (specific) {
|
||||
return modules.get(routerPrefix);
|
||||
}
|
||||
let matchedModule = null;
|
||||
let matchedLength = 0;
|
||||
|
||||
modules.forEach((value, key) => {
|
||||
if (routerPrefix.startsWith(key) && key.length > matchedLength) {
|
||||
matchedModule = value;
|
||||
matchedLength = key.length;
|
||||
}
|
||||
});
|
||||
return matchedModule;
|
||||
};
|
||||
|
||||
const loadModule = async (routerPrefix: string, pluginName: any, exposedModule: string , pluginPath: any) => {
|
||||
if (!modules.get(routerPrefix)) {
|
||||
try {
|
||||
const Module = await loadRemoteModule(generateRemoteModuleTemplate(pluginName, exposedModule, pluginPath));
|
||||
setModules(prevModules => new Map(prevModules).set(routerPrefix, Module));
|
||||
if (!validateExportLifecycle(Module)) {
|
||||
console.error('需要导出插件生命周期函数');
|
||||
return;
|
||||
}
|
||||
await Module.bootstrap?.({
|
||||
pluginProvider,
|
||||
pluginEventHub: pluginEventHub,
|
||||
pluginSlotHub
|
||||
});
|
||||
return Module[exposedModule];
|
||||
} catch (error) {
|
||||
console.error('导入插件失败:', error);
|
||||
}
|
||||
}
|
||||
return getModule(routerPrefix, true)[exposedModule];
|
||||
};
|
||||
|
||||
const loadExecutedPlugin = async () => {
|
||||
for (const plugin of executeList) {
|
||||
try {
|
||||
const Module = await loadRemoteModule(generateRemoteModuleTemplate(plugin.name, plugin?.expose || 'Bootstrap', plugin.path || `${DEFAULT_LOCAL_PLUGIN_PATH}${plugin.name}/apipark.js`));
|
||||
const bootstrap = Module.bootstrap;
|
||||
if (!bootstrap) {
|
||||
console.warn('立即执行插件未导出Bootstrap模块或bootstrap函数');
|
||||
} else {
|
||||
await bootstrap({
|
||||
pluginEventHub,
|
||||
pluginSlotHub,
|
||||
pluginProvider,
|
||||
platformProvider:null,
|
||||
closeModal,
|
||||
messageService,
|
||||
modalService,
|
||||
apiService:fetchData
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('执行插件失败:', error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// TODO 暂未找到关闭弹窗的全局方法
|
||||
const closeModal = () => {
|
||||
};
|
||||
|
||||
const loadPlugins = () => {
|
||||
return new Promise((resolve) => {
|
||||
const routerConfig: RouteConfig[] = [];
|
||||
apipark['builtIn'].default({ routerConfig } as CoreObj);
|
||||
// Assuming you have a way to reset router config in React
|
||||
// resetRouterConfig(routerConfig);
|
||||
console.log(routerConfig)
|
||||
// setFinalRouterConfig(routerConfig)
|
||||
installPlugin(routerConfig, executeList).then((res)=>{
|
||||
resolve(res)
|
||||
})
|
||||
// .then(async () => {
|
||||
// // resetRouterConfig(routerConfig);
|
||||
// await loadExecutedPlugin();
|
||||
// resolve(true);
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
const installPlugin = (routerConfig: any[], executeList: never[]) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// fetchData('system/plugins',{method:'GET'}).then((resp) => {
|
||||
// if (resp.code === 0){
|
||||
const resp = {data:{
|
||||
"buildAt": "2024-09-13T03:51:25Z",
|
||||
"build_user": "gitlab-runner",
|
||||
"git_commint": "6438d5aaff146dc560ed0d8563788e64a49640a5",
|
||||
"goversion": "go version go1.21.4 linux/amd64",
|
||||
"guide": true,
|
||||
"plugins": [
|
||||
{
|
||||
"driver": "apipark.builtIn.component",
|
||||
"name": "guide",
|
||||
"router": [
|
||||
{
|
||||
"path": "guide/*",
|
||||
"type": "normal"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"driver": "apipark.builtIn.component",
|
||||
"name": "team",
|
||||
"router": [
|
||||
{
|
||||
"path": "team",
|
||||
"type": "normal"
|
||||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// "driver": "apipark.remote.normal",
|
||||
// "name": "remote",
|
||||
// "router": [
|
||||
// {
|
||||
// "path": "remote",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "driver": "apipark.local.preload",
|
||||
// "name": "auth",
|
||||
// "router": [
|
||||
// {
|
||||
// "expose": "AppModule",
|
||||
// "path": "auth",
|
||||
// "type": "root"
|
||||
// },
|
||||
// {
|
||||
// "expose": "AuthInfoModule",
|
||||
// "path": "auth-info",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "driver": "apipark.builtIn.component",
|
||||
// "name": "email",
|
||||
// "router": [
|
||||
// {
|
||||
// "path": "system/email",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "driver": "apipark.builtIn.module",
|
||||
// "name": "open-api",
|
||||
// "router": [
|
||||
// {
|
||||
// "path": "system/ext-app",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "driver": "apipark.local.router",
|
||||
// "name": "monitor",
|
||||
// "router": [
|
||||
// {
|
||||
// "expose": "AppModule",
|
||||
// "path": "monitor",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// "driver": "apipark.remote.normal",
|
||||
// "name": "apispace",
|
||||
// "router": [
|
||||
// {
|
||||
// "path": "remote/apispace",
|
||||
// "type": "normal"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
],
|
||||
"powered": "Powered by https://eolink.com",
|
||||
"product": "apipark",
|
||||
"version": "6438d5aa"
|
||||
}}
|
||||
dispatch({type:'UPDATE_VERSION',version:resp.data.version})
|
||||
dispatch({type:'UPDATE_DATE',updateDate:resp.data.buildAt})
|
||||
dispatch({type:'UPDATE_POWER',powered:resp.data.powered})
|
||||
const driverMethod = { apipark: apipark };
|
||||
const pluginConfigList = resp.data.plugins;
|
||||
const pluginLoader = { loadModule };
|
||||
const pluginLifecycleGuard ={};
|
||||
const builtInPluginLoader = loadBuiltInModule;
|
||||
|
||||
// pluginSlotHub.addSlot('renewMenu', () => {
|
||||
// // navigation.dataUpdated = true;
|
||||
// // Assuming you have a way to get menu list in React
|
||||
// // getMenuList().then(() => {});
|
||||
// });
|
||||
console.log('pluginConfigList', pluginConfigList)
|
||||
for (const plugin of pluginConfigList) {
|
||||
try {
|
||||
const driverName = plugin.driver;
|
||||
if (!driverName) {
|
||||
console.error('no driver name');
|
||||
continue;
|
||||
}
|
||||
console.log(driverName)
|
||||
const driver = driverName.split('.').reduce((driverMethod: { [x: string]: any; }, driverName: string | number) => driverMethod[driverName], driverMethod);
|
||||
driver({ routerConfig, executeList, pluginLoader, pluginProvider, pluginLifecycleGuard, builtInPluginLoader }, plugin);
|
||||
} catch (err) {
|
||||
console.warn('安装插件出错:', err);
|
||||
}
|
||||
}
|
||||
// resetRouterConfig(routerConfig);
|
||||
console.log('get router', routerConfig)
|
||||
// setFinalRouterConfig(routerConfig)
|
||||
resolve(routerConfig);
|
||||
// } else {
|
||||
// messageService.error(resp.msg || '获取插件配置列表失败,请重试!');
|
||||
// reject(new Error(resp.msg || '获取插件配置列表失败'));
|
||||
// }
|
||||
// });
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const loadBuiltInModule = (pluginName: any) => {
|
||||
try {
|
||||
const { module } = routerMap.get(pluginName);
|
||||
return module;
|
||||
} catch (err) {
|
||||
console.warn(`安装内置插件[${pluginName}]出错:`, err);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
loadPlugins,
|
||||
loadModule,
|
||||
loadExecutedPlugin,
|
||||
closeModal,
|
||||
setBaseHref,
|
||||
getModule
|
||||
};
|
||||
};
|
||||
|
||||
export default usePluginLoader;
|
||||
@@ -0,0 +1,214 @@
|
||||
import { RouteConfig } from '@businessEntry/components/aoplatform/RenderRoutes';
|
||||
import { routerMap } from '@businessEntry/consts/const';
|
||||
import { isFunction } from 'lodash-es'
|
||||
// @ts-expect-error module cannot find
|
||||
import { __federation_method_setRemote,__federation_method_getRemote,__federation_method_unwrapDefault } from 'virtual:__federation__';
|
||||
|
||||
interface RemoteModuleConfig{
|
||||
type:string
|
||||
remoteEntry:string
|
||||
exposedModule:string
|
||||
remoteName:string
|
||||
}
|
||||
|
||||
export async function loadRemoteModule(remoteModuleConfig:RemoteModuleConfig){
|
||||
__federation_method_setRemote(remoteModuleConfig.remoteName, {
|
||||
url: () => Promise.resolve(remoteModuleConfig.remoteEntry),
|
||||
format: 'esm',
|
||||
from: 'vite',
|
||||
});
|
||||
|
||||
return await __federation_method_getRemote(
|
||||
remoteModuleConfig.remoteName,
|
||||
`./${remoteModuleConfig.exposedModule}`
|
||||
)
|
||||
}
|
||||
|
||||
export function generateRemoteModuleTemplate(
|
||||
pluginName: string,
|
||||
exposedModule: string,
|
||||
pluginPath: string
|
||||
):RemoteModuleConfig {
|
||||
return {
|
||||
type: 'module',
|
||||
remoteEntry: pluginPath,
|
||||
exposedModule: `./${exposedModule}`,
|
||||
remoteName: pluginName
|
||||
}
|
||||
}
|
||||
|
||||
/** 校验子应用导出的 生命周期 对象是否正确 */
|
||||
export function validateExportLifecycle(exports: unknown) {
|
||||
const { bootstrap, mount, unmount } = exports ?? {}
|
||||
return isFunction(bootstrap) && isFunction(mount) && isFunction(unmount)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const DEFAULT_LOCAL_PLUGIN_PATH = '/plugin-frontend/'
|
||||
interface PluginRouterConfig {
|
||||
path:string;
|
||||
type:string;
|
||||
expose?:string
|
||||
}
|
||||
interface PluginConfig {
|
||||
name: string;
|
||||
router: Array<PluginRouterConfig>;
|
||||
path?: string;
|
||||
driver:string
|
||||
}
|
||||
|
||||
export interface CoreObj {
|
||||
routerConfig: RouteConfig[];
|
||||
executeList: unknown[];
|
||||
pluginLoader: PluginLoaderService;
|
||||
pluginLifecycleGuard: PluginLifecycleGuard;
|
||||
pluginProvider: PluginProviderService;
|
||||
builtInPluginLoader: (name: string) => any;
|
||||
}
|
||||
|
||||
const defaultBuiltInPlugin:Array<{path:string, pathMatch?:'full' | 'prefix', componentName?:string, type?:string}> = [
|
||||
{ path: '/', pathMatch: 'full', componentName: 'login' },
|
||||
{ path: '/login', componentName: 'login' },
|
||||
{ path: '/', componentName: 'basicLayout' },
|
||||
// { path: '**', componentName: 'redirectPage' }
|
||||
|
||||
]
|
||||
|
||||
|
||||
export const ApiparkPluginDriver:{[key:string]:{[key:string]:(coreObj?:CoreObj, pluginConfig?:PluginConfig)=>(CoreObj|undefined)}} = {
|
||||
builtIn: {
|
||||
// apinto主项目驱动,在core中自动调,不根据插件配置表
|
||||
default: (coreObj?:CoreObj) => {
|
||||
if(!coreObj) return coreObj
|
||||
const url = new URL(window.location.href)
|
||||
const navHidden = url.searchParams.get('nav_hidden') || sessionStorage.getItem('nav_hidden')
|
||||
if (navHidden === 'true') sessionStorage.setItem('nav_hidden', navHidden)
|
||||
const routes = defaultBuiltInPlugin.filter(plugin =>navHidden === 'true' && plugin.componentName === 'basicLayout' ? routerMap.get('navHidden')!.component : routerMap.get(plugin.componentName || plugin.path) ).map(plugin => (
|
||||
{
|
||||
path: plugin.path,
|
||||
component: navHidden === 'true' && plugin.componentName === 'basicLayout' ? routerMap.get('navHidden')!.component : routerMap.get(plugin.componentName || plugin.path)?.component,
|
||||
children: [],
|
||||
key:plugin.componentName,
|
||||
data: {
|
||||
type: plugin.type || plugin.componentName || plugin.path
|
||||
},
|
||||
pathMatch: plugin.pathMatch || 'prefix'
|
||||
})
|
||||
)
|
||||
console.log(routes)
|
||||
coreObj.routerConfig.push(...routes)
|
||||
return coreObj
|
||||
},
|
||||
component: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
for (const pluginRouter of pluginConfig.router) {
|
||||
console.log(pluginRouter,{path: pluginRouter.path,component: routerMap.get(pluginConfig.name)?.component})
|
||||
const routerToChanged:RouteConfig[] = pluginRouter.type === 'root' ? coreObj.routerConfig : coreObj.routerConfig.find((router: RouteConfig) => router.path === '/' && router?.pathMatch !== 'full')!.children as RouteConfig[]
|
||||
// coreObj.pluginProvider.setRouterConfig(pluginRouter.type === 'root', {
|
||||
// path: pluginRouter.path,
|
||||
// component: routerMap.get(pluginConfig.name)!.component
|
||||
// }, coreObj.routerConfig)
|
||||
routerMap.get(pluginConfig.name) && routerToChanged.unshift({...routerMap.get(pluginConfig.name)!, key:pluginConfig.name, path:pluginRouter.path})
|
||||
}
|
||||
return coreObj
|
||||
},
|
||||
module: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
for (const pluginRouter of pluginConfig.router) {
|
||||
const routerToChanged:RouteConfig[] = pluginRouter.type === 'root' ? coreObj.routerConfig : coreObj.routerConfig.find((router: RouteConfig) => router.path === '/' && router?.pathMatch !== 'full')!.children as RouteConfig[]
|
||||
console.log(pluginConfig,pluginRouter,routerMap.get(pluginRouter.name), {
|
||||
path: pluginRouter.path,
|
||||
})
|
||||
// coreObj.pluginProvider.setRouterConfig(pluginRouter.type === 'root', {
|
||||
// path: pluginRouter.path,
|
||||
// component: routerMap.get(pluginConfig.name)!.component,
|
||||
// children: coreObj.builtInPluginLoader(pluginConfig.name)
|
||||
// }, coreObj.routerConfig)
|
||||
routerMap.get(pluginRouter.name) && routerToChanged.unshift({...routerMap.get(pluginRouter.name)!, key:pluginRouter.name, path:pluginRouter.path})
|
||||
}
|
||||
return coreObj
|
||||
},
|
||||
httpApi: () => {
|
||||
return undefined
|
||||
}
|
||||
},
|
||||
remote: {
|
||||
normal: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
const remoteRouter = coreObj.routerConfig.find((item:RouteConfig) => item?.data?.['type'] === 'remotePlugin')
|
||||
if (!remoteRouter) {
|
||||
// coreObj.pluginProvider.setRouterConfig(false, {
|
||||
// path: 'remote',
|
||||
// children: [
|
||||
// {
|
||||
// path: ':moduleName',
|
||||
// component: routerMap.get('remote').component
|
||||
// }
|
||||
// ],
|
||||
// data: {
|
||||
// type: 'remotePlugin'
|
||||
// }
|
||||
// }, coreObj.routerConfig)
|
||||
}
|
||||
return coreObj
|
||||
}
|
||||
},
|
||||
intelligent: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
normal: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
const remoteRouter = coreObj.routerConfig.find((item:RouteConfig) => item?.data?.['type'] === 'intelligentPlugin')
|
||||
if (!remoteRouter) {
|
||||
// coreObj.pluginProvider.setRouterConfig(false, {
|
||||
// path: 'template',
|
||||
// loadChildren: coreObj.builtInPluginLoader('intelligent'),
|
||||
// data: {
|
||||
// type: 'intelligentPlugin'
|
||||
// }
|
||||
// }, coreObj.routerConfig)
|
||||
}
|
||||
return coreObj
|
||||
}
|
||||
},
|
||||
local: {
|
||||
router: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
for (const pluginRouter of pluginConfig.router) {
|
||||
if (pluginRouter.type === 'sub') {
|
||||
continue
|
||||
}
|
||||
updateRouterConfigWithPlugin(coreObj, pluginRouter, pluginConfig)
|
||||
}
|
||||
return coreObj
|
||||
},
|
||||
preload: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {
|
||||
if(!coreObj || !pluginConfig) return coreObj
|
||||
coreObj.executeList.push({ ...pluginConfig, expose: 'Bootstrap', bootstrap: 'BootstrapModule.bootstrap' })
|
||||
for (const pluginRouter of pluginConfig.router) {
|
||||
updateRouterConfigWithPlugin(coreObj, pluginRouter, pluginConfig)
|
||||
}
|
||||
return coreObj
|
||||
}
|
||||
// extender: (coreObj?:CoreObj, pluginConfig?:PluginConfig) => {}
|
||||
}
|
||||
}
|
||||
function updateRouterConfigWithPlugin (coreObj: CoreObj, pluginRouter: PluginRouterConfig, pluginConfig: PluginConfig) {
|
||||
if (!pluginRouter.expose) {
|
||||
throw new Error('pluginRouter.expose is required')
|
||||
} else {
|
||||
// coreObj.pluginProvider.setRouterConfig(pluginRouter.type === 'root', {
|
||||
// path: pluginRouter.path,
|
||||
// loadChildren: () => coreObj.pluginLoader.loadModule(
|
||||
// pluginRouter.path,
|
||||
// pluginConfig.name,
|
||||
// pluginRouter.expose!,
|
||||
// pluginConfig.path || `${DEFAULT_LOCAL_PLUGIN_PATH}${pluginConfig.name}/ApiparkPluginDriver.js`
|
||||
// ),
|
||||
// canActivate: [coreObj.pluginLifecycleGuard],
|
||||
// canActivateChild: [coreObj.pluginLifecycleGuard],
|
||||
// canDeactivate: [coreObj.pluginLifecycleGuard],
|
||||
// canLoad: [coreObj.pluginLifecycleGuard]
|
||||
// }, coreObj.routerConfig)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, Plugin } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars';
|
||||
import tailwindcss from 'tailwindcss';
|
||||
import autoprefixer from 'autoprefixer';
|
||||
import federation from "@originjs/vite-plugin-federation";
|
||||
|
||||
export default defineConfig({
|
||||
cacheDir: './node_modules/.vite',
|
||||
@@ -11,26 +12,17 @@ export default defineConfig({
|
||||
outDir:'../../dist',
|
||||
sourcemap: false,
|
||||
chunkSizeWarningLimit: 50000,
|
||||
cacheDir: './node_modules/.vite',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
return id.toString().split('node_modules/')[1].split('/')[0].toString();
|
||||
}
|
||||
// 针对 pnpm 和 Monorepo 特殊处理
|
||||
if (id.includes('.pnpm')) {
|
||||
const segments = id.split(path.sep);
|
||||
const packageName = segments[segments.indexOf('.pnpm') + 1].split('@')[0];
|
||||
return packageName;
|
||||
}
|
||||
}
|
||||
chunkFileNames: 'assets/eo-[name]-[hash].js',
|
||||
},
|
||||
},
|
||||
},
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
tailwindcss(path.resolve(__dirname, '../common/tailwind.config.js')),
|
||||
autoprefixer
|
||||
autoprefixer,
|
||||
],
|
||||
},
|
||||
preprocessorOptions: {
|
||||
@@ -49,6 +41,16 @@ export default defineConfig({
|
||||
exclude:[],
|
||||
warnOnError:false
|
||||
}),
|
||||
federation({
|
||||
name:"container",
|
||||
remotes:{
|
||||
remoteApp: 'http://localhost:5001/assets/remoteEntry.js' // 远程项目的URL
|
||||
},
|
||||
shared:[
|
||||
"react",
|
||||
"react-dom",
|
||||
]
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
|
||||
-85
File diff suppressed because one or more lines are too long
@@ -1,11 +1,9 @@
|
||||
|
||||
export type BasicResponse<T> = {
|
||||
code:number
|
||||
data:T
|
||||
msg:string
|
||||
}
|
||||
|
||||
|
||||
export const STATUS_CODE = {
|
||||
SUCCESS:0,
|
||||
UNANTHORIZED:401,
|
||||
@@ -29,6 +27,7 @@ export const routerKeyMap = new Map<string, string[]|string>([
|
||||
['maintenanceCenter',['aisetting','datasourcing','cluster','cert','logsettings','resourcesettings','openapi']
|
||||
]])
|
||||
|
||||
|
||||
|
||||
export const COLUMNS_TITLE = {
|
||||
operate : ''
|
||||
|
||||
@@ -47,6 +47,14 @@ export const GlobalContext = createContext<{
|
||||
checkPermission:(access:keyof typeof PERMISSION_DEFINITION[0] | Array<keyof typeof PERMISSION_DEFINITION[0]>)=>boolean
|
||||
teamDataFlushed:boolean
|
||||
accessInit:boolean
|
||||
// 插件系统
|
||||
pluginEventHub:unknown
|
||||
pluginSlotHubService:{
|
||||
addSlot:(name:string, content:unknown)=>void
|
||||
addSlotArr:(name:string, content:unknown[])=>void
|
||||
removeSlot:(name:string)=>void
|
||||
getSlot:(name:string)=>unknown
|
||||
}
|
||||
aiConfigFlushed:boolean
|
||||
setAiConfigFlushed:(flush:boolean)=>void
|
||||
} | undefined>(undefined);
|
||||
@@ -118,6 +126,8 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => {
|
||||
const [accessInit, setAccessInit] = useState<boolean>(false)
|
||||
const [aiConfigFlushed, setAiConfigFlushed] = useState<boolean>(false)
|
||||
let getGlobalAccessPromise: Promise<BasicResponse<{ access:string[] }>> | null = null
|
||||
const [pluginEventHub] = useState<unknown>({})
|
||||
const [pluginSlotHub] = useState<Map<string,unknown>>(new Map())
|
||||
|
||||
const getGlobalAccessData = ()=>{
|
||||
if(getGlobalAccessPromise){
|
||||
@@ -176,6 +186,14 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => {
|
||||
return revs
|
||||
}
|
||||
|
||||
const pluginSlotHubService = {
|
||||
addSlot:pluginSlotHub.set,
|
||||
addSlotArr : (name:string, content:any[]) => {pluginSlotHub.get(name) ? pluginSlotHub.set(name, (pluginSlotHub.get(name) as Array<unknown>).push(content)) : pluginSlotHub.set(name, content)},
|
||||
removeSlot:pluginSlotHub.delete,
|
||||
getSlot:pluginSlotHub.get
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<GlobalContext.Provider value={
|
||||
{ state, dispatch,accessData,pluginAccessDictionary,
|
||||
@@ -184,7 +202,7 @@ export const GlobalProvider: FC<{children:ReactNode}> = ({ children }) => {
|
||||
getTeamAccessData,teamDataFlushed,
|
||||
cleanTeamAccessData,
|
||||
resetAccess ,checkPermission,accessInit,
|
||||
aiConfigFlushed, setAiConfigFlushed}}>
|
||||
aiConfigFlushed, setAiConfigFlushed,pluginEventHub,pluginSlotHubService}}>
|
||||
{children}
|
||||
</GlobalContext.Provider>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import BasicLayout from '@common/components/aoplatform/BasicLayout';
|
||||
import {createElement, ReactElement,ReactNode,Suspense} from 'react';
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import {App, Skeleton} from "antd";
|
||||
import {SystemProvider} from "@core/contexts/SystemContext.tsx";
|
||||
import {useGlobalContext} from "@common/contexts/GlobalStateContext.tsx";
|
||||
import {FC,lazy} from 'react';
|
||||
import { TeamProvider } from '@core/contexts/TeamContext.tsx';
|
||||
@@ -13,7 +14,6 @@ import Guide from '@core/pages/guide/Guide';
|
||||
import { AiServiceProvider } from '@core/contexts/AiServiceContext';
|
||||
import AiServiceOutlet from '@core/pages/aiService/AiServiceOutlet';
|
||||
import SystemOutlet from '@core/pages/system/SystemOutlet';
|
||||
import { SystemProvider } from '@core/contexts/SystemContext';
|
||||
|
||||
type RouteConfig = {
|
||||
path:string
|
||||
@@ -50,57 +50,52 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'/',
|
||||
component:<Login/>,
|
||||
key: uuidv4(),
|
||||
key: 'root',
|
||||
},
|
||||
{
|
||||
path:'/login',
|
||||
component:<Login/>,
|
||||
key: uuidv4()
|
||||
key: 'login'
|
||||
},
|
||||
{
|
||||
path:'/',
|
||||
component:<ProtectedRoute/>,
|
||||
key: uuidv4(),
|
||||
key: 'layout',
|
||||
children:[
|
||||
// {
|
||||
// path:'approval/*',
|
||||
// component:<ApprovalPage />,
|
||||
// key:uuidv4()
|
||||
// },
|
||||
{
|
||||
path:'guide/*',
|
||||
component:<Guide />,
|
||||
key:uuidv4()
|
||||
key:'guide'
|
||||
},
|
||||
{
|
||||
path:'team',
|
||||
component:<Outlet/>,
|
||||
key: uuidv4(),
|
||||
key: 'team',
|
||||
provider: TeamProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'teamList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: uuidv4(),
|
||||
key: 'teamList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamList.tsx'))
|
||||
},
|
||||
{
|
||||
path:'inside/:teamId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsidePage.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'teamInside',
|
||||
children:[
|
||||
{
|
||||
path:'member',
|
||||
key: uuidv4(),
|
||||
key: 'teamMember',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamInsideMember.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: uuidv4(),
|
||||
key: 'teamSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/team/TeamConfig.tsx')),
|
||||
},
|
||||
]
|
||||
@@ -111,36 +106,37 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
path:'service',
|
||||
key: uuidv4(),
|
||||
component:<SystemOutlet />,
|
||||
key: 'restService',
|
||||
provider: SystemProvider,
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'restServiceList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceList3',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemList.tsx')),
|
||||
},
|
||||
{
|
||||
path:':teamId',
|
||||
component:<Outlet/>,
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInside',
|
||||
children:[
|
||||
{
|
||||
path:'inside/:serviceId',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInside2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'api',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApi',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideApiDocument.tsx')),
|
||||
},
|
||||
{
|
||||
@@ -157,22 +153,22 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
},
|
||||
{
|
||||
path:'route',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideRoute',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/api/SystemInsideRouterList')),
|
||||
},
|
||||
{
|
||||
path:'upstream',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideUpstream',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/upstream/SystemInsideUpstreamContent.tsx')),
|
||||
},
|
||||
{
|
||||
path:'document',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideDocument',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideDocument.tsx')),
|
||||
},
|
||||
{
|
||||
path:'subscriber',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideSubscriber',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemInsideSubscriber.tsx')),
|
||||
children:[
|
||||
|
||||
@@ -180,17 +176,17 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
},
|
||||
{
|
||||
path:'approval',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApproval',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApproval.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApprovalList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
key: 'restServiceInsideApprovalList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/approval/SystemInsideApprovalList.tsx')),
|
||||
}
|
||||
]
|
||||
@@ -198,30 +194,30 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'topology',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemTopology.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'systemTopology',
|
||||
children:[
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'publish',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublish',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublish.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublishList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'*',
|
||||
key: uuidv4(),
|
||||
key: 'systemPublishList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/publish/SystemInsidePublishList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key: uuidv4(),
|
||||
key: 'systemConfig',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/system/SystemConfig.tsx')),
|
||||
children:[
|
||||
|
||||
@@ -321,42 +317,42 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
},
|
||||
{
|
||||
path:'datasourcing',
|
||||
key: uuidv4(),
|
||||
key: 'dataSourcing',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideDashboardSetting.tsx')),
|
||||
},
|
||||
{
|
||||
path:'cluster',
|
||||
key: uuidv4(),
|
||||
key: 'cluster',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCluster.tsx')),
|
||||
},
|
||||
{
|
||||
path:'aisetting',
|
||||
key: uuidv4(),
|
||||
key: 'aiSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/aiSetting/AiSettingList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'cert',
|
||||
key: uuidv4(),
|
||||
key: 'cert',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/partitions/PartitionInsideCert.tsx')),
|
||||
},
|
||||
{
|
||||
path:'serviceHub',
|
||||
component:<Outlet />,
|
||||
key:uuidv4(),
|
||||
key:'serviceHub',
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key: uuidv4(),
|
||||
key: 'serviceHubList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'detail/:serviceId',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubDetail',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/ServiceHubDetail.tsx')),
|
||||
}]
|
||||
},
|
||||
@@ -369,107 +365,102 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
path:'tenantManagement',
|
||||
component:<Outlet />,
|
||||
provider:TenantManagementProvider,
|
||||
key:uuidv4(),
|
||||
key:'tenantManagement',
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:':teamId/inside/:appId',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInside',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsidePage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'service',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInsideService',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideService.tsx')),
|
||||
},
|
||||
{
|
||||
path:'authorization',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementInsideAuthorization',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementInsideAuth.tsx')),
|
||||
},
|
||||
{
|
||||
path:'setting',
|
||||
key:uuidv4(),
|
||||
key:'tenantManagementSetting',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ManagementAppSetting.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubManagementList',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:teamId',
|
||||
key:uuidv4(),
|
||||
key:'serviceHubManagementList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@market/pages/serviceHub/management/ServiceHubManagement.tsx')),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'member',
|
||||
key:uuidv4(),
|
||||
key:'member',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberPage.tsx')),
|
||||
children:[
|
||||
{
|
||||
path:'',
|
||||
key:uuidv4(),
|
||||
key:'memberList',
|
||||
component:<Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'memberList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
},
|
||||
{
|
||||
path:'list/:memberGroupId',
|
||||
key:uuidv4(),
|
||||
key:'memberList3',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/member/MemberList.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'role',
|
||||
key:uuidv4(),
|
||||
key:'role',
|
||||
component:<Outlet />,
|
||||
children:[
|
||||
{
|
||||
path: '',
|
||||
key: uuidv4(),
|
||||
key: 'roleList',
|
||||
component: <Navigate to="list" />
|
||||
},
|
||||
{
|
||||
path:'list',
|
||||
key:uuidv4(),
|
||||
key:'roleList2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleList.tsx')),
|
||||
},{
|
||||
path:':roleType/config/:roleId',
|
||||
key:uuidv4(),
|
||||
key:'roleConfig',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
},{
|
||||
path:':roleType/config',
|
||||
key:uuidv4(),
|
||||
key:'roleConfig2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/role/RoleConfig.tsx')),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path:'assets',
|
||||
component:<p>设计中</p>,
|
||||
key:uuidv4()
|
||||
},
|
||||
{
|
||||
path:'analytics',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/Dashboard.tsx')),
|
||||
key:uuidv4(),
|
||||
key:'analytics',
|
||||
children:[
|
||||
{
|
||||
path:'total',
|
||||
key:uuidv4(),
|
||||
key:'analytics2',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@dashboard/pages/DashboardTotal.tsx')),
|
||||
},
|
||||
]
|
||||
@@ -477,38 +468,38 @@ const PUBLIC_ROUTES:RouteConfig[] = [
|
||||
{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
key:'intelligentPlugin'
|
||||
},
|
||||
{
|
||||
path:'logsettings/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/logsettings/LogSettings.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'logSettings',
|
||||
children:[{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
key:'logSettings2'
|
||||
}]
|
||||
|
||||
},
|
||||
APP_MODE ==='pro' && {
|
||||
path:'resourcesettings/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/resourcesettings/ResourceSettings.tsx')),
|
||||
key: uuidv4(),
|
||||
key: 'resourceSettings',
|
||||
children:[{
|
||||
path:'template/:moduleId',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@common/components/aoplatform/intelligent-plugin/IntelligentPluginList.tsx')),
|
||||
key:uuidv4()
|
||||
key:'resourceSettings2'
|
||||
}]
|
||||
|
||||
},
|
||||
{
|
||||
path:'userProfile/*',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/UserProfile.tsx')),
|
||||
key:uuidv4(),
|
||||
key:'userProfile',
|
||||
children:[{
|
||||
path:'changepsw',
|
||||
lazy:lazy(() => import(/* webpackChunkName: "[request]" */ '@core/pages/userProfile/ChangePsw.tsx')),
|
||||
key:uuidv4()
|
||||
key:'changePsw'
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -520,7 +511,7 @@ const RenderRoutes = ()=> {
|
||||
<App className="h-full" message={{ maxCount: 1 }}>
|
||||
<Router>
|
||||
<Routes>
|
||||
{generateRoutes(PUBLIC_ROUTES)}
|
||||
{ generateRoutes(PUBLIC_ROUTES)}
|
||||
</Routes>
|
||||
</Router>
|
||||
</App>
|
||||
|
||||
@@ -74,7 +74,7 @@ const SystemInsidePage:FC = ()=> {
|
||||
'group'),
|
||||
getItem($t('管理'), 'mng', null,
|
||||
[
|
||||
APP_MODE === 'pro' ? getItem(<Link to="./topology">{$t('调用拓扑图')}</Link>, 'topology',undefined,undefined,undefined,'project.mySystem.topology.view'):null,
|
||||
// APP_MODE === 'pro' ? getItem(<Link to="./topology">{$t('调用拓扑图')}</Link>, 'topology',undefined,undefined,undefined,'project.mySystem.topology.view'):null,
|
||||
getItem(<Link to="./setting">{$t('设置')}</Link>, 'setting',undefined,undefined,undefined,'')],
|
||||
'group'),
|
||||
],[state.language])
|
||||
|
||||
@@ -18,7 +18,7 @@ export default defineConfig({
|
||||
chunkFileNames: 'assets/eo-[name]-[hash].js',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [
|
||||
|
||||
@@ -138,7 +138,7 @@ const ServiceHubList:FC = ()=>{
|
||||
<div className="pt-[20px]">
|
||||
<Card title={CardTitle(item)} className="shadow-[0_5px_10px_0_rgba(0,0,0,0.05)] rounded-[10px] overflow-visible cursor-pointer h-[180px] m-0 transition duration-500 hover:shadow-[0_5px_20px_0_rgba(0,0,0,0.15)] hover:scale-[1.05]" classNames={{header:'border-b-[0px] p-[20px] ', body:"pt-0"}} onClick={()=>showDocumentDetail(item)}>
|
||||
<span className="line-clamp-3 text-[12px] text-[#666] "
|
||||
style={{'word-break':'auto-phrase'}}>{item.description || $t('暂无服务描述')}</span>
|
||||
style={{wordBreak:'auto-phrase'}}>{item.description || $t('暂无服务描述')}</span>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -10,8 +10,8 @@ import {OpenApiConfig, OpenApiConfigFieldType, OpenApiConfigHandle} from "./Open
|
||||
import { SimpleMemberItem } from "@common/const/type.ts";
|
||||
import TableBtnWithPermission from "@common/components/aoplatform/TableBtnWithPermission.tsx";
|
||||
import { frontendTimeSorter } from "@common/utils/dataTransfer.ts";
|
||||
import { OPENAPI_LIST_COLUMNS } from "@market/consts/const.tsx";
|
||||
import { OpenApiTableListItem } from "@market/consts/type.ts";
|
||||
import { OPENAPI_LIST_COLUMNS } from "@openApi/consts/const.tsx";
|
||||
import { OpenApiTableListItem } from "@openApi/consts/type.ts";
|
||||
import { $t } from "@common/locales/index.ts";
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"paths": {
|
||||
"@common/*": ["../common/src/*"],
|
||||
"@core/*": ["../core/src/*"],
|
||||
"@market/*": ["./src/*"]
|
||||
"@openApi/*": ["./src/*"]
|
||||
},
|
||||
},
|
||||
"include": ["src", "public/iconpark_eolink.js", "public/iconpark_apinto.js", "../common/src/component/aoplatform/EditableTableWithModal.tsx", "../common/src/components/aoplatform/TreeWithMore.tsx", "../common/src/components/aoplatform/DatePicker.tsx", "../common/src/components/aoplatform/TimeRangeSelector.tsx", "../common/src/components/aoplatform/TimePicker.tsx", "../common/src/components/aoplatform/MemberTransfer.tsx", "../common/src/components/aoplatform/PageList.tsx", "../common/src/components/aoplatform/ErrorBoundary.tsx", "../core/src/pages/serviceCategory/ServiceHubCategoryConfig.tsx"],
|
||||
|
||||
Reference in New Issue
Block a user