Variables: Improve display when selecting variables with the same value #40607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
there are some scenarios where having variables with different labels but the same underlying value could make sense. e.g. if the variables are key=location, value=hostname. you may have a server that is responsible for asia + australia for example. in which case you might have 2 different variables,
asia=<hostname>andaustralia=<hostname>wherehostnameare the same value.i don't think we can ever fully support this use case without a significant amount of refactoring. for example, the current variable value is stored in the query parameter, but if there are 2 variables with the same value we have no way of knowing which variable was actually selected.
the confusion happens when you select one of these options from the variable picker. because they share the same value, when you select one of these variables it displays the first option matching the value as selected. this may or may not be the actual option you selected. by introducing a check on the label as well, we at least ensure that the option you selected is then displayed in the variable picker.
Which issue(s) this PR fixes:
Fixes #40414
Special notes for your reviewer: