diff options
Diffstat (limited to 'app/assets/javascripts/issues/list/components/issues_list_app.vue')
-rw-r--r-- | app/assets/javascripts/issues/list/components/issues_list_app.vue | 41 |
1 files changed, 22 insertions, 19 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 6c46013e4f9..5c4bf8f19e4 100644 --- a/app/assets/javascripts/issues/list/components/issues_list_app.vue +++ b/app/assets/javascripts/issues/list/components/issues_list_app.vue @@ -2,17 +2,23 @@ import { GlButton, GlFilteredSearchToken, GlTooltipDirective } from '@gitlab/ui'; import * as Sentry from '@sentry/browser'; import fuzzaldrinPlus from 'fuzzaldrin-plus'; +import { isEmpty } from 'lodash'; import IssueCardStatistics from 'ee_else_ce/issues/list/components/issue_card_statistics.vue'; import IssueCardTimeInfo from 'ee_else_ce/issues/list/components/issue_card_time_info.vue'; import getIssuesQuery from 'ee_else_ce/issues/list/queries/get_issues.query.graphql'; import getIssuesCountsQuery from 'ee_else_ce/issues/list/queries/get_issues_counts.query.graphql'; -import { createAlert, VARIANT_INFO } from '~/flash'; +import { createAlert, VARIANT_INFO } from '~/alert'; import { TYPENAME_USER } from '~/graphql_shared/constants'; import { convertToGraphQLId, getIdFromGraphQLId } from '~/graphql_shared/utils'; -import { ITEM_TYPE } from '~/groups/constants'; import CsvImportExportButtons from '~/issuable/components/csv_import_export_buttons.vue'; import IssuableByEmail from '~/issuable/components/issuable_by_email.vue'; -import { STATUS_CLOSED } from '~/issues/constants'; +import { + STATUS_ALL, + STATUS_CLOSED, + STATUS_OPEN, + WORKSPACE_GROUP, + WORKSPACE_PROJECT, +} from '~/issues/constants'; import axios from '~/lib/utils/axios_utils'; import { fetchPolicies } from '~/lib/graphql'; import { isPositiveInteger } from '~/lib/utils/number_utils'; @@ -46,7 +52,7 @@ import { TOKEN_TYPE_TYPE, } from '~/vue_shared/components/filtered_search_bar/constants'; import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_root.vue'; -import { IssuableListTabs, IssuableStates } from '~/vue_shared/issuable/list/constants'; +import { DEFAULT_PAGE_SIZE, IssuableListTabs } from '~/vue_shared/issuable/list/constants'; import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import NewResourceDropdown from '~/vue_shared/components/new_resource_dropdown/new_resource_dropdown.vue'; import { @@ -56,7 +62,6 @@ import { i18n, ISSUE_REFERENCE, MAX_LIST_SIZE, - PAGE_SIZE, PARAM_FIRST_PAGE_SIZE, PARAM_LAST_PAGE_SIZE, PARAM_PAGE_AFTER, @@ -177,8 +182,8 @@ export default { pageParams: {}, showBulkEditSidebar: false, sortKey: CREATED_DESC, - state: IssuableStates.Opened, - pageSize: PAGE_SIZE, + state: STATUS_OPEN, + pageSize: DEFAULT_PAGE_SIZE, }; }, apollo: { @@ -206,9 +211,8 @@ export default { Sentry.captureException(error); }, skip() { - return !this.hasAnyIssues; + return !this.hasAnyIssues || isEmpty(this.pageParams); }, - debounce: 200, }, issuesCounts: { query: getIssuesCountsQuery, @@ -223,9 +227,8 @@ export default { Sentry.captureException(error); }, skip() { - return !this.hasAnyIssues; + return !this.hasAnyIssues || isEmpty(this.pageParams); }, - debounce: 200, context: { isSingleRequest: true, }, @@ -249,7 +252,7 @@ export default { }; }, namespace() { - return this.isProject ? ITEM_TYPE.PROJECT : ITEM_TYPE.GROUP; + return this.isProject ? WORKSPACE_PROJECT : WORKSPACE_GROUP; }, defaultWorkItemTypes() { return [...defaultWorkItemTypes, ...this.eeWorkItemTypes]; @@ -275,7 +278,7 @@ export default { return this.sortKey === RELATIVE_POSITION_ASC; }, isOpenTab() { - return this.state === IssuableStates.Opened; + return this.state === STATUS_OPEN; }, showCsvButtons() { return this.isProject && this.isSignedIn; @@ -449,7 +452,7 @@ export default { return this.issues.length > 0 && (this.pageInfo.hasNextPage || this.pageInfo.hasPreviousPage); }, showPageSizeControls() { - return this.currentTabCount > PAGE_SIZE; + return this.currentTabCount > DEFAULT_PAGE_SIZE; }, sortOptions() { return getSortOptions({ @@ -461,9 +464,9 @@ export default { tabCounts() { const { openedIssues, closedIssues, allIssues } = this.issuesCounts; return { - [IssuableStates.Opened]: openedIssues?.count, - [IssuableStates.Closed]: closedIssues?.count, - [IssuableStates.All]: allIssues?.count, + [STATUS_OPEN]: openedIssues?.count, + [STATUS_CLOSED]: closedIssues?.count, + [STATUS_ALL]: allIssues?.count, }; }, currentTabCount() { @@ -726,7 +729,7 @@ export default { const lastPageSize = getParameterByName(PARAM_LAST_PAGE_SIZE); const state = getParameterByName(PARAM_STATE); - const defaultSortKey = state === IssuableStates.Closed ? UPDATED_DESC : CREATED_DESC; + const defaultSortKey = state === STATUS_CLOSED ? UPDATED_DESC : CREATED_DESC; const dashboardSortKey = getSortKey(sortValue); const graphQLSortKey = isSortKey(sortValue?.toUpperCase()) && sortValue.toUpperCase(); @@ -750,7 +753,7 @@ export default { getParameterByName(PARAM_PAGE_BEFORE), ); this.sortKey = sortKey; - this.state = state || IssuableStates.Opened; + this.state = state || STATUS_OPEN; }, }, }; |