Stop the progressbar when an error occurs trying to fetch a report.

pull/6827/head
Tim Felgentreff 14 years ago
parent 1f1d5dc22a
commit 29ef6e820b
  1. 2
      assets/javascripts/reporting/controls.js
  2. 10
      assets/javascripts/reporting/progressbar.js

@ -121,8 +121,10 @@ Reporting.Controls = {
default_failure_callback: function (response) {
if (response.status >= 400 && response.status < 500) {
Reporting.flash(response.responseText);
Reporting.Progress.abort();
} else {
Reporting.flash("There was an error getting the results. The administrator has been informed.");
Reporting.Progress.abort();
}
}
};

@ -3,14 +3,18 @@
Reporting.Progress = {
abort: function () {
window.progressbar.stop();
},
replace_with_bar: function (element) {
var parent = element.up();
var size = parseInt(element.getAttribute('data-query-size'), 10) || 500;
element.remove();
var bar = Reporting.Progress.add_bar_to_parent(parent);
window.progressbar = Reporting.Progress.add_bar_to_parent(parent);
// Speed determined through laborous experimentation!
bar.options.interval = (size * (Math.log(size))) / 100000;
bar.start();
window.progressbar.options.interval = (size * (Math.log(size))) / 100000;
window.progressbar.start();
},
add_bar_to_parent: function (parent) {

Loading…
Cancel
Save