mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Added abililty to filter by alert state Ok or Alert
This commit is contained in:
		@@ -7,6 +7,11 @@ if (is_numeric($_POST['device_id'])) {
 | 
			
		||||
    $param[] = $_POST['device_id'];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($_POST['state'] >= 0) {
 | 
			
		||||
    $where .= ' AND `E`.`state` = ?';
 | 
			
		||||
    $param[] = mres($_POST['state']);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($_SESSION['userlevel'] >= '5') {
 | 
			
		||||
    $sql = " FROM `alert_log` AS E LEFT JOIN devices AS D ON E.device_id=D.device_id RIGHT JOIN alert_rules AS R ON E.rule_id=R.id WHERE $where";
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,16 @@ foreach (get_all_devices() as $hostname) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
               "</select>"+
 | 
			
		||||
               "</div>"+
 | 
			
		||||
               "<div class=\"form-group\">"+
 | 
			
		||||
               "<label>"+
 | 
			
		||||
               "<strong> State </strong>"+
 | 
			
		||||
               "</label>"+
 | 
			
		||||
               "<select name=\"state\" id=\"state\" class=\"form-control input-sm\">"+
 | 
			
		||||
               "<option value=\"-1\"></option>"+
 | 
			
		||||
               "<option value=\"0\">Ok</option>"+
 | 
			
		||||
               "<option value=\"1\">Alert</option>"+
 | 
			
		||||
               "</select>"+
 | 
			
		||||
               "</div>"+
 | 
			
		||||
               "<button type=\"submit\" class=\"btn btn-default input-sm\">Filter</button>"+
 | 
			
		||||
@@ -69,7 +79,8 @@ foreach (get_all_devices() as $hostname) {
 | 
			
		||||
    {
 | 
			
		||||
        return {
 | 
			
		||||
            id: "alertlog",
 | 
			
		||||
            device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>'
 | 
			
		||||
            device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
 | 
			
		||||
            state: '<?php echo htmlspecialchars($_POST['state']); ?>'
 | 
			
		||||
        };
 | 
			
		||||
    },
 | 
			
		||||
    url: "ajax_table.php"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user