Commit a6b74a6c authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch...

Merge branch '295626-when-epic-swimlanes-are-enabled-milestones-are-incorrectly-scoped-in-boards-sidebar' into 'master'

Scope milestones on swimlane boards to project and its ancestors [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!52199
parents d8f2b0d5 dc9c6864
...@@ -8,9 +8,8 @@ import { ...@@ -8,9 +8,8 @@ import {
GlDropdownDivider, GlDropdownDivider,
GlLoadingIcon, GlLoadingIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { fetchPolicies } from '~/lib/graphql';
import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue'; import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue';
import groupMilestones from '../../graphql/group_milestones.query.graphql'; import projectMilestones from '../../graphql/project_milestones.query.graphql';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
...@@ -34,22 +33,21 @@ export default { ...@@ -34,22 +33,21 @@ export default {
}, },
apollo: { apollo: {
milestones: { milestones: {
fetchPolicy: fetchPolicies.CACHE_AND_NETWORK, query: projectMilestones,
query: groupMilestones,
debounce: 250, debounce: 250,
skip() { skip() {
return !this.edit; return !this.edit;
}, },
variables() { variables() {
return { return {
fullPath: this.groupFullPath, fullPath: this.projectPath,
searchTitle: this.searchTitle, searchTitle: this.searchTitle,
state: 'active', state: 'active',
includeDescendants: true, includeAncestors: true,
}; };
}, },
update(data) { update(data) {
const edges = data?.group?.milestones?.edges ?? []; const edges = data?.project?.milestones?.edges ?? [];
return edges.map((item) => item.node); return edges.map((item) => item.node);
}, },
error() { error() {
......
query groupMilestones( query groupMilestones(
$fullPath: ID! $fullPath: ID!
$state: MilestoneStateEnum $state: MilestoneStateEnum
$includeDescendants: Boolean $includeAncestors: Boolean
$searchTitle: String $searchTitle: String
) { ) {
group(fullPath: $fullPath) { project(fullPath: $fullPath) {
milestones(state: $state, includeDescendants: $includeDescendants, searchTitle: $searchTitle) { milestones(state: $state, includeAncestors: $includeAncestors, searchTitle: $searchTitle) {
edges { edges {
node { node {
id id
......
---
title: Scope milestones on swimlane boards to project and its ancestors
merge_request: 52199
author:
type: fixed
...@@ -20,7 +20,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () => ...@@ -20,7 +20,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
wrapper = null; wrapper = null;
}); });
const createWrapper = ({ milestone = null } = {}) => { const createWrapper = ({ milestone = null, loading = false } = {}) => {
store = createStore(); store = createStore();
store.state.issues = { [TEST_ISSUE.id]: { ...TEST_ISSUE, milestone } }; store.state.issues = { [TEST_ISSUE.id]: { ...TEST_ISSUE, milestone } };
store.state.activeId = TEST_ISSUE.id; store.state.activeId = TEST_ISSUE.id;
...@@ -38,7 +38,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () => ...@@ -38,7 +38,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
}, },
mocks: { mocks: {
$apollo: { $apollo: {
loading: false, loading,
}, },
}, },
}); });
...@@ -63,12 +63,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () => ...@@ -63,12 +63,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
}); });
it('shows loader while Apollo is loading', async () => { it('shows loader while Apollo is loading', async () => {
createWrapper({ milestone: TEST_MILESTONE }); createWrapper({ milestone: TEST_MILESTONE, loading: true });
expect(findLoader().exists()).toBe(false);
wrapper.vm.$apollo.loading = true;
await wrapper.vm.$nextTick();
expect(findLoader().exists()).toBe(true); expect(findLoader().exists()).toBe(true);
}); });
...@@ -76,8 +71,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () => ...@@ -76,8 +71,7 @@ describe('~/boards/components/sidebar/board_sidebar_milestone_select.vue', () =>
it('shows message when error or no milestones found', async () => { it('shows message when error or no milestones found', async () => {
createWrapper(); createWrapper();
wrapper.setData({ milestones: [] }); await wrapper.setData({ milestones: [] });
await wrapper.vm.$nextTick();
expect(findNoMilestonesFoundItem().text()).toBe('No milestones found'); expect(findNoMilestonesFoundItem().text()).toBe('No milestones found');
}); });
......
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