Commit db673e0f authored by Kev's avatar Kev

Refactor folder structure for security dashboard GraphQL files

This moves all graphql files used in the security dashboards in the
following folder structure which is ordered by type.

    + graphql
      + mutations
      + queries
      + fragments

This should _not_ affect any functionality of the security dashboards.
parent 428ba0dc
......@@ -4,7 +4,7 @@ import SecurityDashboardLayout from 'ee/security_dashboard/components/security_d
import GroupSecurityVulnerabilities from 'ee/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import CsvExportButton from './csv_export_button.vue';
import vulnerableProjectsQuery from '../graphql/vulnerable_projects.query.graphql';
import vulnerableProjectsQuery from '../graphql/queries/vulnerable_projects.query.graphql';
import DashboardNotConfigured from './empty_states/group_dashboard_not_configured.vue';
import VulnerabilitiesCountList from './vulnerability_count_list.vue';
import { vulnerabilitiesSeverityCountScopes } from '../constants';
......
......@@ -2,7 +2,7 @@
import produce from 'immer';
import { GlAlert, GlLoadingIcon, GlIntersectionObserver } from '@gitlab/ui';
import VulnerabilityList from './vulnerability_list.vue';
import vulnerabilitiesQuery from '../graphql/group_vulnerabilities.graphql';
import vulnerabilitiesQuery from '../graphql/queries/group_vulnerabilities.query.graphql';
import { VULNERABILITIES_PER_PAGE } from '../store/constants';
import { preparePageInfo } from '../helpers';
......
<script>
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import projectsQuery from 'ee/security_dashboard/graphql/get_instance_security_dashboard_projects.query.graphql';
import projectsQuery from 'ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql';
import createFlash from '~/flash';
import { createProjectLoadingError } from '../helpers';
import InstanceSecurityVulnerabilities from './first_class_instance_security_dashboard_vulnerabilities.vue';
......
<script>
import { GlAlert } from '@gitlab/ui';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import projectsQuery from 'ee/security_dashboard/graphql/get_instance_security_dashboard_projects.query.graphql';
import projectsQuery from 'ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql';
import { createProjectLoadingError } from '../helpers';
import ProjectManager from './first_class_project_manager/project_manager.vue';
......
......@@ -3,7 +3,7 @@ import produce from 'immer';
import { GlAlert, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui';
import { fetchPolicies } from '~/lib/graphql';
import VulnerabilityList from './vulnerability_list.vue';
import vulnerabilitiesQuery from '../graphql/instance_vulnerabilities.graphql';
import vulnerabilitiesQuery from '../graphql/queries/instance_vulnerabilities.query.graphql';
import { VULNERABILITIES_PER_PAGE } from '../store/constants';
import { preparePageInfo } from '../helpers';
......
<script>
import { GlButton } from '@gitlab/ui';
import produce from 'immer';
import getProjects from 'ee/security_dashboard/graphql/get_projects.query.graphql';
import projectsQuery from 'ee/security_dashboard/graphql/get_instance_security_dashboard_projects.query.graphql';
import addProjectToSecurityDashboard from 'ee/security_dashboard/graphql/add_project_to_security_dashboard.mutation.graphql';
import deleteProjectFromSecurityDashboard from 'ee/security_dashboard/graphql/delete_project_from_security_dashboard.mutation.graphql';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
import projectsQuery from 'ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql';
import addProjectToSecurityDashboard from 'ee/security_dashboard/graphql/mutations/add_project_to_security_dashboard.mutation.graphql';
import deleteProjectFromSecurityDashboard from 'ee/security_dashboard/graphql/mutations/delete_project_from_security_dashboard.mutation.graphql';
import { createInvalidProjectMessage } from 'ee/security_dashboard/utils/first_class_project_manager_utils';
import ProjectList from './project_list.vue';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
......
......@@ -6,9 +6,9 @@ import DashboardNotConfigured from './empty_states/group_dashboard_not_configure
import SecurityChartsLayout from './security_charts_layout.vue';
import VulnerabilityChart from './first_class_vulnerability_chart.vue';
import VulnerabilitySeverities from './first_class_vulnerability_severities.vue';
import vulnerabilityHistoryQuery from '../graphql/group_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from '../graphql/group_vulnerability_grades.query.graphql';
import vulnerableProjectsQuery from '../graphql/vulnerable_projects.query.graphql';
import vulnerabilityHistoryQuery from '../graphql/queries/group_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from '../graphql/queries/group_vulnerability_grades.query.graphql';
import vulnerableProjectsQuery from '../graphql/queries/vulnerable_projects.query.graphql';
export default {
components: {
......
......@@ -6,9 +6,9 @@ import DashboardNotConfigured from './empty_states/instance_dashboard_not_config
import SecurityChartsLayout from './security_charts_layout.vue';
import VulnerabilityChart from './first_class_vulnerability_chart.vue';
import VulnerabilitySeverities from './first_class_vulnerability_severities.vue';
import projectsQuery from '../graphql/get_instance_security_dashboard_projects.query.graphql';
import vulnerabilityHistoryQuery from '../graphql/instance_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from '../graphql/instance_vulnerability_grades.query.graphql';
import projectsQuery from '../graphql/queries/get_instance_security_dashboard_projects.query.graphql';
import vulnerabilityHistoryQuery from '../graphql/queries/instance_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from '../graphql/queries/instance_vulnerability_grades.query.graphql';
export default {
components: {
......
......@@ -5,7 +5,7 @@ import { s__ } from '~/locale';
import SecurityReportsSummary from './security_reports_summary.vue';
import SecurityDashboard from './security_dashboard_vuex.vue';
import { fetchPolicies } from '~/lib/graphql';
import pipelineSecurityReportSummaryQuery from '../graphql/pipeline_security_report_summary.query.graphql';
import pipelineSecurityReportSummaryQuery from '../graphql/queries/pipeline_security_report_summary.query.graphql';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
......
......@@ -3,7 +3,7 @@ import { GlLink } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import PipelineStatusBadge from './pipeline_status_badge.vue';
import projectAutoFixMrsCountQuery from '../graphql/project_auto_fix_mrs_count.query.graphql';
import projectAutoFixMrsCountQuery from '../graphql/queries/project_auto_fix_mrs_count.query.graphql';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
......
......@@ -7,7 +7,7 @@ import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility';
import { createProjectLoadingError } from '../helpers';
import DashboardNotConfigured from './empty_states/reports_not_configured.vue';
import SecurityChartsLayout from './security_charts_layout.vue';
import projectsHistoryQuery from '../graphql/project_vulnerabilities_by_day_and_count.graphql';
import projectsHistoryQuery from '../graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql';
const MAX_DAYS = 100;
const ISO_DATE = 'isoDate';
......
......@@ -2,9 +2,9 @@
import { GlAlert, GlLoadingIcon, GlIntersectionObserver } from '@gitlab/ui';
import produce from 'immer';
import { __ } from '~/locale';
import securityScannersQuery from '../graphql/project_security_scanners.graphql';
import vulnerabilitiesQuery from '../graphql/project_vulnerabilities.query.graphql';
import vulnerabilitiesQueryAutoFix from '../graphql/project_vulnerabilities_autofix.query.graphql';
import securityScannersQuery from '../graphql/queries/project_security_scanners.query.graphql';
import vulnerabilitiesQuery from '../graphql/queries/project_vulnerabilities.query.graphql';
import vulnerabilitiesQueryAutoFix from '../graphql/queries/project_vulnerabilities_autofix.query.graphql';
import { preparePageInfo } from '../helpers';
import { VULNERABILITIES_PER_PAGE } from '../store/constants';
import VulnerabilityList from './vulnerability_list.vue';
......
......@@ -3,7 +3,7 @@ import { GlButton, GlFormSelect } from '@gitlab/ui';
import { s__, n__ } from '~/locale';
import toast from '~/vue_shared/plugins/global_toast';
import createFlash from '~/flash';
import vulnerabilityDismiss from '../graphql/vulnerability_dismiss.mutation.graphql';
import vulnerabilityDismiss from '../graphql/mutations/vulnerability_dismiss.mutation.graphql';
const REASON_NONE = s__('SecurityReports|[No reason]');
const REASON_WONT_FIX = s__("SecurityReports|Won't fix / Accept risk");
......
<script>
import vulnerabilitySeveritiesCountQuery from '../graphql/vulnerability_severities_count.graphql';
import vulnerabilitySeveritiesCountQuery from '../graphql/queries/vulnerability_severities_count.query.graphql';
import VulnerabilityCountListLayout from './vulnerability_count_list_layout.vue';
import { vulnerabilitiesSeverityCountScopes } from '../constants';
......
#import "ee/security_dashboard/graphql/vulnerability_severities_count.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/vulnerability_severities_count.fragment.graphql"
fragment ProjectVulnerabilitySeveritiesCount on Project {
vulnerabilitySeveritiesCount {
......
import vulnerabilityConfirm from './vulnerability_confirm.mutation.graphql';
import vulnerabilityDismiss from './vulnerability_dismiss.mutation.graphql';
import vulnerabilityResolve from './vulnerability_resolve.mutation.graphql';
import vulnerabilityRevertToDetected from './vulnerability_revert_to_detected.mutation.graphql';
import vulnerabilityConfirm from './mutations/vulnerability_confirm.mutation.graphql';
import vulnerabilityDismiss from './mutations/vulnerability_dismiss.mutation.graphql';
import vulnerabilityResolve from './mutations/vulnerability_resolve.mutation.graphql';
import vulnerabilityRevertToDetected from './mutations/vulnerability_revert_to_detected.mutation.graphql';
export default {
revert: vulnerabilityRevertToDetected,
......
#import "ee/security_dashboard/graphql/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
mutation addProjectToSecurityDashboard($id: ID!) {
addProjectToSecurityDashboard(input: { id: $id }) {
......
#import "ee/security_dashboard/graphql/project.fragment.graphql"
#import "ee/security_dashboard/graphql/project_vulnerability_severities_count.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project_vulnerability_severities_count.fragment.graphql"
query projectsQuery {
instanceSecurityDashboard {
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "ee/security_dashboard/graphql/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
query getProjects(
$search: String!
......
#import "./vulnerability_scanner.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/vulnerability_scanner.fragment.graphql"
query groupSpecificScanners($fullPath: ID!) {
group(fullPath: $fullPath) {
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "./vulnerability.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql"
query group(
$fullPath: ID!
......
#import "ee/security_dashboard/graphql/project.fragment.graphql"
#import "ee/security_dashboard/graphql/project_vulnerability_severities_count.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project_vulnerability_severities_count.fragment.graphql"
query groupVulnerabilityGrades($fullPath: ID!) {
group(fullPath: $fullPath) {
......
#import "./vulnerability_scanner.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/vulnerability_scanner.fragment.graphql"
query instanceSpecificScanners {
instanceSecurityDashboard {
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "./vulnerability.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql"
query instance(
$after: String
......
#import "ee/security_dashboard/graphql/project.fragment.graphql"
#import "ee/security_dashboard/graphql/project_vulnerability_severities_count.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project_vulnerability_severities_count.fragment.graphql"
query instanceVulnerabilityGrades {
instanceSecurityDashboard {
......
#import "./vulnerability_scanner.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/vulnerability_scanner.fragment.graphql"
query projectSpecificScanners($fullPath: ID!) {
project(fullPath: $fullPath) {
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "./vulnerability.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql"
query project(
$fullPath: ID!
......
#import "~/graphql_shared/fragments/pageInfoCursorsOnly.fragment.graphql"
#import "./vulnerability.fragment.graphql"
#import "../fragments/vulnerability.fragment.graphql"
query project(
$fullPath: ID!
......
#import "ee/security_dashboard/graphql/vulnerability_severities_count.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/vulnerability_severities_count.fragment.graphql"
query vulnerabilitySeveritiesCount(
$fullPath: ID = ""
......
#import "./project.fragment.graphql"
#import "../fragments/project.fragment.graphql"
query group($fullPath: ID!) {
group(fullPath: $fullPath) {
......
......@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import ProjectList from 'ee/security_dashboard/components/first_class_project_manager/project_list.vue';
import ProjectManager from 'ee/security_dashboard/components/first_class_project_manager/project_manager.vue';
import getProjects from 'ee/security_dashboard/graphql/get_projects.query.graphql';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
import waitForPromises from 'helpers/wait_for_promises';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
......
......@@ -2,8 +2,8 @@ import { GlLink } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import VulnerabilitySeverity from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import groupVulnerabilityGradesQuery from 'ee/security_dashboard/graphql/group_vulnerability_grades.query.graphql';
import instanceVulnerabilityGradesQuery from 'ee/security_dashboard/graphql/instance_vulnerability_grades.query.graphql';
import groupVulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql';
import instanceVulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql';
import { severityGroupTypes } from 'ee/security_dashboard/store/modules/vulnerable_projects/constants';
import { Accordion, AccordionItem } from 'ee/vue_shared/components/accordion';
import { trimText } from 'helpers/text_helper';
......
......@@ -5,16 +5,19 @@ import VulnerabilityChart from 'ee/security_dashboard/components/first_class_vul
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import GroupSecurityCharts from 'ee/security_dashboard/components/group_security_charts.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_layout.vue';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/group_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/group_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql';
import { TEST_HOST } from 'jest/helpers/test_constants';
jest.mock('ee/security_dashboard/graphql/group_vulnerability_grades.query.graphql', () => ({
jest.mock('ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql', () => ({
mockGrades: true,
}));
jest.mock('ee/security_dashboard/graphql/group_vulnerability_history.query.graphql', () => ({
mockHistory: true,
}));
jest.mock(
'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql',
() => ({
mockHistory: true,
}),
);
describe('Group Security Charts component', () => {
let wrapper;
......
......@@ -5,15 +5,21 @@ import VulnerabilityChart from 'ee/security_dashboard/components/first_class_vul
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import InstanceSecurityCharts from 'ee/security_dashboard/components/instance_security_charts.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_layout.vue';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/instance_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/instance_vulnerability_history.query.graphql';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql';
jest.mock('ee/security_dashboard/graphql/instance_vulnerability_grades.query.graphql', () => ({
mockGrades: true,
}));
jest.mock('ee/security_dashboard/graphql/instance_vulnerability_history.query.graphql', () => ({
mockHistory: true,
}));
jest.mock(
'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql',
() => ({
mockGrades: true,
}),
);
jest.mock(
'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql',
() => ({
mockHistory: true,
}),
);
describe('Instance Security Charts component', () => {
let wrapper;
......
......@@ -5,7 +5,7 @@ import VueApollo from 'vue-apollo';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue';
import ProjectSecurityCharts from 'ee/security_dashboard/components/project_security_charts.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_layout.vue';
import projectsHistoryQuery from 'ee/security_dashboard/graphql/project_vulnerabilities_by_day_and_count.graphql';
import projectsHistoryQuery from 'ee/security_dashboard/graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql';
import createMockApollo from 'jest/helpers/mock_apollo_helper';
import {
mockProjectSecurityChartsWithData,
......
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