From c180fdbedeb534b3a4b32c83db754baad6a16a7e Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 29 Apr 2017 21:17:58 +0545 Subject: Let he user know if all selected interfaces are down in the interface statistics widget. At the moment, if all the selected interfaces are down, the widget will just display no columns. That will make users wonder what happened. (cherry picked from commit b22fceb2d7973b8c80a55b4ec492819ddd5ae9f9) --- .../local/www/widgets/widgets/interface_statistics.widget.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php index 0ea20bb..ff2cc29 100644 --- a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php +++ b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php @@ -81,7 +81,8 @@ if ($_REQUEST && $_REQUEST['ajax']) { ); $skipinterfaces = explode(",", $user_settings['widgets']['interface_statistics']['iffilter']); - $interface_is_displayed = false; + $an_interface_is_selected = false; // decide if at least 1 interface is selected for display + $an_interface_is_displayed = false; // decide if at least 1 interface is displayed (i.e. not down) print(""); print( ""); @@ -92,17 +93,20 @@ if ($_REQUEST && $_REQUEST['ajax']) { continue; } - $interface_is_displayed = true; + $an_interface_is_selected = true; $ifinfo_arr[$ifdescr] = get_interface_info($ifdescr); $ifinfo_arr[$ifdescr]['inbytes'] = format_bytes($ifinfo_arr[$ifdescr]['inbytes']); $ifinfo_arr[$ifdescr]['outbytes'] = format_bytes($ifinfo_arr[$ifdescr]['outbytes']); if ($ifinfo_arr[$ifdescr]['status'] != "down") { + $an_interface_is_displayed = true; print("" . $ifname . ""); } } - if (!$interface_is_displayed) { + if (!$an_interface_is_selected) { print("" . gettext('All interfaces are hidden.') . ""); + } else if (!$an_interface_is_displayed) { + print("" . gettext('All selected interfaces are down.') . ""); } print( ""); -- cgit v1.1