Commit a77a0895 authored by Savas Vedova's avatar Savas Vedova

Merge branch '338790-rename-not-configured-components' into 'master'

Rename vulnerability report empty state components

See merge request gitlab-org/gitlab!73745
parents b9e1303d 8c61425f
...@@ -5,7 +5,7 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/grou ...@@ -5,7 +5,7 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/grou
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql'; import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers'; import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash'; import createFlash from '~/flash';
import DashboardNotConfigured from '../shared/empty_states/group_dashboard_not_configured.vue'; import ReportNotConfigured from '../shared/empty_states/report_not_configured_group.vue';
import VulnerabilitySeverities from '../shared/project_security_status_chart.vue'; import VulnerabilitySeverities from '../shared/project_security_status_chart.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue'; import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue'; import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue';
...@@ -13,7 +13,7 @@ import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_ch ...@@ -13,7 +13,7 @@ import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_ch
export default { export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
DashboardNotConfigured, ReportNotConfigured,
SecurityDashboardLayout, SecurityDashboardLayout,
VulnerabilitySeverities, VulnerabilitySeverities,
VulnerabilitiesOverTimeChart, VulnerabilitiesOverTimeChart,
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
<template> <template>
<security-dashboard-layout> <security-dashboard-layout>
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <report-not-configured />
</template> </template>
<template v-else-if="shouldShowCharts" #default> <template v-else-if="shouldShowCharts" #default>
<vulnerabilities-over-time-chart :query="vulnerabilityHistoryQuery" /> <vulnerabilities-over-time-chart :query="vulnerabilityHistoryQuery" />
......
...@@ -5,7 +5,8 @@ import countsQuery from 'ee/security_dashboard/graphql/queries/vulnerability_sev ...@@ -5,7 +5,8 @@ import countsQuery from 'ee/security_dashboard/graphql/queries/vulnerability_sev
import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerabilities.query.graphql'; import vulnerabilitiesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerabilities.query.graphql';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import DashboardNotConfiguredGroup from '../shared/empty_states/group_dashboard_not_configured.vue'; import VulnerabilityReportHeader from '../shared/vulnerability_report/vulnerability_report_header.vue';
import ReportNotConfiguredGroup from '../shared/empty_states/report_not_configured_group.vue';
import VulnerabilityCounts from '../shared/vulnerability_report/vulnerability_counts.vue'; import VulnerabilityCounts from '../shared/vulnerability_report/vulnerability_counts.vue';
import VulnerabilityList from '../shared/vulnerability_report/vulnerability_list.vue'; import VulnerabilityList from '../shared/vulnerability_report/vulnerability_list.vue';
import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue'; import VulnerabilityFilters from '../shared/vulnerability_report/vulnerability_filters.vue';
...@@ -18,7 +19,8 @@ export default { ...@@ -18,7 +19,8 @@ export default {
VulnerabilityFilters, VulnerabilityFilters,
GlIntersectionObserver, GlIntersectionObserver,
GlLoadingIcon, GlLoadingIcon,
DashboardNotConfiguredGroup, ReportNotConfiguredGroup,
VulnerabilityReportHeader,
}, },
inject: ['groupFullPath', 'canViewFalsePositive', 'canAdminVulnerability', 'hasProjects'], inject: ['groupFullPath', 'canViewFalsePositive', 'canAdminVulnerability', 'hasProjects'],
data() { data() {
...@@ -141,10 +143,12 @@ export default { ...@@ -141,10 +143,12 @@ export default {
</script> </script>
<template> <template>
<dashboard-not-configured-group v-if="!hasProjects" /> <report-not-configured-group v-if="!hasProjects" />
<div v-else class="gl-mt-5"> <div v-else>
<vulnerability-counts :counts="counts" :is-loading="isLoadingCounts" /> <vulnerability-report-header />
<vulnerability-counts class="gl-mt-7" :counts="counts" :is-loading="isLoadingCounts" />
<vulnerability-filters <vulnerability-filters
:filters="$options.filtersToShow" :filters="$options.filtersToShow"
...@@ -153,7 +157,7 @@ export default { ...@@ -153,7 +157,7 @@ export default {
/> />
<vulnerability-list <vulnerability-list
class="gl-mt-5" class="gl-mt-6"
:is-loading="isLoadingInitialVulnerabilities" :is-loading="isLoadingInitialVulnerabilities"
:vulnerabilities="vulnerabilities" :vulnerabilities="vulnerabilities"
:fields="fields" :fields="fields"
......
...@@ -5,7 +5,7 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/inst ...@@ -5,7 +5,7 @@ import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/inst
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql'; import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql';
import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers'; import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash'; import createFlash from '~/flash';
import DashboardNotConfigured from '../shared/empty_states/instance_dashboard_not_configured.vue'; import ReportNotConfigured from '../shared/empty_states/report_not_configured_instance.vue';
import VulnerabilitySeverities from '../shared/project_security_status_chart.vue'; import VulnerabilitySeverities from '../shared/project_security_status_chart.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue'; import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue'; import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_chart.vue';
...@@ -13,7 +13,7 @@ import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_ch ...@@ -13,7 +13,7 @@ import VulnerabilitiesOverTimeChart from '../shared/vulnerabilities_over_time_ch
export default { export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
DashboardNotConfigured, ReportNotConfigured,
SecurityDashboardLayout, SecurityDashboardLayout,
VulnerabilitySeverities, VulnerabilitySeverities,
VulnerabilitiesOverTimeChart, VulnerabilitiesOverTimeChart,
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
<template> <template>
<security-dashboard-layout> <security-dashboard-layout>
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <report-not-configured />
</template> </template>
<template v-else-if="shouldShowCharts" #default> <template v-else-if="shouldShowCharts" #default>
<vulnerabilities-over-time-chart :query="vulnerabilityHistoryQuery" /> <vulnerabilities-over-time-chart :query="vulnerabilityHistoryQuery" />
......
...@@ -7,7 +7,7 @@ import createFlash from '~/flash'; ...@@ -7,7 +7,7 @@ import createFlash from '~/flash';
import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility'; import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility';
import { getSvgIconPathContent } from '~/lib/utils/icon_utils'; import { getSvgIconPathContent } from '~/lib/utils/icon_utils';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import DashboardNotConfigured from '../shared/empty_states/reports_not_configured.vue'; import ReportNotConfigured from '../shared/empty_states/report_not_configured_project.vue';
import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue'; import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
const CHART_DEFAULT_DAYS = 30; const CHART_DEFAULT_DAYS = 30;
...@@ -24,7 +24,7 @@ const SEVERITIES = [ ...@@ -24,7 +24,7 @@ const SEVERITIES = [
export default { export default {
components: { components: {
DashboardNotConfigured, ReportNotConfigured,
SecurityDashboardLayout, SecurityDashboardLayout,
GlLoadingIcon, GlLoadingIcon,
GlLineChart, GlLineChart,
...@@ -169,7 +169,7 @@ export default { ...@@ -169,7 +169,7 @@ export default {
<template> <template>
<security-dashboard-layout ref="layout"> <security-dashboard-layout ref="layout">
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <report-not-configured />
</template> </template>
<template v-else-if="shouldShowCharts" #default> <template v-else-if="shouldShowCharts" #default>
<gl-line-chart <gl-line-chart
......
<script> <script>
import { GlEmptyState, GlButton } from '@gitlab/ui'; import { GlEmptyState } from '@gitlab/ui';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
export default { export default {
components: { components: {
GlEmptyState, GlEmptyState,
GlButton,
}, },
inject: ['dashboardDocumentation', 'emptyStateSvgPath'], inject: ['dashboardDocumentation', 'emptyStateSvgPath'],
i18n: { i18n: {
...@@ -23,9 +22,7 @@ export default { ...@@ -23,9 +22,7 @@ export default {
:title="$options.i18n.title" :title="$options.i18n.title"
:svg-path="emptyStateSvgPath" :svg-path="emptyStateSvgPath"
:description="$options.i18n.description" :description="$options.i18n.description"
> :secondary-button-text="$options.i18n.secondaryButtonText"
<template #actions> :secondary-button-link="dashboardDocumentation"
<gl-button :href="dashboardDocumentation">{{ $options.i18n.secondaryButtonText }}</gl-button> />
</template>
</gl-empty-state>
</template> </template>
...@@ -13,10 +13,10 @@ import PipelineFindings from '../pipeline/pipeline_findings.vue'; ...@@ -13,10 +13,10 @@ import PipelineFindings from '../pipeline/pipeline_findings.vue';
import ProjectVulnerabilities from '../project/project_vulnerabilities.vue'; import ProjectVulnerabilities from '../project/project_vulnerabilities.vue';
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 ReportNotConfiguredGroup from './empty_states/report_not_configured_group.vue';
import DashboardNotConfiguredInstance from './empty_states/instance_dashboard_not_configured.vue'; import ReportNotConfiguredInstance from './empty_states/report_not_configured_instance.vue';
import DashboardNotConfiguredProject from './empty_states/reports_not_configured.vue'; import ReportNotConfiguredProject from './empty_states/report_not_configured_project.vue';
import OperationalReportNotConfigured from './empty_states/operational_report_not_configured.vue'; import ReportNotConfiguredOperational from './empty_states/report_not_configured_operational.vue';
import Filters from './filters/filters_layout.vue'; import Filters from './filters/filters_layout.vue';
import ProjectPipelineStatus from './project_pipeline_status.vue'; import ProjectPipelineStatus from './project_pipeline_status.vue';
import SurveyRequestBanner from './survey_request_banner.vue'; import SurveyRequestBanner from './survey_request_banner.vue';
...@@ -34,10 +34,10 @@ export default { ...@@ -34,10 +34,10 @@ export default {
Filters, Filters,
CsvExportButton, CsvExportButton,
SurveyRequestBanner, SurveyRequestBanner,
DashboardNotConfiguredGroup, ReportNotConfiguredGroup,
DashboardNotConfiguredInstance, ReportNotConfiguredInstance,
DashboardNotConfiguredProject, ReportNotConfiguredProject,
OperationalReportNotConfigured, ReportNotConfiguredOperational,
PortalTarget, PortalTarget,
ProjectPipelineStatus, ProjectPipelineStatus,
GlLink, GlLink,
...@@ -137,9 +137,9 @@ export default { ...@@ -137,9 +137,9 @@ export default {
<gl-loading-icon v-if="!projectsWereFetched" size="lg" class="gl-mt-6" /> <gl-loading-icon v-if="!projectsWereFetched" size="lg" class="gl-mt-6" />
<template v-else-if="!isDashboardConfigured"> <template v-else-if="!isDashboardConfigured">
<survey-request-banner v-if="shouldShowSurvey" class="gl-mt-5" /> <survey-request-banner v-if="shouldShowSurvey" class="gl-mt-5" />
<dashboard-not-configured-group v-if="isGroup" /> <report-not-configured-group v-if="isGroup" />
<dashboard-not-configured-instance v-else-if="isInstance" /> <report-not-configured-instance v-else-if="isInstance" />
<dashboard-not-configured-project v-else-if="isProject" /> <report-not-configured-project v-else-if="isProject" />
</template> </template>
<template v-else> <template v-else>
<portal-target :name="$options.vulnerabilityReportAlertsPortal" multiple /> <portal-target :name="$options.vulnerabilityReportAlertsPortal" multiple />
...@@ -178,7 +178,7 @@ export default { ...@@ -178,7 +178,7 @@ export default {
<pipeline-findings v-else-if="isPipeline" :filters="filters" /> <pipeline-findings v-else-if="isPipeline" :filters="filters" />
<template #operational-empty-state> <template #operational-empty-state>
<operational-report-not-configured /> <report-not-configured-operational />
</template> </template>
</vulnerability-report-layout> </vulnerability-report-layout>
</template> </template>
......
<script>
import { GlSprintf, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import CsvExportButton from '../csv_export_button.vue';
export default {
components: { GlSprintf, GlLink, CsvExportButton },
inject: ['dashboardDocumentation'],
i18n: {
title: s__('SecurityReports|Vulnerability Report'),
description: s__(
"SecurityReports|The Vulnerability Report shows the results of the latest successful pipeline on your project's default branch, as well as vulnerabilities from your latest container scan. %{linkStart}Learn more.%{linkEnd}",
),
},
};
</script>
<template>
<header>
<h2 class="gl-display-flex">
{{ $options.i18n.title }}
<csv-export-button class="gl-ml-auto" />
</h2>
<gl-sprintf :message="$options.i18n.description">
<template #link="{ content }">
<gl-link :href="dashboardDocumentation" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
</header>
</template>
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import GroupSecurityDashboard from 'ee/security_dashboard/components/group/group_security_dashboard.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 ReportNotConfiguredGroup from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_group.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/shared/project_security_status_chart.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 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 VulnerabilitiesOverTimeChart from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart.vue';
...@@ -28,7 +28,7 @@ describe('Group Security Dashboard component', () => { ...@@ -28,7 +28,7 @@ describe('Group Security Dashboard component', () => {
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart); const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart);
const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities); const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities);
const findDashboardNotConfigured = () => wrapper.find(DashboardNotConfigured); const findReportNotConfigured = () => wrapper.find(ReportNotConfiguredGroup);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(GroupSecurityDashboard, { wrapper = shallowMount(GroupSecurityDashboard, {
...@@ -57,13 +57,13 @@ describe('Group Security Dashboard component', () => { ...@@ -57,13 +57,13 @@ describe('Group Security Dashboard component', () => {
createWrapper({ loading: true }); createWrapper({ loading: true });
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(false); expect(reportNotConfigured.exists()).toBe(false);
expect(loadingIcon.exists()).toBe(true); expect(loadingIcon.exists()).toBe(true);
expect(vulnerabilitiesOverTimeChart.exists()).toBe(false); expect(vulnerabilitiesOverTimeChart.exists()).toBe(false);
expect(vulnerabilitySeverities.exists()).toBe(false); expect(vulnerabilitySeverities.exists()).toBe(false);
...@@ -73,13 +73,13 @@ describe('Group Security Dashboard component', () => { ...@@ -73,13 +73,13 @@ describe('Group Security Dashboard component', () => {
createWrapper(); createWrapper();
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(true); expect(reportNotConfigured.exists()).toBe(true);
expect(loadingIcon.exists()).toBe(false); expect(loadingIcon.exists()).toBe(false);
expect(vulnerabilitiesOverTimeChart.exists()).toBe(false); expect(vulnerabilitiesOverTimeChart.exists()).toBe(false);
expect(vulnerabilitySeverities.exists()).toBe(false); expect(vulnerabilitySeverities.exists()).toBe(false);
...@@ -91,13 +91,13 @@ describe('Group Security Dashboard component', () => { ...@@ -91,13 +91,13 @@ describe('Group Security Dashboard component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(false); expect(reportNotConfigured.exists()).toBe(false);
expect(loadingIcon.exists()).toBe(false); expect(loadingIcon.exists()).toBe(false);
expect(vulnerabilitiesOverTimeChart.exists()).toBe(true); expect(vulnerabilitiesOverTimeChart.exists()).toBe(true);
expect(vulnerabilitiesOverTimeChart.props()).toEqual({ query: vulnerabilityHistoryQuery }); expect(vulnerabilitiesOverTimeChart.props()).toEqual({ query: vulnerabilityHistoryQuery });
......
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import InstanceSecurityDashboard from 'ee/security_dashboard/components/instance/instance_security_dashboard.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 ReportNotConfiguredInstance from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_instance.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/shared/project_security_status_chart.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 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 VulnerabilitiesOverTimeChart from 'ee/security_dashboard/components/shared/vulnerabilities_over_time_chart.vue';
...@@ -28,7 +28,7 @@ describe('Instance Security Dashboard component', () => { ...@@ -28,7 +28,7 @@ describe('Instance Security Dashboard component', () => {
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart); const findVulnerabilitiesOverTimeChart = () => wrapper.find(VulnerabilitiesOverTimeChart);
const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities); const findVulnerabilitySeverities = () => wrapper.find(VulnerabilitySeverities);
const findDashboardNotConfigured = () => wrapper.find(DashboardNotConfigured); const findReportNotConfigured = () => wrapper.find(ReportNotConfiguredInstance);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(InstanceSecurityDashboard, { wrapper = shallowMount(InstanceSecurityDashboard, {
...@@ -56,13 +56,13 @@ describe('Instance Security Dashboard component', () => { ...@@ -56,13 +56,13 @@ describe('Instance Security Dashboard component', () => {
createWrapper({ loading: true }); createWrapper({ loading: true });
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(false); expect(reportNotConfigured.exists()).toBe(false);
expect(loadingIcon.exists()).toBe(true); expect(loadingIcon.exists()).toBe(true);
expect(vulnerabilitiesOverTimeChart.exists()).toBe(false); expect(vulnerabilitiesOverTimeChart.exists()).toBe(false);
expect(vulnerabilitySeverities.exists()).toBe(false); expect(vulnerabilitySeverities.exists()).toBe(false);
...@@ -72,13 +72,13 @@ describe('Instance Security Dashboard component', () => { ...@@ -72,13 +72,13 @@ describe('Instance Security Dashboard component', () => {
createWrapper(); createWrapper();
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(true); expect(reportNotConfigured.exists()).toBe(true);
expect(loadingIcon.exists()).toBe(false); expect(loadingIcon.exists()).toBe(false);
expect(vulnerabilitiesOverTimeChart.exists()).toBe(false); expect(vulnerabilitiesOverTimeChart.exists()).toBe(false);
expect(vulnerabilitySeverities.exists()).toBe(false); expect(vulnerabilitySeverities.exists()).toBe(false);
...@@ -90,13 +90,13 @@ describe('Instance Security Dashboard component', () => { ...@@ -90,13 +90,13 @@ describe('Instance Security Dashboard component', () => {
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
const securityChartsLayout = findSecurityChartsLayoutComponent(); const securityChartsLayout = findSecurityChartsLayoutComponent();
const dashboardNotConfigured = findDashboardNotConfigured(); const reportNotConfigured = findReportNotConfigured();
const loadingIcon = findLoadingIcon(); const loadingIcon = findLoadingIcon();
const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart(); const vulnerabilitiesOverTimeChart = findVulnerabilitiesOverTimeChart();
const vulnerabilitySeverities = findVulnerabilitySeverities(); const vulnerabilitySeverities = findVulnerabilitySeverities();
expect(securityChartsLayout.exists()).toBe(true); expect(securityChartsLayout.exists()).toBe(true);
expect(dashboardNotConfigured.exists()).toBe(false); expect(reportNotConfigured.exists()).toBe(false);
expect(loadingIcon.exists()).toBe(false); expect(loadingIcon.exists()).toBe(false);
expect(vulnerabilitiesOverTimeChart.props()).toEqual({ query: vulnerabilityHistoryQuery }); expect(vulnerabilitiesOverTimeChart.props()).toEqual({ query: vulnerabilityHistoryQuery });
expect(vulnerabilitySeverities.exists()).toBe(true); expect(vulnerabilitySeverities.exists()).toBe(true);
......
...@@ -3,7 +3,7 @@ import { GlLineChart } from '@gitlab/ui/dist/charts'; ...@@ -3,7 +3,7 @@ import { GlLineChart } from '@gitlab/ui/dist/charts';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount, createLocalVue } from '@vue/test-utils';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import ProjectSecurityDashboard from 'ee/security_dashboard/components/project/project_security_dashboard.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 ReportNotConfigured from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_project.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/shared/security_dashboard_layout.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 projectsHistoryQuery from 'ee/security_dashboard/graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql';
import { useFakeDate } from 'helpers/fake_date'; import { useFakeDate } from 'helpers/fake_date';
...@@ -28,7 +28,7 @@ describe('Project Security Dashboard component', () => { ...@@ -28,7 +28,7 @@ describe('Project Security Dashboard component', () => {
const findLineChart = () => wrapper.find(GlLineChart); const findLineChart = () => wrapper.find(GlLineChart);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findEmptyState = () => wrapper.find(DashboardNotConfigured); const findEmptyState = () => wrapper.find(ReportNotConfigured);
const createApolloProvider = (...queries) => { const createApolloProvider = (...queries) => {
return createMockApollo([...queries]); return createMockApollo([...queries]);
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Group Security Dashboard Empty State matches snapshot 1`] = `
"<gl-empty-state-stub title=\\"Monitor vulnerabilities in your group\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in projects within your group. Vulnerabilities in projects are shown here when security testing is configured.\\">
<gl-button-stub category=\\"primary\\" variant=\\"default\\" size=\\"medium\\" icon=\\"\\" buttontextclasses=\\"\\" href=\\"/path/to/dashboard/documentation\\">Learn more</gl-button-stub>
</gl-empty-state-stub>"
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Instance Security Dashboard Empty State matches snapshot 1`] = `"<gl-empty-state-stub title=\\"Monitor vulnerabilities in all of your projects\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in your selected projects. Vulnerabilities for selected projects with security testing configured are shown here.\\" primarybuttonlink=\\"/path/to/dashboard/settings\\" primarybuttontext=\\"Add projects\\" secondarybuttonlink=\\"/path/to/dashboard/documentation\\" secondarybuttontext=\\"Learn more\\"></gl-empty-state-stub>"`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Group report not configured component matches snapshot 1`] = `"<gl-empty-state-stub title=\\"Monitor vulnerabilities in your group\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in projects within your group. Vulnerabilities in projects are shown here when security testing is configured.\\" secondarybuttonlink=\\"/path/to/dashboard/documentation\\" secondarybuttontext=\\"Learn more\\"></gl-empty-state-stub>"`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Instance report not configured component matches snapshot 1`] = `"<gl-empty-state-stub title=\\"Monitor vulnerabilities in all of your projects\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in your selected projects. Vulnerabilities for selected projects with security testing configured are shown here.\\" primarybuttonlink=\\"/path/to/dashboard/settings\\" primarybuttontext=\\"Add projects\\" secondarybuttonlink=\\"/path/to/dashboard/documentation\\" secondarybuttontext=\\"Learn more\\"></gl-empty-state-stub>"`;
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`reports not configured empty state matches the snapshot for groups 1`] = ` exports[`Operational report not configured component matches the snapshot for groups 1`] = `
<gl-empty-state-stub <gl-empty-state-stub
description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in any project in this group." description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in any project in this group."
primarybuttonlink="/operational-configuration" primarybuttonlink="/operational-configuration"
...@@ -12,7 +12,7 @@ exports[`reports not configured empty state matches the snapshot for groups 1`] ...@@ -12,7 +12,7 @@ exports[`reports not configured empty state matches the snapshot for groups 1`]
/> />
`; `;
exports[`reports not configured empty state matches the snapshot for instances 1`] = ` exports[`Operational report not configured component matches the snapshot for instances 1`] = `
<gl-empty-state-stub <gl-empty-state-stub
description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in any project in this instance." description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in any project in this instance."
primarybuttonlink="/operational-configuration" primarybuttonlink="/operational-configuration"
...@@ -24,7 +24,7 @@ exports[`reports not configured empty state matches the snapshot for instances 1 ...@@ -24,7 +24,7 @@ exports[`reports not configured empty state matches the snapshot for instances 1
/> />
`; `;
exports[`reports not configured empty state matches the snapshot for projects 1`] = ` exports[`Operational report not configured component matches the snapshot for projects 1`] = `
<gl-empty-state-stub <gl-empty-state-stub
description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in this project." description="Manage and track vulnerabilities identified in your Kubernetes clusters. Vulnerabilities appear here after you create a scan execution policy in this project."
primarybuttonlink="/operational-configuration" primarybuttonlink="/operational-configuration"
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Project report not configured component matches snapshot 1`] = `"<gl-empty-state-stub title=\\"Monitor vulnerabilities in your project\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in your project. Vulnerabilities are shown here when security testing is configured.\\" primarybuttonlink=\\"/configuration\\" primarybuttontext=\\"Configure security testing\\" secondarybuttonlink=\\"/help\\" secondarybuttontext=\\"Learn more\\"></gl-empty-state-stub>"`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`reports not configured empty state matches snapshot 1`] = `"<gl-empty-state-stub title=\\"Monitor vulnerabilities in your project\\" svgpath=\\"/placeholder.svg\\" description=\\"Manage and track vulnerabilities identified in your project. Vulnerabilities are shown here when security testing is configured.\\" primarybuttonlink=\\"/configuration\\" primarybuttontext=\\"Configure security testing\\" secondarybuttonlink=\\"/help\\" secondarybuttontext=\\"Learn more\\"></gl-empty-state-stub>"`;
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/group_dashboard_not_configured.vue'; import ReportNotConfiguredGroup from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_group.vue';
describe('Group Security Dashboard Empty State', () => { describe('Group report not configured component', () => {
let wrapper; let wrapper;
const dashboardDocumentation = '/path/to/dashboard/documentation'; const dashboardDocumentation = '/path/to/dashboard/documentation';
const emptyStateSvgPath = '/placeholder.svg'; const emptyStateSvgPath = '/placeholder.svg';
const createWrapper = () => const createWrapper = () =>
shallowMount(DashboardNotConfigured, { shallowMount(ReportNotConfiguredGroup, {
provide: { provide: {
dashboardDocumentation, dashboardDocumentation,
emptyStateSvgPath, emptyStateSvgPath,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DashboardNotConfigured from 'ee/security_dashboard/components/shared/empty_states/instance_dashboard_not_configured.vue'; import ReportNotConfiguredInstance from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_instance.vue';
describe('Instance Security Dashboard Empty State', () => { describe('Instance report not configured component', () => {
let wrapper; let wrapper;
const instanceDashboardSettingsPath = '/path/to/dashboard/settings'; const instanceDashboardSettingsPath = '/path/to/dashboard/settings';
const dashboardDocumentation = '/path/to/dashboard/documentation'; const dashboardDocumentation = '/path/to/dashboard/documentation';
const emptyStateSvgPath = '/placeholder.svg'; const emptyStateSvgPath = '/placeholder.svg';
const createWrapper = () => const createWrapper = () =>
shallowMount(DashboardNotConfigured, { shallowMount(ReportNotConfiguredInstance, {
provide: { provide: {
dashboardDocumentation, dashboardDocumentation,
emptyStateSvgPath, emptyStateSvgPath,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import OperationalReportNotConfigured from 'ee/security_dashboard/components/shared/empty_states/operational_report_not_configured.vue'; import ReportNotConfiguredOperational from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_operational.vue';
describe('reports not configured empty state', () => { describe('Operational report not configured component', () => {
let wrapper; let wrapper;
const operationalConfigurationPath = '/operational-configuration'; const operationalConfigurationPath = '/operational-configuration';
const operationalEmptyStateSvgPath = '/operational-placeholder.svg'; const operationalEmptyStateSvgPath = '/operational-placeholder.svg';
const operationalHelpPath = '/operational-help'; const operationalHelpPath = '/operational-help';
const createComponent = (dashboardType = 'project') => { const createComponent = (dashboardType = 'project') => {
wrapper = shallowMount(OperationalReportNotConfigured, { wrapper = shallowMount(ReportNotConfiguredOperational, {
provide: { provide: {
dashboardType, dashboardType,
operationalConfigurationPath, operationalConfigurationPath,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import ReportsNotConfigured from 'ee/security_dashboard/components/shared/empty_states/reports_not_configured.vue'; import ReportNotConfiguredProject from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_project.vue';
describe('reports not configured empty state', () => { describe('Project report not configured component', () => {
let wrapper; let wrapper;
const emptyStateSvgPath = '/placeholder.svg'; const emptyStateSvgPath = '/placeholder.svg';
const securityConfigurationPath = '/configuration'; const securityConfigurationPath = '/configuration';
const securityDashboardHelpPath = '/help'; const securityDashboardHelpPath = '/help';
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(ReportsNotConfigured, { wrapper = shallowMount(ReportNotConfiguredProject, {
provide: { provide: {
emptyStateSvgPath, emptyStateSvgPath,
securityConfigurationPath, securityConfigurationPath,
......
import { GlLink } from '@gitlab/ui';
import VulnerabilityReportHeader from 'ee/security_dashboard/components/shared/vulnerability_report/vulnerability_report_header.vue';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import CsvExportButton from 'ee/security_dashboard/components/shared/csv_export_button.vue';
describe('Vulnerability report header component', () => {
let wrapper;
const createWrapper = ({ dashboardDocumentation } = {}) => {
wrapper = mountExtended(VulnerabilityReportHeader, {
provide: { dashboardDocumentation },
stubs: { CsvExportButton: true },
});
};
afterEach(() => {
wrapper.destroy();
});
it('shows the CSV export button', () => {
createWrapper();
expect(wrapper.findComponent(CsvExportButton).exists()).toBe(true);
});
it('shows the correct link for the documentation', () => {
const dashboardDocumentation = 'http://some/link';
createWrapper({ dashboardDocumentation });
expect(wrapper.findComponent(GlLink).attributes('href')).toBe(dashboardDocumentation);
});
});
...@@ -9,9 +9,9 @@ import InstanceVulnerabilities from 'ee/security_dashboard/components/instance/i ...@@ -9,9 +9,9 @@ import InstanceVulnerabilities from 'ee/security_dashboard/components/instance/i
import ProjectVulnerabilities from 'ee/security_dashboard/components/project/project_vulnerabilities.vue'; import ProjectVulnerabilities from 'ee/security_dashboard/components/project/project_vulnerabilities.vue';
import AutoFixUserCallout from 'ee/security_dashboard/components/shared/auto_fix_user_callout.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 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 ReportNotConfiguredGroup from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_group.vue';
import DashboardNotConfiguredInstance from 'ee/security_dashboard/components/shared/empty_states/instance_dashboard_not_configured.vue'; import ReportNotConfiguredInstance from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_instance.vue';
import DashboardNotConfiguredProject from 'ee/security_dashboard/components/shared/empty_states/reports_not_configured.vue'; import ReportNotConfiguredProject from 'ee/security_dashboard/components/shared/empty_states/report_not_configured_project.vue';
import Filters from 'ee/security_dashboard/components/shared/filters/filters_layout.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 ProjectPipelineStatus from 'ee/security_dashboard/components/shared/project_pipeline_status.vue';
import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_request_banner.vue'; import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_request_banner.vue';
...@@ -33,9 +33,9 @@ describe('Vulnerability Report', () => { ...@@ -33,9 +33,9 @@ describe('Vulnerability Report', () => {
const findGroupVulnerabilities = () => wrapper.findComponent(GroupVulnerabilities); const findGroupVulnerabilities = () => wrapper.findComponent(GroupVulnerabilities);
const findProjectVulnerabilities = () => wrapper.findComponent(ProjectVulnerabilities); const findProjectVulnerabilities = () => wrapper.findComponent(ProjectVulnerabilities);
const findCsvExportButton = () => wrapper.findComponent(CsvExportButton); const findCsvExportButton = () => wrapper.findComponent(CsvExportButton);
const findGroupEmptyState = () => wrapper.findComponent(DashboardNotConfiguredGroup); const findGroupEmptyState = () => wrapper.findComponent(ReportNotConfiguredGroup);
const findInstanceEmptyState = () => wrapper.findComponent(DashboardNotConfiguredInstance); const findInstanceEmptyState = () => wrapper.findComponent(ReportNotConfiguredInstance);
const findProjectEmptyState = () => wrapper.findComponent(DashboardNotConfiguredProject); const findProjectEmptyState = () => wrapper.findComponent(ReportNotConfiguredProject);
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findFilters = () => wrapper.findComponent(Filters); const findFilters = () => wrapper.findComponent(Filters);
const findVulnerabilitiesCountList = () => wrapper.findComponent(VulnerabilitiesCountList); const findVulnerabilitiesCountList = () => wrapper.findComponent(VulnerabilitiesCountList);
......
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