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