diff --git a/react-ui/src/components/ParameterSelect/index.tsx b/react-ui/src/components/ParameterSelect/index.tsx index 36b75d30..c9a78069 100644 --- a/react-ui/src/components/ParameterSelect/index.tsx +++ b/react-ui/src/components/ParameterSelect/index.tsx @@ -16,13 +16,17 @@ export type ParameterSelectObject = { [key: string]: any; }; +export type ParameterSelectDataType = 'dataset' | 'model' | 'service' | 'resource'; + export interface ParameterSelectProps extends SelectProps { /** 类型 */ - dataType: 'dataset' | 'model' | 'service' | 'resource'; + dataType: ParameterSelectDataType; /** 是否只是展示信息 */ display?: boolean; /** 值,支持对象,对象必须包含 value */ value?: string | ParameterSelectObject; + /** 用于流水线, 流水线资源规格要求 id 为字符串 */ + isPipeline?: boolean; /** 修改后回调 */ onChange?: (value: string | ParameterSelectObject) => void; } @@ -32,6 +36,7 @@ function ParameterSelect({ dataType, display = false, value, + isPipeline = false, onChange, ...rest }: ParameterSelectProps) { @@ -39,6 +44,12 @@ function ParameterSelect({ const propsConfig = paramSelectConfig[dataType]; const valueText = typeof value === 'object' && value !== null ? value.value : value; const [resourceStandardList] = useComputingResource(); + const computingResource = isPipeline + ? resourceStandardList.map((v) => ({ + ...v, + id: String(v.id), + })) + : resourceStandardList; useEffect(() => { // 获取下拉数据 @@ -56,7 +67,7 @@ function ParameterSelect({ getSelectOptions(); }, [propsConfig]); - const selectOptions = dataType === 'resource' ? resourceStandardList : options; + const selectOptions = dataType === 'resource' ? computingResource : options; const handleChange = (text: string) => { if (typeof value === 'object' && value !== null) { diff --git a/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx b/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx index 8defc169..44b35d2b 100644 --- a/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx +++ b/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx @@ -1,7 +1,7 @@ import CodeSelectorModal from '@/components/CodeSelectorModal'; import KFIcon from '@/components/KFIcon'; import ParameterInput, { requiredValidator } from '@/components/ParameterInput'; -import ParameterSelect from '@/components/ParameterSelect'; +import ParameterSelect, { type ParameterSelectDataType } from '@/components/ParameterSelect'; import ResourceSelectorModal, { ResourceSelectorType, selectorTypeConfig, @@ -520,7 +520,8 @@ const PipelineNodeParameter = forwardRef(({ onFormChange }: PipelineNodeParamete {item.value.type === 'select' ? ( ['dataset', 'model', 'service', 'resource'].includes(item.value.item_type) ? ( ) : null