Commit 7d2d9b68 authored by Coung Ngo's avatar Coung Ngo Committed by Ezekiel Kigbo

Filter by issue reference in group/project issues list refactor

Add ability to filter by issue reference to mimic the same
functionality on the Haml page.

Behind `vue_issues_list` feature flag defaulted to off.
parent 32293539
...@@ -39,6 +39,7 @@ import { IssuableListTabs, IssuableStates } from '~/vue_shared/issuable/list/con ...@@ -39,6 +39,7 @@ import { IssuableListTabs, IssuableStates } from '~/vue_shared/issuable/list/con
import { import {
CREATED_DESC, CREATED_DESC,
i18n, i18n,
ISSUE_REFERENCE,
MAX_LIST_SIZE, MAX_LIST_SIZE,
PAGE_SIZE, PAGE_SIZE,
PARAM_STATE, PARAM_STATE,
...@@ -219,11 +220,13 @@ export default { ...@@ -219,11 +220,13 @@ export default {
}, },
computed: { computed: {
queryVariables() { queryVariables() {
const isIidSearch = ISSUE_REFERENCE.test(this.searchQuery);
return { return {
fullPath: this.fullPath, fullPath: this.fullPath,
iid: isIidSearch ? this.searchQuery.slice(1) : undefined,
isProject: this.isProject, isProject: this.isProject,
isSignedIn: this.isSignedIn, isSignedIn: this.isSignedIn,
search: this.searchQuery, search: isIidSearch ? undefined : this.searchQuery,
sort: this.sortKey, sort: this.sortKey,
state: this.state, state: this.state,
...this.pageParams, ...this.pageParams,
......
...@@ -52,6 +52,7 @@ export const i18n = { ...@@ -52,6 +52,7 @@ export const i18n = {
upvotes: __('Upvotes'), upvotes: __('Upvotes'),
}; };
export const ISSUE_REFERENCE = /^#\d+$/;
export const MAX_LIST_SIZE = 10; export const MAX_LIST_SIZE = 10;
export const PAGE_SIZE = 20; export const PAGE_SIZE = 20;
export const PAGE_SIZE_MANUAL = 100; export const PAGE_SIZE_MANUAL = 100;
......
...@@ -5,6 +5,7 @@ query getIssues( ...@@ -5,6 +5,7 @@ query getIssues(
$isProject: Boolean = false $isProject: Boolean = false
$isSignedIn: Boolean = false $isSignedIn: Boolean = false
$fullPath: ID! $fullPath: ID!
$iid: String
$search: String $search: String
$sort: IssueSort $sort: IssueSort
$state: IssuableState $state: IssuableState
...@@ -29,6 +30,7 @@ query getIssues( ...@@ -29,6 +30,7 @@ query getIssues(
id id
issues( issues(
includeSubgroups: true includeSubgroups: true
iid: $iid
search: $search search: $search
sort: $sort sort: $sort
state: $state state: $state
...@@ -59,6 +61,7 @@ query getIssues( ...@@ -59,6 +61,7 @@ query getIssues(
project(fullPath: $fullPath) @include(if: $isProject) { project(fullPath: $fullPath) @include(if: $isProject) {
id id
issues( issues(
iid: $iid
search: $search search: $search
sort: $sort sort: $sort
state: $state state: $state
......
query getIssuesCount( query getIssuesCount(
$isProject: Boolean = false $isProject: Boolean = false
$fullPath: ID! $fullPath: ID!
$iid: String
$search: String $search: String
$assigneeId: String $assigneeId: String
$assigneeUsernames: [String!] $assigneeUsernames: [String!]
...@@ -20,6 +21,7 @@ query getIssuesCount( ...@@ -20,6 +21,7 @@ query getIssuesCount(
openedIssues: issues( openedIssues: issues(
includeSubgroups: true includeSubgroups: true
state: opened state: opened
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -37,6 +39,7 @@ query getIssuesCount( ...@@ -37,6 +39,7 @@ query getIssuesCount(
closedIssues: issues( closedIssues: issues(
includeSubgroups: true includeSubgroups: true
state: closed state: closed
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -54,6 +57,7 @@ query getIssuesCount( ...@@ -54,6 +57,7 @@ query getIssuesCount(
allIssues: issues( allIssues: issues(
includeSubgroups: true includeSubgroups: true
state: all state: all
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -73,6 +77,7 @@ query getIssuesCount( ...@@ -73,6 +77,7 @@ query getIssuesCount(
id id
openedIssues: issues( openedIssues: issues(
state: opened state: opened
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -91,6 +96,7 @@ query getIssuesCount( ...@@ -91,6 +96,7 @@ query getIssuesCount(
} }
closedIssues: issues( closedIssues: issues(
state: closed state: closed
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -109,6 +115,7 @@ query getIssuesCount( ...@@ -109,6 +115,7 @@ query getIssuesCount(
} }
allIssues: issues( allIssues: issues(
state: all state: all
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
......
...@@ -5,6 +5,7 @@ query getIssuesEE( ...@@ -5,6 +5,7 @@ query getIssuesEE(
$isProject: Boolean = false $isProject: Boolean = false
$isSignedIn: Boolean = false $isSignedIn: Boolean = false
$fullPath: ID! $fullPath: ID!
$iid: String
$search: String $search: String
$sort: IssueSort $sort: IssueSort
$state: IssuableState $state: IssuableState
...@@ -34,6 +35,7 @@ query getIssuesEE( ...@@ -34,6 +35,7 @@ query getIssuesEE(
issues( issues(
includeSubepics: true includeSubepics: true
includeSubgroups: true includeSubgroups: true
iid: $iid
search: $search search: $search
sort: $sort sort: $sort
state: $state state: $state
...@@ -72,6 +74,7 @@ query getIssuesEE( ...@@ -72,6 +74,7 @@ query getIssuesEE(
id id
issues( issues(
includeSubepics: true includeSubepics: true
iid: $iid
search: $search search: $search
sort: $sort sort: $sort
state: $state state: $state
......
query getIssuesCountEE( query getIssuesCountEE(
$isProject: Boolean = false $isProject: Boolean = false
$fullPath: ID! $fullPath: ID!
$iid: String
$search: String $search: String
$assigneeId: String $assigneeId: String
$assigneeUsernames: [String!] $assigneeUsernames: [String!]
...@@ -25,6 +26,7 @@ query getIssuesCountEE( ...@@ -25,6 +26,7 @@ query getIssuesCountEE(
includeSubepics: true includeSubepics: true
includeSubgroups: true includeSubgroups: true
state: opened state: opened
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -47,6 +49,7 @@ query getIssuesCountEE( ...@@ -47,6 +49,7 @@ query getIssuesCountEE(
includeSubepics: true includeSubepics: true
includeSubgroups: true includeSubgroups: true
state: closed state: closed
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -69,6 +72,7 @@ query getIssuesCountEE( ...@@ -69,6 +72,7 @@ query getIssuesCountEE(
includeSubepics: true includeSubepics: true
includeSubgroups: true includeSubgroups: true
state: all state: all
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -93,6 +97,7 @@ query getIssuesCountEE( ...@@ -93,6 +97,7 @@ query getIssuesCountEE(
openedIssues: issues( openedIssues: issues(
includeSubepics: true includeSubepics: true
state: opened state: opened
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -116,6 +121,7 @@ query getIssuesCountEE( ...@@ -116,6 +121,7 @@ query getIssuesCountEE(
closedIssues: issues( closedIssues: issues(
includeSubepics: true includeSubepics: true
state: closed state: closed
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
...@@ -139,6 +145,7 @@ query getIssuesCountEE( ...@@ -139,6 +145,7 @@ query getIssuesCountEE(
allIssues: issues( allIssues: issues(
includeSubepics: true includeSubepics: true
state: all state: all
iid: $iid
search: $search search: $search
assigneeId: $assigneeId assigneeId: $assigneeId
assigneeUsernames: $assigneeUsernames assigneeUsernames: $assigneeUsernames
......
...@@ -516,6 +516,14 @@ RSpec.describe 'Filter issues', :js do ...@@ -516,6 +516,14 @@ RSpec.describe 'Filter issues', :js do
expect_no_issues_list expect_no_issues_list
expect_filtered_search_input(search) expect_filtered_search_input(search)
end end
it 'filters issues by issue reference' do
search = '#1'
input_filtered_search(search)
expect_issues_list_count(1)
expect_filtered_search_input(search)
end
end end
context 'searched text with other filters' do context 'searched text with other filters' do
......
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