Skip to content

Commit

Permalink
Merge pull request #1621 from pnaik1/issue-1516
Browse files Browse the repository at this point in the history
Parameters from triggered runs not copied when run is duplicated
  • Loading branch information
openshift-merge-robot authored Aug 3, 2023
2 parents 8a468d0 + 3acf411 commit 88206c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ const PipelineSection: React.FC<PipelineSectionProps> = ({ onLoaded, value, onCh
const [pipelines, loaded] = usePipelines();
React.useEffect(() => {
onLoaded(loaded);
}, [onLoaded, loaded]);
// only run when `loaded` changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [loaded]);
if (!loaded) {
return <Skeleton />;
}
Expand Down
22 changes: 10 additions & 12 deletions frontend/src/concepts/pipelines/content/createRun/useRunFormData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,21 @@ const useUpdateData = <T extends PipelineCoreResourceKF>(

const useUpdatePipeline = (
setFunction: UpdateObjectAtPropAndValue<RunFormData>,
initialData?: PipelineCoreResourceKF,
initialData?: PipelineRunKF | PipelineRunJobKF,
) => {
const updatedSetFunction = React.useCallback(
const updatedSetFunction = React.useCallback<UpdateObjectAtPropAndValue<RunFormData>>(
(key, resource) => {
setFunction(key, resource);
if (resource && 'parameters' in resource) {
setFunction(
'params',
(resource.parameters || []).map((p) => ({ label: p.name, value: p.value ?? '' })),
);
} else {
setFunction('params', []);
}
setFunction(
'params',
initialData?.pipeline_spec.parameters?.map((p) => ({
label: p.name,
value: p.value ?? '',
})) ?? [],
);
},
[setFunction],
[setFunction, initialData?.pipeline_spec.parameters],
);

return useUpdateData(
updatedSetFunction,
initialData,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/concepts/pipelines/kfTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export type PipelineSpecKF = {
pipeline_name?: string;
workflow_manifest?: string;
pipeline_manifests?: string;
parameters: ParameterKF[];
parameters?: ParameterKF[];
runtime_config: PipelineSpecRuntimeConfig;
};

Expand Down

0 comments on commit 88206c9

Please sign in to comment.