diff options
Diffstat (limited to 'app/assets/javascripts/issues/list')
6 files changed, 39 insertions, 17 deletions
diff --git a/app/assets/javascripts/issues/list/components/issues_list_app.vue b/app/assets/javascripts/issues/list/components/issues_list_app.vue index 3866a7b3305..a532fa5b771 100644 --- a/app/assets/javascripts/issues/list/components/issues_list_app.vue +++ b/app/assets/javascripts/issues/list/components/issues_list_app.vue @@ -39,8 +39,11 @@ import { IssuableListTabs, IssuableStates } from '~/vue_shared/issuable/list/con import { CREATED_DESC, i18n, + ISSUE_REFERENCE, MAX_LIST_SIZE, PAGE_SIZE, + PARAM_PAGE_AFTER, + PARAM_PAGE_BEFORE, PARAM_STATE, RELATIVE_POSITION_ASC, TOKEN_TYPE_ASSIGNEE, @@ -134,6 +137,8 @@ export default { }, }, data() { + const pageAfter = getParameterByName(PARAM_PAGE_AFTER); + const pageBefore = getParameterByName(PARAM_PAGE_BEFORE); const state = getParameterByName(PARAM_STATE); const defaultSortKey = state === IssuableStates.Closed ? UPDATED_DESC : CREATED_DESC; const dashboardSortKey = getSortKey(this.initialSort); @@ -165,7 +170,7 @@ export default { issuesCounts: {}, issuesError: null, pageInfo: {}, - pageParams: getInitialPageParams(sortKey), + pageParams: getInitialPageParams(sortKey, pageAfter, pageBefore), showBulkEditSidebar: false, sortKey, state: state || IssuableStates.Opened, @@ -219,11 +224,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, @@ -234,7 +241,12 @@ export default { return this.isProject ? ITEM_TYPE.PROJECT : ITEM_TYPE.GROUP; }, hasSearch() { - return this.searchQuery || Object.keys(this.urlFilterParams).length; + return ( + this.searchQuery || + Object.keys(this.urlFilterParams).length || + this.pageParams.afterCursor || + this.pageParams.beforeCursor + ); }, isBulkEditButtonDisabled() { return this.showBulkEditSidebar || !this.issues.length; @@ -391,6 +403,8 @@ export default { }, urlParams() { return { + page_after: this.pageParams.afterCursor, + page_before: this.pageParams.beforeCursor, search: this.searchQuery, sort: urlSortParams[this.sortKey], state: this.state, diff --git a/app/assets/javascripts/issues/list/constants.js b/app/assets/javascripts/issues/list/constants.js index 284167a933f..4b07a078512 100644 --- a/app/assets/javascripts/issues/list/constants.js +++ b/app/assets/javascripts/issues/list/constants.js @@ -52,20 +52,15 @@ 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; +export const PARAM_PAGE_AFTER = 'page_after'; +export const PARAM_PAGE_BEFORE = 'page_before'; export const PARAM_STATE = 'state'; export const RELATIVE_POSITION = 'relative_position'; -export const defaultPageSizeParams = { - firstPageSize: PAGE_SIZE, -}; - -export const largePageSizeParams = { - firstPageSize: PAGE_SIZE_MANUAL, -}; - export const BLOCKING_ISSUES_ASC = 'BLOCKING_ISSUES_ASC'; export const BLOCKING_ISSUES_DESC = 'BLOCKING_ISSUES_DESC'; export const CREATED_ASC = 'CREATED_ASC'; diff --git a/app/assets/javascripts/issues/list/queries/get_issues.query.graphql b/app/assets/javascripts/issues/list/queries/get_issues.query.graphql index be8deb3fe97..529262d2162 100644 --- a/app/assets/javascripts/issues/list/queries/get_issues.query.graphql +++ b/app/assets/javascripts/issues/list/queries/get_issues.query.graphql @@ -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 diff --git a/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql b/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql index 1a345fd2877..58e7ce32e7c 100644 --- a/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql +++ b/app/assets/javascripts/issues/list/queries/get_issues_counts.query.graphql @@ -1,6 +1,7 @@ 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 diff --git a/app/assets/javascripts/issues/list/queries/search_users.query.graphql b/app/assets/javascripts/issues/list/queries/search_users.query.graphql index 92517ad35d0..46b48e4e41c 100644 --- a/app/assets/javascripts/issues/list/queries/search_users.query.graphql +++ b/app/assets/javascripts/issues/list/queries/search_users.query.graphql @@ -3,7 +3,7 @@ query searchUsers($fullPath: ID!, $search: String, $isProject: Boolean = false) { group(fullPath: $fullPath) @skip(if: $isProject) { id - groupMembers(search: $search) { + groupMembers(search: $search, relations: [DIRECT, INHERITED, SHARED_FROM_GROUPS]) { nodes { id user { @@ -14,7 +14,7 @@ query searchUsers($fullPath: ID!, $search: String, $isProject: Boolean = false) } project(fullPath: $fullPath) @include(if: $isProject) { id - projectMembers(search: $search) { + projectMembers(search: $search, relations: [DIRECT, INHERITED, INVITED_GROUPS]) { nodes { id user { diff --git a/app/assets/javascripts/issues/list/utils.js b/app/assets/javascripts/issues/list/utils.js index 6322968b3f0..4b77bd9bc5f 100644 --- a/app/assets/javascripts/issues/list/utils.js +++ b/app/assets/javascripts/issues/list/utils.js @@ -10,16 +10,16 @@ import { BLOCKING_ISSUES_DESC, CREATED_ASC, CREATED_DESC, - defaultPageSizeParams, DUE_DATE_ASC, DUE_DATE_DESC, filters, LABEL_PRIORITY_ASC, LABEL_PRIORITY_DESC, - largePageSizeParams, MILESTONE_DUE_ASC, MILESTONE_DUE_DESC, NORMAL_FILTER, + PAGE_SIZE, + PAGE_SIZE_MANUAL, POPULARITY_ASC, POPULARITY_DESC, PRIORITY_ASC, @@ -43,8 +43,11 @@ import { WEIGHT_DESC, } from './constants'; -export const getInitialPageParams = (sortKey) => - sortKey === RELATIVE_POSITION_ASC ? largePageSizeParams : defaultPageSizeParams; +export const getInitialPageParams = (sortKey, afterCursor, beforeCursor) => ({ + firstPageSize: sortKey === RELATIVE_POSITION_ASC ? PAGE_SIZE_MANUAL : PAGE_SIZE, + afterCursor, + beforeCursor, +}); export const getSortKey = (sort) => Object.keys(urlSortParams).find((key) => urlSortParams[key] === sort); |