Skip to content

Commit

Permalink
Fixes #36627 - Discard irrelevant inputs on template change
Browse files Browse the repository at this point in the history
Previously we kept the pre-filled values from the previous template and
then sent them to the backend together with the inputs for the new
template. This prevented the job from being started as the backend
didn't know what to do with the extra inputs.
  • Loading branch information
adamruzicka committed Aug 1, 2023
1 parent 0f26c58 commit ff20421
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions webpack/JobWizard/JobWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,23 @@ export const JobWizard = ({ rerunData }) => {
job_template: { name, description_format },
},
}) => {
const allowedInputs = template_inputs
.map(({ inputName }) => inputName)
.concat(
advanced_template_inputs.map(({ inputName }) => inputName)
);
const prune = inputs =>
allowedInputs.reduce(
(acc, key) =>
inputs.hasOwnProperty(key)
? { [key]: inputs[key], ...acc }
: acc,
{}
);
setTemplateValues(prune);
setAdvancedValues(currentAdvancedValues => ({
...currentAdvancedValues,
templateValues: prune(currentAdvancedValues.templateValues),
description:
generateDefaultDescription({
description_format,
Expand Down

0 comments on commit ff20421

Please sign in to comment.