From 7a4852908b0b6d06c25873c519e6fc9da98470d1 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Mon, 19 May 2025 18:41:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/pages/Mirror/Create/index.less | 8 +++++ react-ui/src/pages/Mirror/Create/index.tsx | 35 +++++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/react-ui/src/pages/Mirror/Create/index.less b/react-ui/src/pages/Mirror/Create/index.less index 84f4c197..403a2a44 100644 --- a/react-ui/src/pages/Mirror/Create/index.less +++ b/react-ui/src/pages/Mirror/Create/index.less @@ -9,6 +9,14 @@ background-color: white; border-radius: 10px; + &__name-row { + :global { + .ant-form-item-row { + flex-wrap: nowrap; + } + } + } + &__type { color: @text-color; font-size: @font-size-input-lg; diff --git a/react-ui/src/pages/Mirror/Create/index.tsx b/react-ui/src/pages/Mirror/Create/index.tsx index a32e99a1..ebbd12e7 100644 --- a/react-ui/src/pages/Mirror/Create/index.tsx +++ b/react-ui/src/pages/Mirror/Create/index.tsx @@ -123,8 +123,6 @@ function MirrorCreate() { return true; }; - const descTitle = isAddVersion ? '版本描述' : '镜像描述'; - return (
@@ -161,6 +159,7 @@ function MirrorCreate() { message: '只支持小写字母、数字、点(.)、下划线(_)、中横线(-)、斜杠(/)', }, ]} + className={styles['mirror-create__content__name-row']} > + {!isAddVersion && ( + + + + + + + + )} Date: Tue, 20 May 2025 09:31:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BD=8D=E4=BA=8E=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E7=BB=93=E6=9E=9C=E7=9A=84=E9=A1=B5=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E5=B7=A6=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E7=AD=9B=E9=80=89=EF=BC=8C=E9=A1=B5=E9=9D=A2=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=9A=82=E6=97=A0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/Dataset/components/ResourceList/index.tsx | 7 +++++++ .../src/pages/Dataset/components/ResourcePage/index.tsx | 2 ++ 2 files changed, 9 insertions(+) diff --git a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx index 2f1e8d4e..450a5c11 100644 --- a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx @@ -16,6 +16,7 @@ import styles from './index.less'; export type ResourceListRef = { reset: () => void; + resetPage: () => void; }; type ResourceListProps = { @@ -97,6 +98,12 @@ function ResourceList( setDataList(undefined); setTotal(0); }, + resetPage: () => { + setPagination((prev) => ({ + ...prev, + current: 1, + })); + }, }; }, [], diff --git a/react-ui/src/pages/Dataset/components/ResourcePage/index.tsx b/react-ui/src/pages/Dataset/components/ResourcePage/index.tsx index fce95046..c21984ac 100644 --- a/react-ui/src/pages/Dataset/components/ResourcePage/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourcePage/index.tsx @@ -56,11 +56,13 @@ function ResourcePage({ resourceType }: ResourcePageProps) { // 选择类型 const chooseType = (record: CategoryData) => { + dataListRef.current?.resetPage(); setActiveType((prev) => (prev === record.name ? undefined : record.name)); }; // 选择 Tag const chooseTag = (record: CategoryData) => { + dataListRef.current?.resetPage(); setActiveTag((prev) => (prev === record.name ? undefined : record.name)); }; From 9a89988e95d3c696571c668def64423425334b8e Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Tue, 20 May 2025 09:32:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E2=80=9C=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=B8=AD=E2=80=9D=E7=8A=B6=E6=80=81=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E6=9E=84=E5=BB=BA=E6=88=90=E5=8A=9F?= =?UTF-8?q?/=E5=A4=B1=E8=B4=A5=E7=8A=B6=E6=80=81=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=90=8E=E9=87=8D=E6=96=B0=E6=98=BE=E7=A4=BA=E5=9C=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/pages/Mirror/Info/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/src/pages/Mirror/Info/index.tsx b/react-ui/src/pages/Mirror/Info/index.tsx index c270909f..bbef6e4f 100644 --- a/react-ui/src/pages/Mirror/Info/index.tsx +++ b/react-ui/src/pages/Mirror/Info/index.tsx @@ -211,7 +211,7 @@ function MirrorInfo() { hidden: isPublic, render: (_: any, record: MirrorVersionData) => (
- {!isPublic && ( + {!isPublic && record.status && record.status !== MirrorVersionStatus.Building && ( Date: Tue, 20 May 2025 11:23:23 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E6=9C=BA?= =?UTF-8?q?=E5=99=A8=E5=AD=A6=E4=B9=A0=E8=BF=90=E8=A1=8C&=E8=8E=B7?= =?UTF-8?q?=E5=8F=96tensorboard=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/components/IFramePage/index.tsx | 16 ++-- react-ui/src/enums/index.ts | 2 +- .../ExperimentVisualResult/index.less | 8 ++ .../ExperimentVisualResult/index.tsx | 86 +++++++++++++++---- 4 files changed, 87 insertions(+), 25 deletions(-) create mode 100644 react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.less diff --git a/react-ui/src/components/IFramePage/index.tsx b/react-ui/src/components/IFramePage/index.tsx index 0d56724d..a087da42 100644 --- a/react-ui/src/components/IFramePage/index.tsx +++ b/react-ui/src/components/IFramePage/index.tsx @@ -1,12 +1,11 @@ import FullScreenFrame from '@/components/FullScreenFrame'; -import KFSpin from '@/components/KFSpin'; import { getKnowledgeGraphUrl, getLabelStudioUrl } from '@/services/developmentEnvironment'; +import Loading from '@/utils/loading'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; import { FloatButton } from 'antd'; import classNames from 'classnames'; import { useEffect, useState } from 'react'; -import { createPortal } from 'react-dom'; import './index.less'; export enum IframePageType { @@ -66,16 +65,18 @@ type IframePageProps = { /** 系统内嵌 iframe,目前系统有数据标注、应用开发、开发环境、GitLink 四个子系统,使用时可以添加其他子系统 */ function IframePage({ type, openInTab = false, className, style }: IframePageProps) { const [iframeUrl, setIframeUrl] = useState(''); - const [loading, setLoading] = useState(false); + // const [loading, setLoading] = useState(false); useEffect(() => { const requestIframeUrl = async () => { - setLoading(true); + //setLoading(true); + Loading.show(); const [res] = await to(getRequestAPI(type)()); if (res && res.data) { setIframeUrl(res.data); } else { - setLoading(false); + Loading.hide(); + // setLoading(false); } }; @@ -83,12 +84,13 @@ function IframePage({ type, openInTab = false, className, style }: IframePagePro }, [type]); const hideLoading = () => { - setLoading(false); + // setLoading(false); + Loading.hide(); }; return (
- {loading && createPortal(, document.body)} + {/* {loading && createPortal(, document.body)} */} {openInTab && window.open(iframeUrl, '_blank')} />}
diff --git a/react-ui/src/enums/index.ts b/react-ui/src/enums/index.ts index a9dd4a0f..8cc2398e 100644 --- a/react-ui/src/enums/index.ts +++ b/react-ui/src/enums/index.ts @@ -33,7 +33,7 @@ export enum TensorBoardStatus { Unknown = 'Unknown', // 未知 Pending = 'Pending', // 启动中 Running = 'Running', // 运行中 - Terminated = 'Terminated', // 未启动或者已终止 + Terminated = 'Terminated', // 未启动 Failed = 'Failed', // 失败 } diff --git a/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.less b/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.less new file mode 100644 index 00000000..2cf61f91 --- /dev/null +++ b/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.less @@ -0,0 +1,8 @@ +.experiment-visual { + width: 100%; + height: 100%; + + &__empty { + height: 100%; + } +} diff --git a/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.tsx b/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.tsx index 1837d625..26ebbeca 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.tsx +++ b/react-ui/src/pages/AutoML/components/ExperimentVisualResult/index.tsx @@ -5,10 +5,15 @@ */ import IframePage, { IframePageType } from '@/components/IFramePage'; -import { runTensorBoardReq } from '@/services/experiment/index.js'; +import KFEmpty, { EmptyType } from '@/components/KFEmpty'; +import KFSpin from '@/components/KFSpin'; +import { TensorBoardStatus } from '@/enums'; +import { getTensorBoardStatusReq, runTensorBoardReq } from '@/services/experiment/index.js'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; -import { useEffect, useState } from 'react'; +import { LoadingOutlined } from '@ant-design/icons'; +import { useCallback, useEffect, useState } from 'react'; +import styles from './index.less'; type TensorBoardProps = { namespace?: string; @@ -16,28 +21,75 @@ type TensorBoardProps = { }; function ExperimentVisualResult({ namespace, path }: TensorBoardProps) { - const [tensorboardUrl, setTensorboardUrl] = useState(''); - useEffect(() => { - // 运行 TensorBoard - const runTensorBoard = async () => { - const params = { - namespace: namespace, - path: path, - }; - const [res] = await to(runTensorBoardReq(params)); - if (res && res.data) { - const url = res.data; - SessionStorage.setItem(SessionStorage.tensorBoardUrlKey, url); - setTensorboardUrl(url); + const [tensorboardUrl, setTensorboardUrl] = useState(undefined); + const [status, setStatus] = useState(undefined); + + // 获取 TensorBoard 状态 + const getTensorBoardStatus = useCallback(async () => { + const params = { + namespace: namespace, + path: path, + }; + const [res] = await to(getTensorBoardStatusReq(params)); + if (res && res.data) { + const status = res.data.status as TensorBoardStatus | undefined; + setStatus(res.data.status); + if (!status || status === TensorBoardStatus.Pending) { + setTimeout(() => { + getTensorBoardStatus(); + }, 5000); } + } + }, [namespace, path]); + + // 运行 TensorBoard + const runTensorBoard = useCallback(async () => { + const params = { + namespace: namespace, + path: path, }; + const [res] = await to(runTensorBoardReq(params)); + if (res && res.data) { + const url = res.data; + SessionStorage.setItem(SessionStorage.tensorBoardUrlKey, url); + setTensorboardUrl(url); + getTensorBoardStatus(); + } else { + setTensorboardUrl(null); + } + }, [namespace, path, getTensorBoardStatus]); + useEffect(() => { if (namespace && path) { runTensorBoard(); } - }, [namespace, path]); + }, [namespace, path, runTensorBoard]); - return <>{tensorboardUrl && }; + if (tensorboardUrl === null || status === TensorBoardStatus.Failed) { + return ( +
+ +
+ ); + } else if (status === TensorBoardStatus.Pending) { + return ( +
+ } size="large" /> +
+ ); + } else if (status === TensorBoardStatus.Running) { + return ( +
+ +
+ ); + } } export default ExperimentVisualResult;