Commit 41c5a0c7 authored by Scott Hampton's avatar Scott Hampton

Fix the project ID query param

Fix the query param for the project IDs array
so that the endpoint path is valid.

Also removed including subgroups since it
is making the list of projects confusing. You
can view the same page in a subgroup, so
no functionality is being lost.
parent d0a4f311
...@@ -79,7 +79,7 @@ export default { ...@@ -79,7 +79,7 @@ export default {
// not including a project_ids param is the same as selecting all the projects // not including a project_ids param is the same as selecting all the projects
if (!this.selectAllProjects) { if (!this.selectAllProjects) {
queryParams.set('project_ids', this.selectedProjectIdsParam); this.selectedProjectIds.forEach(id => queryParams.append('project_ids[]', id));
} }
return `${this.groupAnalyticsCoverageReportsPath}&${queryParams.toString()}`; return `${this.groupAnalyticsCoverageReportsPath}&${queryParams.toString()}`;
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
project.name.toLowerCase().includes(this.projectSearchTerm.toLowerCase()), project.name.toLowerCase().includes(this.projectSearchTerm.toLowerCase()),
); );
}, },
selectedProjectIdsParam() { selectedProjectIds() {
return this.groupProjects.filter(project => project.isSelected).map(project => project.id); return this.groupProjects.filter(project => project.isSelected).map(project => project.id);
}, },
}, },
......
query getGroupProjects($groupFullPath: ID!) { query getGroupProjects($groupFullPath: ID!) {
group(fullPath: $groupFullPath) { group(fullPath: $groupFullPath) {
projects(includeSubgroups: true) { projects {
nodes { nodes {
name name
id id
......
---
title: Fix project_ids query param for group test coverage report
merge_request: 42880
author:
type: fixed
...@@ -89,7 +89,8 @@ describe('Group repository analytics app', () => { ...@@ -89,7 +89,8 @@ describe('Group repository analytics app', () => {
}); });
it('renders primary action as a link with two project IDs as parameters', () => { it('renders primary action as a link with two project IDs as parameters', () => {
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&project_ids=${groupProjectsData[0].id}%2C${groupProjectsData[1].id}`; const projectIdsQueryParam = `project_ids%5B%5D=${groupProjectsData[0].id}&project_ids%5B%5D=${groupProjectsData[1].id}`;
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&${projectIdsQueryParam}`;
expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath); expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath);
}); });
...@@ -101,7 +102,8 @@ describe('Group repository analytics app', () => { ...@@ -101,7 +102,8 @@ describe('Group repository analytics app', () => {
}); });
it('renders primary action as a link with one project ID as a parameter', () => { it('renders primary action as a link with one project ID as a parameter', () => {
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&project_ids=${groupProjectsData[0].id}`; const projectIdsQueryParam = `project_ids%5B%5D=${groupProjectsData[0].id}`;
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&${projectIdsQueryParam}`;
expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath); expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath);
}); });
......
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