Added a sub-menu on the device list page to enable quick access to features

This commit is contained in:
laf 2015-02-03 21:35:34 +00:00
parent e77daabeb5
commit 6e7c095bde
4 changed files with 51 additions and 16 deletions

View File

@ -27,23 +27,24 @@ if ($device['os'] == "ios") { formatCiscoHardware($device, true); }
$device['os_text'] = $config['os'][$device['os']]['text'];
$image = getImage($device);
echo(' <tr onclick="location.href=\'device/'.$device['device_id'].'/\'" style="cursor: pointer;">
<td class="'. $class .' "></td>
<td>' . $image . '</td>
<td><span style="font-size: 15px;">' . generate_device_link($device) . '</span></td>'
echo(' <tr>
<td class="'. $class .' " '. $cell_click .'></td>
<td '. $cell_click .'>' . $image . '</td>
<td '. $cell_click .'><span style="font-size: 15px;">' . generate_device_link($device) . '</span></td>'
);
echo('<td>');
echo('<td '. $cell_click .'>');
if ($port_count) { echo(' <img src="images/icons/port.png" align=absmiddle /> '.$port_count); }
echo('<br />');
if ($sensor_count) { echo(' <img src="images/icons/sensors.png" align=absmiddle /> '.$sensor_count); }
echo('</td>');
echo(' <td>' . $device['hardware'] . ' ' . $device['features'] . '</td>');
echo(' <td>' . $device['os_text'] . ' ' . $device['version'] . '</td>');
echo(' <td>' . formatUptime($device['uptime'], 'short') . ' <br />');
echo(' <td '. $cell_click .'>' . $device['hardware'] . ' ' . $device['features'] . '</td>');
echo(' <td '. $cell_click .'>' . $device['os_text'] . ' ' . $device['version'] . '</td>');
echo(' <td '. $cell_click .'>' . formatUptime($device['uptime'], 'short') . ' <br />');
if (get_dev_attrib($device,'override_sysLocation_bool')) { $device['location'] = get_dev_attrib($device,'override_sysLocation_string'); }
echo(' ' . truncate($device['location'],32, '') . '</td>');
require 'hostbox-menu.inc.php';
echo(' </tr>');

View File

@ -0,0 +1,31 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* 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. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
echo('<td><div class="collapse navbar-collapse" id="navHeaderCollapse">
<div class="btn-group">
<button type="button" class="btn btn-sm btn-danger dropdown-toggle" data-toggle="dropdown" aria-expand="false">Action <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right">');
if (device_permitted($device['device_id'])) {
echo '<li><a href="'.generate_device_url($device).'"> <img src="images/16/server.png" border="0" align="absmiddle" /> View device</a></li>';
echo '<li><a href="'.generate_device_url($device, array('tab' => 'alerts')).'"> <img src="images/16/bell.png" border="0" align="absmiddle" /> View alerts</a></li>';
if ($_SESSION['userlevel'] >= "7") {
echo '<li><a href="'.generate_device_url($device, array('tab' => 'edit')).'"> <img src="images/16/wrench.png" border="0" align="absmiddle" /> Edit device</a></li>';
}
}
echo('
</ul>
</div>
</div></td>');
?>

View File

@ -35,24 +35,25 @@ $device['os_text'] = $config['os'][$device['os']]['text'];
$port_count = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `device_id` = ?", array($device['device_id']));
$sensor_count = dbFetchCell("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ?", array($device['device_id']));
echo(' <tr onclick="location.href=\'device/device='.$device['device_id'].'/\'" style="cursor: pointer;">
<td class="'. $table_tab_colour .'"></td>
<td>' . $image . '</td>
<td><span style="font-size: 15px;">' . generate_device_link($device) . '</span>
echo(' <tr>
<td class="'. $table_tab_colour .' '. $cell_click .'"></td>
<td '. $cell_click .'>' . $image . '</td>
<td '. $cell_click .'><span style="font-size: 15px;">' . generate_device_link($device) . '</span>
<br />' . $device['sysName'] . '</td>'
);
echo('<td>');
echo('<td '. $cell_click .'>');
if ($port_count) { echo(' <img src="images/icons/port.png" align=absmiddle /> '.$port_count); }
echo('<br />');
if ($sensor_count) { echo(' <img src="images/icons/sensors.png" align=absmiddle /> '.$sensor_count); }
echo('</td>');
echo(' <td>' . $device['hardware'] . '<br />' . $device['features'] . '</td>');
echo(' <td>' . $device['os_text'] . '<br />' . $device['version'] . '</td>');
echo(' <td>' . formatUptime($device['uptime'], 'short') . ' <br />');
echo(' <td '. $cell_click .'>' . $device['hardware'] . '<br />' . $device['features'] . '</td>');
echo(' <td '. $cell_click .'>' . $device['os_text'] . '<br />' . $device['version'] . '</td>');
echo(' <td '. $cell_click .'>' . formatUptime($device['uptime'], 'short') . ' <br />');
if (get_dev_attrib($device,'override_sysLocation_bool')) { $device['location'] = get_dev_attrib($device,'override_sysLocation_string'); }
echo(' ' . truncate($device['location'],32, '') . '</td>');
require 'hostbox-menu.inc.php';
echo(' </tr>');

View File

@ -283,6 +283,7 @@ if($format == "graph")
<th>Platform</th>
<th>Operating System</th>
<th>Uptime/Location</th>
<th>Actions</th>
</tr>');
}
@ -293,6 +294,7 @@ if($format == "graph")
if (!$location_filter || ((get_dev_attrib($device,'override_sysLocation_bool') && get_dev_attrib($device,'override_sysLocation_string') == $location_filter)
|| $device['location'] == $location_filter))
{
$cell_click = 'onclick="location.href=\'device/device='.$device['device_id'].'/\'" style="cursor: pointer;"';
if ($subformat == "detail")
{
include("includes/hostbox.inc.php");