Skip to content
Snippets Groups Projects

Migrate GlDropdown to GlListbox in severity filter

Merged David Pisek requested to merge 409701-migrate-severity_filter-to-listbox into master
All threads resolved!
Compare and Show latest version
2 files
+ 14355
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -33,14 +33,16 @@ export default {
@@ -33,14 +33,16 @@ export default {
toggleText() {
toggleText() {
return getSelectedOptionsText(this.dropdownItems[0].options, this.selectedIds);
return getSelectedOptionsText(this.dropdownItems[0].options, this.selectedIds);
},
},
dropdownItems() {
listboxItems() {
// this will create a group with the label "Severity" and the options "All severities", "Critical", "High", etc.
const optionsGroup = {
return [{ text: this.$options.i18n.label, options: FILTER_ITEMS }];
text: this.$options.i18n.label,
 
options: FILTER_ITEMS,
 
};
 
return [optionsGroup];
},
},
},
},
watch: {
watch: {
selectedIds: {
selectedIds: {
immediate: true,
handler(selection = [], prevSelection = []) {
handler(selection = [], prevSelection = []) {
const lastSelectedId = selection.at(-1);
const lastSelectedId = selection.at(-1);
const prevLastSelectedId = prevSelection.at(-1);
const prevLastSelectedId = prevSelection.at(-1);
@@ -77,7 +79,7 @@ export default {
@@ -77,7 +79,7 @@ export default {
<label class="gl-mb-2">{{ $options.i18n.label }}</label>
<label class="gl-mb-2">{{ $options.i18n.label }}</label>
<gl-collapsible-listbox
<gl-collapsible-listbox
v-model="selectedIds"
v-model="selectedIds"
:items="dropdownItems"
:items="listboxItems"
:toggle-text="toggleText"
:toggle-text="toggleText"
multiple
multiple
block
block
Loading