From 61590f09ba735a532ff337ea841c8f4d27bd81e3 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sat, 18 Mar 2017 10:22:17 +0500 Subject: Initialize stores on application load --- web/app/controller/Root.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'web/app/controller') 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)}); + } + } + } + }); } }); -- cgit v1.2.3