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