summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/widgets
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-03-19 12:21:44 +0545
committerPhil Davis <phil.davis@inf.org>2017-03-19 12:21:44 +0545
commit575b5c1ce07cdc8f85f6c48d213c31959a8c4184 (patch)
tree94dad99a5203a969231f97e8ffa88c811452bb9c /src/usr/local/www/widgets
parent6e8777f2f181d8814a49e787c65b285fdc9e15eb (diff)
downloadpfsense-575b5c1ce07cdc8f85f6c48d213c31959a8c4184.zip
pfsense-575b5c1ce07cdc8f85f6c48d213c31959a8c4184.tar.gz
Traffic Graphs Widget handle no items selected for display
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r--src/usr/local/www/widgets/widgets/traffic_graphs.widget.php18
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);
+ }
}
});
OpenPOWER on IntegriCloud