Commit 0465cd31 authored by Thomas Randolph's avatar Thomas Randolph

Update all uses of gl_dropdown to use objects

Update explicit headers to new format
parent 4b01f494
...@@ -14,7 +14,7 @@ export default class TransferDropdown { ...@@ -14,7 +14,7 @@ export default class TransferDropdown {
} }
buildDropdown() { buildDropdown() {
const extraOptions = [{ id: '-1', text: __('No parent group') }, 'divider']; const extraOptions = [{ id: '-1', text: __('No parent group') }, { type: 'divider' }];
this.groupDropdown.glDropdown({ this.groupDropdown.glDropdown({
selectable: true, selectable: true,
......
...@@ -231,7 +231,7 @@ export default class LabelsSelect { ...@@ -231,7 +231,7 @@ export default class LabelsSelect {
}); });
} }
if (extraData.length) { if (extraData.length) {
extraData.push('divider'); extraData.push({ type: 'divider' });
data = extraData.concat(data); data = extraData.concat(data);
} }
} }
......
...@@ -100,7 +100,7 @@ export default class MilestoneSelect { ...@@ -100,7 +100,7 @@ export default class MilestoneSelect {
}); });
} }
if (extraOptions.length) { if (extraOptions.length) {
extraOptions.push('divider'); extraOptions.push({ type: 'divider' });
} }
callback(extraOptions.concat(data)); callback(extraOptions.concat(data));
......
...@@ -34,7 +34,7 @@ export default class NamespaceSelect { ...@@ -34,7 +34,7 @@ export default class NamespaceSelect {
id: null, id: null,
}; };
namespaces.unshift(anyNamespace); namespaces.unshift(anyNamespace);
namespaces.splice(1, 0, 'divider'); namespaces.splice(1, 0, { type: 'divider' });
} }
return dataCallback(namespaces); return dataCallback(namespaces);
}); });
......
...@@ -30,7 +30,7 @@ export default class Search { ...@@ -30,7 +30,7 @@ export default class Search {
data.unshift({ data.unshift({
full_name: __('Any'), full_name: __('Any'),
}); });
data.splice(1, 0, 'divider'); data.splice(1, 0, { type: 'divider' });
return callback(data); return callback(data);
}); });
}, },
...@@ -57,7 +57,7 @@ export default class Search { ...@@ -57,7 +57,7 @@ export default class Search {
data.unshift({ data.unshift({
name_with_namespace: __('Any'), name_with_namespace: __('Any'),
}); });
data.splice(1, 0, 'divider'); data.splice(1, 0, { type: 'divider' });
return data; return data;
}) })
......
...@@ -191,13 +191,14 @@ export class SearchAutocomplete { ...@@ -191,13 +191,14 @@ export class SearchAutocomplete {
// Add group header before list each group // Add group header before list each group
if (lastCategory !== suggestion.category) { if (lastCategory !== suggestion.category) {
if (!firstCategory) { if (!firstCategory) {
data.push('separator'); data.push({ type: 'separator' });
} }
if (firstCategory) { if (firstCategory) {
firstCategory = false; firstCategory = false;
} }
data.push({ data.push({
header: suggestion.category, type: 'header',
content: suggestion.category,
}); });
lastCategory = suggestion.category; lastCategory = suggestion.category;
} }
...@@ -221,7 +222,7 @@ export class SearchAutocomplete { ...@@ -221,7 +222,7 @@ export class SearchAutocomplete {
template = s__('SearchAutocomplete|in this group'); template = s__('SearchAutocomplete|in this group');
} }
data.unshift('separator'); data.unshift({ type: 'separator' });
data.unshift({ data.unshift({
icon, icon,
text: term, text: term,
...@@ -271,7 +272,8 @@ export class SearchAutocomplete { ...@@ -271,7 +272,8 @@ export class SearchAutocomplete {
if (name) { if (name) {
baseItems.push({ baseItems.push({
header: `${name}`, type: 'header',
content: `${name}`,
}); });
} }
......
...@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) {
} }
if (showDivider) { if (showDivider) {
users.splice(showDivider, 0, 'divider'); users.splice(showDivider, 0, { type: 'divider' });
} }
if ($dropdown.hasClass('js-multiselect')) { if ($dropdown.hasClass('js-multiselect')) {
...@@ -343,7 +343,8 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -343,7 +343,8 @@ function UsersSelect(currentUser, els, options = {}) {
if ($dropdown.data('dropdownHeader')) { if ($dropdown.data('dropdownHeader')) {
showDivider += 1; showDivider += 1;
users.splice(showDivider, 0, { users.splice(showDivider, 0, {
header: $dropdown.data('dropdownHeader'), type: 'header',
content: $dropdown.data('dropdownHeader'),
}); });
} }
...@@ -358,7 +359,7 @@ function UsersSelect(currentUser, els, options = {}) { ...@@ -358,7 +359,7 @@ function UsersSelect(currentUser, els, options = {}) {
users.splice(showDivider, 0, selectedUser); users.splice(showDivider, 0, selectedUser);
}); });
users.splice(showDivider + 1, 0, 'divider'); users.splice(showDivider + 1, 0, { type: 'divider' });
} }
} }
} }
......
...@@ -33,7 +33,9 @@ export default class CiTemplate { ...@@ -33,7 +33,9 @@ export default class CiTemplate {
name: __('No required pipeline'), name: __('No required pipeline'),
id: null, id: null,
}, },
'divider', {
type: 'divider',
},
], ],
...this.$dropdown.data('data'), ...this.$dropdown.data('data'),
}; };
......
...@@ -369,12 +369,15 @@ export default class AccessDropdown { ...@@ -369,12 +369,15 @@ export default class AccessDropdown {
}); });
if (roles.length) { if (roles.length) {
consolidatedData = consolidatedData.concat([{ type: 'header', content: s__('AccessDropdown|Roles') }], roles); consolidatedData = consolidatedData.concat(
[{ type: 'header', content: s__('AccessDropdown|Roles') }],
roles,
);
} }
if (groups.length) { if (groups.length) {
if (roles.length) { if (roles.length) {
consolidatedData = consolidatedData.concat(['divider']); consolidatedData = consolidatedData.concat([{ type: 'divider' }]);
} }
consolidatedData = consolidatedData.concat( consolidatedData = consolidatedData.concat(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment