From 32f97ab4246f2a5b604e016726f0bc95fc34ea26 Mon Sep 17 00:00:00 2001 From: Louis Bailleul Date: Thu, 19 Nov 2015 09:54:26 +0000 Subject: [PATCH] Add hide/show feature for neighbors interfaces in the device ports page --- html/css/styles.css | 3 ++- html/includes/print-interface.inc.php | 35 ++++++++++++++++++--------- html/js/librenms.js | 20 +++++++++++++++ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/html/css/styles.css b/html/css/styles.css index 46abbc37f..778f3fba2 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -1764,4 +1764,5 @@ tr.search:nth-child(odd) { label { font-weight: normal; -} \ No newline at end of file +} + diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index b15c9b773..31f947f1e 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -36,8 +36,8 @@ else { $mac = ''; } -echo " - "; +echo " + "; echo ' '.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
".$port['ifAlias'].''; @@ -62,7 +62,7 @@ if ($port_details) { echo ''; -echo ''; +echo ""; if ($port_details) { $port['graph_type'] = 'port_bits'; @@ -73,7 +73,7 @@ if ($port_details) { echo generate_port_link($port, ""); } -echo ''; +echo ""; if ($port['ifOperStatus'] == 'up') { $port['in_rate'] = ($port['ifInOctets_rate'] * 8); @@ -86,7 +86,7 @@ if ($port['ifOperStatus'] == 'up') { ".format_bi($port['ifOutUcastPkts_rate']).'pps'; } -echo ''; +echo ""; if ($port['ifSpeed']) { echo ''.humanspeed($port['ifSpeed']).''; } @@ -130,19 +130,19 @@ if ($device['os'] == 'ios' || $device['os'] == 'iosxe') { }//end if if ($port_adsl['adslLineCoding']) { - echo ''; + echo ""; echo $port_adsl['adslLineCoding'].'/'.rewrite_adslLineType($port_adsl['adslLineType']); echo '
'; echo 'Sync:'.formatRates($port_adsl['adslAtucChanCurrTxRate']).'/'.formatRates($port_adsl['adslAturChanCurrTxRate']); echo '
'; echo 'Max:'.formatRates($port_adsl['adslAtucCurrAttainableRate']).'/'.formatRates($port_adsl['adslAturCurrAttainableRate']); - echo ''; + echo ""; echo 'Atten:'.$port_adsl['adslAtucCurrAtn'].'dB/'.$port_adsl['adslAturCurrAtn'].'dB'; echo '
'; echo 'SNR:'.$port_adsl['adslAtucCurrSnrMgn'].'dB/'.$port_adsl['adslAturCurrSnrMgn'].'dB'; } else { - echo ''; + echo ""; if ($port['ifType'] && $port['ifType'] != '') { echo ''.fixiftype($port['ifType']).''; } @@ -158,7 +158,7 @@ else { echo '-'; } - echo ''; + echo ""; if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') { echo ''.formatMac($port['ifPhysAddress']).''; } @@ -176,7 +176,11 @@ else { }//end if echo ''; -echo ''; +echo ''; + +$neighborsCount=0; +echo '
+ '; if (strpos($port['label'], 'oopback') === false && !$graph_type) { foreach (dbFetchRows('SELECT * FROM `links` AS L, `ports` AS I, `devices` AS D WHERE L.local_port_id = ? AND L.remote_port_id = I.port_id AND I.device_id = D.device_id', array($if_id)) as $link) { // echo("Directly Connected " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "
"); @@ -235,8 +239,15 @@ if (strpos($port['label'], 'oopback') === false && !$graph_type) { if ($port_details && $config['enable_port_relationship'] === true && port_permitted($int_link,$device['device_id'])) { foreach ($int_links as $int_link) { + $neighborsCount++; + if($neighborsCount == 4) + { + echo '
[...]
'; + echo '
'; + echo '
'; // If we're showing graphs, generate the graph and print the img tags if ($graph_type == 'etherlike') { diff --git a/html/js/librenms.js b/html/js/librenms.js index 3df1fc533..31f4f8796 100644 --- a/html/js/librenms.js +++ b/html/js/librenms.js @@ -122,6 +122,7 @@ $(document).ready(function() { } }); }); + }); function submitCustomRange(frmdata) { @@ -135,3 +136,22 @@ function submitCustomRange(frmdata) { return true; } +$(document).on("click", '.collapse-neighbors', function(event) +{ + var caller = $(this); + var button = caller.find('.neighbors-button'); + var list = caller.find('.neighbors-interface-list'); + var continued = caller.find('.neighbors-list-continued'); + + if(button.hasClass("glyphicon-triangle-right")) + { + button.addClass('glyphicon-triangle-bottom').removeClass('glyphicon-triangle-right'); + }else + { + button.addClass('glyphicon-triangle-right').removeClass('glyphicon-triangle-bottom'); + } + + list.toggle(); + continued.toggle(); +}); +