2015-02-22 10:49:26 +01:00
|
|
|
<?php
|
|
|
|
|
$param = array();
|
2015-04-01 00:21:56 +01:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$pagetitle[] = 'Alert Log';
|
2015-02-22 10:49:26 +01:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
echo '<div class="panel panel-default panel-condensed">
|
2015-02-22 10:49:26 +01:00
|
|
|
<div class="panel-heading">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-2">
|
2015-04-01 00:21:56 +01:00
|
|
|
<strong>Alert Log entries</strong>
|
2015-02-22 10:49:26 +01:00
|
|
|
</div>
|
2015-04-01 00:21:56 +01:00
|
|
|
<div class="col-md-2 col-md-offset-8">
|
|
|
|
|
<div class="pull-right pdf-export"></div>
|
2015-02-22 10:49:26 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-07-13 20:10:26 +02:00
|
|
|
';
|
2015-02-22 10:49:26 +01:00
|
|
|
?>
|
|
|
|
|
|
2015-05-17 11:44:33 +00:00
|
|
|
<div class="table-responsive">
|
2015-04-01 00:21:56 +01:00
|
|
|
<table id="alertlog" class="table table-hover table-condensed table-striped">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2015-04-04 00:54:50 +01:00
|
|
|
<th data-column-id="time_logged" data-order="desc">Time logged</th>
|
2015-05-17 11:44:33 +00:00
|
|
|
<th data-column-id="details" data-sortable="false"> </th>
|
2015-04-01 00:21:56 +01:00
|
|
|
<th data-column-id="hostname">Device</th>
|
2015-06-02 19:42:08 +02:00
|
|
|
<th data-column-id="alert">Alert</th>
|
2015-04-01 00:21:56 +01:00
|
|
|
<th data-column-id="status" data-sortable="false">Status</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2015-05-17 11:44:33 +00:00
|
|
|
</div>
|
2015-04-01 00:21:56 +01:00
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
var grid = $("#alertlog").bootgrid({
|
|
|
|
|
ajax: true,
|
2015-04-04 00:54:50 +01:00
|
|
|
templates: {
|
2017-05-03 16:51:01 -05:00
|
|
|
header: '<div id="{{ctx.id}}" class="{{css.header}}"><div class="row"> \
|
|
|
|
|
<div class="col-sm-8 actionBar"><span class="pull-left"> \
|
|
|
|
|
<form method="post" action="" class="form-inline" role="form" id="result_form"> \
|
|
|
|
|
<div class="form-group"> \
|
|
|
|
|
<label> \
|
|
|
|
|
<strong>Device </strong> \
|
|
|
|
|
</label> \
|
|
|
|
|
<select name="device_id" id="device_id" class="form-control input-sm" style="min-width: 175px;"> \
|
|
|
|
|
<option value="">All Devices</option> \
|
|
|
|
|
</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> \
|
|
|
|
|
</form></span></div> \
|
|
|
|
|
<div class="col-sm-4 actionBar"><p class="{{css.search}}"></p><p class="{{css.actions}}"></p></div></div></div>'
|
2015-04-04 00:54:50 +01:00
|
|
|
},
|
2015-04-01 00:21:56 +01:00
|
|
|
post: function ()
|
|
|
|
|
{
|
|
|
|
|
return {
|
|
|
|
|
id: "alertlog",
|
2016-05-02 19:40:12 +00:00
|
|
|
device_id: '<?php echo htmlspecialchars($_POST['device_id']); ?>',
|
|
|
|
|
state: '<?php echo htmlspecialchars($_POST['state']); ?>'
|
2015-04-01 00:21:56 +01:00
|
|
|
};
|
|
|
|
|
},
|
2015-08-11 14:54:05 -07:00
|
|
|
url: "ajax_table.php"
|
2015-04-01 00:21:56 +01:00
|
|
|
}).on("loaded.rs.jquery.bootgrid", function() {
|
|
|
|
|
|
|
|
|
|
var results = $("div.infos").text().split(" ");
|
|
|
|
|
low = results[1] -1 ;
|
|
|
|
|
high = results[3];
|
|
|
|
|
max = high - low;
|
|
|
|
|
search = $('.search-field').val();
|
|
|
|
|
|
2017-01-21 13:24:05 +02:00
|
|
|
$(".pdf-export").html("<a href='pdf.php?report=alert-log&device_id=<?php echo $_POST['device_id']; ?>&string="+search+"&results="+max+"&start="+low+"'><i class='fa fa-heartbeat fa-lg icon-theme' aria-hidden='true'></i> Export to pdf</a>");
|
2015-05-17 11:44:33 +00:00
|
|
|
|
|
|
|
|
grid.find(".incident-toggle").each( function() {
|
|
|
|
|
$(this).parent().addClass('incident-toggle-td');
|
|
|
|
|
}).on("click", function(e) {
|
|
|
|
|
var target = $(this).data("target");
|
|
|
|
|
$(target).collapse('toggle');
|
2016-09-22 10:44:17 -04:00
|
|
|
$(this).toggleClass('fa-plus fa-minus');
|
2015-05-17 11:44:33 +00:00
|
|
|
});
|
|
|
|
|
grid.find(".incident").each( function() {
|
|
|
|
|
$(this).parent().addClass('col-lg-4 col-md-4 col-sm-4 col-xs-4');
|
|
|
|
|
$(this).parent().parent().on("mouseenter", function() {
|
|
|
|
|
$(this).find(".incident-toggle").fadeIn(200);
|
|
|
|
|
}).on("mouseleave", function() {
|
|
|
|
|
$(this).find(".incident-toggle").fadeOut(200);
|
|
|
|
|
}).on("click", "td:not(.incident-toggle-td)", function() {
|
|
|
|
|
var target = $(this).parent().find(".incident-toggle").data("target");
|
2016-09-22 10:44:17 -04:00
|
|
|
if( $(this).parent().find(".incident-toggle").hasClass('fa-plus') ) {
|
|
|
|
|
$(this).parent().find(".incident-toggle").toggleClass('fa-plus fa-minus');
|
2015-05-17 11:44:33 +00:00
|
|
|
$(target).collapse('toggle');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-04-01 00:21:56 +01:00
|
|
|
});
|
2017-05-03 16:51:01 -05:00
|
|
|
|
|
|
|
|
<?php echo generate_fill_select_js('hostnames', '#device_id', $_POST['device_id']); ?>
|
2015-03-03 18:48:40 +01:00
|
|
|
</script>
|