Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
a50ba8dc15
commit
02bb524d05
|
|
@ -143,6 +143,8 @@ export default {
|
||||||
hideText: __('Hide values'),
|
hideText: __('Hide values'),
|
||||||
},
|
},
|
||||||
formElementClasses: 'md:gl-mr-3 gl-mb-3 gl-basis-1/4 gl-shrink-0 gl-flex-grow-0',
|
formElementClasses: 'md:gl-mr-3 gl-mb-3 gl-basis-1/4 gl-shrink-0 gl-flex-grow-0',
|
||||||
|
// it's used to prevent the overwrite if 'gl-h-7' or '!gl-h-7' were used
|
||||||
|
textAreaStyle: { height: '32px' },
|
||||||
computed: {
|
computed: {
|
||||||
dropdownTranslations() {
|
dropdownTranslations() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -374,7 +376,7 @@ export default {
|
||||||
<div v-for="(variable, index) in variables" :key="`var-${index}`">
|
<div v-for="(variable, index) in variables" :key="`var-${index}`">
|
||||||
<div
|
<div
|
||||||
v-if="!variable.destroy"
|
v-if="!variable.destroy"
|
||||||
class="gl-mb-3 gl-flex gl-flex-col gl-items-stretch gl-pb-2 md:gl-flex-row"
|
class="gl-mb-3 gl-flex gl-flex-col gl-items-stretch gl-pb-2 md:gl-flex-row md:gl-items-start"
|
||||||
data-testid="ci-variable-row"
|
data-testid="ci-variable-row"
|
||||||
>
|
>
|
||||||
<gl-collapsible-listbox
|
<gl-collapsible-listbox
|
||||||
|
|
@ -399,7 +401,6 @@ export default {
|
||||||
value="*****************"
|
value="*****************"
|
||||||
disabled
|
disabled
|
||||||
class="gl-mb-3 !gl-h-7"
|
class="gl-mb-3 !gl-h-7"
|
||||||
:no-resize="false"
|
|
||||||
data-testid="pipeline-form-ci-variable-hidden-value"
|
data-testid="pipeline-form-ci-variable-hidden-value"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -407,7 +408,8 @@ export default {
|
||||||
v-else
|
v-else
|
||||||
v-model="variable.value"
|
v-model="variable.value"
|
||||||
:placeholder="s__('CiVariables|Input variable value')"
|
:placeholder="s__('CiVariables|Input variable value')"
|
||||||
class="gl-mb-3 !gl-h-7"
|
class="gl-mb-3 gl-min-h-7"
|
||||||
|
:style="$options.textAreaStyle"
|
||||||
:no-resize="false"
|
:no-resize="false"
|
||||||
data-testid="pipeline-form-ci-variable-value"
|
data-testid="pipeline-form-ci-variable-value"
|
||||||
@change="resetVariable(index)"
|
@change="resetVariable(index)"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import {
|
||||||
getDefaultWorkItemTypes,
|
getDefaultWorkItemTypes,
|
||||||
getInitialPageParams,
|
getInitialPageParams,
|
||||||
getTypeTokenOptions,
|
getTypeTokenOptions,
|
||||||
|
getFilterTokens,
|
||||||
|
convertToUrlParams,
|
||||||
} from 'ee_else_ce/issues/list/utils';
|
} from 'ee_else_ce/issues/list/utils';
|
||||||
import { TYPENAME_USER } from '~/graphql_shared/constants';
|
import { TYPENAME_USER } from '~/graphql_shared/constants';
|
||||||
import { convertToGraphQLId } from '~/graphql_shared/utils';
|
import { convertToGraphQLId } from '~/graphql_shared/utils';
|
||||||
|
|
@ -22,10 +24,20 @@ import {
|
||||||
WORKSPACE_PROJECT,
|
WORKSPACE_PROJECT,
|
||||||
} from '~/issues/constants';
|
} from '~/issues/constants';
|
||||||
import { AutocompleteCache } from '~/issues/dashboard/utils';
|
import { AutocompleteCache } from '~/issues/dashboard/utils';
|
||||||
|
import {
|
||||||
|
CREATED_DESC,
|
||||||
|
PARAM_FIRST_PAGE_SIZE,
|
||||||
|
PARAM_LAST_PAGE_SIZE,
|
||||||
|
PARAM_PAGE_AFTER,
|
||||||
|
PARAM_PAGE_BEFORE,
|
||||||
|
PARAM_STATE,
|
||||||
|
PARAM_SORT,
|
||||||
|
} from '~/issues/list/constants';
|
||||||
import searchLabelsQuery from '~/issues/list/queries/search_labels.query.graphql';
|
import searchLabelsQuery from '~/issues/list/queries/search_labels.query.graphql';
|
||||||
import setSortPreferenceMutation from '~/issues/list/queries/set_sort_preference.mutation.graphql';
|
import setSortPreferenceMutation from '~/issues/list/queries/set_sort_preference.mutation.graphql';
|
||||||
import { fetchPolicies } from '~/lib/graphql';
|
import { fetchPolicies } from '~/lib/graphql';
|
||||||
import { scrollUp } from '~/lib/utils/scroll_utils';
|
import { scrollUp } from '~/lib/utils/scroll_utils';
|
||||||
|
import { isPositiveInteger } from '~/lib/utils/number_utils';
|
||||||
import { __, s__ } from '~/locale';
|
import { __, s__ } from '~/locale';
|
||||||
import {
|
import {
|
||||||
OPERATORS_IS,
|
OPERATORS_IS,
|
||||||
|
|
@ -53,6 +65,7 @@ import IssuableList from '~/vue_shared/issuable/list/components/issuable_list_ro
|
||||||
import WorkItemDrawer from '~/work_items/components/work_item_drawer.vue';
|
import WorkItemDrawer from '~/work_items/components/work_item_drawer.vue';
|
||||||
import { DEFAULT_PAGE_SIZE, issuableListTabs } 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 glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
||||||
|
import { getParameterByName } from '~/lib/utils/url_utility';
|
||||||
import { STATE_CLOSED, STATE_OPEN, WORK_ITEM_TYPE_ENUM_EPIC } from '../constants';
|
import { STATE_CLOSED, STATE_OPEN, WORK_ITEM_TYPE_ENUM_EPIC } from '../constants';
|
||||||
import getWorkItemsQuery from '../graphql/list/get_work_items.query.graphql';
|
import getWorkItemsQuery from '../graphql/list/get_work_items.query.graphql';
|
||||||
import getWorkItemStateCountsQuery from '../graphql/list/get_work_item_state_counts.query.graphql';
|
import getWorkItemStateCountsQuery from '../graphql/list/get_work_item_state_counts.query.graphql';
|
||||||
|
|
@ -114,9 +127,9 @@ export default {
|
||||||
hasAnyIssues: false,
|
hasAnyIssues: false,
|
||||||
isInitialLoadComplete: false,
|
isInitialLoadComplete: false,
|
||||||
pageInfo: {},
|
pageInfo: {},
|
||||||
pageParams: getInitialPageParams(),
|
pageParams: {},
|
||||||
pageSize: DEFAULT_PAGE_SIZE,
|
pageSize: DEFAULT_PAGE_SIZE,
|
||||||
sortKey: deriveSortKey({ sort: this.initialSort, sortMap: urlSortParams }),
|
sortKey: CREATED_DESC,
|
||||||
state: STATUS_OPEN,
|
state: STATUS_OPEN,
|
||||||
workItems: [],
|
workItems: [],
|
||||||
workItemStateCounts: {},
|
workItemStateCounts: {},
|
||||||
|
|
@ -241,7 +254,6 @@ export default {
|
||||||
isProject: !this.isGroup,
|
isProject: !this.isGroup,
|
||||||
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-assignee`,
|
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-assignee`,
|
||||||
preloadedUsers,
|
preloadedUsers,
|
||||||
multiSelect: this.glFeatures.groupMultiSelectTokens,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: TOKEN_TYPE_AUTHOR,
|
type: TOKEN_TYPE_AUTHOR,
|
||||||
|
|
@ -255,7 +267,6 @@ export default {
|
||||||
isProject: !this.isGroup,
|
isProject: !this.isGroup,
|
||||||
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-author`,
|
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-author`,
|
||||||
preloadedUsers,
|
preloadedUsers,
|
||||||
multiSelect: this.glFeatures.groupMultiSelectTokens,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: TOKEN_TYPE_GROUP,
|
type: TOKEN_TYPE_GROUP,
|
||||||
|
|
@ -275,7 +286,6 @@ export default {
|
||||||
fetchLabels: this.fetchLabels,
|
fetchLabels: this.fetchLabels,
|
||||||
fetchLatestLabels: this.glFeatures.frontendCaching ? this.fetchLatestLabels : null,
|
fetchLatestLabels: this.glFeatures.frontendCaching ? this.fetchLatestLabels : null,
|
||||||
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-label`,
|
recentSuggestionsStorageKey: `${this.fullPath}-issues-recent-tokens-label`,
|
||||||
multiSelect: this.glFeatures.groupMultiSelectTokens,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: TOKEN_TYPE_MILESTONE,
|
type: TOKEN_TYPE_MILESTONE,
|
||||||
|
|
@ -362,6 +372,20 @@ export default {
|
||||||
hasQualityManagementFeature: this.hasQualityManagementFeature,
|
hasQualityManagementFeature: this.hasQualityManagementFeature,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
urlFilterParams() {
|
||||||
|
return convertToUrlParams(this.filterTokens);
|
||||||
|
},
|
||||||
|
urlParams() {
|
||||||
|
return {
|
||||||
|
sort: urlSortParams[this.sortKey],
|
||||||
|
state: this.state,
|
||||||
|
...this.urlFilterParams,
|
||||||
|
first_page_size: this.pageParams.firstPageSize,
|
||||||
|
last_page_size: this.pageParams.lastPageSize,
|
||||||
|
page_after: this.pageParams.afterCursor ?? undefined,
|
||||||
|
page_before: this.pageParams.beforeCursor ?? undefined,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
eeWorkItemUpdateCount() {
|
eeWorkItemUpdateCount() {
|
||||||
|
|
@ -371,8 +395,14 @@ export default {
|
||||||
}
|
}
|
||||||
this.$apollo.queries.workItems.refetch();
|
this.$apollo.queries.workItems.refetch();
|
||||||
},
|
},
|
||||||
|
$route(newValue, oldValue) {
|
||||||
|
if (newValue.fullPath !== oldValue.fullPath) {
|
||||||
|
this.updateData(getParameterByName(PARAM_SORT));
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.updateData(this.initialSort);
|
||||||
this.autocompleteCache = new AutocompleteCache();
|
this.autocompleteCache = new AutocompleteCache();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -417,10 +447,14 @@ export default {
|
||||||
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.pageParams = getInitialPageParams(this.pageSize);
|
this.pageParams = getInitialPageParams(this.pageSize);
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
handleFilter(tokens) {
|
handleFilter(tokens) {
|
||||||
this.filterTokens = tokens;
|
this.filterTokens = tokens;
|
||||||
this.pageParams = getInitialPageParams(this.pageSize);
|
this.pageParams = getInitialPageParams(this.pageSize);
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
handleNextPage() {
|
handleNextPage() {
|
||||||
this.pageParams = {
|
this.pageParams = {
|
||||||
|
|
@ -428,11 +462,15 @@ export default {
|
||||||
firstPageSize: this.pageSize,
|
firstPageSize: this.pageSize,
|
||||||
};
|
};
|
||||||
scrollUp();
|
scrollUp();
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
handlePageSizeChange(pageSize) {
|
handlePageSizeChange(pageSize) {
|
||||||
this.pageSize = pageSize;
|
this.pageSize = pageSize;
|
||||||
this.pageParams = getInitialPageParams(pageSize);
|
this.pageParams = getInitialPageParams(pageSize);
|
||||||
scrollUp();
|
scrollUp();
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
handlePreviousPage() {
|
handlePreviousPage() {
|
||||||
this.pageParams = {
|
this.pageParams = {
|
||||||
|
|
@ -440,6 +478,8 @@ export default {
|
||||||
lastPageSize: this.pageSize,
|
lastPageSize: this.pageSize,
|
||||||
};
|
};
|
||||||
scrollUp();
|
scrollUp();
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
handleSort(sortKey) {
|
handleSort(sortKey) {
|
||||||
if (this.sortKey === sortKey) {
|
if (this.sortKey === sortKey) {
|
||||||
|
|
@ -452,6 +492,8 @@ export default {
|
||||||
if (this.isSignedIn) {
|
if (this.isSignedIn) {
|
||||||
this.saveSortPreference(sortKey);
|
this.saveSortPreference(sortKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$router.push({ query: this.urlParams });
|
||||||
},
|
},
|
||||||
saveSortPreference(sortKey) {
|
saveSortPreference(sortKey) {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
|
|
@ -485,6 +527,26 @@ export default {
|
||||||
await this.$apollo.queries.workItems.refetch();
|
await this.$apollo.queries.workItems.refetch();
|
||||||
this.isRefetching = false;
|
this.isRefetching = false;
|
||||||
},
|
},
|
||||||
|
updateData(sort) {
|
||||||
|
const firstPageSize = getParameterByName(PARAM_FIRST_PAGE_SIZE);
|
||||||
|
const lastPageSize = getParameterByName(PARAM_LAST_PAGE_SIZE);
|
||||||
|
const state = getParameterByName(PARAM_STATE);
|
||||||
|
|
||||||
|
this.filterTokens = getFilterTokens(window.location.search);
|
||||||
|
|
||||||
|
this.pageParams = getInitialPageParams(
|
||||||
|
this.pageSize,
|
||||||
|
isPositiveInteger(firstPageSize) ? parseInt(firstPageSize, 10) : undefined,
|
||||||
|
isPositiveInteger(lastPageSize) ? parseInt(lastPageSize, 10) : undefined,
|
||||||
|
getParameterByName(PARAM_PAGE_AFTER) ?? undefined,
|
||||||
|
getParameterByName(PARAM_PAGE_BEFORE) ?? undefined,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger pageSize UI component update based on URL changes
|
||||||
|
this.pageSize = this.pageParams.firstPageSize;
|
||||||
|
this.sortKey = deriveSortKey({ sort, sortMap: urlSortParams });
|
||||||
|
this.state = state || STATUS_OPEN;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -508,6 +570,7 @@ export default {
|
||||||
:error="error"
|
:error="error"
|
||||||
:has-next-page="pageInfo.hasNextPage"
|
:has-next-page="pageInfo.hasNextPage"
|
||||||
:has-previous-page="pageInfo.hasPreviousPage"
|
:has-previous-page="pageInfo.hasPreviousPage"
|
||||||
|
:initial-filter-value="filterTokens"
|
||||||
:initial-sort-by="sortKey"
|
:initial-sort-by="sortKey"
|
||||||
:issuables="workItems"
|
:issuables="workItems"
|
||||||
:issuables-loading="isLoading"
|
:issuables-loading="isLoading"
|
||||||
|
|
@ -520,6 +583,7 @@ export default {
|
||||||
:show-pagination-controls="showPaginationControls"
|
:show-pagination-controls="showPaginationControls"
|
||||||
show-work-item-type-icon
|
show-work-item-type-icon
|
||||||
:sort-options="$options.sortOptions"
|
:sort-options="$options.sortOptions"
|
||||||
|
sync-filter-and-sort
|
||||||
:tab-counts="tabCounts"
|
:tab-counts="tabCounts"
|
||||||
:tabs="$options.issuableListTabs"
|
:tabs="$options.issuableListTabs"
|
||||||
use-keyset-pagination
|
use-keyset-pagination
|
||||||
|
|
|
||||||
|
|
@ -4,39 +4,6 @@
|
||||||
border: 1px solid $gray-100;
|
border: 1px solid $gray-100;
|
||||||
border-radius: $gl-border-radius-base;
|
border-radius: $gl-border-radius-base;
|
||||||
|
|
||||||
.card.card-body-segment {
|
|
||||||
padding: $gl-padding;
|
|
||||||
|
|
||||||
&:not(:last-of-type) {
|
|
||||||
border-bottom: 1px solid $gray-100;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.borderless {
|
|
||||||
border-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.branch-info {
|
|
||||||
.commit-sha,
|
|
||||||
.commit-info {
|
|
||||||
margin-left: 4px;
|
|
||||||
|
|
||||||
.fork-svg {
|
|
||||||
margin-right: 4px;
|
|
||||||
vertical-align: bottom;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ref-name {
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.admin-well h4 {
|
|
||||||
border-bottom: 1px solid $border-color;
|
|
||||||
padding-bottom: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon-container {
|
.icon-container {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 0.5rem 0 0.25rem;
|
margin: 0 0.5rem 0 0.25rem;
|
||||||
|
|
@ -57,10 +24,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-gray {
|
|
||||||
background-color: $well-expand-item;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branches {
|
.branches {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
@ -69,11 +32,3 @@
|
||||||
vertical-align: text-top;
|
vertical-align: text-top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.card-body-centered {
|
|
||||||
h1 {
|
|
||||||
font-weight: $gl-font-weight-normal;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 48px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -162,10 +162,6 @@
|
||||||
.generic-commit-status {
|
.generic-commit-status {
|
||||||
a {
|
a {
|
||||||
color: $gl-text-color;
|
color: $gl-text-color;
|
||||||
|
|
||||||
&.autodevops-badge {
|
|
||||||
color: $white;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-row-description {
|
.commit-row-description {
|
||||||
|
|
@ -232,29 +228,3 @@
|
||||||
font-weight: $gl-font-weight-normal;
|
font-weight: $gl-font-weight-normal;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gpg-popover-icon {
|
|
||||||
// same margin as .s32.avatar
|
|
||||||
margin-right: $btn-side-margin;
|
|
||||||
|
|
||||||
&.valid {
|
|
||||||
svg {
|
|
||||||
border: 1px solid $brand-success;
|
|
||||||
fill: $brand-success;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.invalid {
|
|
||||||
svg {
|
|
||||||
border: 1px solid $gray-200;
|
|
||||||
fill: $gray-200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
svg {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
border-radius: 50%;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ Using the [rails console](../../../administration/operations/rails_console.md#st
|
||||||
```ruby
|
```ruby
|
||||||
p = Project.find_by_full_path('project/path')
|
p = Project.find_by_full_path('project/path')
|
||||||
p.events.pushed_action.last(100).each do |e|
|
p.events.pushed_action.last(100).each do |e|
|
||||||
puts "%-20.20s %8s...%8s (%s)", e.push_event_payload[:ref], e.push_event_payload[:commit_from], e.push_event_payload[:commit_to], e.author.try(:username)
|
printf "%-20.20s %8s...%8s (%s)", e.push_event_payload[:ref], e.push_event_payload[:commit_from], e.push_event_payload[:commit_to], e.author.try(:username)
|
||||||
end ; nil
|
end ; nil
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { shallowMount } from '@vue/test-utils';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import Vue, { nextTick } from 'vue';
|
import Vue, { nextTick } from 'vue';
|
||||||
import VueApollo from 'vue-apollo';
|
import VueApollo from 'vue-apollo';
|
||||||
|
import VueRouter from 'vue-router';
|
||||||
import * as Sentry from '~/sentry/sentry_browser_wrapper';
|
import * as Sentry from '~/sentry/sentry_browser_wrapper';
|
||||||
import IssueCardStatistics from 'ee_else_ce/issues/list/components/issue_card_statistics.vue';
|
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 IssueCardTimeInfo from 'ee_else_ce/issues/list/components/issue_card_time_info.vue';
|
||||||
|
|
@ -39,6 +40,7 @@ import getWorkItemStateCountsQuery from '~/work_items/graphql/list/get_work_item
|
||||||
import getWorkItemsQuery from '~/work_items/graphql/list/get_work_items.query.graphql';
|
import getWorkItemsQuery from '~/work_items/graphql/list/get_work_items.query.graphql';
|
||||||
import WorkItemDrawer from '~/work_items/components/work_item_drawer.vue';
|
import WorkItemDrawer from '~/work_items/components/work_item_drawer.vue';
|
||||||
import { STATE_CLOSED } from '~/work_items/constants';
|
import { STATE_CLOSED } from '~/work_items/constants';
|
||||||
|
import { createRouter } from '~/work_items/router';
|
||||||
import {
|
import {
|
||||||
groupWorkItemsQueryResponse,
|
groupWorkItemsQueryResponse,
|
||||||
groupWorkItemStateCountsQueryResponse,
|
groupWorkItemStateCountsQueryResponse,
|
||||||
|
|
@ -58,6 +60,7 @@ describeSkipVue3(skipReason, () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
|
|
||||||
Vue.use(VueApollo);
|
Vue.use(VueApollo);
|
||||||
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
const defaultQueryHandler = jest.fn().mockResolvedValue(groupWorkItemsQueryResponse);
|
const defaultQueryHandler = jest.fn().mockResolvedValue(groupWorkItemsQueryResponse);
|
||||||
const countsQueryHandler = jest.fn().mockResolvedValue(groupWorkItemStateCountsQueryResponse);
|
const countsQueryHandler = jest.fn().mockResolvedValue(groupWorkItemStateCountsQueryResponse);
|
||||||
|
|
@ -74,6 +77,7 @@ describeSkipVue3(skipReason, () => {
|
||||||
sortPreferenceMutationResponse = mutationHandler,
|
sortPreferenceMutationResponse = mutationHandler,
|
||||||
} = {}) => {
|
} = {}) => {
|
||||||
wrapper = shallowMount(WorkItemsListApp, {
|
wrapper = shallowMount(WorkItemsListApp, {
|
||||||
|
router: createRouter({ fullPath: '/work_item' }),
|
||||||
apolloProvider: createMockApollo([
|
apolloProvider: createMockApollo([
|
||||||
[getWorkItemsQuery, queryHandler],
|
[getWorkItemsQuery, queryHandler],
|
||||||
[getWorkItemStateCountsQuery, countsQueryHandler],
|
[getWorkItemStateCountsQuery, countsQueryHandler],
|
||||||
|
|
@ -182,7 +186,6 @@ describeSkipVue3(skipReason, () => {
|
||||||
includeDescendants: true,
|
includeDescendants: true,
|
||||||
sort: CREATED_DESC,
|
sort: CREATED_DESC,
|
||||||
state: STATUS_OPEN,
|
state: STATUS_OPEN,
|
||||||
firstPageSize: 20,
|
|
||||||
types: type,
|
types: type,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -213,7 +216,6 @@ describeSkipVue3(skipReason, () => {
|
||||||
describe('when eeCreatedWorkItemsCount is updated', () => {
|
describe('when eeCreatedWorkItemsCount is updated', () => {
|
||||||
it('refetches work items', async () => {
|
it('refetches work items', async () => {
|
||||||
mountComponent();
|
mountComponent();
|
||||||
await waitForPromises();
|
|
||||||
|
|
||||||
expect(defaultQueryHandler).toHaveBeenCalledTimes(1);
|
expect(defaultQueryHandler).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
|
|
@ -478,17 +480,20 @@ describeSkipVue3(skipReason, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('refetches and resets when work item is deleted', async () => {
|
it('refetches and resets when work item is deleted', async () => {
|
||||||
|
expect(defaultQueryHandler).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
findDrawer().vm.$emit('workItemDeleted');
|
findDrawer().vm.$emit('workItemDeleted');
|
||||||
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
checkThatDrawerPropsAreEmpty();
|
checkThatDrawerPropsAreEmpty();
|
||||||
|
|
||||||
// first call when mounted, second call after deletion
|
expect(defaultQueryHandler).toHaveBeenCalledTimes(3);
|
||||||
expect(defaultQueryHandler).toHaveBeenCalledTimes(2);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('refetches when the selected work item is closed', async () => {
|
it('refetches when the selected work item is closed', async () => {
|
||||||
|
expect(defaultQueryHandler).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
// component displays open work items by default
|
// component displays open work items by default
|
||||||
findDrawer().vm.$emit('work-item-updated', {
|
findDrawer().vm.$emit('work-item-updated', {
|
||||||
state: STATE_CLOSED,
|
state: STATE_CLOSED,
|
||||||
|
|
@ -496,8 +501,7 @@ describeSkipVue3(skipReason, () => {
|
||||||
|
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
// first call when mounted, second call after update
|
expect(defaultQueryHandler).toHaveBeenCalledTimes(3);
|
||||||
expect(defaultQueryHandler).toHaveBeenCalledTimes(2);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue