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/components/DisabledInput/index.less b/react-ui/src/components/DisabledInput/index.less new file mode 100644 index 00000000..2eb28917 --- /dev/null +++ b/react-ui/src/components/DisabledInput/index.less @@ -0,0 +1,9 @@ +.disabled-input { + padding: 4px 11px; + color: rgba(0, 0, 0, 0.25); + font-size: @font-size-input; + background-color: rgba(0, 0, 0, 0.04); + border: 1px solid #d9d9d9; + border-radius: 6px; + cursor: not-allowed; +} diff --git a/react-ui/src/components/DisabledInput/index.tsx b/react-ui/src/components/DisabledInput/index.tsx new file mode 100644 index 00000000..a3c67b7d --- /dev/null +++ b/react-ui/src/components/DisabledInput/index.tsx @@ -0,0 +1,20 @@ +import { Typography } from 'antd'; +import styles from './index.less'; + +type DisabledInputProps = { + value?: any; + valuePropName?: string; +}; + +function DisabledInput({ value, valuePropName }: DisabledInputProps) { + const data = valuePropName ? value[valuePropName] : value; + return ( +
+ + {data} + +
+ ); +} + +export default DisabledInput; 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) => { +