From 516378f3900f1b71787b652d27a2f4a9d9440da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=99=88=20=20jacopo=20beschi=20=F0=9F=99=89?= Date: Mon, 3 Dec 2018 16:48:02 +0000 Subject: Resolve "Filter by `None`/`Any` for labels in issues/mrs/boards" --- .../filtered_search/issuable_filtered_search_token_keys.js | 7 ++++++- app/views/shared/issuable/_search_bar.html.haml | 5 ++++- ...0-filter-by-none-any-for-labels-in-issues-mrs-boards.yml | 5 +++++ locale/gitlab.pot | 3 --- spec/features/boards/modal_filter_spec.rb | 2 +- spec/features/issues/filtered_search/dropdown_label_spec.rb | 13 +++++++++++-- 6 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/52370-filter-by-none-any-for-labels-in-issues-mrs-boards.yml diff --git a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js index bb0ecb8efe7..b494b7e2de0 100644 --- a/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js +++ b/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js @@ -88,10 +88,15 @@ export const conditions = [ value: 'started', }, { - url: 'label_name[]=No+Label', + url: 'label_name[]=None', tokenKey: 'label', value: 'none', }, + { + url: 'label_name[]=Any', + tokenKey: 'any', + value: 'any', + }, { url: 'my_reaction_emoji=None', tokenKey: 'my-reaction', diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index 6939aba6896..7c5af0b9775 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -95,7 +95,10 @@ %ul{ data: { dropdown: true } } %li.filter-dropdown-item{ data: { value: 'none' } } %button.btn.btn-link{ type: 'button' } - = _('No Label') + = _('None') + %li.filter-dropdown-item{ data: { value: 'any' } } + %button.btn.btn-link{ type: 'button' } + = _('Any') %li.divider.droplab-item-ignore %ul.filter-dropdown{ data: { dynamic: true, dropdown: true } } %li.filter-dropdown-item diff --git a/changelogs/unreleased/52370-filter-by-none-any-for-labels-in-issues-mrs-boards.yml b/changelogs/unreleased/52370-filter-by-none-any-for-labels-in-issues-mrs-boards.yml new file mode 100644 index 00000000000..9e1ee3ede5e --- /dev/null +++ b/changelogs/unreleased/52370-filter-by-none-any-for-labels-in-issues-mrs-boards.yml @@ -0,0 +1,5 @@ +--- +title: Adds Any option to label filters +merge_request: 23111 +author: Jacopo Beschi @jacopo-beschi +type: added diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 3769dfab143..60274d883fa 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4297,9 +4297,6 @@ msgstr "" msgid "No" msgstr "" -msgid "No Label" -msgstr "" - msgid "No assignee" msgstr "" diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb index 2cdd3f55b50..d96707e55fd 100644 --- a/spec/features/boards/modal_filter_spec.rb +++ b/spec/features/boards/modal_filter_spec.rb @@ -176,7 +176,7 @@ describe 'Issue Boards add issue modal filtering', :js do it 'filters by no label' do set_filter('label') - click_filter_link('No Label') + click_filter_link('None') submit_filter page.within('.add-issues-modal') do diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index ca5d506ab04..b25b1514d62 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -45,7 +45,8 @@ describe 'Dropdown label', :js do bug_label = create(:label, project: project, title: 'bug-label') init_label_search - filtered_search.native.send_keys(:down, :down, :enter) + # navigate to the bug_label option and selects it + filtered_search.native.send_keys(:down, :down, :down, :enter) expect_tokens([label_token(bug_label.title)]) expect_filtered_search_input_empty @@ -234,12 +235,20 @@ describe 'Dropdown label', :js do end it 'selects `no label`' do - find("#{js_dropdown_label} .filter-dropdown-item", text: 'No Label').click + find("#{js_dropdown_label} .filter-dropdown-item", text: 'None').click expect(page).not_to have_css(js_dropdown_label) expect_tokens([label_token('none', false)]) expect_filtered_search_input_empty end + + it 'selects `any label`' do + find("#{js_dropdown_label} .filter-dropdown-item", text: 'Any').click + + expect(page).not_to have_css(js_dropdown_label) + expect_tokens([label_token('any', false)]) + expect_filtered_search_input_empty + end end describe 'input has existing content' do -- cgit v1.2.1