Browse Source

feat: 整理路由

pull/105/head
cp3hnu 1 year ago
parent
commit
f9761354d3
12 changed files with 138 additions and 101 deletions
  1. +116
    -80
      react-ui/config/routes.ts
  2. +1
    -1
      react-ui/src/pages/Dataset/components/ResourceList/index.tsx
  3. +1
    -0
      react-ui/src/pages/DevelopmentEnvironment/List/index.tsx
  4. +4
    -4
      react-ui/src/pages/Experiment/index.jsx
  5. +1
    -1
      react-ui/src/pages/Mirror/List/index.tsx
  6. +3
    -3
      react-ui/src/pages/Model/components/NodeTooltips/index.tsx
  7. +1
    -1
      react-ui/src/pages/ModelDeployment/List/index.tsx
  8. +2
    -2
      react-ui/src/pages/Monitor/Job/index.tsx
  9. +2
    -2
      react-ui/src/pages/Monitor/Online/index.tsx
  10. +3
    -3
      react-ui/src/pages/Pipeline/index.jsx
  11. +2
    -2
      react-ui/src/pages/System/Role/index.tsx
  12. +2
    -2
      react-ui/src/pages/System/User/index.tsx

+ 116
- 80
react-ui/config/routes.ts View File

@@ -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',


+ 1
- 1
react-ui/src/pages/Dataset/components/ResourceList/index.tsx View File

@@ -131,7 +131,7 @@ function ResourceList(
activeTag: dataTag,
});
const prefix = config.prefix;
navigate(`/dataset/${prefix}/${record.id}`);
navigate(`/dataset/${prefix}/info/${record.id}`);
};

// 分页切换


+ 1
- 0
react-ui/src/pages/DevelopmentEnvironment/List/index.tsx View File

@@ -268,6 +268,7 @@ function EditorList() {
total: total,
showSizeChanger: true,
showQuickJumper: true,
showTotal: () => `共${total}条`,
}}
onChange={handleTableChange}
rowKey="id"


+ 4
- 4
react-ui/src/pages/Experiment/index.jsx View File

@@ -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}`);
},
};
};


+ 1
- 1
react-ui/src/pages/Mirror/List/index.tsx View File

@@ -125,7 +125,7 @@ function MirrorList() {

// 查看详情
const toDetail = (record: MirrorData) => {
navigate(`/dataset/mirror/${record.id}`);
navigate(`/dataset/mirror/info/${record.id}`);
setCacheState({
activeTab,
pagination,


+ 3
- 3
react-ui/src/pages/Model/components/NodeTooltips/index.tsx View File

@@ -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');
};



+ 1
- 1
react-ui/src/pages/ModelDeployment/List/index.tsx View File

@@ -162,7 +162,7 @@ function ModelDeployment() {
searchStatus,
});

navigate(`/modelDeployment/${record.service_id}`);
navigate(`/modelDeployment/info/${record.service_id}`);
};

// 分页切换


+ 2
- 2
react-ui/src/pages/Monitor/Job/index.tsx View File

@@ -232,7 +232,7 @@ const JobTableList: React.FC = () => {
type="link"
size="small"
key="edit"
icon=<EditOutlined />
icon={<EditOutlined />}
hidden={!access.hasPerms('monitor:job:edit')}
onClick={() => {
setModalVisible(true);
@@ -246,7 +246,7 @@ const JobTableList: React.FC = () => {
size="small"
danger
key="batchRemove"
icon=<DeleteOutlined />
icon={<DeleteOutlined />}
hidden={!access.hasPerms('monitor:job:remove')}
onClick={async () => {
Modal.confirm({


+ 2
- 2
react-ui/src/pages/Monitor/Online/index.tsx View File

@@ -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=<DeleteOutlined />
icon={<DeleteOutlined />}
hidden={!access.hasPerms('monitor:online:forceLogout')}
onClick={async () => {
Modal.confirm({


+ 3
- 3
react-ui/src/pages/Pipeline/index.jsx View File

@@ -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}` });
}
});
}


+ 2
- 2
react-ui/src/pages/System/Role/index.tsx View File

@@ -261,7 +261,7 @@ const RoleTableList: React.FC = () => {
type="link"
size="small"
key="edit"
icon=<EditOutlined />
icon={<EditOutlined />}
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=<DeleteOutlined />
icon={<DeleteOutlined />}
hidden={!access.hasPerms('system:role:remove')}
onClick={async () => {
Modal.confirm({


+ 2
- 2
react-ui/src/pages/System/User/index.tsx View File

@@ -286,7 +286,7 @@ const UserTableList: React.FC = () => {
type="link"
size="small"
key="edit"
icon=<EditOutlined />
icon={<EditOutlined />}
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=<DeleteOutlined />
icon={<DeleteOutlined />}
key="batchRemove"
hidden={!access.hasPerms('system:user:remove')}
onClick={async () => {


Loading…
Cancel
Save