diff options
author | Steve Beaver <sbeaver@netgate.com> | 2017-03-20 10:00:22 -0400 |
---|---|---|
committer | Steve Beaver <sbeaver@netgate.com> | 2017-03-20 10:00:22 -0400 |
commit | 84eb285c564b25baeca8eda12309946695d2e6a6 (patch) | |
tree | 2c99aed1df9387177ed409ab5f6e4efc5e7f13fb /src/usr/local | |
parent | 26bb4faf19da6194f1f70d202be5850182ccb528 (diff) | |
parent | 575b5c1ce07cdc8f85f6c48d213c31959a8c4184 (diff) | |
download | pfsense-84eb285c564b25baeca8eda12309946695d2e6a6.zip pfsense-84eb285c564b25baeca8eda12309946695d2e6a6.tar.gz |
Merge pull request #3656 from phil-davis/traffic-graph-widget-filter-handle-none-to-display
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/widgets/widgets/traffic_graphs.widget.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php index 64b72f2..0fd30be 100644 --- a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php +++ b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php @@ -70,7 +70,7 @@ if ($_POST) { if (is_array($_POST['show'])) { $user_settings["widgets"]["traffic_graphs"]["filter"] = implode(',', array_diff($validNames, $_POST['show'])); } else { - $user_settings["widgets"]["traffic_graphs"]["filter"] = ""; + $user_settings["widgets"]["traffic_graphs"]["filter"] = implode(',', $validNames); } save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Updated traffic graphs widget settings via dashboard.")); @@ -133,6 +133,12 @@ $tg_displayed_ifs_array = []; echo ' <svg></svg>'; echo '</div>'; } + + if (!$tg_displayed) { + echo '<div id="traffic-chartnone" class="d3-chart traffic-widget-chart">'; + echo gettext('All traffic graphs are hidden.'); + echo '</div>'; + } ?> <!-- close the body we're wrapped in and add a configuration-panel --> @@ -257,7 +263,7 @@ events.push(function() { localStorage.setItem('size', <?=$tg_size?>); localStorage.setItem('backgroundupdate', <?=$tg_backgroundupdate?>); - window.interfaces = InterfaceString.split("|"); + window.interfaces = InterfaceString.split("|").filter(function(entry) { return entry.trim() != ''; }); window.charts = {}; window.myData = {}; window.updateIds = 0; @@ -295,7 +301,9 @@ events.push(function() { }); - draw_graph(refreshInterval, then, backgroundupdate); + if (window.interfaces.length > 0) { + draw_graph(refreshInterval, then, backgroundupdate); + } //re-draw graph when the page goes from inactive (in it's window) to active Visibility.change(function (e, state) { @@ -332,7 +340,9 @@ events.push(function() { }); - draw_graph(refreshInterval, then, backgroundupdate); + if (window.interfaces.length > 0) { + draw_graph(refreshInterval, then, backgroundupdate); + } } }); |