From f9761354d39f57bdc695ccf128a99f03764cfa22 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Tue, 16 Jul 2024 10:25:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B4=E7=90=86=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/routes.ts | 196 +++++++++++------- .../Dataset/components/ResourceList/index.tsx | 2 +- .../DevelopmentEnvironment/List/index.tsx | 1 + react-ui/src/pages/Experiment/index.jsx | 8 +- react-ui/src/pages/Mirror/List/index.tsx | 2 +- .../Model/components/NodeTooltips/index.tsx | 6 +- .../src/pages/ModelDeployment/List/index.tsx | 2 +- react-ui/src/pages/Monitor/Job/index.tsx | 4 +- react-ui/src/pages/Monitor/Online/index.tsx | 4 +- react-ui/src/pages/Pipeline/index.jsx | 6 +- react-ui/src/pages/System/Role/index.tsx | 4 +- react-ui/src/pages/System/User/index.tsx | 4 +- 12 files changed, 138 insertions(+), 101 deletions(-) diff --git a/react-ui/config/routes.ts b/react-ui/config/routes.ts index c61d1dab..c6162f97 100644 --- a/react-ui/config/routes.ts +++ b/react-ui/config/routes.ts @@ -16,6 +16,18 @@ export default [ redirect: '/workspace', breadcrumb: '工作空间', }, + { + name: 'workspace', + path: '/workspace', + routes: [ + { + name: '工作空间', + path: '', + key: 'workspace', + component: './Workspace/index', + }, + ], + }, { path: '/user', layout: false, @@ -31,23 +43,27 @@ export default [ path: '/account', routes: [ { - name: 'acenter', + name: '用户中心', path: '/account/center', component: './User/Center', }, { - name: 'asettings', + name: '用户设置', path: '/account/settings', component: './User/Settings', }, ], }, { - name: 'datasetPreparation', + name: '数据准备', path: '/datasetPreparation', routes: [ { - name: 'datasetAnnotation', + path: '', + redirect: '/datasetPreparation/datasetAnnotation', + }, + { + name: '数据标注', path: 'datasetAnnotation', component: './DatasetPreparation/DatasetAnnotation/index', }, @@ -59,9 +75,29 @@ export default [ ], }, { - name: 'pipeline', + name: 'developmentEnvironment', + path: '/developmentEnvironment', + routes: [ + { + name: '开发环境', + path: '', + component: './DevelopmentEnvironment/Editor', + }, + { + name: '创建编辑器', + path: 'create', + component: './DevelopmentEnvironment/Create', + }, + { + name: '编辑器', + path: 'editor', + component: './DevelopmentEnvironment/Editor', + }, + ], + }, + { + name: '流水线', path: '/pipeline', - breadcrumb: '流水线', routes: [ { path: '', @@ -75,82 +111,39 @@ export default [ name: '流水线模板', path: '', component: './Pipeline/index', - breadcrumb: '流水线模板', }, { name: '流水线详情', - path: ':id', + path: 'info/:id', component: './Pipeline/editPipeline/index', - breadcrumb: '流水线详情', }, ], }, { name: '实验', path: 'experiment', - breadcrumb: '实验', routes: [ { name: '实验', path: '', component: './Experiment/index', - breadcrumb: '实验', }, { - name: '实验训练', - path: ':workflowId/:id', + name: '实验实例', + path: 'instance/:workflowId/:id', component: './Experiment/Info/index', - breadcrumb: '实验训练', }, { name: '实验对比', path: 'compare', component: './Experiment/Comparison/index', - breadcrumb: '实验对比', }, ], }, ], }, { - name: 'developmentEnvironment', - path: '/developmentEnvironment', - routes: [ - { - name: '开发环境', - path: '', - component: './DevelopmentEnvironment/Editor', - }, - { - name: '创建编辑器', - path: 'create', - component: './DevelopmentEnvironment/Create', - }, - { - name: '编辑器', - path: 'editor', - component: './DevelopmentEnvironment/Editor', - }, - ], - }, - { - name: 'system', - path: '/system', - routes: [ - { - name: '字典数据', - path: '/system/dict-data/index/:id', - component: './System/DictData', - }, - { - name: '分配用户', - path: '/system/role-auth/user/:id', - component: './System/Role/authUser', - }, - ], - }, - { - name: 'dataset', + name: 'AI资产', path: '/dataset', routes: [ { @@ -162,13 +155,13 @@ export default [ path: 'dataset', routes: [ { - name: '数据集列表', + name: '数据集', path: '', component: './Dataset/index', }, { name: '数据集简介', - path: ':id', + path: 'info/:id', component: './Dataset/intro', }, ], @@ -178,13 +171,13 @@ export default [ path: 'model', routes: [ { - name: '模型列表', + name: '模型', path: '', component: './Model/index', }, { name: '模型简介', - path: ':id', + path: 'info/:id', component: './Model/intro', }, ], @@ -194,13 +187,13 @@ export default [ path: 'mirror', routes: [ { - name: '镜像列表', + name: '镜像', path: '', component: './Mirror/List', }, { name: '镜像详情', - path: ':id', + path: 'info/:id', component: './Mirror/Info', }, { @@ -213,40 +206,28 @@ export default [ ], }, { - name: 'workspace', - path: '/workspace', - routes: [ - { - name: '工作空间', - path: '', - key: 'workspace', - component: './Workspace/index', - }, - ], - }, - { - name: 'modelDeployment', + name: '模型部署', path: '/modelDeployment', routes: [ { - name: '模型列表', + name: '模型部署', path: '', component: './ModelDeployment/List', }, { - name: '镜像详情', - path: ':id', + name: '模型部署详情', + path: 'info/:id', component: './ModelDeployment/Info', }, { - name: '创建镜像', + name: '创建推理服务', path: 'create', component: './ModelDeployment/Create', }, ], }, { - name: 'appsDeployment', + name: '应用开发', path: '/appsDeployment', routes: [ { @@ -258,7 +239,7 @@ export default [ ], }, { - name: 'see', + name: '监控运维', path: '/see', routes: [ { @@ -270,7 +251,7 @@ export default [ ], }, { - name: 'readad', + name: '资源', path: '/readad', routes: [ { @@ -282,7 +263,7 @@ export default [ ], }, { - name: 'compent', + name: '组件', path: '/compent', routes: [ { @@ -320,6 +301,61 @@ export default [ }, ], }, + { + name: '系统管理', + path: '/system', + routes: [ + { + path: '', + redirect: '/system/user', + }, + { + name: '用户管理', + path: '/system/user', + component: './System/User', + }, + { + name: '角色管理', + path: '/system/role', + component: './System/Role', + }, + { + name: '定时任务', + path: '/system/job', + component: './Monitor/Job', + }, + { + name: '菜单管理', + path: '/system/menu', + component: './System/Menu', + }, + { + name: '部门管理', + path: '/system/dept', + component: './System/Dept', + }, + { + name: '岗位管理', + path: '/system/post', + component: './System/Post', + }, + { + name: '字典管理', + path: '/system/dict', + component: './System/Dict', + }, + { + name: '字典数据', + path: '/system/dict-data/index/:id', + component: './System/DictData', + }, + { + name: '分配用户', + path: '/system/role-auth/user/:id', + component: './System/Role/authUser', + }, + ], + }, { name: 'docs', path: '/docs', diff --git a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx index e7891141..60626faf 100644 --- a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx @@ -131,7 +131,7 @@ function ResourceList( activeTag: dataTag, }); const prefix = config.prefix; - navigate(`/dataset/${prefix}/${record.id}`); + navigate(`/dataset/${prefix}/info/${record.id}`); }; // 分页切换 diff --git a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx index 38a98e6a..6d3d6d0c 100644 --- a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx +++ b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx @@ -268,6 +268,7 @@ function EditorList() { total: total, showSizeChanger: true, showQuickJumper: true, + showTotal: () => `共${total}条`, }} onChange={handleTableChange} rowKey="id" diff --git a/react-ui/src/pages/Experiment/index.jsx b/react-ui/src/pages/Experiment/index.jsx index 8a223f6c..e9ad6821 100644 --- a/react-ui/src/pages/Experiment/index.jsx +++ b/react-ui/src/pages/Experiment/index.jsx @@ -30,7 +30,7 @@ import { experimentStatusInfo } from './status'; const timerIds = new Map(); function Experiment() { - const navgite = useNavigate(); + const navigate = useNavigate(); const [experimentList, setExperimentList] = useState([]); const [workflowList, setWorkflowList] = useState([]); const [queryFlow, setQueryFlow] = useState({ @@ -275,12 +275,12 @@ function Experiment() { // 跳转到流水线 const gotoPipeline = (e, record) => { e.stopPropagation(); - navgite({ pathname: `/pipeline/template/${record.workflow_id}` }); + navigate({ pathname: `/pipeline/template/info/${record.workflow_id}` }); }; // 跳转到实验实例详情 const gotoInstanceInfo = (item, record) => { - navgite({ pathname: `/pipeline/experiment/${record.workflow_id}/${item.id}` }); + navigate({ pathname: `/pipeline/experiment/instance/${record.workflow_id}/${item.id}` }); }; // 处理 TensorBoard 操作 @@ -327,7 +327,7 @@ function Experiment() { }, ], onClick: ({ key }) => { - navgite(`/pipeline/experiment/compare?type=${key}&id=${experimentId}`); + navigate(`/pipeline/experiment/compare?type=${key}&id=${experimentId}`); }, }; }; diff --git a/react-ui/src/pages/Mirror/List/index.tsx b/react-ui/src/pages/Mirror/List/index.tsx index 50e2730e..53f5d825 100644 --- a/react-ui/src/pages/Mirror/List/index.tsx +++ b/react-ui/src/pages/Mirror/List/index.tsx @@ -125,7 +125,7 @@ function MirrorList() { // 查看详情 const toDetail = (record: MirrorData) => { - navigate(`/dataset/mirror/${record.id}`); + navigate(`/dataset/mirror/info/${record.id}`); setCacheState({ activeTab, pagination, diff --git a/react-ui/src/pages/Model/components/NodeTooltips/index.tsx b/react-ui/src/pages/Model/components/NodeTooltips/index.tsx index f5bb2c82..11c2a72d 100644 --- a/react-ui/src/pages/Model/components/NodeTooltips/index.tsx +++ b/react-ui/src/pages/Model/components/NodeTooltips/index.tsx @@ -16,7 +16,7 @@ function ModelInfo({ resourceId, data, onVersionChange }: ModelInfoProps) { const gotoExperimentPage = () => { if (data.train_task?.ins_id) { const { origin } = location; - const url = `${origin}/pipeline/experiment/${data.workflow_id}/${data.train_task.ins_id}`; + const url = `${origin}/pipeline/experiment/instance/${data.workflow_id}/${data.train_task.ins_id}`; window.open(url, '_blank'); } }; @@ -28,7 +28,7 @@ function ModelInfo({ resourceId, data, onVersionChange }: ModelInfoProps) { if (data.current_model_id === resourceId) { onVersionChange?.(data.version); } else { - const path = `/dataset/model/${data.current_model_id}?tab=${ResourceInfoTabKeys.Evolution}&version=${data.version}`; + const path = `/dataset/model/info/${data.current_model_id}?tab=${ResourceInfoTabKeys.Evolution}&version=${data.version}`; navigate(path); } }; @@ -100,7 +100,7 @@ function ModelInfo({ resourceId, data, onVersionChange }: ModelInfoProps) { function DatasetInfo({ data }: { data: TrainDataset }) { const gotoDatasetPage = () => { const { origin } = location; - const url = `${origin}/dataset/dataset/${data.dataset_id}?tab=${ResourceInfoTabKeys.Version}&version=${data.dataset_version}`; + const url = `${origin}/dataset/dataset/info/${data.dataset_id}?tab=${ResourceInfoTabKeys.Version}&version=${data.dataset_version}`; window.open(url, '_blank'); }; diff --git a/react-ui/src/pages/ModelDeployment/List/index.tsx b/react-ui/src/pages/ModelDeployment/List/index.tsx index 556f3f40..d2509068 100644 --- a/react-ui/src/pages/ModelDeployment/List/index.tsx +++ b/react-ui/src/pages/ModelDeployment/List/index.tsx @@ -162,7 +162,7 @@ function ModelDeployment() { searchStatus, }); - navigate(`/modelDeployment/${record.service_id}`); + navigate(`/modelDeployment/info/${record.service_id}`); }; // 分页切换 diff --git a/react-ui/src/pages/Monitor/Job/index.tsx b/react-ui/src/pages/Monitor/Job/index.tsx index 93fcdd63..a160be3e 100644 --- a/react-ui/src/pages/Monitor/Job/index.tsx +++ b/react-ui/src/pages/Monitor/Job/index.tsx @@ -232,7 +232,7 @@ const JobTableList: React.FC = () => { type="link" size="small" key="edit" - icon= + icon={} hidden={!access.hasPerms('monitor:job:edit')} onClick={() => { setModalVisible(true); @@ -246,7 +246,7 @@ const JobTableList: React.FC = () => { size="small" danger key="batchRemove" - icon= + icon={} hidden={!access.hasPerms('monitor:job:remove')} onClick={async () => { Modal.confirm({ diff --git a/react-ui/src/pages/Monitor/Online/index.tsx b/react-ui/src/pages/Monitor/Online/index.tsx index 2d22bd21..105d568c 100644 --- a/react-ui/src/pages/Monitor/Online/index.tsx +++ b/react-ui/src/pages/Monitor/Online/index.tsx @@ -3,7 +3,7 @@ import { DeleteOutlined } from '@ant-design/icons'; import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components'; import { FormattedMessage, useAccess, useIntl } from '@umijs/max'; import type { FormInstance } from 'antd'; -import { Button, message, Modal } from 'antd'; +import { Button, Modal, message } from 'antd'; import React, { useEffect, useRef } from 'react'; /* * @@ -102,7 +102,7 @@ const OnlineUserTableList: React.FC = () => { size="small" danger key="batchRemove" - icon= + icon={} hidden={!access.hasPerms('monitor:online:forceLogout')} onClick={async () => { Modal.confirm({ diff --git a/react-ui/src/pages/Pipeline/index.jsx b/react-ui/src/pages/Pipeline/index.jsx index 9bb9804c..e51c5c08 100644 --- a/react-ui/src/pages/Pipeline/index.jsx +++ b/react-ui/src/pages/Pipeline/index.jsx @@ -21,7 +21,7 @@ import Styles from './index.less'; const { TextArea } = Input; const Pipeline = () => { const [form] = Form.useForm(); - const navgite = useNavigate(); + const navigate = useNavigate(); const [formId, setFormId] = useState(null); const [dialogTitle, setDialogTitle] = useState('新建流水线'); @@ -43,7 +43,7 @@ const Pipeline = () => { }; const routeToEdit = (e, record) => { e.stopPropagation(); - navgite({ pathname: `/pipeline/template/${record.id}` }); + navigate({ pathname: `/pipeline/template/info/${record.id}` }); }; const showModal = () => { form.resetFields(); @@ -66,7 +66,7 @@ const Pipeline = () => { setIsModalOpen(false); message.success('新建成功'); if (ret.code === 200) { - navgite({ pathname: `/pipeline/template/${ret.data.id}` }); + navigate({ pathname: `/pipeline/template/info/${ret.data.id}` }); } }); } diff --git a/react-ui/src/pages/System/Role/index.tsx b/react-ui/src/pages/System/Role/index.tsx index 26957bd3..2d54af8c 100644 --- a/react-ui/src/pages/System/Role/index.tsx +++ b/react-ui/src/pages/System/Role/index.tsx @@ -261,7 +261,7 @@ const RoleTableList: React.FC = () => { type="link" size="small" key="edit" - icon= + icon={} hidden={!access.hasPerms('system:role:edit')} onClick={() => { getRoleMenuList(record.roleId).then((res) => { @@ -288,7 +288,7 @@ const RoleTableList: React.FC = () => { size="small" danger key="batchRemove" - icon= + icon={} hidden={!access.hasPerms('system:role:remove')} onClick={async () => { Modal.confirm({ diff --git a/react-ui/src/pages/System/User/index.tsx b/react-ui/src/pages/System/User/index.tsx index 9ee0469f..1135c17f 100644 --- a/react-ui/src/pages/System/User/index.tsx +++ b/react-ui/src/pages/System/User/index.tsx @@ -286,7 +286,7 @@ const UserTableList: React.FC = () => { type="link" size="small" key="edit" - icon= + icon={} hidden={!access.hasPerms('system:user:edit')} onClick={async () => { fetchUserInfo(record.userId); @@ -302,7 +302,7 @@ const UserTableList: React.FC = () => { type="link" size="small" danger - icon= + icon={} key="batchRemove" hidden={!access.hasPerms('system:user:remove')} onClick={async () => {