| @@ -32,9 +32,9 @@ export default function BasicTableInfo({ | |||||
| return ( | return ( | ||||
| <div className={classNames('kf-basic-table-info', className)} style={style}> | <div className={classNames('kf-basic-table-info', className)} style={style}> | ||||
| {showDatas.map((item) => ( | |||||
| {showDatas.map((item, index) => ( | |||||
| <BasicInfoItem | <BasicInfoItem | ||||
| key={item.label} | |||||
| key={`${item.label}-${index}`} | |||||
| data={item} | data={item} | ||||
| labelWidth={labelWidth} | labelWidth={labelWidth} | ||||
| classPrefix="kf-basic-table-info" | classPrefix="kf-basic-table-info" | ||||
| @@ -63,7 +63,7 @@ function AutoMLList() { | |||||
| const params: Record<string, any> = { | const params: Record<string, any> = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| ml_name: searchText, | |||||
| ml_name: searchText || undefined, | |||||
| }; | }; | ||||
| const [res] = await to(getAutoMLListReq(params)); | const [res] = await to(getAutoMLListReq(params)); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| @@ -76,6 +76,10 @@ function AutoMLList() { | |||||
| // 搜索 | // 搜索 | ||||
| const onSearch: SearchProps['onSearch'] = (value) => { | const onSearch: SearchProps['onSearch'] = (value) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 删除模型部署 | // 删除模型部署 | ||||
| @@ -59,7 +59,7 @@ function CodeConfigList() { | |||||
| const params = { | const params = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| code_repo_name: searchText !== '' ? searchText : undefined, | |||||
| code_repo_name: searchText || undefined, | |||||
| }; | }; | ||||
| const [res] = await to(getCodeConfigListReq(params)); | const [res] = await to(getCodeConfigListReq(params)); | ||||
| if (res && res.data && res.data.content) { | if (res && res.data && res.data.content) { | ||||
| @@ -83,6 +83,10 @@ function CodeConfigList() { | |||||
| // 搜索 | // 搜索 | ||||
| const handleSearch = (value: string) => { | const handleSearch = (value: string) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 删除 | // 删除 | ||||
| @@ -179,7 +179,7 @@ function AddVersionModal({ | |||||
| 上传文件 | 上传文件 | ||||
| </Button> | </Button> | ||||
| {resourceType === ResourceType.Dataset && ( | {resourceType === ResourceType.Dataset && ( | ||||
| <div className={styles['upload-tip']}>只允许上传 .zip 格式文件</div> | |||||
| <div className={styles['upload-tip']}>只允许上传 .zip 和 .tgz 格式文件</div> | |||||
| )} | )} | ||||
| </Upload> | </Upload> | ||||
| </Form.Item> | </Form.Item> | ||||
| @@ -89,7 +89,7 @@ function ResourceList( | |||||
| is_public: isPublic, | is_public: isPublic, | ||||
| [config.typeParamKey]: dataType, | [config.typeParamKey]: dataType, | ||||
| [config.tagParamKey]: dataTag, | [config.tagParamKey]: dataTag, | ||||
| name: searchText !== '' ? searchText : undefined, | |||||
| name: searchText || undefined, | |||||
| }; | }; | ||||
| const request = config.getList; | const request = config.getList; | ||||
| const [res] = await to(request(params)); | const [res] = await to(request(params)); | ||||
| @@ -115,6 +115,10 @@ function ResourceList( | |||||
| // 搜索 | // 搜索 | ||||
| const handleSearch = (value: string) => { | const handleSearch = (value: string) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 删除 | // 删除 | ||||
| @@ -87,7 +87,7 @@ function MirrorList() { | |||||
| const params: Record<string, any> = { | const params: Record<string, any> = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| name: searchText, | |||||
| name: searchText || undefined, | |||||
| image_type: activeTab === CommonTabKeys.Public ? 1 : 0, | image_type: activeTab === CommonTabKeys.Public ? 1 : 0, | ||||
| }; | }; | ||||
| const [res] = await to(getMirrorListReq(params)); | const [res] = await to(getMirrorListReq(params)); | ||||
| @@ -120,6 +120,10 @@ function MirrorList() { | |||||
| // 搜索 | // 搜索 | ||||
| const onSearch: SearchProps['onSearch'] = (value) => { | const onSearch: SearchProps['onSearch'] = (value) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 查看详情 | // 查看详情 | ||||
| @@ -69,7 +69,7 @@ function ModelDeployment() { | |||||
| const params: Record<string, any> = { | const params: Record<string, any> = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| service_name: searchText, | |||||
| service_name: searchText || undefined, | |||||
| service_type: serviceType, | service_type: serviceType, | ||||
| }; | }; | ||||
| const [res] = await to(getServiceListReq(params)); | const [res] = await to(getServiceListReq(params)); | ||||
| @@ -102,6 +102,10 @@ function ModelDeployment() { | |||||
| // 搜索 | // 搜索 | ||||
| const onSearch: SearchProps['onSearch'] = (value) => { | const onSearch: SearchProps['onSearch'] = (value) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 处理删除 | // 处理删除 | ||||
| @@ -110,7 +110,7 @@ function ServiceInfo() { | |||||
| const params: Record<string, any> = { | const params: Record<string, any> = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| version: searchText, | |||||
| version: searchText || undefined, | |||||
| run_state: serviceStatus, | run_state: serviceStatus, | ||||
| service_id: serviceId, | service_id: serviceId, | ||||
| }; | }; | ||||
| @@ -159,6 +159,10 @@ function ServiceInfo() { | |||||
| // 搜索 | // 搜索 | ||||
| const onSearch: SearchProps['onSearch'] = (value) => { | const onSearch: SearchProps['onSearch'] = (value) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| // 处理删除 | // 处理删除 | ||||
| @@ -40,7 +40,7 @@ function CodeSelectorModal({ onOk, ...rest }: CodeSelectorModalProps) { | |||||
| const params = { | const params = { | ||||
| page: pagination.current! - 1, | page: pagination.current! - 1, | ||||
| size: pagination.pageSize, | size: pagination.pageSize, | ||||
| code_repo_name: searchText !== '' ? searchText : undefined, | |||||
| code_repo_name: searchText || undefined, | |||||
| }; | }; | ||||
| const [res] = await to(getCodeConfigListReq(params)); | const [res] = await to(getCodeConfigListReq(params)); | ||||
| if (res && res.data && res.data.content) { | if (res && res.data && res.data.content) { | ||||
| @@ -52,6 +52,10 @@ function CodeSelectorModal({ onOk, ...rest }: CodeSelectorModalProps) { | |||||
| // 搜索 | // 搜索 | ||||
| const handleSearch = (value: string) => { | const handleSearch = (value: string) => { | ||||
| setSearchText(value); | setSearchText(value); | ||||
| setPagination((prev) => ({ | |||||
| ...prev, | |||||
| current: 1, | |||||
| })); | |||||
| }; | }; | ||||
| const handleClick = (item: CodeConfigData) => { | const handleClick = (item: CodeConfigData) => { | ||||
| @@ -44,14 +44,14 @@ const convertMirrorToTreeData = (list: MirrorData[]): TreeDataNode[] => { | |||||
| })); | })); | ||||
| }; | }; | ||||
| // 数据集版本列表转为树形结构 | |||||
| const convertDatasetVersionToTreeData = ( | |||||
| // 数据集、模型版本列表转为树形结构 | |||||
| const convertResourceVersionToTreeData = ( | |||||
| parentId: string, | parentId: string, | ||||
| info: ResourceData, | info: ResourceData, | ||||
| list: ResourceVersionData[], | list: ResourceVersionData[], | ||||
| ): TreeDataNode[] => { | ): TreeDataNode[] => { | ||||
| return list.map((item: ResourceVersionData) => ({ | return list.map((item: ResourceVersionData) => ({ | ||||
| ...pick(info, ['id', 'name', 'owner', 'identifier']), | |||||
| ...pick(info, ['id', 'name', 'owner', 'identifier', 'is_public']), | |||||
| version: item.name, | version: item.name, | ||||
| title: item.name, | title: item.name, | ||||
| key: `${parentId}-${item.name}`, | key: `${parentId}-${item.name}`, | ||||
| @@ -85,6 +85,7 @@ interface SelectorTypeInfo { | |||||
| readonly buttontTitle: string; // 按钮 title | readonly buttontTitle: string; // 按钮 title | ||||
| } | } | ||||
| // 数据集选择 | |||||
| export class DatasetSelector implements SelectorTypeInfo { | export class DatasetSelector implements SelectorTypeInfo { | ||||
| readonly name = '数据集'; | readonly name = '数据集'; | ||||
| readonly modalIcon = datasetImg; | readonly modalIcon = datasetImg; | ||||
| @@ -114,14 +115,14 @@ export class DatasetSelector implements SelectorTypeInfo { | |||||
| const res = await getDatasetVersionList(pick(parentNode, ['owner', 'identifier'])); | const res = await getDatasetVersionList(pick(parentNode, ['owner', 'identifier'])); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const list = res.data; | const list = res.data; | ||||
| return convertDatasetVersionToTreeData(parentKey, parentNode, list); | |||||
| return convertResourceVersionToTreeData(parentKey, parentNode, list); | |||||
| } else { | } else { | ||||
| return Promise.reject('获取数据集版本列表失败'); | return Promise.reject('获取数据集版本列表失败'); | ||||
| } | } | ||||
| } | } | ||||
| async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) { | 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); | const res = await getDatasetInfo(params); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const path = res.data.relative_paths || ''; | const path = res.data.relative_paths || ''; | ||||
| @@ -136,6 +137,7 @@ export class DatasetSelector implements SelectorTypeInfo { | |||||
| } | } | ||||
| } | } | ||||
| // 模型选择 | |||||
| export class ModelSelector implements SelectorTypeInfo { | export class ModelSelector implements SelectorTypeInfo { | ||||
| readonly name = '模型'; | readonly name = '模型'; | ||||
| readonly modalIcon = modelImg; | readonly modalIcon = modelImg; | ||||
| @@ -165,14 +167,14 @@ export class ModelSelector implements SelectorTypeInfo { | |||||
| const res = await getModelVersionList(pick(parentNode, ['owner', 'identifier'])); | const res = await getModelVersionList(pick(parentNode, ['owner', 'identifier'])); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const list = res.data; | const list = res.data; | ||||
| return convertDatasetVersionToTreeData(key, parentNode, list); | |||||
| return convertResourceVersionToTreeData(key, parentNode, list); | |||||
| } else { | } else { | ||||
| return Promise.reject('获取模型版本列表失败'); | return Promise.reject('获取模型版本列表失败'); | ||||
| } | } | ||||
| } | } | ||||
| async getFiles(_parentKey: string, parentNode: ResourceData & ResourceVersionData) { | 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); | const res = await getModelInfo(params); | ||||
| if (res && res.data) { | if (res && res.data) { | ||||
| const path = res.data.relative_paths || ''; | const path = res.data.relative_paths || ''; | ||||
| @@ -187,6 +189,7 @@ export class ModelSelector implements SelectorTypeInfo { | |||||
| } | } | ||||
| } | } | ||||
| // 镜像选择 | |||||
| export class MirrorSelector implements SelectorTypeInfo { | export class MirrorSelector implements SelectorTypeInfo { | ||||
| readonly name = '镜像'; | readonly name = '镜像'; | ||||
| readonly modalIcon = mirrorImg; | readonly modalIcon = mirrorImg; | ||||