diff options
author | Abyss777 <abyss@fox5.ru> | 2016-08-30 14:31:21 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-08-30 14:31:21 +0500 |
commit | 72dd6fa3f04a12df346ef3996878092cde407681 (patch) | |
tree | 93f72a32f389c9629ce54cad69ef8d458abae215 /web/app/view | |
parent | bcaad78df62ea695757a37f97757b1a34e228ed5 (diff) | |
download | trackermap-server-72dd6fa3f04a12df346ef3996878092cde407681.tar.gz trackermap-server-72dd6fa3f04a12df346ef3996878092cde407681.tar.bz2 trackermap-server-72dd6fa3f04a12df346ef3996878092cde407681.zip |
Used static variable and move creation allEvents item from config to ReportConfigController.init()
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/ReportConfigController.js | 12 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/web/app/view/ReportConfigController.js b/web/app/view/ReportConfigController.js index 5bd6ae7ef..64acb7403 100644 --- a/web/app/view/ReportConfigController.js +++ b/web/app/view/ReportConfigController.js @@ -21,7 +21,11 @@ Ext.define('Traccar.view.ReportConfigController', { init: function () { var store = this.lookupReference('eventTypeField').getStore(); - if (store.getCount() === 1) { + if (store.getCount() === 0) { + store.add({ + type: Traccar.store.ReportEventTypes.allEvents, + name: Strings.eventAll + }); Ext.create('Traccar.store.AllNotifications').load({ scope: this, callback: function (records, operation, success) { @@ -44,10 +48,10 @@ Ext.define('Traccar.view.ReportConfigController', { this.getView().callingPanel.deviceId = this.lookupReference('deviceField').getValue(); this.getView().callingPanel.groupId = this.lookupReference('groupField').getValue(); eventType = this.lookupReference('eventTypeField').getValue(); - if (eventType.indexOf(Ext.getStore('ReportEventTypes').allEvents) > -1) { - eventType = [Ext.getStore('ReportEventTypes').allEvents]; + if (eventType.indexOf(Traccar.store.ReportEventTypes.allEvents) > -1) { + eventType = [Traccar.store.ReportEventTypes.allEvents]; } else if (eventType.length === this.lookupReference('eventTypeField').getStore().getCount() - 1) { - eventType = [Ext.getStore('ReportEventTypes').allEvents]; + eventType = [Traccar.store.ReportEventTypes.allEvents]; } this.getView().callingPanel.eventType = eventType; this.getView().callingPanel.fromDate = this.lookupReference('fromDateField').getValue(); diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 4cc42456c..a4a5c6227 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -43,7 +43,7 @@ Ext.define('Traccar.view.ReportController', { if (this.eventType !== undefined) { dialog.lookupReference('eventTypeField').setValue(this.eventType); } else { - dialog.lookupReference('eventTypeField').setValue([Ext.getStore('ReportEventTypes').allEvents]); + dialog.lookupReference('eventTypeField').setValue([Traccar.store.ReportEventTypes.allEvents]); } if (this.fromDate !== undefined) { dialog.lookupReference('fromDateField').setValue(this.fromDate); |