Skip to content

Commit 8b9764f

Browse files
committed
Lobby / Dashboard / Traffic Graph: prevent duplicate traffic pollers mangling with the graphs.
1 parent 4e9144f commit 8b9764f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/www/widgets/widgets/traffic_graphs.widget.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
* page setup
6565
*/
6666
$(window).on("load", function() {
67+
// XXX: since dashboard widgets may have changed the dom, prevent on load being executed multiple times.
68+
// it's not very pretty, but prevents mangled graphs
69+
if (window.traffic_graph_widget_loaded !== undefined) {
70+
return;
71+
}
72+
window.traffic_graph_widget_loaded = true;
6773
function format_field(value) {
6874
if (!isNaN(value) && value > 0) {
6975
let fileSizeTypes = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
@@ -195,7 +201,6 @@ function traffic_graph(target, init_data) {
195201
(function traffic_poller(){
196202
ajaxGet("/api/diagnostics/traffic/interface", {}, function(data, status) {
197203
if (data.interfaces !== undefined) {
198-
console.log(data);
199204
$( document ).trigger( "updateTrafficCharts", [ data ] );
200205
}
201206
});

0 commit comments

Comments
 (0)