Commit 3e3c1cd9 authored by David O'Regan's avatar David O'Regan

Merge branch '284894-refactor-security-dashboards-folder-structure-part-3' into 'master'

Refactor folder structure for the security dashboards [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!63634
parents da3a6a5b ad9434db
......@@ -5,8 +5,8 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/grou
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash';
import DashboardNotConfigured from '../empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue';
import DashboardNotConfigured from '../shared/empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../shared/project_security_status_chart.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue';
......
......@@ -4,7 +4,7 @@ import produce from 'immer';
import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerabilities.query.graphql';
import { preparePageInfo } from 'ee/security_dashboard/helpers';
import { VULNERABILITIES_PER_PAGE } from 'ee/security_dashboard/store/constants';
import VulnerabilityList from '../vulnerability_list.vue';
import VulnerabilityList from '../shared/vulnerability_list.vue';
export default {
components: {
......
......@@ -5,8 +5,8 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/inst
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash';
import DashboardNotConfigured from '../empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue';
import DashboardNotConfigured from '../shared/empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../shared/project_security_status_chart.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue';
......
......@@ -5,7 +5,7 @@ import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/instance
import { preparePageInfo } from 'ee/security_dashboard/helpers';
import { VULNERABILITIES_PER_PAGE } from 'ee/security_dashboard/store/constants';
import { fetchPolicies } from '~/lib/graphql';
import VulnerabilityList from '../vulnerability_list.vue';
import VulnerabilityList from '../shared/vulnerability_list.vue';
export default {
components: {
......
<script>
import { GlBadge, GlButton, GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui';
import projectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash';
import { s__ } from '~/locale';
import ProjectAvatar from '~/vue_shared/components/project_avatar/default.vue';
import projectsQuery from '../../graphql/queries/instance_projects.query.graphql';
export default {
i18n: {
......
......@@ -5,7 +5,7 @@ import addProjectToSecurityDashboard from 'ee/security_dashboard/graphql/mutatio
import deleteProjectFromSecurityDashboard from 'ee/security_dashboard/graphql/mutations/delete_project_from_security_dashboard.mutation.graphql';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
import instanceProjectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql';
import { createInvalidProjectMessage } from 'ee/security_dashboard/utils/first_class_project_manager_utils';
import { createInvalidProjectMessage } from 'ee/security_dashboard/utils/project_manager_utils';
import createFlash from '~/flash';
import { __, s__, sprintf } from '~/locale';
import ProjectSelector from '~/vue_shared/components/project_selector/project_selector.vue';
......
......@@ -4,7 +4,7 @@ import { mapState, mapActions } from 'vuex';
import { severityFilter, pipelineScannerFilter } from 'ee/security_dashboard/helpers';
import { DISMISSAL_STATES } from 'ee/security_dashboard/store/modules/filters/constants';
import { s__ } from '~/locale';
import StandardFilter from '../filters/standard_filter.vue';
import StandardFilter from '../shared/filters/standard_filter.vue';
export default {
i18n: {
......
......@@ -4,7 +4,7 @@ import { produce } from 'immer';
import findingsQuery from 'ee/security_dashboard/graphql/queries/pipeline_findings.query.graphql';
import { preparePageInfo } from 'ee/security_dashboard/helpers';
import { VULNERABILITIES_PER_PAGE } from 'ee/security_dashboard/store/constants';
import VulnerabilityList from '../vulnerability_list.vue';
import VulnerabilityList from '../shared/vulnerability_list.vue';
export default {
name: 'PipelineFindings',
......
......@@ -5,7 +5,7 @@ import pipelineSecurityReportSummaryQuery from 'ee/security_dashboard/graphql/qu
import { fetchPolicies } from '~/lib/graphql';
import { s__ } from '~/locale';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import VulnerabilityReport from '../vulnerability_report.vue';
import VulnerabilityReport from '../shared/vulnerability_report.vue';
import ScanErrorsAlert from './scan_errors_alert.vue';
import SecurityDashboard from './security_dashboard_vuex.vue';
import SecurityReportsSummary from './security_reports_summary.vue';
......
......@@ -4,7 +4,7 @@ import PipelineArtifactDownload from 'ee/vue_shared/security_reports/components/
import IssueModal from 'ee/vue_shared/security_reports/components/modal.vue';
import { securityReportTypeEnumToReportType } from 'ee/vue_shared/security_reports/constants';
import { vulnerabilityModalMixin } from 'ee/vue_shared/security_reports/mixins/vulnerability_modal_mixin';
import VulnerabilityReportLayout from '../vulnerability_report_layout.vue';
import VulnerabilityReportLayout from '../shared/vulnerability_report_layout.vue';
import Filters from './filters.vue';
import LoadingError from './loading_error.vue';
import SecurityDashboardTable from './security_dashboard_table.vue';
......
......@@ -7,7 +7,7 @@ import createFlash from '~/flash';
import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility';
import { getSvgIconPathContent } from '~/lib/utils/icon_utils';
import { s__, __ } from '~/locale';
import DashboardNotConfigured from '../empty_states/reports_not_configured.vue';
import DashboardNotConfigured from '../shared/empty_states/reports_not_configured.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
const CHART_DEFAULT_DAYS = 30;
......
......@@ -10,7 +10,7 @@ import { VULNERABILITIES_PER_PAGE } from 'ee/security_dashboard/store/constants'
import { parseBoolean } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import VulnerabilityList from '../vulnerability_list.vue';
import VulnerabilityList from '../shared/vulnerability_list.vue';
import SecurityScannerAlert from './security_scanner_alert.vue';
export default {
......
<script>
import { GlDropdownDivider } from '@gitlab/ui';
import { xor, remove } from 'lodash';
import { activityOptions } from '../../helpers';
import { activityOptions } from 'ee/security_dashboard/helpers';
import FilterBody from './filter_body.vue';
import FilterItem from './filter_item.vue';
import StandardFilter from './standard_filter.vue';
......
......@@ -6,11 +6,11 @@ import {
scannerFilter,
activityFilter,
getProjectFilter,
} from '../helpers';
import { DASHBOARD_TYPES } from '../store/constants';
import ActivityFilter from './filters/activity_filter.vue';
import ScannerFilter from './filters/scanner_filter.vue';
import StandardFilter from './filters/standard_filter.vue';
} from 'ee/security_dashboard/helpers';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import ActivityFilter from './activity_filter.vue';
import ScannerFilter from './scanner_filter.vue';
import StandardFilter from './standard_filter.vue';
export default {
components: { StandardFilter, ScannerFilter, ActivityFilter },
......
......@@ -2,7 +2,7 @@
import { GlDropdownDivider, GlDropdownItem, GlTruncate } from '@gitlab/ui';
import { union, without, get, set, keyBy } from 'lodash';
import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants';
import { createScannerOption } from '../../helpers';
import { createScannerOption } from 'ee/security_dashboard/helpers';
import FilterBody from './filter_body.vue';
import FilterItem from './filter_item.vue';
import StandardFilter from './standard_filter.vue';
......
<script>
import { GlLink } from '@gitlab/ui';
import projectAutoFixMrsCountQuery from 'ee/security_dashboard/graphql/queries/project_auto_fix_mrs_count.query.graphql';
import { __, s__ } from '~/locale';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import projectAutoFixMrsCountQuery from '../graphql/queries/project_auto_fix_mrs_count.query.graphql';
import PipelineStatusBadge from './pipeline_status_badge.vue';
export default {
......
<script>
import { GlCollapse, GlButton, GlAlert } from '@gitlab/ui';
import vulnerabilityStateMutations from 'ee/security_dashboard/graphql/mutate_vulnerability_state';
import eventHub from 'ee/security_dashboard/utils/event_hub';
import { __, s__, n__ } from '~/locale';
import toast from '~/vue_shared/plugins/global_toast';
import eventHub from '../utils/event_hub';
import StatusDropdown from './status_dropdown.vue';
export default {
......
......@@ -11,7 +11,7 @@ import {
} from '~/lib/utils/datetime_utility';
import { formattedChangeInPercent } from '~/lib/utils/number_utils';
import { s__, sprintf } from '~/locale';
import ChartButtons from '../vulnerability_chart_buttons.vue';
import ChartButtons from './vulnerabilities_over_time_chart_buttons.vue';
const ISO_DATE = 'isoDate';
const TH_CLASS = 'gl-bg-white!';
......
<script>
import vulnerabilitySeveritiesCountQuery from '../graphql/queries/vulnerability_severities_count.query.graphql';
import { DASHBOARD_TYPES } from '../store/constants';
import eventHub from '../utils/event_hub';
import vulnerabilitySeveritiesCountQuery from 'ee/security_dashboard/graphql/queries/vulnerability_severities_count.query.graphql';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import eventHub from 'ee/security_dashboard/utils/event_hub';
import VulnerabilityCountListLayout from './vulnerability_count_list_layout.vue';
export default {
......
<script>
import { GlAlert } from '@gitlab/ui';
import { SEVERITIES } from '../store/modules/vulnerabilities/constants';
import { SEVERITIES } from 'ee/security_dashboard/store/modules/vulnerabilities/constants';
import VulnerabilityCount from './vulnerability_count.vue';
export default {
......
......@@ -8,10 +8,9 @@ import {
GlTooltipDirective,
GlTable,
} from '@gitlab/ui';
import AutoFixHelpText from 'ee/security_dashboard/components/auto_fix_help_text.vue';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/empty_states/dashboard_has_no_vulnerabilities.vue';
import FiltersProducedNoResults from 'ee/security_dashboard/components/empty_states/filters_produced_no_results.vue';
import VulnerabilityCommentIcon from 'ee/security_dashboard/components/vulnerability_comment_icon.vue';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/shared/empty_states/dashboard_has_no_vulnerabilities.vue';
import FiltersProducedNoResults from 'ee/security_dashboard/components/shared/empty_states/filters_produced_no_results.vue';
import { VULNERABILITIES_PER_PAGE, DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue';
import convertReportType from 'ee/vue_shared/security_reports/store/utils/convert_report_type';
import getPrimaryIdentifier from 'ee/vue_shared/security_reports/store/utils/get_primary_identifier';
......@@ -20,9 +19,10 @@ import { VULNERABILITY_STATES } from 'ee/vulnerabilities/constants';
import { formatDate } from '~/lib/utils/datetime_utility';
import { convertToSnakeCase } from '~/lib/utils/text_utility';
import { s__, __ } from '~/locale';
import { VULNERABILITIES_PER_PAGE, DASHBOARD_TYPES } from '../store/constants';
import AutoFixHelpText from './auto_fix_help_text.vue';
import IssuesBadge from './issues_badge.vue';
import SelectionSummary from './selection_summary.vue';
import VulnerabilityCommentIcon from './vulnerability_comment_icon.vue';
export default {
components: {
......
......@@ -2,23 +2,23 @@
import { GlLoadingIcon } from '@gitlab/ui';
import Cookies from 'js-cookie';
import { PortalTarget } from 'portal-vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
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 { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import groupProjectsQuery from '../graphql/queries/group_projects.query.graphql';
import instanceProjectsQuery from '../graphql/queries/instance_projects.query.graphql';
import GroupVulnerabilities from '../group/group_vulnerabilities.vue';
import InstanceVulnerabilities from '../instance/instance_vulnerabilities.vue';
import PipelineFindings from '../pipeline/pipeline_findings.vue';
import ProjectVulnerabilities from '../project/project_vulnerabilities.vue';
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';
import DashboardNotConfiguredInstance from './empty_states/instance_dashboard_not_configured.vue';
import DashboardNotConfiguredProject from './empty_states/reports_not_configured.vue';
import GroupVulnerabilities from './group/group_vulnerabilities.vue';
import InstanceVulnerabilities from './instance/instance_vulnerabilities.vue';
import PipelineFindings from './pipeline/pipeline_findings.vue';
import ProjectVulnerabilities from './project/project_vulnerabilities.vue';
import Filters from './filters/filters_layout.vue';
import ProjectPipelineStatus from './project_pipeline_status.vue';
import SurveyRequestBanner from './shared/survey_request_banner.vue';
import SurveyRequestBanner from './survey_request_banner.vue';
import VulnerabilitiesCountList from './vulnerability_count_list.vue';
import VulnerabilityReportLayout from './vulnerability_report_layout.vue';
......
<script>
import { GlBadge, GlTabs, GlTab, GlLink, GlIcon } from '@gitlab/ui';
import { mapActions, mapGetters, mapState } from 'vuex';
import UnscannedProjectsTabContent from './unscanned_projects_tab_content.vue';
export default {
components: { GlBadge, GlTabs, GlTab, GlLink, GlIcon, UnscannedProjectsTabContent },
props: {
endpoint: {
type: String,
required: true,
},
helpPath: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapState('unscannedProjects', ['isLoading']),
...mapGetters('unscannedProjects', [
'outdatedProjects',
'outdatedProjectsCount',
'untestedProjects',
'untestedProjectsCount',
]),
hasOutdatedProjects() {
return this.outdatedProjectsCount > 0;
},
hasUntestedProjects() {
return this.untestedProjectsCount > 0;
},
},
created() {
this.fetchUnscannedProjects(this.endpoint);
},
methods: {
...mapActions('unscannedProjects', ['fetchUnscannedProjects']),
},
};
</script>
<template>
<section class="border rounded">
<header class="px-3 pt-3 mb-0">
<h4 class="my-0">
{{ s__('UnscannedProjects|Project scanning') }}
<gl-link
v-if="helpPath"
:href="helpPath"
:title="__('Project scanning help page')"
target="_blank"
><gl-icon name="question" :size="12" class="align-top"
/></gl-link>
</h4>
<p class="text-secondary mb-0">
{{ s__('UnscannedProjects|Default branch scanning by project') }}
</p>
</header>
<div>
<gl-tabs>
<gl-tab ref="outdatedProjectsTab" title-item-class="ml-3">
<template #title>
{{ s__('UnscannedProjects|Out of date') }}
<gl-badge
v-if="!isLoading"
ref="outdatedProjectsCount"
size="sm"
class="gl-tab-counter-badge"
pill
>{{ outdatedProjectsCount }}
</gl-badge>
</template>
<unscanned-projects-tab-content :is-loading="isLoading" :is-empty="!hasOutdatedProjects">
<div v-for="dateRange in outdatedProjects" :key="dateRange.fromDay" class="mb-3">
<h5 class="m-0">{{ dateRange.description }}</h5>
<ul class="list-unstyled mb-0">
<li v-for="project in dateRange.projects" :key="project.id" class="mt-1">
<gl-link target="_blank" :href="`${project.fullPath}/pipelines`">{{
project.fullName
}}</gl-link>
</li>
</ul>
</div>
</unscanned-projects-tab-content>
</gl-tab>
<gl-tab ref="untestedProjectsTab" title-item-class="ml-3">
<template #title>
{{ s__('UnscannedProjects|Untested') }}
<gl-badge
v-if="!isLoading"
ref="untestedProjectsCount"
size="sm"
class="gl-tab-counter-badge"
pill
>{{ untestedProjectsCount }}
</gl-badge>
</template>
<unscanned-projects-tab-content :is-loading="isLoading" :is-empty="!hasUntestedProjects">
<ul class="list-unstyled m-0">
<li v-for="project in untestedProjects" :key="project.id" class="mb-1">
<gl-link target="_blank" :href="`${project.fullPath}/security/configuration`">{{
project.fullName
}}</gl-link>
</li>
</ul>
</unscanned-projects-tab-content>
</gl-tab>
</gl-tabs>
</div>
</section>
</template>
<script>
import { GlLoadingIcon } from '@gitlab/ui';
export default {
components: {
GlLoadingIcon,
},
props: {
isLoading: {
type: Boolean,
required: false,
default: false,
},
isEmpty: {
type: Boolean,
required: false,
default: false,
},
},
// The fixed height prevents the tab-content from jumping around and is set to match the other widgets
// within the aside.
// Details: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24242#note_282008456
wrapperHeight: '15rem',
};
</script>
<template>
<div class="mx-3 my-2 overflow-auto" :style="{ height: $options.wrapperHeight }">
<gl-loading-icon v-if="isLoading" size="sm" />
<template v-else>
<template v-if="!isEmpty">
<slot></slot>
</template>
<p v-else class="mb-0">
{{ s__('UnscannedProjects|Your projects are up do date! Nice job!') }}
</p>
</template>
</div>
</template>
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import ProjectManager from './components/first_class_project_manager/project_manager.vue';
import ProjectManager from './components/instance/project_manager.vue';
import apolloProvider from './graphql/provider';
export default (el) => {
......
......@@ -4,7 +4,7 @@ import { parseBoolean } from '~/lib/utils/common_utils';
import GroupSecurityCharts from './components/group/group_security_dashboard.vue';
import InstanceSecurityCharts from './components/instance/instance_security_dashboard.vue';
import ProjectSecurityCharts from './components/project/project_security_dashboard.vue';
import UnavailableState from './components/unavailable_state.vue';
import UnavailableState from './components/shared/empty_states/unavailable_state.vue';
import apolloProvider from './graphql/provider';
import createRouter from './router';
import createStore from './store';
......
import Vue from 'vue';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { parseBoolean } from '~/lib/utils/common_utils';
import UnavailableState from './components/unavailable_state.vue';
import VulnerabilityReport from './components/vulnerability_report.vue';
import UnavailableState from './components/shared/empty_states/unavailable_state.vue';
import VulnerabilityReport from './components/shared/vulnerability_report.vue';
import apolloProvider from './graphql/provider';
import createRouter from './router';
import createStore from './store';
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UnscannedProjects component header matches the snapshot when the "helpPath" prop is empty 1`] = `
<header
class="px-3 pt-3 mb-0"
>
<h4
class="my-0"
>
Project scanning
<!---->
</h4>
<p
class="text-secondary mb-0"
>
Default branch scanning by project
</p>
</header>
`;
exports[`UnscannedProjects component header matches the snapshot when the "helpPath" prop is not empty 1`] = `
<header
class="px-3 pt-3 mb-0"
>
<h4
class="my-0"
>
Project scanning
<a
class="gl-link"
href="/foo/bar/help"
rel="noopener"
target="_blank"
title="Project scanning help page"
>
<svg
aria-hidden="true"
class="align-top gl-icon s12"
data-testid="question-icon"
role="img"
>
<use
href="#question"
/>
</svg>
</a>
</h4>
<p
class="text-secondary mb-0"
>
Default branch scanning by project
</p>
</header>
`;
exports[`UnscannedProjects component tab content shows a list of outdated projects 1`] = `
<div
class="mx-3 my-2 overflow-auto"
style="height: 15rem;"
>
<div
class="mb-3"
>
<h5
class="m-0"
>
Outdated Projects Group 1
</h5>
<ul
class="list-unstyled mb-0"
>
<li
class="mt-1"
>
<a
class="gl-link"
href="/outdated-project-1/pipelines"
rel="noopener"
target="_blank"
>
Outdated Project One
</a>
</li>
</ul>
</div>
<div
class="mb-3"
>
<h5
class="m-0"
>
Outdated Projects Group 2
</h5>
<ul
class="list-unstyled mb-0"
>
<li
class="mt-1"
>
<a
class="gl-link"
href="/outdated-project-2/pipelines"
rel="noopener"
target="_blank"
>
Outdated Project Two
</a>
</li>
</ul>
</div>
</div>
`;
exports[`UnscannedProjects component tab content shows a list of untested projects 1`] = `
<div
class="mx-3 my-2 overflow-auto"
style="height: 15rem;"
>
<ul
class="list-unstyled m-0"
>
<li
class="mb-1"
>
<a
class="gl-link"
href="/untested-1/security/configuration"
rel="noopener"
target="_blank"
>
Untested Project One
</a>
</li>
<li
class="mb-1"
>
<a
class="gl-link"
href="/untested-2/security/configuration"
rel="noopener"
target="_blank"
>
Untested Project Two
</a>
</li>
</ul>
</div>
`;
import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import GroupSecurityDashboard from 'ee/security_dashboard/components/group/group_security_dashboard.vue';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/shared/project_security_status_chart.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart.vue';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql';
......
......@@ -2,7 +2,7 @@ import { GlAlert, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import GroupVulnerabilities from 'ee/security_dashboard/components/group/group_vulnerabilities.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
import VulnerabilityList from 'ee/security_dashboard/components/shared/vulnerability_list.vue';
import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerabilities.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper';
import { generateVulnerabilities } from '../mock_data';
......
import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import InstanceSecurityDashboard from 'ee/security_dashboard/components/instance/instance_security_dashboard.vue';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/shared/project_security_status_chart.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart.vue';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql';
......
......@@ -2,7 +2,7 @@ import { GlAlert, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import InstanceVulnerabilities from 'ee/security_dashboard/components/instance/instance_vulnerabilities.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
import VulnerabilityList from 'ee/security_dashboard/components/shared/vulnerability_list.vue';
import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerabilities.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper';
import { generateVulnerabilities } from '../mock_data';
......
import { GlBadge, GlLoadingIcon } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import ProjectList from 'ee/security_dashboard/components/first_class_project_manager/project_list.vue';
import ProjectList from 'ee/security_dashboard/components/instance/project_list.vue';
import projectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
......
import { GlButton } from '@gitlab/ui';
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 ProjectList from 'ee/security_dashboard/components/instance/project_list.vue';
import ProjectManager from 'ee/security_dashboard/components/instance/project_manager.vue';
import getProjects from 'ee/security_dashboard/graphql/queries/get_projects.query.graphql';
import waitForPromises from 'helpers/wait_for_promises';
import createFlash from '~/flash';
......
......@@ -2,7 +2,7 @@ import { GlAlert, GlIntersectionObserver, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import PipelineFindings from 'ee/security_dashboard/components/pipeline/pipeline_findings.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
import VulnerabilityList from 'ee/security_dashboard/components/shared/vulnerability_list.vue';
import pipelineFindingsQuery from 'ee/security_dashboard/graphql/queries/pipeline_findings.query.graphql';
import createMockApollo from 'helpers/mock_apollo_helper';
import { mockPipelineFindingsResponse } from '../../mock_data';
......
......@@ -5,7 +5,7 @@ import PipelineSecurityDashboard from 'ee/security_dashboard/components/pipeline
import ScanErrorsAlert from 'ee/security_dashboard/components/pipeline/scan_errors_alert.vue';
import SecurityDashboard from 'ee/security_dashboard/components/pipeline/security_dashboard_vuex.vue';
import SecurityReportsSummary from 'ee/security_dashboard/components/pipeline/security_reports_summary.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/shared/vulnerability_report.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
......
......@@ -7,7 +7,7 @@ import Filters from 'ee/security_dashboard/components/pipeline/filters.vue';
import LoadingError from 'ee/security_dashboard/components/pipeline/loading_error.vue';
import SecurityDashboardTable from 'ee/security_dashboard/components/pipeline/security_dashboard_table.vue';
import SecurityDashboard from 'ee/security_dashboard/components/pipeline/security_dashboard_vuex.vue';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/shared/vulnerability_report_layout.vue';
import { getStoreConfig } from 'ee/security_dashboard/store';
import { VULNERABILITY_MODAL_ID } from 'ee/vue_shared/security_reports/components/constants';
import IssueModal from 'ee/vue_shared/security_reports/components/modal.vue';
......
......@@ -2,8 +2,8 @@ import { GlLoadingIcon } from '@gitlab/ui';
import { GlLineChart } from '@gitlab/ui/dist/charts';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue';
import ProjectSecurityDashboard from 'ee/security_dashboard/components/project/project_security_dashboard.vue';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/reports_not_configured.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/shared/security_dashboard_layout.vue';
import projectsHistoryQuery from 'ee/security_dashboard/graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql';
import { useFakeDate } from 'helpers/fake_date';
......
......@@ -4,7 +4,7 @@ import { Portal } from 'portal-vue';
import VueApollo from 'vue-apollo';
import ProjectVulnerabilities from 'ee/security_dashboard/components/project/project_vulnerabilities.vue';
import SecurityScannerAlert from 'ee/security_dashboard/components/project/security_scanner_alert.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
import VulnerabilityList from 'ee/security_dashboard/components/shared/vulnerability_list.vue';
import securityScannersQuery from 'ee/security_dashboard/graphql/queries/project_security_scanners.query.graphql';
import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/project_vulnerabilities.query.graphql';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
......
import { mount } from '@vue/test-utils';
import AutoFixHelpText from 'ee/security_dashboard/components/auto_fix_help_text.vue';
import AutoFixHelpText from 'ee/security_dashboard/components/shared/auto_fix_help_text.vue';
const TEST_MERGE_REQUEST_DATA = {
webUrl: 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48820',
......
import { GlBanner } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import AutoFixUserCallout from 'ee/security_dashboard/components/auto_fix_user_callout.vue';
import AutoFixUserCallout from 'ee/security_dashboard/components/shared/auto_fix_user_callout.vue';
describe('AutoFixUserCallout', () => {
let wrapper;
......
......@@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import CsvExportButton, {
STORAGE_KEY,
} from 'ee/security_dashboard/components/csv_export_button.vue';
} from 'ee/security_dashboard/components/shared/csv_export_button.vue';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { TEST_HOST } from 'helpers/test_constants';
import createFlash from '~/flash';
......
import { mount } from '@vue/test-utils';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/empty_states/dashboard_has_no_vulnerabilities.vue';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/shared/empty_states/dashboard_has_no_vulnerabilities.vue';
describe('dashboard has no vulnerabilities empty state', () => {
let wrapper;
......
import { GlEmptyState } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import FiltersProducedNoResults from 'ee/security_dashboard/components/empty_states/filters_produced_no_results.vue';
import FiltersProducedNoResults from 'ee/security_dashboard/components/shared/empty_states/filters_produced_no_results.vue';
describe('filters produced no results empty state', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/group_dashboard_not_configured.vue';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/group_dashboard_not_configured.vue';
describe('Group Security Dashboard Empty State', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/instance_dashboard_not_configured.vue';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/instance_dashboard_not_configured.vue';
describe('Instance Security Dashboard Empty State', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import ReportsNotConfigured from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue';
import ReportsNotConfigured from 'ee/security_dashboard/components/shared/empty_states/reports_not_configured.vue';
describe('reports not configured empty state', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import ActivityFilter from 'ee/security_dashboard/components/filters/activity_filter.vue';
import ActivityFilter from 'ee/security_dashboard/components/shared/filters/activity_filter.vue';
import { activityFilter, activityOptions } from 'ee/security_dashboard/helpers';
const { NO_ACTIVITY, WITH_ISSUES, NO_LONGER_DETECTED } = activityOptions;
......
import { GlDropdown, GlSearchBoxByType, GlLoadingIcon } from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import FilterBody from 'ee/security_dashboard/components/filters/filter_body.vue';
import FilterBody from 'ee/security_dashboard/components/shared/filters/filter_body.vue';
describe('Filter Body component', () => {
let wrapper;
......
import { GlDropdownItem, GlTruncate } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import FilterItem from 'ee/security_dashboard/components/filters/filter_item.vue';
import FilterItem from 'ee/security_dashboard/components/shared/filters/filter_item.vue';
describe('Filter Item component', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import ActivityFilter from 'ee/security_dashboard/components/filters/activity_filter.vue';
import ScannerFilter from 'ee/security_dashboard/components/filters/scanner_filter.vue';
import StandardFilter from 'ee/security_dashboard/components/filters/standard_filter.vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import ActivityFilter from 'ee/security_dashboard/components/shared/filters/activity_filter.vue';
import Filters from 'ee/security_dashboard/components/shared/filters/filters_layout.vue';
import ScannerFilter from 'ee/security_dashboard/components/shared/filters/scanner_filter.vue';
import StandardFilter from 'ee/security_dashboard/components/shared/filters/standard_filter.vue';
import { getProjectFilter } from 'ee/security_dashboard/helpers';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
......
......@@ -2,8 +2,8 @@ import { GlDropdownItem, GlDropdownDivider } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { sampleSize, cloneDeep } from 'lodash';
import VueRouter from 'vue-router';
import FilterItem from 'ee/security_dashboard/components/filters/filter_item.vue';
import ScannerFilter from 'ee/security_dashboard/components/filters/scanner_filter.vue';
import FilterItem from 'ee/security_dashboard/components/shared/filters/filter_item.vue';
import ScannerFilter from 'ee/security_dashboard/components/shared/filters/scanner_filter.vue';
import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants';
import { scannerFilter } from 'ee/security_dashboard/helpers';
......
import { createLocalVue, shallowMount } from '@vue/test-utils';
import VueRouter from 'vue-router';
import FilterBody from 'ee/security_dashboard/components/filters/filter_body.vue';
import StandardFilter from 'ee/security_dashboard/components/filters/standard_filter.vue';
import FilterBody from 'ee/security_dashboard/components/shared/filters/filter_body.vue';
import StandardFilter from 'ee/security_dashboard/components/shared/filters/standard_filter.vue';
const localVue = createLocalVue();
localVue.use(VueRouter);
......
import { GlIcon, GlPopover, GlBadge } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import IssuesBadge from 'ee/security_dashboard/components/issues_badge.vue';
import IssuesBadge from 'ee/security_dashboard/components/shared/issues_badge.vue';
import IssueLink from 'ee/vulnerabilities/components/issue_link.vue';
describe('Remediated badge component', () => {
......
import { GlBadge, GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import PipelineStatusBadge from 'ee/security_dashboard/components/pipeline_status_badge.vue';
import PipelineStatusBadge from 'ee/security_dashboard/components/shared/pipeline_status_badge.vue';
describe('Pipeline status badge', () => {
let wrapper;
......
......@@ -2,8 +2,8 @@ import { GlLink } from '@gitlab/ui';
import { within } from '@testing-library/dom';
import { shallowMount } from '@vue/test-utils';
import { merge } from 'lodash';
import PipelineStatusBadge from 'ee/security_dashboard/components/pipeline_status_badge.vue';
import ProjectPipelineStatus from 'ee/security_dashboard/components/project_pipeline_status.vue';
import PipelineStatusBadge from 'ee/security_dashboard/components/shared/pipeline_status_badge.vue';
import ProjectPipelineStatus from 'ee/security_dashboard/components/shared/project_pipeline_status.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
......
import { GlLink, GlLoadingIcon } 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 VulnerabilitySeverity from 'ee/security_dashboard/components/shared/project_security_status_chart.vue';
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';
......@@ -13,7 +13,7 @@ import {
mockProjectsWithSeverityCounts,
mockInstanceVulnerabilityGrades,
mockGroupVulnerabilityGrades,
} from '../mock_data';
} from '../../mock_data';
const localVue = createLocalVue();
localVue.use(VueApollo);
......
import { GlAlert } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import SelectionSummary from 'ee/security_dashboard/components/selection_summary.vue';
import StatusDropdown from 'ee/security_dashboard/components/status_dropdown.vue';
import SelectionSummary from 'ee/security_dashboard/components/shared/selection_summary.vue';
import StatusDropdown from 'ee/security_dashboard/components/shared/status_dropdown.vue';
import vulnerabilityStateMutations from 'ee/security_dashboard/graphql/mutate_vulnerability_state';
import eventHub from 'ee/security_dashboard/utils/event_hub';
import createMockApollo from 'helpers/mock_apollo_helper';
......
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import StatusDropdown from 'ee/security_dashboard/components/status_dropdown.vue';
import StatusDropdown from 'ee/security_dashboard/components/shared/status_dropdown.vue';
import { VULNERABILITY_STATE_OBJECTS } from 'ee/vulnerabilities/constants';
describe('Status Dropdown component', () => {
......
import { shallowMount, mount, createLocalVue } from '@vue/test-utils';
import Vue from 'vue';
import component from 'ee/security_dashboard/components/vulnerability_chart_buttons.vue';
import component from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart_buttons.vue';
import { DAYS } from 'ee/security_dashboard/store/constants';
const localVue = createLocalVue();
......
import { GlLoadingIcon, GlTable } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import VulnerabilitiesOverTimeChart from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart.vue';
import ChartButtons from 'ee/security_dashboard/components/vulnerability_chart_buttons.vue';
import ChartButtons from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart_buttons.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
describe('Vulnerabilities Over Time Chart Component', () => {
......
import { GlAlert } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import VulnerabilityCount from 'ee/security_dashboard/components/vulnerability_count.vue';
import VulnerabilityCountListLayout from 'ee/security_dashboard/components/vulnerability_count_list_layout.vue';
import VulnerabilityCount from 'ee/security_dashboard/components/shared/vulnerability_count.vue';
import VulnerabilityCountListLayout from 'ee/security_dashboard/components/shared/vulnerability_count_list_layout.vue';
describe('Vulnerabilities count list component', () => {
let wrapper;
......
import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo';
import VulnerabilityCountList from 'ee/security_dashboard/components/vulnerability_count_list.vue';
import VulnerabilityCountListLayout from 'ee/security_dashboard/components/vulnerability_count_list_layout.vue';
import VulnerabilityCountList from 'ee/security_dashboard/components/shared/vulnerability_count_list.vue';
import VulnerabilityCountListLayout from 'ee/security_dashboard/components/shared/vulnerability_count_list_layout.vue';
import countQuery from 'ee/security_dashboard/graphql/queries/vulnerability_severities_count.query.graphql';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import eventHub from 'ee/security_dashboard/utils/event_hub';
import createMockApollo from 'helpers/mock_apollo_helper';
import { mockVulnerabilitySeveritiesGraphQLResponse } from '../mock_data';
import { mockVulnerabilitySeveritiesGraphQLResponse } from '../../mock_data';
const localVue = createLocalVue();
localVue.use(VueApollo);
......
import { GlCard } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import VulnerabilityCount from 'ee/security_dashboard/components/vulnerability_count.vue';
import VulnerabilityCount from 'ee/security_dashboard/components/shared/vulnerability_count.vue';
import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue';
describe('Vulnerability Count', () => {
......
import { GlDeprecatedSkeletonLoading as GlSkeletonLoading, GlTable, GlTruncate } from '@gitlab/ui';
import { capitalize } from 'lodash';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/empty_states/dashboard_has_no_vulnerabilities.vue';
import FiltersProducedNoResults from 'ee/security_dashboard/components/empty_states/filters_produced_no_results.vue';
import IssuesBadge from 'ee/security_dashboard/components/issues_badge.vue';
import SelectionSummary from 'ee/security_dashboard/components/selection_summary.vue';
import VulnerabilityCommentIcon from 'ee/security_dashboard/components/vulnerability_comment_icon.vue';
import VulnerabilityList from 'ee/security_dashboard/components/vulnerability_list.vue';
import DashboardHasNoVulnerabilities from 'ee/security_dashboard/components/shared/empty_states/dashboard_has_no_vulnerabilities.vue';
import FiltersProducedNoResults from 'ee/security_dashboard/components/shared/empty_states/filters_produced_no_results.vue';
import IssuesBadge from 'ee/security_dashboard/components/shared/issues_badge.vue';
import SelectionSummary from 'ee/security_dashboard/components/shared/selection_summary.vue';
import VulnerabilityCommentIcon from 'ee/security_dashboard/components/shared/vulnerability_comment_icon.vue';
import VulnerabilityList from 'ee/security_dashboard/components/shared/vulnerability_list.vue';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import RemediatedBadge from 'ee/vulnerabilities/components/remediated_badge.vue';
import { trimText } from 'helpers/text_helper';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { generateVulnerabilities, vulnerabilities } from './mock_data';
import { generateVulnerabilities, vulnerabilities } from '../mock_data';
describe('Vulnerability list component', () => {
let wrapper;
......
import { shallowMount } from '@vue/test-utils';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/shared/vulnerability_report_layout.vue';
describe('Vulnerability Report Layout component', () => {
let wrapper;
......
......@@ -4,25 +4,25 @@ import Cookies from 'js-cookie';
import { PortalTarget } from 'portal-vue';
import { nextTick } from 'vue';
import VueApollo from 'vue-apollo';
import AutoFixUserCallout from 'ee/security_dashboard/components/auto_fix_user_callout.vue';
import CsvExportButton from 'ee/security_dashboard/components/csv_export_button.vue';
import DashboardNotConfiguredGroup from 'ee/security_dashboard/components/empty_states/group_dashboard_not_configured.vue';
import DashboardNotConfiguredInstance from 'ee/security_dashboard/components/empty_states/instance_dashboard_not_configured.vue';
import DashboardNotConfiguredProject from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import GroupVulnerabilities from 'ee/security_dashboard/components/group/group_vulnerabilities.vue';
import InstanceVulnerabilities from 'ee/security_dashboard/components/instance/instance_vulnerabilities.vue';
import ProjectVulnerabilities from 'ee/security_dashboard/components/project/project_vulnerabilities.vue';
import ProjectPipelineStatus from 'ee/security_dashboard/components/project_pipeline_status.vue';
import AutoFixUserCallout from 'ee/security_dashboard/components/shared/auto_fix_user_callout.vue';
import CsvExportButton from 'ee/security_dashboard/components/shared/csv_export_button.vue';
import DashboardNotConfiguredGroup from 'ee/security_dashboard/components/shared/empty_states/group_dashboard_not_configured.vue';
import DashboardNotConfiguredInstance from 'ee/security_dashboard/components/shared/empty_states/instance_dashboard_not_configured.vue';
import DashboardNotConfiguredProject from 'ee/security_dashboard/components/shared/empty_states/reports_not_configured.vue';
import Filters from 'ee/security_dashboard/components/shared/filters/filters_layout.vue';
import ProjectPipelineStatus from 'ee/security_dashboard/components/shared/project_pipeline_status.vue';
import SurveyRequestBanner from 'ee/security_dashboard/components/shared/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 VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
import VulnerabilitiesCountList from 'ee/security_dashboard/components/shared/vulnerability_count_list.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/shared/vulnerability_report.vue';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/shared/vulnerability_report_layout.vue';
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';
import { mockVulnerableProjectsInstance, mockVulnerableProjectsGroup } from '../../mock_data';
describe('Vulnerability Report', () => {
let wrapper;
......
import { GlTab } from '@gitlab/ui';
import { mount, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import UnscannedProjects from 'ee/security_dashboard/components/unscanned_projects.vue';
import TabContent from 'ee/security_dashboard/components/unscanned_projects_tab_content.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('UnscannedProjects component', () => {
let wrapper;
const defaultPropsData = { endpoint: 'foo/bar/endpoint', helpPath: 'foo/bar/help' };
const defaultState = {
isLoading: false,
projects: [],
};
const defaultGetters = {
outdatedProjects: () => [],
untestedProjects: () => [],
outdatedProjectsCount: () => 1,
untestedProjectsCount: () => 1,
};
const defaultActions = {
fetchUnscannedProjects: jest.fn(),
};
const factory = ({ getters = {}, propsData = {}, state = {} } = {}) => {
const store = new Vuex.Store({
modules: {
unscannedProjects: {
namespaced: true,
actions: defaultActions,
getters: { ...defaultGetters, ...getters },
state: { ...defaultState, ...state },
},
},
});
wrapper = mount(UnscannedProjects, {
propsData: { ...defaultPropsData, ...propsData },
store,
localVue,
});
};
const outdatedProjectsTab = () => wrapper.find({ ref: 'outdatedProjectsTab' });
const untestedProjectsTab = () => wrapper.find({ ref: 'untestedProjectsTab' });
const outdatedProjectsTabContent = () => outdatedProjectsTab().find(TabContent);
const untestedProjectsTabContent = () => untestedProjectsTab().find(TabContent);
const outdatedProjectsCount = () => wrapper.find({ ref: 'outdatedProjectsCount' });
const untestedProjectsCount = () => wrapper.find({ ref: 'untestedProjectsCount' });
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('lifecycle hooks', () => {
it('fetches projects from the given endpoint when the component is created', () => {
factory();
expect(defaultActions.fetchUnscannedProjects).toHaveBeenCalledTimes(1);
expect(defaultActions.fetchUnscannedProjects.mock.calls[0][1]).toBe(
defaultPropsData.endpoint,
);
});
});
describe('header', () => {
it.each`
helpPath | description
${'/foo/bar/help'} | ${'not empty'}
${null} | ${'empty'}
`('matches the snapshot when the "helpPath" prop is $description', ({ helpPath }) => {
factory({ propsData: { helpPath } });
expect(wrapper.find('header').element).toMatchSnapshot();
});
});
describe('tab buttons', () => {
it('shows a tab-button for projects which have outdated security scanning', () => {
factory();
expect(outdatedProjectsTab().is(GlTab)).toBe(true);
});
it.each`
type | projectsCount
${'outdated'} | ${outdatedProjectsCount}
${'untested'} | ${untestedProjectsCount}
`(`shows a count of $type projects`, ({ type, projectsCount }) => {
factory({
getters: {
[`${type}ProjectsCount`]: () => 99,
},
});
return wrapper.vm.$nextTick().then(() => {
expect(projectsCount().text()).toContain(99);
});
});
it('shows a tab-button for projects which have no security scanning configured', () => {
factory();
expect(untestedProjectsTab().is(GlTab)).toBe(true);
});
});
describe('tab content', () => {
beforeEach(factory);
it.each`
type | tabContent
${'outdated'} | ${outdatedProjectsTabContent}
${'untested'} | ${untestedProjectsTabContent}
`(
'passes the "isLoading" prop to the $type projects tab-content component',
({ tabContent }) => {
expect(tabContent().props('isLoading')).toBe(false);
factory({ state: { isLoading: true } });
return wrapper.vm.$nextTick(() => {
expect(tabContent().props('isLoading')).toBe(true);
});
},
);
it.each`
type | tabContent
${'outdated'} | ${outdatedProjectsTabContent}
${'untested'} | ${untestedProjectsTabContent}
`(
'passes the "isEmpty" prop to the $type projects tab-content component',
({ type, tabContent }) => {
expect(tabContent().props('isEmpty')).toBe(false);
factory({ getters: { [`${type}ProjectsCount`]: () => 0 } });
return wrapper.vm.$nextTick(() => {
expect(tabContent().props('isEmpty')).toBe(true);
});
},
);
it('shows a list of outdated projects', () => {
factory({
getters: {
outdatedProjects: () => [
{
description: 'Outdated Projects Group 1',
projects: [{ fullName: 'Outdated Project One', fullPath: '/outdated-project-1' }],
},
{
description: 'Outdated Projects Group 2',
projects: [{ fullName: 'Outdated Project Two', fullPath: '/outdated-project-2' }],
},
],
},
});
expect(outdatedProjectsTabContent().element).toMatchSnapshot();
});
it('shows a list of untested projects', () => {
factory({
getters: {
untestedProjects: () => [
{ fullName: 'Untested Project One', fullPath: '/untested-1' },
{ fullName: 'Untested Project Two', fullPath: '/untested-2' },
],
},
});
expect(untestedProjectsTabContent().element).toMatchSnapshot();
});
});
});
import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import UnscannedProjectsTabContent from 'ee/security_dashboard/components/unscanned_projects_tab_content.vue';
const localVue = createLocalVue();
describe('UnscannedProjectTabContent Component', () => {
let wrapper;
const factory = (propsData = {}) => {
wrapper = shallowMount(UnscannedProjectsTabContent, {
propsData,
slots: { default: '<span class="default-slot"></span>' },
localVue,
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
const defaultSlot = () => wrapper.find('.default-slot');
describe('default state', () => {
beforeEach(factory);
it('does not contain a loading icon', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(false);
});
it('renders the default slot', () => {
expect(defaultSlot().exists()).toBe(true);
});
});
describe('loading state', () => {
beforeEach(() => {
factory({ isLoading: true });
});
it('contains a loading icon', () => {
expect(wrapper.find(GlLoadingIcon).exists()).toBe(true);
});
});
describe('empty state', () => {
beforeEach(() => {
factory({ isEmpty: true });
});
it('does not render the default slot', () => {
expect(defaultSlot().exists()).toBe(false);
});
it('contains a message to indicate that all projects are up to date', () => {
expect(wrapper.text()).toContain('Your projects are up do date');
});
});
});
......@@ -25487,9 +25487,6 @@ msgstr ""
msgid "Project path"
msgstr ""
msgid "Project scanning help page"
msgstr ""
msgid "Project security status"
msgstr ""
......@@ -34818,21 +34815,6 @@ msgstr ""
msgid "UnscannedProjects|60 or more days"
msgstr ""
msgid "UnscannedProjects|Default branch scanning by project"
msgstr ""
msgid "UnscannedProjects|Out of date"
msgstr ""
msgid "UnscannedProjects|Project scanning"
msgstr ""
msgid "UnscannedProjects|Untested"
msgstr ""
msgid "UnscannedProjects|Your projects are up do date! Nice job!"
msgstr ""
msgid "Unschedule job"
msgstr ""
......
......@@ -12,7 +12,7 @@ module QA
element :security_report_content, required: true
end
view 'ee/app/assets/javascripts/security_dashboard/components/first_class_vulnerability_severities.vue' do
view 'ee/app/assets/javascripts/security_dashboard/components/shared/project_security_status_chart.vue' do
element :project_name_text, required: true
end
......
......@@ -6,7 +6,7 @@ module QA
module Project
module Secure
class SecurityDashboard < QA::Page::Base
view 'ee/app/assets/javascripts/security_dashboard/components/vulnerability_list.vue' do
view 'ee/app/assets/javascripts/security_dashboard/components/shared/vulnerability_list.vue' do
element :vulnerability
end
......
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