diff --git a/src/views/portfolio/projects/FindingAudit.vue b/src/views/portfolio/projects/FindingAudit.vue
index 2668c0780..40abfd67e 100644
--- a/src/views/portfolio/projects/FindingAudit.vue
+++ b/src/views/portfolio/projects/FindingAudit.vue
@@ -173,6 +173,19 @@
}"
:disabled="analysisState === null"
/>
+
@@ -264,6 +277,8 @@ export default {
auditTrail: null,
comment: null,
isSuppressed: !!this.finding?.analysis?.isSuppressed,
+ suppressionExpiration: null,
+ today: this.getToday(),
analysisChoices: [
{ value: 'NOT_SET', text: this.$t('message.not_set') },
{ value: 'EXPLOITABLE', text: this.$t('message.exploitable') },
@@ -331,6 +346,9 @@ export default {
watch: {
isSuppressed: function (currentValue, oldValue) {
if (oldValue != null) {
+ if (!currentValue) {
+ this.suppressionExpiration = null;
+ }
this.callRestEndpoint(
this.analysisState,
this.analysisJustification,
@@ -338,6 +356,7 @@ export default {
null,
null,
currentValue,
+ currentValue ? this.suppressionExpiration : null,
);
}
},
@@ -350,6 +369,26 @@ export default {
aliases,
);
},
+ getToday() {
+ const today = new Date();
+ const yyyy = today.getFullYear();
+ const mm = (today.getMonth() + 1).toString().padStart(2, '0');
+ const dd = today.getDate().toString().padStart(2, '0');
+ return `${yyyy}-${mm}-${dd}`;
+ },
+ convertTimestampToDateString(timestamp) {
+ if (!timestamp) return null;
+ const date = new Date(timestamp);
+ const yyyy = date.getFullYear();
+ const mm = (date.getMonth() + 1).toString().padStart(2, '0');
+ const dd = date.getDate().toString().padStart(2, '0');
+ return `${yyyy}-${mm}-${dd}`;
+ },
+ convertDateStringToTimestamp(dateString) {
+ if (!dateString) return null;
+ const date = new Date(dateString + 'T00:00:00.000Z');
+ return date.getTime();
+ },
getAnalysis: function () {
let queryString =
'?project=' +
@@ -408,6 +447,13 @@ export default {
} else {
this.isSuppressed = false;
}
+ if (
+ Object.prototype.hasOwnProperty.call(analysis, 'suppressionExpiration')
+ ) {
+ this.suppressionExpiration = analysis.suppressionExpiration
+ ? this.convertTimestampToDateString(analysis.suppressionExpiration)
+ : null;
+ }
},
makeAnalysis: function () {
this.callRestEndpoint(
@@ -417,6 +463,7 @@ export default {
this.analysisDetails,
null,
null,
+ this.suppressionExpiration,
);
},
addComment: function () {
@@ -428,6 +475,7 @@ export default {
this.analysisDetails,
this.comment,
null,
+ this.suppressionExpiration,
);
}
this.comment = null;
@@ -439,8 +487,14 @@ export default {
analysisDetails,
comment,
isSuppressed,
+ suppressionExpiration,
) {
let url = `${this.$api.BASE_URL}/${this.$api.URL_ANALYSIS}`;
+
+ const suppressionExpirationTimestamp = this.convertDateStringToTimestamp(
+ suppressionExpiration,
+ );
+
this.axios
.put(url, {
project: this.projectUuid,
@@ -452,6 +506,7 @@ export default {
analysisDetails: analysisDetails,
comment: comment,
isSuppressed: isSuppressed,
+ suppressionExpiration: suppressionExpirationTimestamp,
})
.then((response) => {
this.$toastr.s(this.$t('message.updated'));