diff --git a/react-ui/src/assets/img/dataset-version.png b/react-ui/src/assets/img/dataset-version.png new file mode 100644 index 00000000..c17d46cf Binary files /dev/null and b/react-ui/src/assets/img/dataset-version.png differ diff --git a/react-ui/src/pages/CodeConfig/components/AddCodeConfigModal/index.tsx b/react-ui/src/pages/CodeConfig/components/AddCodeConfigModal/index.tsx index ce4deafd..6e621086 100644 --- a/react-ui/src/pages/CodeConfig/components/AddCodeConfigModal/index.tsx +++ b/react-ui/src/pages/CodeConfig/components/AddCodeConfigModal/index.tsx @@ -93,7 +93,7 @@ function AddCodeConfigModal({ opType, codeConfigData, onOk, ...rest }: AddCodeCo return ( {item.name} - {/* {item.name} */} ); } diff --git a/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx b/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx index 1037e1b9..c0bfdb33 100644 --- a/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceInfo/index.tsx @@ -22,6 +22,8 @@ import { useEffect, useState } from 'react'; import AddVersionModal from '../AddVersionModal'; import ResourceIntro from '../ResourceIntro'; import ResourceVersion from '../ResourceVersion'; +import VersionCompareModal from '../VersionCompareModal'; +import VersionSelectorModal from '../VersionSelectorModal'; import styles from './index.less'; // 这里值小写是因为值会写在 url 中 @@ -47,7 +49,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { const name = searchParams.get('name') || ''; const owner = searchParams.get('owner') || ''; const identifier = searchParams.get('identifier') || ''; - const is_public = searchParams.get('is_public') || ''; + const is_public = (searchParams.get('is_public') || '') === 'true'; const [versionList, setVersionList] = useState([]); const [version, setVersion] = useState(undefined); const [activeTab, setActiveTab] = useState(defaultTab); @@ -67,7 +69,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { name, identifier, version, - is_public: is_public === 'true', + is_public: is_public, }); } }, [version]); @@ -121,7 +123,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { resoureName: info.name, owner: info.owner, identifier: info.identifier, - is_public: info.is_public, + is_public: is_public, onOk: () => { getVersionList(); close(); @@ -129,6 +131,29 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { }); }; + // 选择版本 + const showVersionSelector = () => { + const { close } = openAntdModal(VersionSelectorModal, { + versions: versionList, + onOk: (version: string[]) => { + showVersionComparison(version); + close(); + }, + }); + }; + + // 版本对比 + const showVersionComparison = (versions: string[]) => { + openAntdModal(VersionCompareModal, { + versions: versions, + resourceType: resourceType, + repo_id: resourceId, + owner: info.owner, + identifier: info.identifier, + is_public: is_public, + }); + }; + // 版本变化 const handleVersionChange = (value: string) => { setVersion(value); @@ -237,6 +262,9 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { +