From 24ed72ab26fd31769e334b928316b038b4d8b647 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 15 Sep 2015 13:43:31 +1200 Subject: More changes to store classes --- web/app/Application.js | 2 +- web/app/store/LatestPositions.js | 20 ++++++++++++++++++++ web/app/store/LiveData.js | 20 -------------------- web/app/store/TimeUnits.js | 18 ++++++++++++------ web/app/view/command/CommandDialog.js | 2 +- web/app/view/map/MapController.js | 2 +- web/app/view/state/StateController.js | 4 ++-- 7 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 web/app/store/LatestPositions.js delete mode 100644 web/app/store/LiveData.js diff --git a/web/app/Application.js b/web/app/Application.js index 9544f21b2..0ed509686 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -35,7 +35,7 @@ Ext.define('Traccar.Application', { stores: [ 'Devices', 'Positions', - 'LiveData', + 'LatestPositions', 'Users', 'Attributes', 'MapTypes', diff --git a/web/app/store/LatestPositions.js b/web/app/store/LatestPositions.js new file mode 100644 index 000000000..c656bdcb8 --- /dev/null +++ b/web/app/store/LatestPositions.js @@ -0,0 +1,20 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.store.LatestPositions', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Position' +}); diff --git a/web/app/store/LiveData.js b/web/app/store/LiveData.js deleted file mode 100644 index 35731e339..000000000 --- a/web/app/store/LiveData.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Ext.define('Traccar.store.LiveData', { - extend: 'Ext.data.Store', - model: 'Traccar.model.Position' -}); diff --git a/web/app/store/TimeUnits.js b/web/app/store/TimeUnits.js index 5d96f3b8b..047fd6016 100644 --- a/web/app/store/TimeUnits.js +++ b/web/app/store/TimeUnits.js @@ -16,10 +16,16 @@ Ext.define('Traccar.store.TimeUnits', { extend: 'Ext.data.Store', - fields: ['multiplier', 'name'], - data: [ - {'multiplier': 1, 'name': strings.sharedSecond}, - {'multiplier': 60, 'name': strings.sharedMinute}, - {'multiplier': 3600, 'name': strings.sharedHour} - ] + fields: ['name', 'factor'], + + data: [{ + name: strings.sharedSecond, + factor: 1 + }, { + name: strings.sharedMinute, + factor: 60 + }, { + name: strings.sharedHour, + factor: 3600 + }] }); diff --git a/web/app/view/command/CommandDialog.js b/web/app/view/command/CommandDialog.js index e862b9076..8f567a74a 100644 --- a/web/app/view/command/CommandDialog.js +++ b/web/app/view/command/CommandDialog.js @@ -56,7 +56,7 @@ Ext.define('Traccar.view.command.CommandDialog', { name: 'unit', store: 'TimeUnits', displayField: 'name', - valueField: 'multiplier' + valueField: 'factor' }] }] }, diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index 0aab71725..b0d8b8f39 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -49,7 +49,7 @@ Ext.define('Traccar.view.map.MapController', { var i; for (i = 0; i < data.length; i++) { - var store = Ext.getStore('LiveData'); + var store = Ext.getStore('LatestPositions'); var found = store.query('deviceId', data[i].deviceId); if (found.getCount() > 0) { diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js index bc125e529..23ac72db3 100644 --- a/web/app/view/state/StateController.js +++ b/web/app/view/state/StateController.js @@ -29,7 +29,7 @@ Ext.define('Traccar.view.state.StateController', { }, init: function() { - var store = Ext.getStore('LiveData'); + var store = Ext.getStore('LatestPositions'); store.on('add', this.add, this); store.on('update', this.update, this); }, @@ -137,7 +137,7 @@ Ext.define('Traccar.view.state.StateController', { selectDevice: function(device) { this.deviceId = device.get('id'); - var found = Ext.getStore('LiveData').query('deviceId', this.deviceId); + var found = Ext.getStore('LatestPositions').query('deviceId', this.deviceId); if (found.getCount() > 0) { this.updatePosition(found.first()); } else { -- cgit v1.2.3