Filter out duplicate values from the variable options dropdown
What does this MR do and why?
This MR adds filtering of duplicate options of the variable options dropdown. In the GlCollapsibleListbox, the value of the listbox item is used as a key, and having duplicated keys causes rendering issues (such as the search not working).
References
Screenshots or screen recordings
Added in an internal comment
How to set up and validate locally
- Create a .gitlab-ci.yml file that contains variables with duplicated options.
- Navigate to Build -> Pipelines -> New and verify the variable options dropdowns work as expected with search functionality working correctly. Verify that the duplicated options are filtered out.
Example of the .gitlab-ci.yml file
variables:
MODULE_NAME:
value: ""
description: "Module name to be built"
N_OPTION:
value: "option_a"
description: "Build flavor"
options:
- ""
- "option_a"
- "option_b"
- "option_a" # Duplicate to test deduplication
MODULE_TARGET1:
value: "-- MUST BE DEFINED --"
description: "Primary target to build"
options:
- "-- MUST BE DEFINED --"
- "target_1"
- "target_2"
- "target_3"
- "target_4"
- "target_1" # Duplicate
- "target_2" # Duplicate
- "target_5"
- "target_6"
- "target_5" # Duplicate
MODULE_TARGET2:
value: "-- TO BE DEFINED --"
description: "Secondary target to build"
options:
- "-- TO BE DEFINED --"
- "target_a"
- "target_b"
- "target_c"
- "target_c" # Duplicate
- "target_d"
- "target_b" # Duplicate
stages:
- build
.build_component_script: &build_component_script
- |
echo "Building target ${MODULE_TARGET}"
echo "Module: ${MODULE_NAME}"
echo "Option: ${N_OPTION}"
build1_component:
tags:
- test-runner
stage: build
rules:
- if: $MODULE_TARGET1 == "-- MUST BE DEFINED --"
when: never
- when: always
script:
- export MODULE_TARGET="${MODULE_TARGET1}"
- *build_component_script
build2_component:
tags:
- test-runner
stage: build
rules:
- if: $MODULE_TARGET2 == "-- TO BE DEFINED --"
when: never
- when: always
script:
- export MODULE_TARGET="${MODULE_TARGET2}"
- *build_component_scriptMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #558525 (closed)
Edited by Anna Vovchenko