ui: don’t consider aborted requests complete

If an existing request is aborted due to a new request, ignore the completion of the initial request.

Example:
1. Chrome dev tools: enable 5 second network latency
2. Execute query
3. A second later, execute the query again
4. Currently, the spinner will hide, and the stats will immediately display, as if the request had completed. Instead, the spinner and stats should wait until the 2nd execution finishes.
This commit is contained in:
Stuart Olivera 2016-10-12 17:05:50 -07:00 committed by beorn7
parent c1ae61a2cc
commit 223a22457f
2 changed files with 152 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -364,7 +364,10 @@ Prometheus.Graph.prototype.submitQuery = function() {
self.showError("Error executing query: " + err);
}
},
complete: function() {
complete: function(xhr, resp) {
if (resp == "abort") {
return;
}
var duration = new Date().getTime() - startTime;
self.evalStats.html("Load time: " + duration + "ms <br /> Resolution: " + resolution + "s");
self.spinner.hide();