re-enable asynchronous ajax

This commit is contained in:
ziirish 2016-07-26 14:02:48 +02:00
parent c9fb4d7058
commit 787e5930ca
6 changed files with 16 additions and 19 deletions

View file

@ -3,12 +3,12 @@ var NOTIF_WARNING = 1;
var NOTIF_ERROR = 2;
var NOTIF_INFO = 3;
var _async_ajax = function(b) {
var _ajax_setup = function(b) {
$.ajaxSetup({
headers: { 'X-From-UI': true },
async: b,
});
};
_ajax_setup();
var pad = function(num, size) {
var s = "0000000" + num;
@ -269,7 +269,6 @@ $('#input-client').typeahead({
{% endif -%}
{% endif -%}
_async_ajax(false);
{% if servers and overview -%}
{% include "js/servers.js" %}

View file

@ -70,6 +70,7 @@ var _client = function() {
}
});
});
_redraw();
})
.fail(myFail)
.fail(function() {
@ -77,7 +78,6 @@ var _client = function() {
$(this).parent().hide();
});
});
_redraw();
};
var _redraw = function() {

View file

@ -55,19 +55,17 @@ $( document ).ready(function() {
}
},
source: function() {
r = [];
{% if edit and edit.found -%}
url = '{{ url_for("api.client_tree", name=cname, backup=nbackup, server=server, root=edit.roots, recursive=True, selected=True) }}';
{% else -%}
url = '{{ url_for("api.client_tree", name=cname, backup=nbackup, server=server) }}';
{% endif -%}
$.getJSON(url, function(data) {
r = data;
return $.getJSON(url, function(data) {
$("#waiting-container").hide();
$("#tree-container").show();
return data;
})
.fail(myFail);
$("#waiting-container").hide();
$("#tree-container").show();
return r;
},
lazyLoad: function(event, data) {
fixNeeded = true;

View file

@ -9,14 +9,14 @@ var _client = function() {
if (!initialized) {
$.each(_charts, function(i, j) {
tmp = nv.models.stackedAreaChart()
.x(function(d) { return d[0] })
.x(function(d) { return d3.time.format.iso.parse(d[0]) })
.y(function(d) { return d[1] })
.useInteractiveGuideline(true)
.color(d3.scale.category20c().range())
.margin({bottom: 115, left: 100})
;
tmp.xAxis.showMaxMin(true).tickFormat(function(d) { return d3.time.format('%x %X')(new Date(d)) }).rotateLabels(-45);
tmp.xAxis.showMaxMin(true).tickFormat(function(d) { console.log(d); return d3.time.format('%x %X')(new Date(d)) }).rotateLabels(-45);
tmp.yAxis.tickFormat(d3.format('f'));
@ -124,14 +124,14 @@ var _client = function() {
$.each(d, function(a, j) {
if (j[c] !== undefined) {
val = parseFloat(j[c][l]);
values.push([ parseInt(j.end)*1000, val ]);
values.push([ j.end, val ]);
push = true;
} else {
values.push([ parseInt(j.end)*1000, 0 ]);
values.push([ j.end, 0 ]);
}
if (stats) {
size.push([ parseInt(j.end)*1000, j.received ]);
duration.push([ parseInt(j.end)*1000, j.duration ]);
size.push([ j.end, j.received ]);
duration.push([ j.end, j.duration ]);
}
});
if (stats) {
@ -157,6 +157,7 @@ var _client = function() {
}
});
});
_redraw();
})
.fail(myFail)
.fail(function() {
@ -164,7 +165,6 @@ var _client = function() {
$(this).parent().hide();
});
});
_redraw();
};
var _redraw = function() {

View file

@ -71,6 +71,7 @@ var _clients = function() {
break;
}
});
_redraw();
})
.fail(myFail)
.fail(function () {
@ -78,7 +79,6 @@ var _clients = function() {
$(this).parent().hide();
});
});
_redraw();
};
var _redraw = function() {

View file

@ -66,6 +66,7 @@ var _servers = function() {
break;
}
});
_redraw();
})
.fail(myFail)
.fail(function () {
@ -73,7 +74,6 @@ var _servers = function() {
$(this).parent().hide();
});
});
_redraw();
};
var _redraw = function() {