Updated unpolled notification to only show unpolled devices

This commit is contained in:
laf 2016-06-21 20:12:32 +01:00
parent cfea3ba13d
commit 06998420cf
3 changed files with 21 additions and 2 deletions

View File

@ -19,6 +19,10 @@ if (isset($searchPhrase) && !empty($searchPhrase)) {
$sql .= " AND (hostname LIKE '%$searchPhrase%' OR last_polled LIKE '%$searchPhrase%' OR last_polled_timetaken LIKE '%$searchPhrase%')";
}
if ($_POST['type'] == "unpolled") {
$sql .= " AND `last_polled` <= DATE_ADD(NOW(), INTERVAL - 15 minute)";
}
if (!isset($sort) || empty($sort)) {
$sort = 'last_polled_timetaken DESC';
}

View File

@ -320,7 +320,7 @@ echo('<h5>Powered by <a href="' . $config['project_home'] . '" target="_blank" c
}
if(dbFetchCell("SELECT COUNT(`device_id`) FROM `devices` WHERE `last_polled` <= DATE_ADD(NOW(), INTERVAL - 15 minute) AND `ignore` = 0 AND `disabled` = 0 AND status = 1",array()) > 0) {
$msg_box[] = array('type' => 'warning', 'message' => "<a href=\"poll-log/\">It appears as though you have some devices that haven't completed polling within the last 15 minutes, you may want to check that out :)</a>",'title' => 'Devices unpolled');
$msg_box[] = array('type' => 'warning', 'message' => "<a href=\"poll-log/filter=unpolled/\">It appears as though you have some devices that haven't completed polling within the last 15 minutes, you may want to check that out :)</a>",'title' => 'Devices unpolled');
}
if(is_array($msg_box)) {

View File

@ -1,6 +1,9 @@
<?php
$no_refresh = true;
$pagetitle[] = 'Poll Log';
if (isset($vars['filter'])) {
$type = $vars['filter'];
}
?>
<table id="poll-log" class="table table-condensed table-hover table-striped">
<thead>
@ -15,12 +18,24 @@ $pagetitle[] = 'Poll Log';
<script>
searchbar = "<div id=\"{{ctx.id}}\" class=\"{{css.header}}\"><div class=\"row\">"+
"<div class=\"col-sm-9 actionBar\"><span class=\"pull-left\">"+
"<a href='<?php echo generate_url(array('page' => 'poll-log')); ?>' class='btn btn-primary btn-sm'>All devices</a> "+
"<a href='<?php echo generate_url(array('page' => 'poll-log', 'filter' => 'unpolled')); ?>' class='btn btn-danger btn-sm'>Unpolled devices</a>"+
"</div><div class=\"col-sm-3 actionBar\"><p class=\"{{css.search}}\"></p><p class=\"{{css.actions}}\"></p></div>";
var grid = $("#poll-log").bootgrid({
ajax: true,
rowCount: [50,100,250,-1],
columnSelection: false,
templates: {
header: searchbar
},
post: function ()
{
return {
id: "poll-log"
id: "poll-log",
type: "<?php echo $type;?>"
};
},
url: "ajax_table.php"