From 8f282c517410a08e42b63a505702c1b51fe3f8f3 Mon Sep 17 00:00:00 2001 From: laf Date: Wed, 22 Jul 2015 22:04:33 +0100 Subject: [PATCH] Tidy up + new tiles --- html/includes/common/availability-map.inc.php | 13 +- .../common/device-summary-horiz.inc.php | 1 + .../{ => common}/device-summary-vert.inc.php | 107 +++++-- html/includes/common/globe.inc.php | 108 +++++++ html/includes/device-summary-horiz.inc.php | 45 --- html/includes/print-alerts.php | 84 ------ html/index.php | 2 + html/pages/alerts.inc.php | 3 +- html/pages/availability-map.inc.php | 40 +-- html/pages/device/alerts.inc.php | 3 +- html/pages/front/default.php | 3 +- html/pages/front/globe.php | 85 +----- html/pages/front/tiles.php | 284 +++++++++--------- sql-schema/058.sql | 3 + 14 files changed, 364 insertions(+), 417 deletions(-) rename html/includes/{ => common}/device-summary-vert.inc.php (52%) create mode 100644 html/includes/common/globe.inc.php delete mode 100644 html/includes/device-summary-horiz.inc.php delete mode 100644 html/includes/print-alerts.php create mode 100644 sql-schema/058.sql diff --git a/html/includes/common/availability-map.inc.php b/html/includes/common/availability-map.inc.php index d8c68becb8..966d6d9996 100644 --- a/html/includes/common/availability-map.inc.php +++ b/html/includes/common/availability-map.inc.php @@ -10,14 +10,14 @@ * the source code distribution for details. */ -$sql = "SELECT `D`.`hostname`,`D`.`device_id`,`D`.`status`,`D`.`uptime` FROM `devices` AS `D`"; +$sql = 'SELECT `D`.`hostname`,`D`.`device_id`,`D`.`status`,`D`.`uptime` FROM `devices` AS `D`'; if (is_admin() === false && is_read() === false) { - $sql .= " , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND"; + $sql .= ' , `devices_perms` AS P WHERE D.`device_id` = P.`device_id` AND P.`user_id` = ? AND'; $param = array($_SESSION['user_id']); } else { - $sql .= " WHERE"; + $sql .= ' WHERE'; } $sql .= " `D`.`ignore` = '0' AND `D`.`disabled` = '0' ORDER BY `hostname`"; @@ -34,12 +34,11 @@ foreach(dbFetchRows($sql,$param) as $device) { else { $btn_type = 'btn-danger'; } - $temp_output[] = " 'device', 'device' => $device['device_id'])). "' role='button' class='btn " . $btn_type . " btn-xs' title='" . $device['hostname'] . "' style='min-height:25px; min-width:25px; border-radius:0px; border:0px; margin:0; padding:0;'>"; + $temp_output[] = ''; } $temp_rows = count($temp_output); -$temp_output[] = ""; -$temp_header = array("

All Devices(" . $temp_rows . ")

"); +$temp_output[] = '
'; +$temp_header = array('

All Devices(' . $temp_rows . ')

'); $common_output = array_merge($temp_header,$temp_output); - diff --git a/html/includes/common/device-summary-horiz.inc.php b/html/includes/common/device-summary-horiz.inc.php index 6a33213cdb..4d150ef8c9 100644 --- a/html/includes/common/device-summary-horiz.inc.php +++ b/html/includes/common/device-summary-horiz.inc.php @@ -49,4 +49,5 @@ $temp_output .= '
'; +unset($common_output); $common_output[] = $temp_output; diff --git a/html/includes/device-summary-vert.inc.php b/html/includes/common/device-summary-vert.inc.php similarity index 52% rename from html/includes/device-summary-vert.inc.php rename to html/includes/common/device-summary-vert.inc.php index ee4e63d073..e5d5706fe1 100644 --- a/html/includes/device-summary-vert.inc.php +++ b/html/includes/common/device-summary-vert.inc.php @@ -1,6 +1,7 @@ + +$temp_output = '
@@ -8,52 +9,102 @@ require_once 'includes/object-cache.inc.php'; - +'; + +if ($config['show_services']) { + + $temp_output .= ' - +'; + +} + +$temp_output .= ' - - - - - + + +'; +if ($config['show_services']) { + + $temp_output .= ' + +'; + +} + +$temp_output .= ' - - - - - + + +'; + +if ($config['show_services']) { + + $temp_output .= ' + +'; + +} + +$temp_output .= ' - - - - - + + +'; + +if ($config['show_services']) { + + $temp_output .= ' + +'; +} + +$temp_output .= ' - - - - - + + +'; + +if ($config['show_services']) { + + $temp_output .= ' + +'; + +} + +$temp_output .= ' - - - - - + + +'; + +if ($config['show_services']) { + + $temp_output .= ' + +'; + +} + +$temp_output .= '
Summary Devices PortsServices
Up'. $devices['up'] .''. $ports['up'] .''. $services['up'] .'
Down'. $devices['down'] .''. $ports['down'] .''. $services['down'] .'
Ignored'. $devices['ignored'] .''. $ports['ignored'] .''. $services['ignored'] .'
Disabled/Shutdown'. $devices['disabled'] .''. $ports['shutdown'] .''. $services['disabled'] .'
Total'. $devices['count'] .''. $ports['count'] .''. $services['count'] .'
+'; + +unset($common_output); +$common_output[] = $temp_output; diff --git a/html/includes/common/globe.inc.php b/html/includes/common/globe.inc.php new file mode 100644 index 0000000000..d703a716e8 --- /dev/null +++ b/html/includes/common/globe.inc.php @@ -0,0 +1,108 @@ + + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* + * Custom Frontpage + * @author f0o + * @copyright 2014 f0o, LibreNMS + * @license GPL + * @package LibreNMS + * @subpackage Frontpage + */ + +$temp_output .= " + +
+"; + +unset($common_output); +$common_output[] = $temp_output; diff --git a/html/includes/device-summary-horiz.inc.php b/html/includes/device-summary-horiz.inc.php deleted file mode 100644 index 6f27b50af2..0000000000 --- a/html/includes/device-summary-horiz.inc.php +++ /dev/null @@ -1,45 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 TotalUpDownIgnoredDisabled
Devices up down ignored disabled
Ports up down ignored shutdown
Services up down ignored disabled
-
diff --git a/html/includes/print-alerts.php b/html/includes/print-alerts.php deleted file mode 100644 index f71b53e78b..0000000000 --- a/html/includes/print-alerts.php +++ /dev/null @@ -1,84 +0,0 @@ -
-
- -
-
-
- - - - - - - - - - - - -
StatusRule HostnameTimestampSeverityAcknowledge
-
- diff --git a/html/index.php b/html/index.php index 98c3d8fee1..6d2ad227cc 100644 --- a/html/index.php +++ b/html/index.php @@ -160,6 +160,8 @@ else { diff --git a/sql-schema/058.sql b/sql-schema/058.sql new file mode 100644 index 0000000000..7099997229 --- /dev/null +++ b/sql-schema/058.sql @@ -0,0 +1,3 @@ +CREATE TABLE `dashboard_items` ( `dashboard_item_id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `widget_id` int(11) NOT NULL, `col` tinyint(4) NOT NULL, `row` tinyint(4) NOT NULL, `size_x` tinyint(4) NOT NULL, `size_y` tinyint(4) NOT NULL, `title` varchar(255) NOT NULL, `content` text NOT NULL, `refresh` tinyint(4) NOT NULL DEFAULT '60', PRIMARY KEY (`dashboard_item_id`), KEY `user_id` (`user_id`,`widget_id`) ) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=latin1; +CREATE TABLE `tiles` ( `tile_id` int(11) NOT NULL AUTO_INCREMENT, `tile_title` varchar(255) NOT NULL, `tile` varchar(255) NOT NULL, `base_dimensions` varchar(10) NOT NULL, PRIMARY KEY (`tile_id`), UNIQUE KEY `tile` (`tile`)) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +INSERT INTO `tiles` (`tile_id`, `tile_title`, `tile`, `base_dimensions`) VALUES (1, 'Availability map', 'availability-map', '4,3'), (2, 'Device summary horizontal', 'device-summary-horiz', '4,2'), (3, 'Alerts', 'alerts', '6,4'), (4, 'Device summary vertical', 'device-summary-vert', '4,3'), (5, 'World map', 'globe', '3,3');