aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-07-24 15:42:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-07-24 15:42:06 +1200
commitef5d479471d84218baaba307c5fa7e0006342114 (patch)
tree69f1a3e5258f2381834a6c8635c21192d0bd555a /web/app/view/ReportController.js
parentb4a48b797681591572762f556a78aca1ff39f512 (diff)
downloadtrackermap-web-ef5d479471d84218baaba307c5fa7e0006342114.tar.gz
trackermap-web-ef5d479471d84218baaba307c5fa7e0006342114.tar.bz2
trackermap-web-ef5d479471d84218baaba307c5fa7e0006342114.zip
Disable report buttons in progress
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js57
1 files changed, 35 insertions, 22 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 204c36cb..6c52cead 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -142,7 +142,7 @@ Ext.define('Traccar.view.ReportController', {
reportType = this.lookupReference('reportTypeField').getValue();
devices = this.deviceId && this.deviceId.length !== 0 || this.groupId && this.groupId.length !== 0;
time = this.fromDate && this.fromTime && this.toDate && this.toTime;
- disabled = !reportType || !devices || !time;
+ disabled = !reportType || !devices || !time || this.reportProgress;
this.lookupReference('showButton').setDisabled(disabled);
this.lookupReference('exportButton').setDisabled(reportType === 'chart' || disabled);
},
@@ -162,6 +162,9 @@ Ext.define('Traccar.view.ReportController', {
this.toDate.getFullYear(), this.toDate.getMonth(), this.toDate.getDate(),
this.toTime.getHours(), this.toTime.getMinutes(), this.toTime.getSeconds(), this.toTime.getMilliseconds());
+ this.reportProgress = true;
+ this.updateButtons();
+
if (button.reference === 'showButton') {
if (reportType === 'chart') {
store = this.getChart().getStore();
@@ -171,6 +174,11 @@ Ext.define('Traccar.view.ReportController', {
}
store.showMarkers = this.showMarkers;
store.load({
+ scope: this,
+ callback: function() {
+ this.reportProgress = false;
+ this.updateButtons();
+ },
params: {
deviceId: this.deviceId,
groupId: this.groupId,
@@ -373,29 +381,34 @@ Ext.define('Traccar.view.ReportController', {
Accept: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
},
binary: true,
- success: function (response) {
- var disposition, filename, type, blob, url, downloadUrl;
- disposition = response.getResponseHeader('Content-Disposition');
- filename = disposition.slice(disposition.indexOf('=') + 1, disposition.length);
- type = response.getResponseHeader('Content-Type');
- blob = new Blob([response.responseBytes], {type: type});
- if (typeof window.navigator.msSaveBlob !== 'undefined') {
- // IE workaround
- window.navigator.msSaveBlob(blob, filename);
- } else {
- url = window.URL || window.webkitURL;
- downloadUrl = url.createObjectURL(blob);
- if (filename) {
- Ext.dom.Helper.append(Ext.getBody(), {
- tag: 'a',
- href: downloadUrl,
- download: filename
- }).click();
+ scope: this,
+ callback: function (options, success, response) {
+ if (success) {
+ var disposition, filename, type, blob, url, downloadUrl;
+ disposition = response.getResponseHeader('Content-Disposition');
+ filename = disposition.slice(disposition.indexOf('=') + 1, disposition.length);
+ type = response.getResponseHeader('Content-Type');
+ blob = new Blob([response.responseBytes], {type: type});
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
+ // IE workaround
+ window.navigator.msSaveBlob(blob, filename);
+ } else {
+ url = window.URL || window.webkitURL;
+ downloadUrl = url.createObjectURL(blob);
+ if (filename) {
+ Ext.dom.Helper.append(Ext.getBody(), {
+ tag: 'a',
+ href: downloadUrl,
+ download: filename
+ }).click();
+ }
+ setTimeout(function () {
+ url.revokeObjectURL(downloadUrl);
+ }, 100);
}
- setTimeout(function () {
- url.revokeObjectURL(downloadUrl);
- }, 100);
}
+ this.reportProgress = false;
+ this.updateButtons();
}
});
},