diff --git a/react-ui/src/components/ResourceSelectorModal/config.tsx b/react-ui/src/components/ResourceSelectorModal/config.tsx index 5dc7b961..20687713 100644 --- a/react-ui/src/components/ResourceSelectorModal/config.tsx +++ b/react-ui/src/components/ResourceSelectorModal/config.tsx @@ -1,7 +1,7 @@ import datasetImg from '@/assets/img/modal-select-dataset.png'; import mirrorImg from '@/assets/img/modal-select-mirror.png'; import modelImg from '@/assets/img/modal-select-model.png'; -import { AvailableRange, CommonTabKeys } from '@/enums'; +import { AvailableRange, CommonTabKeys, MirrorVersionStatus } from '@/enums'; import { ResourceData, ResourceVersionData } from '@/pages/Dataset/config'; import { MirrorVersionData } from '@/pages/Mirror/Info'; import { MirrorData } from '@/pages/Mirror/List'; @@ -224,8 +224,7 @@ export class MirrorSelector implements SelectorTypeInfo { image_id: parentKey, page: 0, size: 2000, - status: 'available', - state: 1, + status: MirrorVersionStatus.Available, }); if (res && res.data) { const list = res.data.content || []; diff --git a/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx b/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx index 3b74b6ad..4c52ea58 100644 --- a/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx +++ b/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx @@ -80,7 +80,7 @@ function HyperParameterBasic({ } return [ { - label: '代码', + label: '代码配置', value: info.code_config, format: formatCodeConfig, }, diff --git a/react-ui/src/utils/index.ts b/react-ui/src/utils/index.ts index 40fa4f8b..0abf1a45 100644 --- a/react-ui/src/utils/index.ts +++ b/react-ui/src/utils/index.ts @@ -278,8 +278,14 @@ export const getGitUrl = (url: string, branch: string): string => { if (!url) { return ''; } - const gitUrl = url.replace(/\.git$/, ''); - return branch ? `${gitUrl}/tree/${branch}` : gitUrl; + let gitUrlStr = url.replace(/\.git$/, ''); + const gitUrl = new URL(gitUrlStr); + if (gitUrl.port === '30202') { + gitUrl.port = '30203'; // 30202 该为 30203 + } + gitUrlStr = gitUrl.href; + + return branch ? `${gitUrlStr.toString()}/tree/${branch}` : gitUrlStr; }; /** diff --git a/react-ui/tests/getGitUrl.tesx.ts b/react-ui/tests/getGitUrl.tesx.ts new file mode 100644 index 00000000..b33a592e --- /dev/null +++ b/react-ui/tests/getGitUrl.tesx.ts @@ -0,0 +1,19 @@ +import { getGitUrl } from '../src/utils'; + +describe('canBeConvertToDate()', () => { + test('empty string', () => { + expect(getGitUrl('', '')).toBe(''); + }); + + test('url domain with branch', () => { + expect( + getGitUrl('https://gitlink.org.cn/somunslotus/material-atom-predict.git', 'master'), + ).toBe('https://gitlink.org.cn/somunslotus/material-atom-predict/tree/master'); + }); + + test('url domain without branch', () => { + expect(getGitUrl('https://gitlink.org.cn/somunslotus/material-atom-predict.git', '')).toBe( + 'https://gitlink.org.cn/somunslotus/material-atom-predict.git', + ); + }); +});