Commit 63de0165 authored by Scott Hampton's avatar Scott Hampton

Update docs for CSV report

Update the documentation to include info
on how the modal works.

Also updated the project selection to not
include project_id params if the user
selects all projects. This ensures that
the user can download a report for all
projects even if they aren't in the dropdown
list.
parent 0e8e9ab1
......@@ -16,7 +16,11 @@ info: To determine the technical writer assigned to the Stage/Group associated w
CAUTION: **Warning:**
This feature might not be available to you. Check the **version history** note above for details.
To get a CSV of the code coverage data for all of the projects in your group, go to your group's **Analytics > CI/CD** page, and click **Download historic test coverage data (.csv)**.
To get a CSV of the code coverage data for all of the projects in your group, go to your group's **Analytics > CI/CD** page, and click **Download historic test coverage data (.csv)**. This report has a maximum of 1000 records. This will open a modal for you to select the any or all projects you want to include in the report. You can also select the time frame for the report from the following options: last week, last 2 weeks, last 30 days, last 60 days, last 90 days.
![Code Coverage Modal](../img/group_code_coverage_csv_v13_4.png)
Due to limitations in the API, in this first iteration the projects dropdown will only show up to 100 projects from your group. This will be updated in future releases to allow for selecting any project in your group. For now, selecting "All projects" will still download the report for all the projects in your group and not just the first 100.
For each day that a coverage report was generated by a job in a project's pipeline, there will be a row in the CSV which includes:
......
......@@ -72,7 +72,7 @@ export default {
const endDate = pikadayToString(today);
today.setDate(today.getDate() - this.selectedDateRange.value);
const startDate = pikadayToString(today);
return `${this.groupAnalyticsCoverageReportsPath}&start_date=${startDate}&end_date=${endDate}&${this.selectedProjectIdsParam}`;
return `${this.groupAnalyticsCoverageReportsPath}&start_date=${startDate}&end_date=${endDate}${this.selectedProjectIdsParam}`;
},
downloadCSVModalButton() {
return {
......@@ -97,9 +97,11 @@ export default {
},
selectedProjectIdsParam() {
if (this.selectAllProjects) {
return getProjectIdQueryParams(this.groupProjects);
return ''; // not including a project_ids param is the same as selecting all the projects
}
return getProjectIdQueryParams(this.groupProjects.filter(project => project.isSelected));
return `&${getProjectIdQueryParams(
this.groupProjects.filter(project => project.isSelected),
)}`;
},
},
methods: {
......
---
title: Fix selecting all projects in group code coverage report
merge_request: 42507
author:
type: fixed
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { GlDropdown, GlDropdownItem, GlModal } from '@gitlab/ui';
import { useFakeDate } from 'helpers/fake_date';
import { getProjectIdQueryParams } from 'ee/analytics/repository_analytics/utils';
import GroupRepositoryAnalytics from 'ee/analytics/repository_analytics/components/group_repository_analytics.vue';
const localVue = createLocalVue();
......@@ -76,11 +75,10 @@ describe('Group repository analytics app', () => {
selectAllCodeCoverageProjects();
});
it('renders primary action as a link with all project IDs as parameters', () => {
const projectIdParams = getProjectIdQueryParams(groupProjectsData);
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&${projectIdParams}`;
expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath);
it('renders primary action as a link with no project_ids param', () => {
expect(findCodeCoverageDownloadButton().attributes('href')).toBe(
groupAnalyticsCoverageReportsPathWithDates,
);
});
});
......@@ -111,15 +109,13 @@ describe('Group repository analytics app', () => {
});
describe('when selecting a date range', () => {
const projectIdParams = '&project_ids=1,2';
it.each`
date | expected
${7} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-29&end_date=2020-07-06${projectIdParams}`}
${14} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-22&end_date=2020-07-06${projectIdParams}`}
${30} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-06&end_date=2020-07-06${projectIdParams}`}
${60} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-05-07&end_date=2020-07-06${projectIdParams}`}
${90} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-04-07&end_date=2020-07-06${projectIdParams}`}
${7} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-29&end_date=2020-07-06`}
${14} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-22&end_date=2020-07-06`}
${30} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-06-06&end_date=2020-07-06`}
${60} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-05-07&end_date=2020-07-06`}
${90} | ${`${injectedProperties.groupAnalyticsCoverageReportsPath}&start_date=2020-04-07&end_date=2020-07-06`}
`(
'updates CSV path to have the start date be $date days before today',
({ date, expected }) => {
......
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