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 | |
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')
-rw-r--r-- | web/app/store/ReportEventTypes.js | 9 | ||||
-rw-r--r-- | web/app/view/ReportConfigController.js | 12 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/web/app/store/ReportEventTypes.js b/web/app/store/ReportEventTypes.js index c5840305a..27bc1fd5d 100644 --- a/web/app/store/ReportEventTypes.js +++ b/web/app/store/ReportEventTypes.js @@ -19,10 +19,7 @@ Ext.define('Traccar.store.ReportEventTypes', { extend: 'Ext.data.Store', fields: ['type', 'name'], - allEvents: '%', - - data: [{ - type: '%', - name: Strings.eventAll - }] + statics: { + allEvents: '%' + } }); 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); |