Commit cd354a0c authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '326029-iteration-report-project-level-view-shows-group-level-burndown' into 'master'

Scope iteration reports to current namespace

See merge request gitlab-org/gitlab!81216
parents ff1030dc da7d20f4
query BurnupTimesSeriesData($id: ID!, $isIteration: Boolean = false, $weight: Boolean = false) {
query BurnupTimesSeriesData(
$id: ID!
$isIteration: Boolean = false
$weight: Boolean = false
$fullPath: String
) {
milestone(id: $id) @skip(if: $isIteration) {
__typename
id
......@@ -37,7 +42,7 @@ query BurnupTimesSeriesData($id: ID!, $isIteration: Boolean = false, $weight: Bo
__typename
id
title
report {
report(fullPath: $fullPath) {
__typename
burnupTimeSeries {
__typename
......
......@@ -142,6 +142,7 @@ To view an iteration report, go to the iterations list page and select an iterat
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/222750) in GitLab 13.6.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/269972) in GitLab 13.7.
> - Scoped burnup and burndown charts in subgroups and projects [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/326029) in GitLab 14.9.
The iteration report includes [burndown and burnup charts](../../project/milestones/burndown_and_burnup_charts.md),
similar to how they appear when viewing a [milestone](../../project/milestones/index.md).
......@@ -149,6 +150,33 @@ similar to how they appear when viewing a [milestone](../../project/milestones/i
Burndown charts help track completion progress of total scope, and burnup charts track the daily
total count and weight of issues added to and completed in a given timebox.
#### Iteration charts scoped to subgroups or projects
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/326029) in GitLab 14.9.
You can view burndown and burnup charts for iterations created for a group in any of its
subgroups or projects.
When you do this, the charts only count the issues that belong to the subgroup or project.
For example, suppose a group has two projects named `Project 1` and `Project 2`.
Each project has a single issue assigned to the same iteration from the group.
An iteration report generated for the group shows issue counts for all the group's projects:
- Completed: 0 of 2
- Incomplete: 0 of 2
- Unstarted: 2 of 2
- Burndown chart total issues: 2
- Burnup chart total issues: 2
An iteration report generated for `Project 1` shows only issues that belong to this project:
- Completed: 0 of 1
- Incomplete: 0 of 1
- Unstarted: 1 of 1
- Burndown chart total issues: 1
- Burnup chart total issues: 1
### Group issues by label
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/225500) in GitLab 13.8.
......
......@@ -78,10 +78,13 @@ export default {
},
query: BurnupQuery,
variables() {
const fullPath = this.isIterationReport ? { fullPath: this.fullPath } : {};
return {
id: this.iterationId || this.milestoneId,
isIteration: Boolean(this.iterationId),
weight: !this.issuesSelected,
...fullPath,
};
},
update(data) {
......@@ -126,6 +129,9 @@ export default {
burnupData() {
return this.report.burnupData;
},
isIterationReport() {
return this.iterationId && !this.milestoneId;
},
columns() {
return [
{
......
......@@ -2,13 +2,17 @@ import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { nextTick } from 'vue';
import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import BurnCharts from 'ee/burndown_chart/components/burn_charts.vue';
import BurndownChart from 'ee/burndown_chart/components/burndown_chart.vue';
import BurnupChart from 'ee/burndown_chart/components/burnup_chart.vue';
import BurnupQuery from 'shared_queries/burndown_chart/burnup.query.graphql';
import OpenTimeboxSummary from 'ee/burndown_chart/components/open_timebox_summary.vue';
import TimeboxSummaryCards from 'ee/burndown_chart/components/timebox_summary_cards.vue';
import createMockApollo from 'helpers/mock_apollo_helper';
import { useFakeDate } from 'helpers/fake_date';
import waitForPromises from 'helpers/wait_for_promises';
import { day1, day2, day3, day4 } from '../mock_data';
function useFakeDateFromDay({ date }) {
......@@ -282,4 +286,50 @@ describe('burndown_chart', () => {
});
});
});
describe('fullPath is only passed for iteration report', () => {
let burnupQuerySpy;
const createComponentWithApollo = ({ props = {} }) => {
Vue.use(VueApollo);
burnupQuerySpy = jest.fn();
wrapper = shallowMount(BurnCharts, {
apolloProvider: createMockApollo([[BurnupQuery, burnupQuerySpy]]),
propsData: {
...defaultProps,
...props,
},
});
};
it('makes a request with a fullPath for iteration', async () => {
createComponentWithApollo({ props: { iterationId: 'id' } });
await waitForPromises();
expect(burnupQuerySpy).toHaveBeenCalledTimes(1);
expect(burnupQuerySpy).toHaveBeenCalledWith(
expect.objectContaining({
id: 'id',
fullPath: defaultProps.fullPath,
}),
);
});
it('makes a request without a fullPath for milestone', async () => {
createComponentWithApollo({ props: { milestoneId: 'id' } });
await waitForPromises();
expect(burnupQuerySpy).toHaveBeenCalledTimes(1);
expect(burnupQuerySpy).toHaveBeenCalledWith(
expect.objectContaining({
id: 'id',
}),
);
expect(burnupQuerySpy).toHaveBeenCalledWith(
expect.not.objectContaining({
fullPath: defaultProps.fullPath,
}),
);
});
});
});
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