mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
(ids) hook in existing api calls to change rule action in alert model, closes https://github.com/opnsense/core/issues/752
This commit is contained in:
parent
2e5ab31825
commit
16a876d045
@ -11,7 +11,7 @@
|
||||
</field>
|
||||
<field>
|
||||
<id>alert_sid</id>
|
||||
<label>Alert sid</label>
|
||||
<label>Alert action / sid</label>
|
||||
<type>info</type>
|
||||
</field>
|
||||
<field>
|
||||
|
||||
@ -413,6 +413,41 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Change sid to action selector after DialogAlert show
|
||||
*/
|
||||
$( "#DialogAlert" ).on('shown.bs.modal', function (e) {
|
||||
// replace "sid" for sid + action
|
||||
$("#alert_sid").show();
|
||||
$("#alert_sid_action").remove();
|
||||
var sid = $("#alert_sid").html();
|
||||
ajaxGet(url="/api/ids/settings/getRuleInfo/"+sid,sendData={}, callback=function(data, status) {
|
||||
if (status == "success") {
|
||||
$("#alert_sid").hide();
|
||||
var alert_select = $('<select class="selectpicker"/>');
|
||||
$.each(data['action'], function(key, value){
|
||||
var opt = $('<option/>').attr("value", key).text(value.value)
|
||||
if (value.selected == 1) {
|
||||
opt.attr('selected', 'selected');
|
||||
}
|
||||
alert_select.append(opt);
|
||||
});
|
||||
$("#alert_sid").parent().append($('<div id="alert_sid_action"/>'));
|
||||
$("#alert_sid_action").append($('<table style="width:200px;"/>')
|
||||
.append($('<tr/>')
|
||||
.append($('<td/>').html(sid))
|
||||
.append($('<td/>').append(alert_select))
|
||||
));
|
||||
alert_select.change(function(){
|
||||
ajaxCall(url="/api/ids/settings/setRule/"+sid, sendData={action:$(this).val()}, callback=function(data,status) {
|
||||
$("#alert_sid_action > small").remove();
|
||||
$("#alert_sid_action").append($('<small/>').html("{{ lang._('Changes will be active after apply (rules tab)') }}"));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user