From b584b73e523729f28cd294fa1c54a1198ddcea30 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 31 May 2016 15:01:23 +1200 Subject: Request report only if device selected --- web/app/view/ReportController.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'web') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 9c2abcc71..4fe7c62b8 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -37,25 +37,27 @@ Ext.define('Traccar.view.ReportController', { fromDate = this.lookupReference('fromDateField').getValue(); fromTime = this.lookupReference('fromTimeField').getValue(); - from = new Date( - fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(), - fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds()); + if (deviceId) { + from = new Date( + fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(), + fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds()); - toDate = this.lookupReference('toDateField').getValue(); - toTime = this.lookupReference('toTimeField').getValue(); + toDate = this.lookupReference('toDateField').getValue(); + toTime = this.lookupReference('toTimeField').getValue(); - to = new Date( - toDate.getFullYear(), toDate.getMonth(), toDate.getDate(), - toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds()); + to = new Date( + toDate.getFullYear(), toDate.getMonth(), toDate.getDate(), + toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds()); - store = Ext.getStore('Positions'); - store.load({ - params: { - deviceId: deviceId, - from: from.toISOString(), - to: to.toISOString() - } - }); + store = Ext.getStore('Positions'); + store.load({ + params: { + deviceId: deviceId, + from: from.toISOString(), + to: to.toISOString() + } + }); + } }, onClearClick: function () { -- cgit v1.2.3