Commit 023929fc authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '300753-use-vulnerability-report-in-pipeline-dashboard' into 'master'

Mount vulnerability report when feature flag is on

See merge request gitlab-org/gitlab!60959
parents 7698eccf e99c7bf0
...@@ -7,6 +7,7 @@ import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; ...@@ -7,6 +7,7 @@ import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import pipelineSecurityReportSummaryQuery from '../graphql/queries/pipeline_security_report_summary.query.graphql'; import pipelineSecurityReportSummaryQuery from '../graphql/queries/pipeline_security_report_summary.query.graphql';
import SecurityDashboard from './security_dashboard_vuex.vue'; import SecurityDashboard from './security_dashboard_vuex.vue';
import SecurityReportsSummary from './security_reports_summary.vue'; import SecurityReportsSummary from './security_reports_summary.vue';
import VulnerabilityReport from './vulnerability_report.vue';
export default { export default {
name: 'PipelineSecurityDashboard', name: 'PipelineSecurityDashboard',
...@@ -14,6 +15,7 @@ export default { ...@@ -14,6 +15,7 @@ export default {
GlEmptyState, GlEmptyState,
SecurityReportsSummary, SecurityReportsSummary,
SecurityDashboard, SecurityDashboard,
VulnerabilityReport,
}, },
mixins: [glFeatureFlagMixin()], mixins: [glFeatureFlagMixin()],
apollo: { apollo: {
...@@ -123,5 +125,6 @@ export default { ...@@ -123,5 +125,6 @@ export default {
<gl-empty-state v-bind="emptyStateProps" /> <gl-empty-state v-bind="emptyStateProps" />
</template> </template>
</security-dashboard> </security-dashboard>
<vulnerability-report v-else />
</div> </div>
</template> </template>
...@@ -98,6 +98,12 @@ export default { ...@@ -98,6 +98,12 @@ export default {
isProject() { isProject() {
return this.dashboardType === DASHBOARD_TYPES.PROJECT; return this.dashboardType === DASHBOARD_TYPES.PROJECT;
}, },
isPipeline() {
return this.dashboardType === DASHBOARD_TYPES.PIPELINE;
},
shouldShowSurvey() {
return !this.isPipeline;
},
isDashboardConfigured() { isDashboardConfigured() {
return this.isProject return this.isProject
? Boolean(this.pipeline?.id) ? Boolean(this.pipeline?.id)
...@@ -125,7 +131,7 @@ export default { ...@@ -125,7 +131,7 @@ export default {
<div> <div>
<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 class="gl-mt-5" /> <survey-request-banner v-if="shouldShowSurvey" class="gl-mt-5" />
<dashboard-not-configured-group v-if="isGroup" /> <dashboard-not-configured-group v-if="isGroup" />
<dashboard-not-configured-instance v-else-if="isInstance" /> <dashboard-not-configured-instance v-else-if="isInstance" />
<dashboard-not-configured-project v-else-if="isProject" /> <dashboard-not-configured-project v-else-if="isProject" />
......
...@@ -37,6 +37,9 @@ export default () => { ...@@ -37,6 +37,9 @@ export default () => {
store: createDashboardStore({ store: createDashboardStore({
dashboardType: DASHBOARD_TYPES.PIPELINE, dashboardType: DASHBOARD_TYPES.PIPELINE,
}), }),
provide: {
dashboardType: DASHBOARD_TYPES.PIPELINE,
},
render(createElement) { render(createElement) {
return createElement(PipelineSecurityDashboard, { return createElement(PipelineSecurityDashboard, {
props: { props: {
......
...@@ -4,6 +4,7 @@ import Vuex from 'vuex'; ...@@ -4,6 +4,7 @@ import Vuex from 'vuex';
import PipelineSecurityDashboard from 'ee/security_dashboard/components/pipeline_security_dashboard.vue'; import PipelineSecurityDashboard from 'ee/security_dashboard/components/pipeline_security_dashboard.vue';
import SecurityDashboard from 'ee/security_dashboard/components/security_dashboard_vuex.vue'; import SecurityDashboard from 'ee/security_dashboard/components/security_dashboard_vuex.vue';
import SecurityReportsSummary from 'ee/security_dashboard/components/security_reports_summary.vue'; import SecurityReportsSummary from 'ee/security_dashboard/components/security_reports_summary.vue';
import VulnerabilityReport from 'ee/security_dashboard/components/vulnerability_report.vue';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -25,6 +26,7 @@ describe('Pipeline Security Dashboard component', () => { ...@@ -25,6 +26,7 @@ describe('Pipeline Security Dashboard component', () => {
let wrapper; let wrapper;
const findSecurityDashboard = () => wrapper.findComponent(SecurityDashboard); const findSecurityDashboard = () => wrapper.findComponent(SecurityDashboard);
const findVulnerabilityReport = () => wrapper.findComponent(VulnerabilityReport);
const factory = (options) => { const factory = (options) => {
store = new Vuex.Store({ store = new Vuex.Store({
...@@ -95,27 +97,23 @@ describe('Pipeline Security Dashboard component', () => { ...@@ -95,27 +97,23 @@ describe('Pipeline Security Dashboard component', () => {
}); });
describe(':pipeline_security_dashboard_graphql feature flag', () => { describe(':pipeline_security_dashboard_graphql feature flag', () => {
it('does not show the security layout when the feature flag is on', () => { const factoryWithFeatureFlag = (value) =>
factory({ factory({
provide: { provide: {
glFeatures: { glFeatures: {
pipelineSecurityDashboardGraphql: true, pipelineSecurityDashboardGraphql: value,
}, },
}, },
}); });
it('does not show the security layout when the feature flag is on but the vulnerability report', () => {
factoryWithFeatureFlag(true);
expect(findSecurityDashboard().exists()).toBe(false); expect(findSecurityDashboard().exists()).toBe(false);
expect(findVulnerabilityReport().exists()).toBe(true);
}); });
it('shows the security layout when the feature flag is off', () => { it('shows the security layout when the feature flag is off', () => {
factory({ factoryWithFeatureFlag(false);
provide: {
glFeatures: {
pipelineSecurityDashboardGraphql: false,
},
},
});
expect(findSecurityDashboard().exists()).toBe(true); expect(findSecurityDashboard().exists()).toBe(true);
}); });
}); });
......
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