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 {
}
buildDropdown() {
const extraOptions = [{ id: '-1', text: __('No parent group') }, 'divider'];
const extraOptions = [{ id: '-1', text: __('No parent group') }, { type: 'divider' }];
this.groupDropdown.glDropdown({
selectable: true,
......
......@@ -231,7 +231,7 @@ export default class LabelsSelect {
});
}
if (extraData.length) {
extraData.push('divider');
extraData.push({ type: 'divider' });
data = extraData.concat(data);
}
}
......
......@@ -100,7 +100,7 @@ export default class MilestoneSelect {
});
}
if (extraOptions.length) {
extraOptions.push('divider');
extraOptions.push({ type: 'divider' });
}
callback(extraOptions.concat(data));
......
......@@ -34,7 +34,7 @@ export default class NamespaceSelect {
id: null,
};
namespaces.unshift(anyNamespace);
namespaces.splice(1, 0, 'divider');
namespaces.splice(1, 0, { type: 'divider' });
}
return dataCallback(namespaces);
});
......
......@@ -30,7 +30,7 @@ export default class Search {
data.unshift({
full_name: __('Any'),
});
data.splice(1, 0, 'divider');
data.splice(1, 0, { type: 'divider' });
return callback(data);
});
},
......@@ -57,7 +57,7 @@ export default class Search {
data.unshift({
name_with_namespace: __('Any'),
});
data.splice(1, 0, 'divider');
data.splice(1, 0, { type: 'divider' });
return data;
})
......
......@@ -191,13 +191,14 @@ export class SearchAutocomplete {
// Add group header before list each group
if (lastCategory !== suggestion.category) {
if (!firstCategory) {
data.push('separator');
data.push({ type: 'separator' });
}
if (firstCategory) {
firstCategory = false;
}
data.push({
header: suggestion.category,
type: 'header',
content: suggestion.category,
});
lastCategory = suggestion.category;
}
......@@ -221,7 +222,7 @@ export class SearchAutocomplete {
template = s__('SearchAutocomplete|in this group');
}
data.unshift('separator');
data.unshift({ type: 'separator' });
data.unshift({
icon,
text: term,
......@@ -271,7 +272,8 @@ export class SearchAutocomplete {
if (name) {
baseItems.push({
header: `${name}`,
type: 'header',
content: `${name}`,
});
}
......
......@@ -333,7 +333,7 @@ function UsersSelect(currentUser, els, options = {}) {
}
if (showDivider) {
users.splice(showDivider, 0, 'divider');
users.splice(showDivider, 0, { type: 'divider' });
}
if ($dropdown.hasClass('js-multiselect')) {
......@@ -343,7 +343,8 @@ function UsersSelect(currentUser, els, options = {}) {
if ($dropdown.data('dropdownHeader')) {
showDivider += 1;
users.splice(showDivider, 0, {
header: $dropdown.data('dropdownHeader'),
type: 'header',
content: $dropdown.data('dropdownHeader'),
});
}
......@@ -358,7 +359,7 @@ function UsersSelect(currentUser, els, options = {}) {
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 {
name: __('No required pipeline'),
id: null,
},
'divider',
{
type: 'divider',
},
],
...this.$dropdown.data('data'),
};
......
......@@ -369,12 +369,15 @@ export default class AccessDropdown {
});
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 (roles.length) {
consolidatedData = consolidatedData.concat(['divider']);
consolidatedData = consolidatedData.concat([{ type: 'divider' }]);
}
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