aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-18 10:22:17 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-18 10:22:17 +0500
commit61590f09ba735a532ff337ea841c8f4d27bd81e3 (patch)
tree0b88aa56e842ba152a35158b6caabe982a2c9563
parentfd2207b15d98d8fdef306f3b94924a759c80a3d9 (diff)
downloadtrackermap-web-61590f09ba735a532ff337ea841c8f4d27bd81e3.tar.gz
trackermap-web-61590f09ba735a532ff337ea841c8f4d27bd81e3.tar.bz2
trackermap-web-61590f09ba735a532ff337ea841c8f4d27bd81e3.zip
Initialize stores on application load
-rw-r--r--web/app/controller/Root.js22
-rw-r--r--web/app/view/AttributeAliases.js2
-rw-r--r--web/app/view/CalendarsController.js5
-rw-r--r--web/app/view/DeviceDistanceDialog.js1
-rw-r--r--web/app/view/GeofencesController.js5
-rw-r--r--web/app/view/ReportConfigController.js22
6 files changed, 25 insertions, 32 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index b6e5f385..950b3348 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -78,7 +78,9 @@ Ext.define('Traccar.controller.Root', {
var attribution, eventId;
Ext.getStore('Groups').load();
Ext.getStore('Geofences').load();
+ Ext.getStore('Calendars').load();
Ext.getStore('AttributeAliases').load();
+ this.initReportEventTypesStore();
Ext.getStore('Devices').load({
scope: this,
callback: function () {
@@ -239,5 +241,25 @@ Ext.define('Traccar.controller.Root', {
if (lat === 0 && lon === 0 && zoom === 0) {
this.fireEvent('zoomtoalldevices');
}
+ },
+
+ initReportEventTypesStore: function () {
+ var store = Ext.getStore('ReportEventTypes');
+ store.add({
+ type: Traccar.store.ReportEventTypes.allEvents,
+ name: Strings.eventAll
+ });
+ Ext.create('Traccar.store.AllNotifications').load({
+ scope: this,
+ callback: function (records, operation, success) {
+ var i, value;
+ if (success) {
+ for (i = 0; i < records.length; i++) {
+ value = records[i].get('type');
+ store.add({type: value, name: Traccar.app.getEventString(value)});
+ }
+ }
+ }
+ });
}
});
diff --git a/web/app/view/AttributeAliases.js b/web/app/view/AttributeAliases.js
index 90067c53..d760b85b 100644
--- a/web/app/view/AttributeAliases.js
+++ b/web/app/view/AttributeAliases.js
@@ -38,7 +38,7 @@ Ext.define('Traccar.view.AttributeAliases', {
store: 'Devices',
displayField: 'name',
valueField: 'id',
- typeAhead: true,
+ editable: false,
listeners: {
change: 'onDeviceChange'
}
diff --git a/web/app/view/CalendarsController.js b/web/app/view/CalendarsController.js
index 65bee91d..bfa7569d 100644
--- a/web/app/view/CalendarsController.js
+++ b/web/app/view/CalendarsController.js
@@ -27,9 +27,6 @@ Ext.define('Traccar.view.CalendarsController', {
objectModel: 'Traccar.model.Calendar',
objectDialog: 'Traccar.view.CalendarDialog',
- removeTitle: Strings.sharedCalendar,
+ removeTitle: Strings.sharedCalendar
- init: function () {
- Ext.getStore('Calendars').load();
- }
});
diff --git a/web/app/view/DeviceDistanceDialog.js b/web/app/view/DeviceDistanceDialog.js
index 8fb342be..25b1ca32 100644
--- a/web/app/view/DeviceDistanceDialog.js
+++ b/web/app/view/DeviceDistanceDialog.js
@@ -33,6 +33,7 @@ Ext.define('Traccar.view.DeviceDistanceDialog', {
store: 'AllDevices',
displayField: 'name',
valueField: 'id',
+ editable: false,
listeners: {
change: 'onDeviceChange'
}
diff --git a/web/app/view/GeofencesController.js b/web/app/view/GeofencesController.js
index bf330872..4ee06e81 100644
--- a/web/app/view/GeofencesController.js
+++ b/web/app/view/GeofencesController.js
@@ -24,11 +24,6 @@ Ext.define('Traccar.view.GeofencesController', {
'Traccar.model.Geofence'
],
- init: function () {
- Ext.getStore('Geofences').load();
- Ext.getStore('Calendars').load();
- },
-
objectModel: 'Traccar.model.Geofence',
objectDialog: 'Traccar.view.GeofenceDialog',
removeTitle: Strings.sharedGeofence
diff --git a/web/app/view/ReportConfigController.js b/web/app/view/ReportConfigController.js
index 955b2e96..5ede1830 100644
--- a/web/app/view/ReportConfigController.js
+++ b/web/app/view/ReportConfigController.js
@@ -25,28 +25,6 @@ Ext.define('Traccar.view.ReportConfigController', {
'Traccar.store.AllNotifications'
],
- init: function () {
- var store = this.lookupReference('eventTypeField').getStore();
- 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) {
- var i, value;
- if (success) {
- for (i = 0; i < records.length; i++) {
- value = records[i].get('type');
- store.add({type: value, name: Traccar.app.getEventString(value)});
- }
- }
- }
- });
- }
- },
-
onSaveClick: function (button) {
var eventType;
this.getView().callingPanel.deviceId = this.lookupReference('deviceField').getValue();