From 50b9a4b3eb77fc6b8f70ba24d2d9f810e2923b15 Mon Sep 17 00:00:00 2001 From: rufhe513 Date: Fri, 25 Apr 2025 09:03:16 +0200 Subject: [PATCH] Add buttons to suppress across all projects This commit adds two new buttons to the frontend UI. The first allows users to suppress a vulnerability in all projects where the affected component exists. The second enables reversing that action by unsuppressing the vulnerability across all projects. These buttons integrate with the backend functionality to ensure consistent suppression handling and improve user efficiency.: Signed-off-by: rufhe513 --- src/views/portfolio/projects/FindingAudit.vue | 69 ++++++++++++++++++- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/src/views/portfolio/projects/FindingAudit.vue b/src/views/portfolio/projects/FindingAudit.vue index 2668c0780..6ca666e3e 100644 --- a/src/views/portfolio/projects/FindingAudit.vue +++ b/src/views/portfolio/projects/FindingAudit.vue @@ -20,7 +20,7 @@ {{ alias.vulnId }}{{ alias.vulnId }} @@ -143,7 +143,7 @@ />
+ > {{ this.$t('message.add_comment') }}
@@ -175,6 +175,34 @@ /> + Suppress all + +

Do you want to suppress the vulnerability in all projects?

+
+ Yes + No +
+
+ Unsuppress all + +

Do you want to unsuppress the vulnerability in all projects?

+
+ Yes + No +
+
+ > {{ this.$t('message.update_details') }} @@ -326,6 +354,7 @@ export default { analysisJustification: null, analysisResponse: null, analysisDetails: null, + suppressAllFlag: false, }; }, watch: { @@ -338,12 +367,35 @@ export default { null, null, currentValue, + false, ); } }, }, mixins: [permissionsMixin], methods: { + suppressForAllProjects() { + this.callRestEndpoint( + this.analysisState, + this.analysisJustification, + this.analysisResponse, + this.analysisDetails, + null, + true, + true, + ); + }, + unSuppressForAllProjects() { + this.callRestEndpoint( + this.analysisState, + this.analysisJustification, + this.analysisResponse, + this.analysisDetails, + null, + false, + true, + ); + }, resolveVulnAliases: function (aliases, vulnSource) { return common.resolveVulnAliases( vulnSource ? vulnSource : this.source, @@ -408,6 +460,13 @@ export default { } else { this.isSuppressed = false; } + if (Object.prototype.hasOwnProperty.call(analysis, 'suppressAllFlag')) { + this.suppressAllFlag = analysis.suppressAllFlag; + } else { + this.suppressAllFlag = false; + } + this.$refs.confirmSuppression.hide(); + this.$refs.confirmUnSuppression.hide(); }, makeAnalysis: function () { this.callRestEndpoint( @@ -417,6 +476,7 @@ export default { this.analysisDetails, null, null, + null, ); }, addComment: function () { @@ -428,6 +488,7 @@ export default { this.analysisDetails, this.comment, null, + null, ); } this.comment = null; @@ -439,6 +500,7 @@ export default { analysisDetails, comment, isSuppressed, + suppressAllFlag, ) { let url = `${this.$api.BASE_URL}/${this.$api.URL_ANALYSIS}`; this.axios @@ -452,6 +514,7 @@ export default { analysisDetails: analysisDetails, comment: comment, isSuppressed: isSuppressed, + suppressAllFlag: suppressAllFlag, }) .then((response) => { this.$toastr.s(this.$t('message.updated'));