From e9abd18df44b12b5376f0cdfa01135679d3bf6ca Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Mon, 15 Jul 2024 15:01:40 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=9D=A2?= =?UTF-8?q?=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/defaultSettings.ts | 2 +- react-ui/config/routes.ts | 53 +++++++-- react-ui/src/app.tsx | 43 +++++--- .../src/components/KFBreadcrumb/index.tsx | 103 ++++++++++++++++++ .../src/components/ParameterInput/index.less | 1 + .../src/components/RightContent/index.less | 10 ++ .../src/components/RightContent/index.tsx | 53 ++++----- react-ui/src/global.less | 17 ++- react-ui/src/iconfont/iconfont.js | 2 +- react-ui/src/overrides.less | 8 ++ react-ui/src/pages/Experiment/Info/index.jsx | 15 ++- react-ui/src/types.ts | 10 ++ 12 files changed, 256 insertions(+), 61 deletions(-) create mode 100644 react-ui/src/components/KFBreadcrumb/index.tsx create mode 100644 react-ui/src/components/RightContent/index.less diff --git a/react-ui/config/defaultSettings.ts b/react-ui/config/defaultSettings.ts index d1842286..b2794f7b 100644 --- a/react-ui/config/defaultSettings.ts +++ b/react-ui/config/defaultSettings.ts @@ -10,7 +10,7 @@ const Settings: ProLayoutProps & { navTheme: 'light', // 拂晓蓝 colorPrimary: '#1664ff', - layout: 'mix', + // layout: 'mix', contentWidth: 'Fluid', fixedHeader: false, fixSiderbar: false, diff --git a/react-ui/config/routes.ts b/react-ui/config/routes.ts index 960a3cb0..c61d1dab 100644 --- a/react-ui/config/routes.ts +++ b/react-ui/config/routes.ts @@ -14,11 +14,7 @@ export default [ { path: '/', redirect: '/workspace', - }, - { - path: '*', - layout: false, - component: './404', + breadcrumb: '工作空间', }, { path: '/user', @@ -65,41 +61,52 @@ export default [ { name: 'pipeline', path: '/pipeline', + breadcrumb: '流水线', routes: [ + { + path: '', + redirect: '/pipeline/template', + }, { name: '流水线模板', - path: 'template', + path: '/pipeline/template', routes: [ { name: '流水线模板', path: '', component: './Pipeline/index', + breadcrumb: '流水线模板', }, { name: '流水线详情', path: ':id', component: './Pipeline/editPipeline/index', + breadcrumb: '流水线详情', }, ], }, { name: '实验', path: 'experiment', + breadcrumb: '实验', routes: [ { name: '实验', path: '', component: './Experiment/index', + breadcrumb: '实验', }, { name: '实验训练', path: ':workflowId/:id', component: './Experiment/Info/index', + breadcrumb: '实验训练', }, { name: '实验对比', path: 'compare', component: './Experiment/Comparison/index', + breadcrumb: '实验对比', }, ], }, @@ -146,6 +153,10 @@ export default [ name: 'dataset', path: '/dataset', routes: [ + { + path: '', + redirect: '/dataset/dataset', + }, { name: '数据集', path: 'dataset', @@ -201,7 +212,6 @@ export default [ }, ], }, - { name: 'workspace', path: '/workspace', @@ -259,6 +269,30 @@ export default [ }, ], }, + { + name: 'readad', + path: '/readad', + routes: [ + { + name: '资源', + path: '', + key: 'readad', + component: './missingPage.jsx', + }, + ], + }, + { + name: 'compent', + path: '/compent', + routes: [ + { + name: '组件', + path: '', + key: 'compent', + component: './missingPage.jsx', + }, + ], + }, { name: 'monitor', path: '/monitor', @@ -298,4 +332,9 @@ export default [ }, ], }, + { + path: '*', + layout: false, + component: './404', + }, ]; diff --git a/react-ui/src/app.tsx b/react-ui/src/app.tsx index 32dbf930..62aa9a4f 100644 --- a/react-ui/src/app.tsx +++ b/react-ui/src/app.tsx @@ -20,18 +20,14 @@ import { import './styles/menu.less'; export { requestConfig as request } from './requestConfig'; // const isDev = process.env.NODE_ENV === 'development'; +import { type GlobalInitialState } from '@/types'; import { menuItemRender } from '@/utils/menuRender'; import { gotoLoginPage } from './utils/ui'; + /** * @see https://umijs.org/zh-CN/plugins/plugin-initial-state * */ -export async function getInitialState(): Promise<{ - settings?: Partial; - currentUser?: API.CurrentUser; - loading?: boolean; - fetchUserInfo?: () => Promise; -}> { - // console.log('getInitialState'); +export async function getInitialState(): Promise { const fetchUserInfo = async () => { try { const response = await getUserInfo(); @@ -56,18 +52,20 @@ export async function getInitialState(): Promise<{ fetchUserInfo, currentUser, settings: defaultSettings as Partial, + collapsed: false, }; } return { fetchUserInfo, settings: defaultSettings as Partial, + collapsed: false, }; } // ProLayout 支持的api https://procomponents.ant.design/components/layout export const layout: RuntimeConfig['layout'] = ({ initialState }) => { return { - rightContentRender: () => , + rightContentRender: false, waterMarkProps: { // content: initialState?.currentUser?.nickName, }, @@ -91,7 +89,6 @@ export const layout: RuntimeConfig['layout'] = ({ initialState }) => { return getRemoteMenu(); }, }, - // footerRender: () =>