diff --git a/react-ui/src/components/BasicTableInfo/index.tsx b/react-ui/src/components/BasicTableInfo/index.tsx index 104bc2bb..571c4b5b 100644 --- a/react-ui/src/components/BasicTableInfo/index.tsx +++ b/react-ui/src/components/BasicTableInfo/index.tsx @@ -32,9 +32,9 @@ export default function BasicTableInfo({ return (
- {showDatas.map((item) => ( + {showDatas.map((item, index) => ( = { page: pagination.current! - 1, size: pagination.pageSize, - ml_name: searchText, + ml_name: searchText || undefined, }; const [res] = await to(getAutoMLListReq(params)); if (res && res.data) { @@ -76,6 +76,10 @@ function AutoMLList() { // 搜索 const onSearch: SearchProps['onSearch'] = (value) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 删除模型部署 diff --git a/react-ui/src/pages/CodeConfig/List/index.tsx b/react-ui/src/pages/CodeConfig/List/index.tsx index e8a2557f..2efef04c 100644 --- a/react-ui/src/pages/CodeConfig/List/index.tsx +++ b/react-ui/src/pages/CodeConfig/List/index.tsx @@ -59,7 +59,7 @@ function CodeConfigList() { const params = { page: pagination.current! - 1, size: pagination.pageSize, - code_repo_name: searchText !== '' ? searchText : undefined, + code_repo_name: searchText || undefined, }; const [res] = await to(getCodeConfigListReq(params)); if (res && res.data && res.data.content) { @@ -83,6 +83,10 @@ function CodeConfigList() { // 搜索 const handleSearch = (value: string) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 删除 diff --git a/react-ui/src/pages/Dataset/components/AddVersionModal/index.tsx b/react-ui/src/pages/Dataset/components/AddVersionModal/index.tsx index 3218e306..5eed0199 100644 --- a/react-ui/src/pages/Dataset/components/AddVersionModal/index.tsx +++ b/react-ui/src/pages/Dataset/components/AddVersionModal/index.tsx @@ -179,7 +179,7 @@ function AddVersionModal({ 上传文件 {resourceType === ResourceType.Dataset && ( -
只允许上传 .zip 格式文件
+
只允许上传 .zip 和 .tgz 格式文件
)} diff --git a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx index 9e872aca..6f2c7523 100644 --- a/react-ui/src/pages/Dataset/components/ResourceList/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceList/index.tsx @@ -89,7 +89,7 @@ function ResourceList( is_public: isPublic, [config.typeParamKey]: dataType, [config.tagParamKey]: dataTag, - name: searchText !== '' ? searchText : undefined, + name: searchText || undefined, }; const request = config.getList; const [res] = await to(request(params)); @@ -115,6 +115,10 @@ function ResourceList( // 搜索 const handleSearch = (value: string) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 删除 diff --git a/react-ui/src/pages/Mirror/List/index.tsx b/react-ui/src/pages/Mirror/List/index.tsx index 76f289b7..629563d4 100644 --- a/react-ui/src/pages/Mirror/List/index.tsx +++ b/react-ui/src/pages/Mirror/List/index.tsx @@ -87,7 +87,7 @@ function MirrorList() { const params: Record = { page: pagination.current! - 1, size: pagination.pageSize, - name: searchText, + name: searchText || undefined, image_type: activeTab === CommonTabKeys.Public ? 1 : 0, }; const [res] = await to(getMirrorListReq(params)); @@ -120,6 +120,10 @@ function MirrorList() { // 搜索 const onSearch: SearchProps['onSearch'] = (value) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 查看详情 diff --git a/react-ui/src/pages/ModelDeployment/List/index.tsx b/react-ui/src/pages/ModelDeployment/List/index.tsx index 6e61c3ab..0632e547 100644 --- a/react-ui/src/pages/ModelDeployment/List/index.tsx +++ b/react-ui/src/pages/ModelDeployment/List/index.tsx @@ -69,7 +69,7 @@ function ModelDeployment() { const params: Record = { page: pagination.current! - 1, size: pagination.pageSize, - service_name: searchText, + service_name: searchText || undefined, service_type: serviceType, }; const [res] = await to(getServiceListReq(params)); @@ -102,6 +102,10 @@ function ModelDeployment() { // 搜索 const onSearch: SearchProps['onSearch'] = (value) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 处理删除 diff --git a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx index f57c86cb..037bbb72 100644 --- a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx +++ b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx @@ -110,7 +110,7 @@ function ServiceInfo() { const params: Record = { page: pagination.current! - 1, size: pagination.pageSize, - version: searchText, + version: searchText || undefined, run_state: serviceStatus, service_id: serviceId, }; @@ -159,6 +159,10 @@ function ServiceInfo() { // 搜索 const onSearch: SearchProps['onSearch'] = (value) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; // 处理删除 diff --git a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx index 24a54293..13198a78 100644 --- a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx +++ b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx @@ -40,7 +40,7 @@ function CodeSelectorModal({ onOk, ...rest }: CodeSelectorModalProps) { const params = { page: pagination.current! - 1, size: pagination.pageSize, - code_repo_name: searchText !== '' ? searchText : undefined, + code_repo_name: searchText || undefined, }; const [res] = await to(getCodeConfigListReq(params)); if (res && res.data && res.data.content) { @@ -52,6 +52,10 @@ function CodeSelectorModal({ onOk, ...rest }: CodeSelectorModalProps) { // 搜索 const handleSearch = (value: string) => { setSearchText(value); + setPagination((prev) => ({ + ...prev, + current: 1, + })); }; const handleClick = (item: CodeConfigData) => { diff --git a/react-ui/src/pages/Pipeline/components/ResourceSelectorModal/config.tsx b/react-ui/src/pages/Pipeline/components/ResourceSelectorModal/config.tsx index c4e8af4a..80e3ab3c 100644 --- a/react-ui/src/pages/Pipeline/components/ResourceSelectorModal/config.tsx +++ b/react-ui/src/pages/Pipeline/components/ResourceSelectorModal/config.tsx @@ -44,14 +44,14 @@ const convertMirrorToTreeData = (list: MirrorData[]): TreeDataNode[] => { })); }; -// 数据集版本列表转为树形结构 -const convertDatasetVersionToTreeData = ( +// 数据集、模型版本列表转为树形结构 +const convertResourceVersionToTreeData = ( parentId: string, info: ResourceData, list: ResourceVersionData[], ): TreeDataNode[] => { return list.map((item: ResourceVersionData) => ({ - ...pick(info, ['id', 'name', 'owner', 'identifier']), + ...pick(info, ['id', 'name', 'owner', 'identifier', 'is_public']), version: item.name, title: item.name, key: `${parentId}-${item.name}`, @@ -85,6 +85,7 @@ interface SelectorTypeInfo { readonly buttontTitle: string; // 按钮 title } +// 数据集选择 export class DatasetSelector implements SelectorTypeInfo { readonly name = '数据集'; readonly modalIcon = datasetImg; @@ -114,14 +115,14 @@ export class DatasetSelector implements SelectorTypeInfo { const res = await getDatasetVersionList(pick(parentNode, ['owner', 'identifier'])); if (res && res.data) { const list = res.data; - return convertDatasetVersionToTreeData(parentKey, parentNode, list); + return convertResourceVersionToTreeData(parentKey, parentNode, list); } else { return Promise.reject('获取数据集版本列表失败'); } } async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) { - const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version']); + const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version', 'is_public']); const res = await getDatasetInfo(params); if (res && res.data) { const path = res.data.relative_paths || ''; @@ -136,6 +137,7 @@ export class DatasetSelector implements SelectorTypeInfo { } } +// 模型选择 export class ModelSelector implements SelectorTypeInfo { readonly name = '模型'; readonly modalIcon = modelImg; @@ -165,14 +167,14 @@ export class ModelSelector implements SelectorTypeInfo { const res = await getModelVersionList(pick(parentNode, ['owner', 'identifier'])); if (res && res.data) { const list = res.data; - return convertDatasetVersionToTreeData(key, parentNode, list); + return convertResourceVersionToTreeData(key, parentNode, list); } else { return Promise.reject('获取模型版本列表失败'); } } async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) { - const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version']); + const params = pick(parentNode, ['owner', 'identifier', 'id', 'name', 'version', 'is_public']); const res = await getModelInfo(params); if (res && res.data) { const path = res.data.relative_paths || ''; @@ -187,6 +189,7 @@ export class ModelSelector implements SelectorTypeInfo { } } +// 镜像选择 export class MirrorSelector implements SelectorTypeInfo { readonly name = '镜像'; readonly modalIcon = mirrorImg;