Name
sn_em_ai.ApplyAndRemoveFeedbackConditions
Description
No description available
Script
var ApplyAndRemoveFeedbackConditions = Class.create();
ApplyAndRemoveFeedbackConditions.prototype = {
initialize: function() {
//alert category type
this.LOG_TYPE_CATEGORY = 2;
//ML Feedback types
this.MUTED = 1;
this.SIGNIFICANT = 2;
this.RAISED = "Raised";
},
type: 'ApplyAndRemoveFeedbackConditions',
checkLogTypeAndRoles : function () {
return current.sn_extra_data.category == this.LOG_TYPE_CATEGORY && (gs.hasRole('evt_mgmt_operator') || gs.hasRole('evt_mgmt_admin'));
},
checkNoFeedbackApplied : function(current) {
return this.checkLogTypeAndRoles(current) && (current.sn_extra_data.applied_feedback == undefined || current.sn_extra_data.applied_feedback.nil());
},
checkIfSpecificFeedbackApplied : function(current, feedback) {
return this.checkLogTypeAndRoles(current) && (current.sn_extra_data.applied_feedback != undefined && current.sn_extra_data.applied_feedback == feedback);
},
markAsSignificantCondition: function(current) {
return this.checkNoFeedbackApplied(current);
},
removeFeedbackAfterSignificantCondition: function(current) {
return this.checkIfSpecificFeedbackApplied(current, this.SIGNIFICANT);
},
muteAlertCondition: function(current) {
return this.checkNoFeedbackApplied(current);
},
removeFeedbackAftermutedCondition: function(current) {
return this.checkIfSpecificFeedbackApplied(current, this.MUTED);
},
raiseCondition: function(current) {
if(!current.getValue('additional_info'))
return false;
var additionalInfoJSON = JSON.parse(current.getValue('additional_info'));
return this.checkNoFeedbackApplied(current) && additionalInfoJSON.sn_detection_type != "NEW_SIGNAL" && additionalInfoJSON.sn_detection_type != "CUSTOM";
},
removeFeedbackAfterRaiseCondition: function(current) {
return this.checkIfSpecificFeedbackApplied(current, this.RAISED);
},
isSeverityOrKeywordMetric: function(current) {
if (current.getValue('additional_info')) {
var additionalInfoJSON = JSON.parse(current.getValue('additional_info'));
if (additionalInfoJSON.sn_metric_type == 'KeywordMetric' || additionalInfoJSON.sn_metric_type == 'PatternSeverityMetric')
return true;
}
return false;
},
};
Sys ID
01bff286b7cbd01022339b86ce11a9ca