From 3a5e334b50bf35d11743d937c9fae2fb8c7829ec Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 19 Sep 2017 09:36:16 +0500 Subject: Implement Notifications per device --- web/app/controller/Root.js | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'web/app/controller/Root.js') diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index 64227aa..75c4531 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -113,7 +113,19 @@ Ext.define('Traccar.controller.Root', { Ext.getStore('ComputedAttributes').load(); Ext.getStore('AllCommandTypes').load(); Ext.getStore('Commands').load(); - this.initReportEventTypesStore(); + Ext.getStore('AllNotificationTypes').load({ + callback: function (records, operation, success) { + var store = Ext.getStore('ReportEventTypes'); + if (success) { + store.add({ + type: Traccar.store.ReportEventTypes.allEvents, + name: Strings.eventAll + }); + store.loadData(records, true); + } + } + }); + Ext.getStore('Notifications').load(); Ext.getStore('ServerAttributes').loadData(Ext.getStore('CommonDeviceAttributes').getData().items, true); Ext.getStore('ServerAttributes').loadData(Ext.getStore('CommonUserAttributes').getData().items, true); @@ -285,28 +297,5 @@ 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