Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 committed Dec 5, 2022
1 parent 4a906c8 commit cfaabff
Showing 1 changed file with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,6 @@ function RecipeForm(props: Props) {
data?.listSecrets?.secrets.sort((secretA, secretB) => secretA.name.localeCompare(secretB.name)) || [];
const [form] = Form.useForm();

// TODO - Combine this with updateFormValues.
function updateFormValue(fieldName, fieldValue) {
let updatedValues = YAML.parse(displayRecipe);
const recipeField = allFields.find((f) => f.name === fieldName);
if (recipeField) {
updatedValues = recipeField.setValueOnRecipeOverride
? recipeField.setValueOnRecipeOverride(updatedValues, fieldValue)
: setFieldValueOnRecipe(updatedValues, fieldValue, recipeField.fieldPath);
}
const stagedRecipe = jsonToYaml(JSON.stringify(updatedValues));
setStagedRecipe(stagedRecipe);
form.setFieldsValue({ [fieldName]: fieldValue });
}

function updateFormValues(changedValues: any, allValues: any) {
let updatedValues = YAML.parse(displayRecipe);

Expand All @@ -148,6 +134,11 @@ function RecipeForm(props: Props) {
setStagedRecipe(stagedRecipe);
}

function updateFormValue(fieldName, fieldValue) {
updateFormValues({ [fieldName]: fieldValue }, { [fieldName]: fieldValue });
form.setFieldsValue({ [fieldName]: fieldValue });
}

return (
<Form
layout="vertical"
Expand Down

0 comments on commit cfaabff

Please sign in to comment.