From d85a228d5baa6a06f25fe611eaa16e819352f4e0 Mon Sep 17 00:00:00 2001 From: crcro Date: Tue, 9 Jan 2018 22:36:28 +0200 Subject: [PATCH] webui: Small eventlog cleanup (#8056) * include status badge in first datetime col * code formatting --- html/css/styles.css | 5 ++++ html/includes/common/eventlog.inc.php | 5 ++-- html/includes/table/eventlog.inc.php | 35 +++++++++++++-------------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/html/css/styles.css b/html/css/styles.css index 40e20cbe17..1baa924e99 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -2179,3 +2179,8 @@ label { border-color: red; } +.eventlog-status { + display: inline-block; + margin-right: 8px; + float: left; +} \ No newline at end of file diff --git a/html/includes/common/eventlog.inc.php b/html/includes/common/eventlog.inc.php index f3802de83a..f8a8d951f8 100644 --- a/html/includes/common/eventlog.inc.php +++ b/html/includes/common/eventlog.inc.php @@ -18,7 +18,6 @@ $common_output[] = ' - @@ -37,8 +36,8 @@ var eventlog_grid = $("#eventlog").bootgrid({ { return { id: "eventlog", - device: "' .mres($vars['device']) .'", - eventtype: "' .mres($vars['eventtype']) .'", + device: "' . mres($vars['device']) . '", + eventtype: "' . mres($vars['eventtype']) . '", }; }, url: "ajax_table.php" diff --git a/html/includes/table/eventlog.inc.php b/html/includes/table/eventlog.inc.php index 543ac37263..a92a38865f 100644 --- a/html/includes/table/eventlog.inc.php +++ b/html/includes/table/eventlog.inc.php @@ -16,7 +16,7 @@ $where = '1'; if (is_numeric($_POST['device'])) { - $where .= ' AND E.host = ?'; + $where .= ' AND E.host = ?'; $param[] = $_POST['device']; } @@ -26,14 +26,14 @@ if (!empty($_POST['eventtype'])) { } if ($_POST['string']) { - $where .= ' AND E.message LIKE ?'; - $param[] = '%'.$_POST['string'].'%'; + $where .= ' AND E.message LIKE ?'; + $param[] = '%' . $_POST['string'] . '%'; } if ($_SESSION['userlevel'] >= '5') { $sql = " FROM `eventlog` AS E LEFT JOIN `devices` AS `D` ON `E`.`host`=`D`.`device_id` WHERE $where"; } else { - $sql = " FROM `eventlog` AS E, devices_perms AS P WHERE $where AND E.host = P.device_id AND P.user_id = ?"; + $sql = " FROM `eventlog` AS E, devices_perms AS P WHERE $where AND E.host = P.device_id AND P.user_id = ?"; $param[] = $_SESSION['user_id']; } @@ -42,7 +42,7 @@ if (isset($searchPhrase) && !empty($searchPhrase)) { } $count_sql = "SELECT COUNT(event_id) $sql"; -$total = dbFetchCell($count_sql, $param); +$total = dbFetchCell($count_sql, $param); if (empty($total)) { $total = 0; } @@ -54,7 +54,7 @@ if (!isset($sort) || empty($sort)) { $sql .= " ORDER BY $sort"; if (isset($current)) { - $limit_low = (($current * $rowCount) - ($rowCount)); + $limit_low = (($current * $rowCount) - ($rowCount)); $limit_high = $rowCount; } @@ -62,36 +62,35 @@ if ($rowCount != -1) { $sql .= " LIMIT $limit_low,$limit_high"; } -$sql = "SELECT `E`.*,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate,severity $sql"; +$sql = "SELECT `E`.*,DATE_FORMAT(datetime, '" . $config['dateformat']['mysql']['compact'] . "') as humandate,severity $sql"; foreach (dbFetchRows($sql, $param) as $eventlog) { $dev = device_by_id_cache($eventlog['host']); if ($eventlog['type'] == 'interface') { $this_if = cleanPort(getifbyid($eventlog['reference'])); - $type = ''.generate_port_link($this_if, makeshortif(strtolower($this_if['label']))).''; + $type = '' . generate_port_link($this_if, makeshortif(strtolower($this_if['label']))) . ''; } else { $type = $eventlog['type']; } $severity_colour = $eventlog['severity']; if ($eventlog['username'] == '') { - $eventlog['username'] = 'System'; + $eventlog['username'] = 'System'; } $response[] = array( - 'eventicon' => " ", - 'datetime' => $eventlog['humandate'], - 'hostname' => generate_device_link($dev, shorthost($dev['hostname'])), - 'type' => $type, - 'message' => htmlspecialchars($eventlog['message']), - 'username' => $eventlog['username'], + 'datetime' => "" . $eventlog['humandate'] . "", + 'hostname' => generate_device_link($dev, shorthost($dev['hostname'])), + 'type' => $type, + 'message' => htmlspecialchars($eventlog['message']), + 'username' => $eventlog['username'], ); } $output = array( - 'current' => $current, + 'current' => $current, 'rowCount' => $rowCount, - 'rows' => $response, - 'total' => $total, + 'rows' => $response, + 'total' => $total, ); echo _json_encode($output);
Timestamp Type Hostname