mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Change procedure management. Using URL instead of file
This commit is contained in:
@@ -97,7 +97,7 @@ if(defined('show_settings')) {
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-4">
|
||||
<label for="proc" class="control-label">Show Doc field: </label>
|
||||
<label for="proc" class="control-label">Show Procedure field: </label>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<select class="form-control" name="proc">';
|
||||
@@ -264,11 +264,11 @@ var alerts_grid = $("#alerts_'.$unique_id.'").bootgrid({
|
||||
url: "ajax_form.php",
|
||||
data: { type: "open-proc", alert_id: alert_id },
|
||||
success: function(msg){
|
||||
window.open("procs/"+msg);
|
||||
// $("#message").html(\'<div class="alert alert-info">Opening \'+msg+\'</div>\');
|
||||
if (msg != "ERROR") { window.open(msg); }
|
||||
else { $("#message").html(\'<div class="alert alert-info">Procedure link does not seem to be valid, please check the rule.</div>\'); }
|
||||
},
|
||||
error: function(){
|
||||
$("#message").html(\'<div class="alert alert-info">An error occurred opening procedure for this alert. Does the procedure exists ?</div>\');
|
||||
$("#message").html(\'<div class="alert alert-info">An error occurred opening procedure for this alert. Does the procedure link was configured ?</div>\');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -27,14 +27,11 @@ $mute = mres($_POST['mute']);
|
||||
$invert = mres($_POST['invert']);
|
||||
$name = mres($_POST['name']);
|
||||
if ($_POST['proc'] != "") { $proc = $_POST['proc']; }
|
||||
else { $proc = "noproc.pdf"; }
|
||||
else { $proc = ""; }
|
||||
|
||||
if (empty($rule)) {
|
||||
$update_message = 'ERROR: No rule was generated - did you forget to click and / or?';
|
||||
}
|
||||
else if (! file_exists ("procs/".$proc)) {
|
||||
$update_message = 'ERROR: Procedure \''.$proc.'\' doesn\'t exists in procs directory';
|
||||
}
|
||||
else if (validate_device_id($_POST['device_id']) || $_POST['device_id'] == '-1' || $_POST['device_id'][0] == ':') {
|
||||
$device_id = $_POST['device_id'];
|
||||
if (!is_numeric($count)) {
|
||||
|
@@ -20,7 +20,8 @@ if (!is_numeric($alert_id)) {
|
||||
}
|
||||
else {
|
||||
$proc = dbFetchCell('SELECT proc FROM alerts,alert_rules WHERE alert_rules.id = alerts.rule_id AND alerts.id = ?', array($alert_id));
|
||||
if (! file_exists ("procs/$proc")) { echo header("HTTP/1.0 404 Not Found"); }
|
||||
if (($proc == "") || ($proc == "NULL")) { echo header("HTTP/1.0 404 Not Found"); }
|
||||
else if (! preg_match ('/^http:\/\//', $proc)) { echo "ERROR"; }
|
||||
else { echo $proc; }
|
||||
exit;
|
||||
}
|
||||
|
@@ -135,7 +135,7 @@ if(is_admin() !== false) {
|
||||
</div>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label for='proc' class='col-sm-3 control-label'>Doc name: </label>
|
||||
<label for='proc' class='col-sm-3 control-label'>Procedure URL: </label>
|
||||
<div class='col-sm-9'>
|
||||
<input type='text' id='proc' name='proc' class='form-control' maxlength='30'>
|
||||
</div>
|
||||
|
@@ -1,2 +1 @@
|
||||
ALTER TABLE alert_rules ADD COLUMN proc VARCHAR(30) AFTER name;
|
||||
UPDATE alert_rules SET proc="noproc.pdf";
|
||||
ALTER TABLE alert_rules ADD COLUMN proc VARCHAR(80) AFTER name;
|
||||
|
Reference in New Issue
Block a user