| @@ -1,7 +1,7 @@ | |||||
| /* | /* | ||||
| * @Author: 赵伟 | * @Author: 赵伟 | ||||
| * @Date: 2024-10-08 15:36:08 | * @Date: 2024-10-08 15:36:08 | ||||
| * @Description: 代码配置选择表单组件 | |||||
| * @Description: 流水线选择代码配置表单 | |||||
| */ | */ | ||||
| import KFIcon from '@/components/KFIcon'; | import KFIcon from '@/components/KFIcon'; | ||||
| @@ -47,6 +47,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { | |||||
| const name = searchParams.get('name') || ''; | const name = searchParams.get('name') || ''; | ||||
| const owner = searchParams.get('owner') || ''; | const owner = searchParams.get('owner') || ''; | ||||
| const identifier = searchParams.get('identifier') || ''; | const identifier = searchParams.get('identifier') || ''; | ||||
| const is_public = searchParams.get('is_public') || ''; | |||||
| const [versionList, setVersionList] = useState<ResourceVersionData[]>([]); | const [versionList, setVersionList] = useState<ResourceVersionData[]>([]); | ||||
| const [version, setVersion] = useState<string | undefined>(undefined); | const [version, setVersion] = useState<string | undefined>(undefined); | ||||
| const [activeTab, setActiveTab] = useState<string>(defaultTab); | const [activeTab, setActiveTab] = useState<string>(defaultTab); | ||||
| @@ -66,6 +67,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { | |||||
| name, | name, | ||||
| identifier, | identifier, | ||||
| version, | version, | ||||
| is_public: is_public === 'true', | |||||
| }); | }); | ||||
| } | } | ||||
| }, [version]); | }, [version]); | ||||
| @@ -77,6 +79,7 @@ const ResourceInfo = ({ resourceType }: ResourceInfoProps) => { | |||||
| id: number; | id: number; | ||||
| identifier: string; | identifier: string; | ||||
| version?: string; | version?: string; | ||||
| is_public: boolean; | |||||
| }) => { | }) => { | ||||
| const request = config.getInfo; | const request = config.getInfo; | ||||
| const [res] = await to(request(params)); | const [res] = await to(request(params)); | ||||
| @@ -122,7 +122,7 @@ function ResourceList( | |||||
| modalConfirm({ | modalConfirm({ | ||||
| title: config.deleteModalTitle, | title: config.deleteModalTitle, | ||||
| onOk: () => { | onOk: () => { | ||||
| deleteRecord(pick(record, ['owner', 'identifier', 'id'])); | |||||
| deleteRecord(pick(record, ['owner', 'identifier', 'id', 'is_public'])); | |||||
| }, | }, | ||||
| }); | }); | ||||
| }; | }; | ||||
| @@ -138,7 +138,7 @@ function ResourceList( | |||||
| }); | }); | ||||
| const prefix = config.prefix; | const prefix = config.prefix; | ||||
| navigate( | navigate( | ||||
| `/dataset/${prefix}/info/${record.id}?name=${record.name}&owner=${record.owner}&identifier=${record.identifier}`, | |||||
| `/dataset/${prefix}/info/${record.id}?name=${record.name}&owner=${record.owner}&identifier=${record.identifier}&is_public=${record.is_public}`, | |||||
| ); | ); | ||||
| }; | }; | ||||
| @@ -28,6 +28,7 @@ function ResourceVersion({ resourceType, info }: ResourceVersionProps) { | |||||
| id: info.id, | id: info.id, | ||||
| version: info.version, | version: info.version, | ||||
| identifier: info.identifier, | identifier: info.identifier, | ||||
| is_public: info.is_public, | |||||
| }); | }); | ||||
| }; | }; | ||||
| @@ -199,6 +199,11 @@ const UserForm: React.FC<UserFormProps> = (props) => { | |||||
| { | { | ||||
| required: true, | required: true, | ||||
| }, | }, | ||||
| { | |||||
| pattern: /^[a-zA-Z0-9](?:[a-zA-Z0-9_.-]*[a-zA-Z0-9])?$/, | |||||
| message: | |||||
| '只能包含数字,字母,下划线(_),中横线(-),英文句号(.),且必须以数字或字母开头与结尾', | |||||
| }, | |||||
| ]} | ]} | ||||
| /> | /> | ||||
| <ProFormText.Password | <ProFormText.Password | ||||
| @@ -7,6 +7,7 @@ | |||||
| import { ExperimentStatus, TensorBoardStatus } from '@/enums'; | import { ExperimentStatus, TensorBoardStatus } from '@/enums'; | ||||
| import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | import type { Settings as LayoutSettings } from '@ant-design/pro-components'; | ||||
| // 单点登录的客户端信息 | |||||
| export type ClientInfo = { | export type ClientInfo = { | ||||
| accessTokenUri: string; | accessTokenUri: string; | ||||
| checkTokenUri: string; | checkTokenUri: string; | ||||
| @@ -92,9 +93,19 @@ export type PipelineNodeModelParameter = { | |||||
| // 修改属性类型 | // 修改属性类型 | ||||
| export type ChangePropertyType<T, K extends keyof T, NewType> = Omit<T, K> & { [P in K]: NewType }; | export type ChangePropertyType<T, K extends keyof T, NewType> = Omit<T, K> & { [P in K]: NewType }; | ||||
| // export type PascalCaseType<T> = { | |||||
| // [K in keyof T as `${Capitalize<string & K>}`]: T[K]; | |||||
| // } | |||||
| // 将属性名称首字母大写 | |||||
| export type PascalCaseType<T> = { | |||||
| [K in keyof T as `${Capitalize<string & K>}`]: T[K]; | |||||
| }; | |||||
| // 将属性名称下划线转换为驼峰 | |||||
| type ToCamelCase<S extends string> = S extends `${infer P}_${infer R}` | |||||
| ? `${P}${Capitalize<ToCamelCase<R>>}` | |||||
| : S; | |||||
| export type KeysToCamelCase<T> = { | |||||
| [K in keyof T as ToCamelCase<K & string>]: T[K]; | |||||
| }; | |||||
| // 序列化后的流水线节点 | // 序列化后的流水线节点 | ||||
| export type PipelineNodeModelSerialize = Omit< | export type PipelineNodeModelSerialize = Omit< | ||||