Commit dfd784e0 authored by Scott Hampton's avatar Scott Hampton

Merge branch '284471-refactor-vulnerability-project-queries' into 'master'

Rename vulnerability projects queries

See merge request gitlab-org/gitlab!59992
parents 81fdc1f7 2209a680
<script> <script>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import createFlash from '~/flash'; import createFlash from '~/flash';
import groupProjectsQuery from '../graphql/queries/group_projects.query.graphql';
import vulnerabilityGradesQuery from '../graphql/queries/group_vulnerability_grades.query.graphql'; import vulnerabilityGradesQuery from '../graphql/queries/group_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from '../graphql/queries/group_vulnerability_history.query.graphql'; import vulnerabilityHistoryQuery from '../graphql/queries/group_vulnerability_history.query.graphql';
import groupProjectsQuery from '../graphql/queries/vulnerable_projects_group.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from '../helpers'; import { PROJECT_LOADING_ERROR_MESSAGE } from '../helpers';
import DashboardNotConfigured from './empty_states/group_dashboard_not_configured.vue'; import DashboardNotConfigured from './empty_states/group_dashboard_not_configured.vue';
import VulnerabilityChart from './first_class_vulnerability_chart.vue'; import VulnerabilityChart from './first_class_vulnerability_chart.vue';
......
...@@ -6,8 +6,8 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d ...@@ -6,8 +6,8 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import vulnerableProjectsGroupQuery from '../graphql/queries/vulnerable_projects_group.query.graphql'; import groupProjectsQuery from '../graphql/queries/group_projects.query.graphql';
import vulnerableProjectsInstanceQuery from '../graphql/queries/vulnerable_projects_instance.query.graphql'; import instanceProjectsQuery from '../graphql/queries/instance_projects.query.graphql';
import AutoFixUserCallout from './auto_fix_user_callout.vue'; import AutoFixUserCallout from './auto_fix_user_callout.vue';
import CsvExportButton from './csv_export_button.vue'; import CsvExportButton from './csv_export_button.vue';
import DashboardNotConfiguredGroup from './empty_states/group_dashboard_not_configured.vue'; import DashboardNotConfiguredGroup from './empty_states/group_dashboard_not_configured.vue';
...@@ -46,8 +46,8 @@ export default { ...@@ -46,8 +46,8 @@ export default {
'pipeline', 'pipeline',
], ],
queries: { queries: {
[DASHBOARD_TYPES.GROUP]: vulnerableProjectsGroupQuery, [DASHBOARD_TYPES.GROUP]: groupProjectsQuery,
[DASHBOARD_TYPES.INSTANCE]: vulnerableProjectsInstanceQuery, [DASHBOARD_TYPES.INSTANCE]: instanceProjectsQuery,
}, },
apollo: { apollo: {
projects: { projects: {
......
query vulnerableProjects($fullPath: ID!) { query groupProjects($fullPath: ID!) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
projects(includeSubgroups: true) { projects(includeSubgroups: true) {
nodes { nodes {
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql" #import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql" #import "../fragments/vulnerability.fragment.graphql"
query instance( query instanceVulnerabilities(
$after: String $after: String
$first: Int $first: Int
$projectId: [ID!] $projectId: [ID!]
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql" #import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql" #import "../fragments/vulnerability.fragment.graphql"
query project( query projectVulnerabilities(
$fullPath: ID! $fullPath: ID!
$after: String $after: String
$first: Int $first: Int
......
query project($fullPath: ID!, $startDate: ISO8601Date!, $endDate: ISO8601Date!) { query projectVulnerabilitiesCount(
$fullPath: ID!
$startDate: ISO8601Date!
$endDate: ISO8601Date!
) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
vulnerabilitiesCountByDay(startDate: $startDate, endDate: $endDate) { vulnerabilitiesCountByDay(startDate: $startDate, endDate: $endDate) {
nodes { nodes {
......
query vulnerableProjects {
instanceSecurityDashboard {
projects {
nodes {
id
name
}
}
}
}
...@@ -17,8 +17,8 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d ...@@ -17,8 +17,8 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d
import SurveyRequestBanner from 'ee/security_dashboard/components/survey_request_banner.vue'; import SurveyRequestBanner from 'ee/security_dashboard/components/survey_request_banner.vue';
import VulnerabilitiesCountList from 'ee/security_dashboard/components/vulnerability_count_list.vue'; import VulnerabilitiesCountList from 'ee/security_dashboard/components/vulnerability_count_list.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue'; import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue';
import vulnerableProjectsGroupQuery from 'ee/security_dashboard/graphql/queries/vulnerable_projects_group.query.graphql'; import groupProjectsQuery from 'ee/security_dashboard/graphql/queries/group_projects.query.graphql';
import vulnerableProjectsInstanceQuery from 'ee/security_dashboard/graphql/queries/vulnerable_projects_instance.query.graphql'; import instanceProjectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import createApolloProvider from 'helpers/mock_apollo_helper'; import createApolloProvider from 'helpers/mock_apollo_helper';
import { mockVulnerableProjectsInstance, mockVulnerableProjectsGroup } from '../mock_data'; import { mockVulnerableProjectsInstance, mockVulnerableProjectsGroup } from '../mock_data';
...@@ -79,10 +79,7 @@ describe('Vulnerability Report', () => { ...@@ -79,10 +79,7 @@ describe('Vulnerability Report', () => {
dashboardType: DASHBOARD_TYPES.INSTANCE, dashboardType: DASHBOARD_TYPES.INSTANCE,
}, },
apolloProvider: createApolloProvider([ apolloProvider: createApolloProvider([
[ [instanceProjectsQuery, jest.fn().mockResolvedValue(mockVulnerableProjectsInstance())],
vulnerableProjectsInstanceQuery,
jest.fn().mockResolvedValue(mockVulnerableProjectsInstance()),
],
]), ]),
}); });
}); });
...@@ -122,10 +119,7 @@ describe('Vulnerability Report', () => { ...@@ -122,10 +119,7 @@ describe('Vulnerability Report', () => {
}, },
data: { filters }, data: { filters },
apolloProvider: createApolloProvider([ apolloProvider: createApolloProvider([
[ [instanceProjectsQuery, jest.fn().mockResolvedValue(mockVulnerableProjectsInstance())],
vulnerableProjectsInstanceQuery,
jest.fn().mockResolvedValue(mockVulnerableProjectsInstance()),
],
]), ]),
}); });
}); });
...@@ -151,10 +145,7 @@ describe('Vulnerability Report', () => { ...@@ -151,10 +145,7 @@ describe('Vulnerability Report', () => {
dashboardType: DASHBOARD_TYPES.GROUP, dashboardType: DASHBOARD_TYPES.GROUP,
}, },
apolloProvider: createApolloProvider([ apolloProvider: createApolloProvider([
[ [groupProjectsQuery, jest.fn().mockResolvedValue(mockVulnerableProjectsGroup())],
vulnerableProjectsGroupQuery,
jest.fn().mockResolvedValue(mockVulnerableProjectsGroup()),
],
]), ]),
}); });
}); });
...@@ -179,7 +170,7 @@ describe('Vulnerability Report', () => { ...@@ -179,7 +170,7 @@ describe('Vulnerability Report', () => {
}, },
apolloProvider: createApolloProvider([ apolloProvider: createApolloProvider([
[ [
vulnerableProjectsGroupQuery, groupProjectsQuery,
jest.fn().mockResolvedValue({ data: { group: { projects: { nodes: [] } } } }), jest.fn().mockResolvedValue({ data: { group: { projects: { nodes: [] } } } }),
], ],
]), ]),
......
...@@ -202,6 +202,7 @@ export const mockVulnerableProjectsInstance = () => ({ ...@@ -202,6 +202,7 @@ export const mockVulnerableProjectsInstance = () => ({
{ {
id: 'gid://gitlab/Project/2', id: 'gid://gitlab/Project/2',
name: 'Gitlab Shell', name: 'Gitlab Shell',
nameWithNamespace: 'Group / Gitlab Shell',
}, },
], ],
}, },
......
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