fix: prompt when parameter options are incompatible#9247
Conversation
| missingParameters.push(parameter) | ||
| } | ||
|
|
||
| // Check if parameter "options" changed and we can't use old build parameters. |
There was a problem hiding this comment.
@BrunoQuaresma I may need your frontend wisdom. I battling the following edge case here:
- We have a
foobarstring parameter with options:aaa,bbb(default),ccc, and the workspace built on it. The workspace usesbbboption. - Change the parameter option
bbbto something else, let's sayddd. - Click "Update".
I can see the UpdateParametersDialog, but when I click the Update button, it gets back to it. If I pick something else, and then click back to the default, it works fine.
I looked deeper, and it seems that Formik doesn't set the internal form.values, even though initialValues are passed. I'm not sure how I can proceed here.
There was a problem hiding this comment.
Apparently, I got it fixes with enableReinitialize. Thanks for the suggestion!
| msg = sdkError.Message | ||
| if sdkError.Helper != "" { | ||
| msg = msg + "\n" + sdkError.Helper | ||
| } else if sdkError.Detail != "" { |
There was a problem hiding this comment.
for reviewers:
Message: "Unable to validate parameter X"
Detail: "parameter value must match one of options"
^ this should be consistent with site UI error
| type JobErrorCode string | ||
|
|
||
| const ( | ||
| MissingTemplateParameter JobErrorCode = "MISSING_TEMPLATE_PARAMETER" |
There was a problem hiding this comment.
for reviewers: used by old legacy parameters (do not exist anymore)
| missingParameters.push(parameter) | ||
| } | ||
|
|
||
| // Check if parameter "options" changed and we can't use old build parameters. |
There was a problem hiding this comment.
Apparently, I got it fixes with enableReinitialize. Thanks for the suggestion!
| <-doneChan | ||
| }) | ||
|
|
||
| t.Run("ParameterOptionChanged", func(t *testing.T) { |
There was a problem hiding this comment.
Can you add a test case where the chosen template parameter disappears completely?
e.g. before: { 1st, 2nd, 3rd }, after: { 1st, 3rd, 4th }
Related: #9163
This PR modifies CLI and site to prompt user for correct parameter options if they are incompatible now (new template version submitted).