mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
Fixed attaching templates to rules
This commit is contained in:
@@ -36,7 +36,7 @@ else {
|
||||
}
|
||||
|
||||
if ($success === true) {
|
||||
dbDelete('alert_template_map', 'id NOT IN ('.implode(',', $ids).')');
|
||||
dbDelete('alert_template_map', 'id NOT IN ('.implode(',', $ids).') AND alert_templates_id =?',array($_POST['template_id']));
|
||||
echo "Alert rules have been attached to this template. $template_map_ids";
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -64,14 +64,20 @@ $('#attach-alert-template').on('show.bs.modal', function(e) {
|
||||
data: { type: "parse-template-rules", template_id: template_id },
|
||||
dataType: "json",
|
||||
success: function(output) {
|
||||
arr = [];
|
||||
selected_items = [];
|
||||
$.each( output.rule_id, function( i, elem) {
|
||||
$('#rules_list option[value='+elem+']').attr("selected", true);
|
||||
elem = parseInt(elem);
|
||||
selected_items.push(elem);
|
||||
});
|
||||
$('#rules_list').val(selected_items);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#attach-alert-template').on('hide.bs.modal', function(e) {
|
||||
$('#rules_list').val([]);
|
||||
});
|
||||
|
||||
$('#alert-template-attach').click('', function(event) {
|
||||
event.preventDefault();
|
||||
var template_id = $("#template_id").val();
|
||||
|
||||
Reference in New Issue
Block a user