Commit 5812f643 authored by Savas Vedova's avatar Savas Vedova

Rename security charts to security dashboard

Previously we named the security dashboard files as security charts.
This was confusing as in the UI we refer to those files as Security
Dashboard. This commit makes sure file names are aligned with the UI.
parent d931fa4d
import initSecurityCharts from 'ee/security_dashboard/security_charts_init'; import initSecurityDashboard from 'ee/security_dashboard/security_dashboard_init';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
initSecurityCharts(document.getElementById('js-group-security-dashboard'), DASHBOARD_TYPES.GROUP); initSecurityDashboard(
document.getElementById('js-group-security-dashboard'),
DASHBOARD_TYPES.GROUP,
);
import initSecurityCharts from 'ee/security_dashboard/security_charts_init'; import initSecurityDashboard from 'ee/security_dashboard/security_dashboard_init';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { waitForCSSLoaded } from '~/helpers/startup_css_helper'; import { waitForCSSLoaded } from '~/helpers/startup_css_helper';
waitForCSSLoaded(() => { waitForCSSLoaded(() => {
initSecurityCharts( initSecurityDashboard(
document.getElementById('js-project-security-dashboard'), document.getElementById('js-project-security-dashboard'),
DASHBOARD_TYPES.PROJECT, DASHBOARD_TYPES.PROJECT,
); );
......
import initSecurityCharts from 'ee/security_dashboard/security_charts_init'; import initSecurityDashboard from 'ee/security_dashboard/security_dashboard_init';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
initSecurityCharts(document.getElementById('js-security'), DASHBOARD_TYPES.INSTANCE); initSecurityDashboard(document.getElementById('js-security'), DASHBOARD_TYPES.INSTANCE);
...@@ -7,14 +7,14 @@ import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers'; ...@@ -7,14 +7,14 @@ import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash'; import createFlash from '~/flash';
import DashboardNotConfigured from '../empty_states/group_dashboard_not_configured.vue'; import DashboardNotConfigured from '../empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue'; import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue';
import SecurityChartsLayout from '../security_charts_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';
export default { export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
DashboardNotConfigured, DashboardNotConfigured,
SecurityChartsLayout, SecurityDashboardLayout,
VulnerabilitySeverities, VulnerabilitySeverities,
VulnerabilitiesOverTimeChart, VulnerabilitiesOverTimeChart,
}, },
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
</script> </script>
<template> <template>
<security-charts-layout> <security-dashboard-layout>
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <dashboard-not-configured />
</template> </template>
...@@ -66,5 +66,5 @@ export default { ...@@ -66,5 +66,5 @@ export default {
<template v-else #loading> <template v-else #loading>
<gl-loading-icon size="lg" class="gl-mt-6" /> <gl-loading-icon size="lg" class="gl-mt-6" />
</template> </template>
</security-charts-layout> </security-dashboard-layout>
</template> </template>
...@@ -7,14 +7,14 @@ import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers'; ...@@ -7,14 +7,14 @@ import { PROJECT_LOADING_ERROR_MESSAGE } from 'ee/security_dashboard/helpers';
import createFlash from '~/flash'; import createFlash from '~/flash';
import DashboardNotConfigured from '../empty_states/instance_dashboard_not_configured.vue'; import DashboardNotConfigured from '../empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue'; import VulnerabilitySeverities from '../first_class_vulnerability_severities.vue';
import SecurityChartsLayout from '../security_charts_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';
export default { export default {
components: { components: {
GlLoadingIcon, GlLoadingIcon,
DashboardNotConfigured, DashboardNotConfigured,
SecurityChartsLayout, SecurityDashboardLayout,
VulnerabilitySeverities, VulnerabilitySeverities,
VulnerabilitiesOverTimeChart, VulnerabilitiesOverTimeChart,
}, },
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
</script> </script>
<template> <template>
<security-charts-layout> <security-dashboard-layout>
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <dashboard-not-configured />
</template> </template>
...@@ -62,5 +62,5 @@ export default { ...@@ -62,5 +62,5 @@ export default {
<template v-else #loading> <template v-else #loading>
<gl-loading-icon size="lg" class="gl-mt-6" /> <gl-loading-icon size="lg" class="gl-mt-6" />
</template> </template>
</security-charts-layout> </security-dashboard-layout>
</template> </template>
...@@ -8,7 +8,7 @@ import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility'; ...@@ -8,7 +8,7 @@ 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 '../empty_states/reports_not_configured.vue'; import DashboardNotConfigured from '../empty_states/reports_not_configured.vue';
import SecurityChartsLayout from '../security_charts_layout.vue'; import SecurityDashboardLayout from '../shared/security_dashboard_layout.vue';
const CHART_DEFAULT_DAYS = 30; const CHART_DEFAULT_DAYS = 30;
const MAX_DAYS = 100; const MAX_DAYS = 100;
...@@ -25,7 +25,7 @@ const SEVERITIES = [ ...@@ -25,7 +25,7 @@ const SEVERITIES = [
export default { export default {
components: { components: {
DashboardNotConfigured, DashboardNotConfigured,
SecurityChartsLayout, SecurityDashboardLayout,
GlLoadingIcon, GlLoadingIcon,
GlLineChart, GlLineChart,
}, },
...@@ -174,7 +174,7 @@ export default { ...@@ -174,7 +174,7 @@ export default {
</script> </script>
<template> <template>
<security-charts-layout ref="layout"> <security-dashboard-layout ref="layout">
<template v-if="shouldShowEmptyState" #empty-state> <template v-if="shouldShowEmptyState" #empty-state>
<dashboard-not-configured /> <dashboard-not-configured />
</template> </template>
...@@ -190,5 +190,5 @@ export default { ...@@ -190,5 +190,5 @@ export default {
<template v-else #loading> <template v-else #loading>
<gl-loading-icon size="lg" class="gl-mt-6" /> <gl-loading-icon size="lg" class="gl-mt-6" />
</template> </template>
</security-charts-layout> </security-dashboard-layout>
</template> </template>
...@@ -6,14 +6,14 @@ import { securityReportTypeEnumToReportType } from 'ee/vue_shared/security_repor ...@@ -6,14 +6,14 @@ import { securityReportTypeEnumToReportType } from 'ee/vue_shared/security_repor
import { vulnerabilityModalMixin } from 'ee/vue_shared/security_reports/mixins/vulnerability_modal_mixin'; import { vulnerabilityModalMixin } from 'ee/vue_shared/security_reports/mixins/vulnerability_modal_mixin';
import Filters from './filters.vue'; import Filters from './filters.vue';
import LoadingError from './loading_error.vue'; import LoadingError from './loading_error.vue';
import SecurityDashboardLayout from './security_dashboard_layout.vue';
import SecurityDashboardTable from './security_dashboard_table.vue'; import SecurityDashboardTable from './security_dashboard_table.vue';
import VulnerabilityReportLayout from './vulnerability_report_layout.vue';
export default { export default {
components: { components: {
Filters, Filters,
IssueModal, IssueModal,
SecurityDashboardLayout, VulnerabilityReportLayout,
SecurityDashboardTable, SecurityDashboardTable,
LoadingError, LoadingError,
PipelineArtifactDownload, PipelineArtifactDownload,
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
:illustrations="loadingErrorIllustrations" :illustrations="loadingErrorIllustrations"
/> />
<template v-else> <template v-else>
<security-dashboard-layout> <vulnerability-report-layout>
<template #header> <template #header>
<filters> <filters>
<template v-if="shouldShowDownloadGuidance" #buttons> <template v-if="shouldShowDownloadGuidance" #buttons>
...@@ -132,7 +132,7 @@ export default { ...@@ -132,7 +132,7 @@ export default {
<slot name="empty-state"></slot> <slot name="empty-state"></slot>
</template> </template>
</security-dashboard-table> </security-dashboard-table>
</security-dashboard-layout> </vulnerability-report-layout>
<issue-modal <issue-modal
:modal="modal" :modal="modal"
......
<script> <script>
import { GlButton, GlBanner, GlSprintf } from '@gitlab/ui'; import { GlButton, GlBanner, GlSprintf } from '@gitlab/ui';
import {
SURVEY_BANNER_LOCAL_STORAGE_KEY,
SURVEY_BANNER_CURRENT_ID,
} from 'ee/security_dashboard/constants';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import showToast from '~/vue_shared/plugins/global_toast'; import showToast from '~/vue_shared/plugins/global_toast';
import { SURVEY_BANNER_LOCAL_STORAGE_KEY, SURVEY_BANNER_CURRENT_ID } from '../constants';
const SURVEY_LINK = 'https://gitlab.fra1.qualtrics.com/jfe/form/SV_7UMsVhPbjmwCp1k'; const SURVEY_LINK = 'https://gitlab.fra1.qualtrics.com/jfe/form/SV_7UMsVhPbjmwCp1k';
const DAYS_TO_ASK_LATER = 7; const DAYS_TO_ASK_LATER = 7;
......
...@@ -3,7 +3,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; ...@@ -3,7 +3,6 @@ import { GlLoadingIcon } from '@gitlab/ui';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { PortalTarget } from 'portal-vue'; import { PortalTarget } from 'portal-vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue'; import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -19,13 +18,14 @@ import InstanceVulnerabilities from './instance/instance_vulnerabilities.vue'; ...@@ -19,13 +18,14 @@ import InstanceVulnerabilities from './instance/instance_vulnerabilities.vue';
import PipelineFindings from './pipeline_findings.vue'; import PipelineFindings from './pipeline_findings.vue';
import ProjectVulnerabilities from './project/project_vulnerabilities.vue'; import ProjectVulnerabilities from './project/project_vulnerabilities.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 './shared/survey_request_banner.vue';
import VulnerabilitiesCountList from './vulnerability_count_list.vue'; import VulnerabilitiesCountList from './vulnerability_count_list.vue';
import VulnerabilityReportLayout from './vulnerability_report_layout.vue';
export default { export default {
components: { components: {
AutoFixUserCallout, AutoFixUserCallout,
SecurityDashboardLayout, VulnerabilityReportLayout,
GroupVulnerabilities, GroupVulnerabilities,
InstanceVulnerabilities, InstanceVulnerabilities,
ProjectVulnerabilities, ProjectVulnerabilities,
...@@ -145,7 +145,7 @@ export default { ...@@ -145,7 +145,7 @@ export default {
:help-page-path="autoFixDocumentation" :help-page-path="autoFixDocumentation"
@close="handleAutoFixUserCalloutClose" @close="handleAutoFixUserCalloutClose"
/> />
<security-dashboard-layout> <vulnerability-report-layout>
<template v-if="!isPipeline" #header> <template v-if="!isPipeline" #header>
<survey-request-banner class="gl-mt-5" /> <survey-request-banner class="gl-mt-5" />
<header class="gl-my-6 gl-display-flex gl-align-items-center"> <header class="gl-my-6 gl-display-flex gl-align-items-center">
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
<instance-vulnerabilities v-else-if="isInstance" :filters="filters" /> <instance-vulnerabilities v-else-if="isInstance" :filters="filters" />
<project-vulnerabilities v-else-if="isProject" :filters="filters" /> <project-vulnerabilities v-else-if="isProject" :filters="filters" />
<pipeline-findings v-else-if="isPipeline" :filters="filters" /> <pipeline-findings v-else-if="isPipeline" :filters="filters" />
</security-dashboard-layout> </vulnerability-report-layout>
</template> </template>
</div> </div>
</template> </template>
import Vue from 'vue'; import Vue from 'vue';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import GroupSecurityCharts from './components/group/group_security_charts.vue'; import GroupSecurityCharts from './components/group/group_security_dashboard.vue';
import InstanceSecurityCharts from './components/instance/instance_security_charts.vue'; import InstanceSecurityCharts from './components/instance/instance_security_dashboard.vue';
import ProjectSecurityCharts from './components/project/project_security_charts.vue'; import ProjectSecurityCharts from './components/project/project_security_dashboard.vue';
import UnavailableState from './components/unavailable_state.vue'; import UnavailableState from './components/unavailable_state.vue';
import apolloProvider from './graphql/provider'; import apolloProvider from './graphql/provider';
import createRouter from './router'; import createRouter from './router';
......
...@@ -2,8 +2,8 @@ import { GlLoadingIcon } from '@gitlab/ui'; ...@@ -2,8 +2,8 @@ import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; 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/empty_states/group_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue'; import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import GroupSecurityCharts from 'ee/security_dashboard/components/group/group_security_charts.vue'; import GroupSecurityDashboard from 'ee/security_dashboard/components/group/group_security_dashboard.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_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';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql'; import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql'; import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/group_vulnerability_history.query.graphql';
...@@ -19,19 +19,19 @@ jest.mock( ...@@ -19,19 +19,19 @@ jest.mock(
}), }),
); );
describe('Group Security Charts component', () => { describe('Group Security Dashboard component', () => {
let wrapper; let wrapper;
const groupFullPath = `${TEST_HOST}/group/5`; const groupFullPath = `${TEST_HOST}/group/5`;
const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityChartsLayout); const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityDashboardLayout);
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 findDashboardNotConfigured = () => wrapper.find(DashboardNotConfigured);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(GroupSecurityCharts, { wrapper = shallowMount(GroupSecurityDashboard, {
mocks: { mocks: {
$apollo: { $apollo: {
queries: { queries: {
...@@ -43,7 +43,7 @@ describe('Group Security Charts component', () => { ...@@ -43,7 +43,7 @@ describe('Group Security Charts component', () => {
}, },
provide: { groupFullPath }, provide: { groupFullPath },
stubs: { stubs: {
SecurityChartsLayout, SecurityDashboardLayout,
}, },
}); });
}; };
......
...@@ -2,8 +2,8 @@ import { GlLoadingIcon } from '@gitlab/ui'; ...@@ -2,8 +2,8 @@ import { GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; 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/empty_states/instance_dashboard_not_configured.vue';
import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue'; import VulnerabilitySeverities from 'ee/security_dashboard/components/first_class_vulnerability_severities.vue';
import InstanceSecurityCharts from 'ee/security_dashboard/components/instance/instance_security_charts.vue'; import InstanceSecurityDashboard from 'ee/security_dashboard/components/instance/instance_security_dashboard.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_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';
import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql'; import vulnerabilityGradesQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_grades.query.graphql';
import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql'; import vulnerabilityHistoryQuery from 'ee/security_dashboard/graphql/queries/instance_vulnerability_history.query.graphql';
...@@ -21,17 +21,17 @@ jest.mock( ...@@ -21,17 +21,17 @@ jest.mock(
}), }),
); );
describe('Instance Security Charts component', () => { describe('Instance Security Dashboard component', () => {
let wrapper; let wrapper;
const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityChartsLayout); const findSecurityChartsLayoutComponent = () => wrapper.find(SecurityDashboardLayout);
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 findDashboardNotConfigured = () => wrapper.find(DashboardNotConfigured);
const createWrapper = ({ loading = false } = {}) => { const createWrapper = ({ loading = false } = {}) => {
wrapper = shallowMount(InstanceSecurityCharts, { wrapper = shallowMount(InstanceSecurityDashboard, {
mocks: { mocks: {
$apollo: { $apollo: {
queries: { queries: {
...@@ -42,7 +42,7 @@ describe('Instance Security Charts component', () => { ...@@ -42,7 +42,7 @@ describe('Instance Security Charts component', () => {
}, },
}, },
stubs: { stubs: {
SecurityChartsLayout, SecurityDashboardLayout,
}, },
}); });
}; };
......
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Project Security Charts component when there is history data should display the chart with data 1`] = ` exports[`Project Security Dashboard component when there is history data should display the chart with data 1`] = `
Array [ Array [
Object { Object {
"data": Array [ "data": Array [
......
...@@ -3,8 +3,8 @@ import { GlLineChart } from '@gitlab/ui/dist/charts'; ...@@ -3,8 +3,8 @@ 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 DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue'; import DashboardNotConfigured from 'ee/security_dashboard/components/empty_states/reports_not_configured.vue';
import ProjectSecurityCharts from 'ee/security_dashboard/components/project/project_security_charts.vue'; import ProjectSecurityDashboard from 'ee/security_dashboard/components/project/project_security_dashboard.vue';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_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';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
...@@ -20,7 +20,7 @@ jest.mock('~/lib/utils/icon_utils', () => ({ ...@@ -20,7 +20,7 @@ jest.mock('~/lib/utils/icon_utils', () => ({
getSvgIconPathContent: jest.fn().mockResolvedValue('mockSvgPathContent'), getSvgIconPathContent: jest.fn().mockResolvedValue('mockSvgPathContent'),
})); }));
describe('Project Security Charts component', () => { describe('Project Security Dashboard component', () => {
let wrapper; let wrapper;
const projectFullPath = 'project/path'; const projectFullPath = 'project/path';
...@@ -35,7 +35,7 @@ describe('Project Security Charts component', () => { ...@@ -35,7 +35,7 @@ describe('Project Security Charts component', () => {
}; };
const createComponent = ({ query, propsData, chartWidth = 1024 }) => { const createComponent = ({ query, propsData, chartWidth = 1024 }) => {
const component = shallowMount(ProjectSecurityCharts, { const component = shallowMount(ProjectSecurityDashboard, {
localVue, localVue,
apolloProvider: createApolloProvider([ apolloProvider: createApolloProvider([
projectsHistoryQuery, projectsHistoryQuery,
...@@ -47,7 +47,7 @@ describe('Project Security Charts component', () => { ...@@ -47,7 +47,7 @@ describe('Project Security Charts component', () => {
...propsData, ...propsData,
}, },
stubs: { stubs: {
SecurityChartsLayout, SecurityDashboardLayout,
}, },
}); });
......
...@@ -5,7 +5,7 @@ import { nextTick } from 'vue'; ...@@ -5,7 +5,7 @@ import { nextTick } from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import Filters from 'ee/security_dashboard/components/filters.vue'; import Filters from 'ee/security_dashboard/components/filters.vue';
import LoadingError from 'ee/security_dashboard/components/loading_error.vue'; import LoadingError from 'ee/security_dashboard/components/loading_error.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue'; import VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
import SecurityDashboardTable from 'ee/security_dashboard/components/security_dashboard_table.vue'; import SecurityDashboardTable from 'ee/security_dashboard/components/security_dashboard_table.vue';
import SecurityDashboard from 'ee/security_dashboard/components/security_dashboard_vuex.vue'; import SecurityDashboard from 'ee/security_dashboard/components/security_dashboard_vuex.vue';
import { getStoreConfig } from 'ee/security_dashboard/store'; import { getStoreConfig } from 'ee/security_dashboard/store';
...@@ -48,7 +48,7 @@ describe('Security Dashboard component', () => { ...@@ -48,7 +48,7 @@ describe('Security Dashboard component', () => {
wrapper = shallowMount(SecurityDashboard, { wrapper = shallowMount(SecurityDashboard, {
store, store,
stubs: { stubs: {
SecurityDashboardLayout, VulnerabilityReportLayout,
}, },
propsData: { propsData: {
dashboardDocumentation: '', dashboardDocumentation: '',
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SecurityChartsLayout from 'ee/security_dashboard/components/security_charts_layout.vue'; import SecurityDashboardLayout from 'ee/security_dashboard/components/shared/security_dashboard_layout.vue';
import SurveyRequestBanner from 'ee/security_dashboard/components/survey_request_banner.vue'; import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_request_banner.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
describe('Security Charts Layout component', () => { describe('Security Dashboard Layout component', () => {
let wrapper; let wrapper;
const DummyComponent = { const DummyComponent = {
...@@ -16,7 +16,7 @@ describe('Security Charts Layout component', () => { ...@@ -16,7 +16,7 @@ describe('Security Charts Layout component', () => {
const findSurveyBanner = () => wrapper.findComponent(SurveyRequestBanner); const findSurveyBanner = () => wrapper.findComponent(SurveyRequestBanner);
const createWrapper = (slots) => { const createWrapper = (slots) => {
wrapper = extendedWrapper(shallowMount(SecurityChartsLayout, { slots })); wrapper = extendedWrapper(shallowMount(SecurityDashboardLayout, { slots }));
}; };
afterEach(() => { afterEach(() => {
......
import { GlBanner, GlButton } from '@gitlab/ui'; import { GlBanner, GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SurveyRequestBanner from 'ee/security_dashboard/components/survey_request_banner.vue'; import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_request_banner.vue';
import { import {
SURVEY_BANNER_LOCAL_STORAGE_KEY, SURVEY_BANNER_LOCAL_STORAGE_KEY,
SURVEY_BANNER_CURRENT_ID, SURVEY_BANNER_CURRENT_ID,
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue'; import VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
describe('Security Dashboard Layout component', () => { describe('Vulnerability Report Layout component', () => {
let wrapper; let wrapper;
const SMALLER_SECTION_CLASS = 'col-xl-7'; const SMALLER_SECTION_CLASS = 'col-xl-7';
const STICKY_SECTION_SELECTOR = '[data-testid="sticky-section"]'; const STICKY_SECTION_SELECTOR = '[data-testid="sticky-section"]';
...@@ -12,7 +12,7 @@ describe('Security Dashboard Layout component', () => { ...@@ -12,7 +12,7 @@ describe('Security Dashboard Layout component', () => {
}; };
const createWrapper = (slots) => { const createWrapper = (slots) => {
wrapper = shallowMount(SecurityDashboardLayout, { slots }); wrapper = shallowMount(VulnerabilityReportLayout, { slots });
}; };
const findArticle = () => wrapper.find('article'); const findArticle = () => wrapper.find('article');
......
...@@ -14,10 +14,10 @@ import GroupVulnerabilities from 'ee/security_dashboard/components/group/group_v ...@@ -14,10 +14,10 @@ import GroupVulnerabilities from 'ee/security_dashboard/components/group/group_v
import InstanceVulnerabilities from 'ee/security_dashboard/components/instance/instance_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 ProjectVulnerabilities from 'ee/security_dashboard/components/project/project_vulnerabilities.vue';
import ProjectPipelineStatus from 'ee/security_dashboard/components/project_pipeline_status.vue'; import ProjectPipelineStatus from 'ee/security_dashboard/components/project_pipeline_status.vue';
import SecurityDashboardLayout from 'ee/security_dashboard/components/security_dashboard_layout.vue'; import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_request_banner.vue';
import SurveyRequestBanner from 'ee/security_dashboard/components/survey_request_banner.vue';
import VulnerabilitiesCountList from 'ee/security_dashboard/components/vulnerability_count_list.vue'; import VulnerabilitiesCountList from 'ee/security_dashboard/components/vulnerability_count_list.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue'; import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue';
import VulnerabilityReportLayout from 'ee/security_dashboard/components/vulnerability_report_layout.vue';
import groupProjectsQuery from 'ee/security_dashboard/graphql/queries/group_projects.query.graphql'; import groupProjectsQuery from 'ee/security_dashboard/graphql/queries/group_projects.query.graphql';
import instanceProjectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql'; import instanceProjectsQuery from 'ee/security_dashboard/graphql/queries/instance_projects.query.graphql';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
...@@ -60,7 +60,7 @@ describe('Vulnerability Report', () => { ...@@ -60,7 +60,7 @@ describe('Vulnerability Report', () => {
provide: { provide: {
...provide, ...provide,
}, },
stubs: { SecurityDashboardLayout }, stubs: { VulnerabilityReportLayout },
}); });
}; };
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Security Charts default states sets up group-level 1`] = `
<div>
<div>
<div
class="gl-spinner-container gl-mt-6"
>
<span
aria-label="Loading"
class="align-text-bottom gl-spinner gl-spinner-dark gl-spinner-lg"
/>
</div>
</div>
</div>
`;
exports[`Security Charts default states sets up instance-level 1`] = `
<div>
<div>
<div
class="gl-spinner-container gl-mt-6"
>
<span
aria-label="Loading"
class="align-text-bottom gl-spinner gl-spinner-dark gl-spinner-lg"
/>
</div>
</div>
</div>
`;
exports[`Security Charts error states has unavailable pages 1`] = `
<div>
<section
class="row empty-state text-center"
>
<div
class="col-12"
>
<div
class="svg-250 svg-content"
>
<img
alt=""
class="gl-max-w-full"
src="/test/empty_state.svg"
/>
</div>
</div>
<div
class="col-12"
>
<div
class="text-content gl-mx-auto gl-my-0 gl-p-5"
>
<h1
class="h4"
>
Oops, something doesn't seem right.
</h1>
<p>
Either you don't have permission to view this dashboard or the dashboard has not been setup. Please check your permission settings with your administrator or check your dashboard configurations to proceed.
</p>
<div
class="gl-display-flex gl-flex-wrap gl-justify-content-center"
>
<a
class="btn gl-mb-3 btn-confirm btn-md gl-button gl-mx-2"
href="/test/dashboard_page"
>
<span
class="gl-button-text"
>
Learn more about setting up your dashboard
</span>
</a>
</div>
</div>
</div>
</section>
</div>
`;
import initSecurityCharts from 'ee/security_dashboard/security_charts_init'; import initSecurityDashboard from 'ee/security_dashboard/security_dashboard_init';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants'; import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
...@@ -11,7 +11,7 @@ const TEST_DATASET = { ...@@ -11,7 +11,7 @@ const TEST_DATASET = {
emptyStateSvgPath: '/test/empty_state.svg', emptyStateSvgPath: '/test/empty_state.svg',
}; };
describe('Security Charts', () => { describe('Security Dashboard', () => {
let vm; let vm;
let root; let root;
...@@ -36,11 +36,11 @@ describe('Security Charts', () => { ...@@ -36,11 +36,11 @@ describe('Security Charts', () => {
const el = document.createElement('div'); const el = document.createElement('div');
Object.assign(el.dataset, { ...TEST_DATASET, ...data }); Object.assign(el.dataset, { ...TEST_DATASET, ...data });
root.appendChild(el); root.appendChild(el);
vm = initSecurityCharts(el, type); vm = initSecurityDashboard(el, type);
}; };
const createEmptyComponent = () => { const createEmptyComponent = () => {
vm = initSecurityCharts(null, null); vm = initSecurityDashboard(null, null);
}; };
describe('default states', () => { describe('default states', () => {
......
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