Skip to content

Remove duplicated config code for filtered search dropdowns

There are currently duplicated code that do the same thing for filtered search dropdowns. We should consolidate it so that there is one SSOT.

#js-dropdown-author.filtered-search-input-dropdown-menu.dropdown-menu
{ data: { icon: 'pencil', hint: 'author', tag: '@author' } }
...
#js-dropdown-assignee.filtered-search-input-dropdown-menu.dropdown-menu
{ data: { icon: 'user', hint: 'assignee', tag: '@assignee' } }
...
#js-dropdown-milestone.filtered-search-input-dropdown-menu.dropdown-menu
{ data: { icon: 'clock-o', hint: 'milestone', tag: '%milestone' } }
...
#js-dropdown-label.filtered-search-input-dropdown-menu.dropdown-menu
{ data: { icon: 'tag', hint: 'label', tag: '~label', type: 'array' } }

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/views/shared/issuable/_search_bar.html.haml

const tokenKeys = [{
  key: 'author',
  type: 'string',
  param: 'username',
  symbol: '@',
}, {
  key: 'assignee',
  type: 'string',
  param: 'username',
  symbol: '@',
}, {
  key: 'milestone',
  type: 'string',
  param: 'title',
  symbol: '%',
}, {
  key: 'label',
  type: 'array',
  param: 'name[]',
  symbol: '~',
}];

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/assets/javascripts/filtered_search/filtered_search_token_keys.js