From 106b60928b3af8c510360fb692dfbe5fb560b4ab Mon Sep 17 00:00:00 2001 From: samdbeckham Date: Thu, 29 Aug 2019 13:07:07 +0100 Subject: [PATCH 1/4] Moves MR reports logic for SAST to the backend - Copies over all the changes from the similar MRs for DAST, dependency and container scanning. - Everything is behind an inactive feature flag. See https://gitlab.com/gitlab-org/gitlab-ee/issues/12002 for more information. --- .../grouped_security_reports_app.vue | 16 ++- .../security_reports/store/actions.js | 25 +--- .../store/modules/sast/actions.js | 28 ++++ .../store/modules/sast/mutation_types.js | 8 +- .../store/modules/sast/mutations.js | 15 +- .../store/modules/sast/state.js | 1 + .../security_reports/store/utils.js | 32 +++++ .../store/modules/sast/actions_spec.js | 128 +++++++++++++++++- .../store/modules/sast/mutations_spec.js | 42 ++++++ .../grouped_security_reports_app_spec.js | 47 +++++++ 10 files changed, 311 insertions(+), 31 deletions(-) diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue index eb355437a8f83c..78e86a3702eb3e 100644 --- a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue +++ b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue @@ -181,6 +181,11 @@ export default { shouldRenderDast() { const { head, diffEndpoint } = this.dast.paths; + return head || diffEndpoint; + }, + shouldRenderSast() { + const { head, diffEndpoint } = this.sast.paths; + return head || diffEndpoint; }, }, @@ -202,7 +207,12 @@ export default { this.setCanCreateIssuePermission(this.canCreateIssue); this.setCanCreateFeedbackPermission(this.canCreateFeedback); - if (this.sastHeadPath) { + const sastDiffEndpoint = gl && gl.mrWidgetData && gl.mrWidgetData.sast_comparison_path; + + if (gon.features && gon.features.sastMergeRequestReportApi && sastDiffEndpoint) { + this.setSastDiffEndpoint(sastDiffEndpoint); + this.fetchSastDiff(); + } else if (this.sastHeadPath) { this.setSastHeadPath(this.sastHeadPath); if (this.sastBasePath) { @@ -307,7 +317,9 @@ export default { ...mapActions('sast', { setSastHeadPath: 'setHeadPath', setSastBasePath: 'setBasePath', + setSastDiffEndpoint: 'setDiffEndpoint', fetchSastReports: 'fetchReports', + fetchSastDiff: 'fetchDiff', }), }, }; @@ -333,7 +345,7 @@ export default {
-