diff options
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/AttributesController.js | 25 | ||||
-rw-r--r-- | web/app/view/BaseMap.js | 2 | ||||
-rw-r--r-- | web/app/view/BasePermissionsController.js | 6 | ||||
-rw-r--r-- | web/app/view/DevicesController.js | 20 | ||||
-rw-r--r-- | web/app/view/GeofenceMap.js | 4 | ||||
-rw-r--r-- | web/app/view/GroupsController.js | 7 | ||||
-rw-r--r-- | web/app/view/Notifications.js | 9 | ||||
-rw-r--r-- | web/app/view/NotificationsController.js | 9 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 13 |
9 files changed, 57 insertions, 38 deletions
diff --git a/web/app/view/AttributesController.js b/web/app/view/AttributesController.js index 663b6eae3..3028e41eb 100644 --- a/web/app/view/AttributesController.js +++ b/web/app/view/AttributesController.js @@ -24,29 +24,32 @@ Ext.define('Traccar.view.AttributesController', { ], init: function () { - var store, propertyName, i = 0; + var store, propertyName, i = 0, attributes; store = Ext.create('Traccar.store.Attributes'); store.setProxy(Ext.create('Ext.data.proxy.Memory')); - for (propertyName in this.getView().record.get('attributes')) { - store.add(Ext.create('Traccar.model.Attribute', { - priority: i++, - name: propertyName, - value:this.getView().record.get('attributes')[propertyName] - })); + attributes = this.getView().record.get('attributes'); + for (propertyName in attributes) { + if (attributes.hasOwnProperty(propertyName)) { + store.add(Ext.create('Traccar.model.Attribute', { + priority: i++, + name: propertyName, + value: this.getView().record.get('attributes')[propertyName] + })); + } } - store.addListener('add', function (store , records , index , eOpts) { - for (var i = 0; i < records.length; i++) { + store.addListener('add', function (store, records, index, eOpts) { + for (i = 0; i < records.length; i++) { this.getView().record.get('attributes')[records[i].get('name')] = records[i].get('value'); this.getView().record.dirty = true; } }, this); - store.addListener('update', function (store, record, operation , modifiedFieldNames , details , eOpts) { + store.addListener('update', function (store, record, operation, modifiedFieldNames, details, eOpts) { if (operation === Ext.data.Model.EDIT) { this.getView().record.get('attributes')[record.get('name')] = record.get('value'); this.getView().record.dirty = true; } }, this); - store.addListener('remove', function (store , records , index , isMove , eOpts) { + store.addListener('remove', function (store, records, index, isMove, eOpts) { delete this.getView().record.get('attributes')[records[index].get('name')]; this.getView().record.dirty = true; }, this); diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js index 7f508cbe8..77646cbef 100644 --- a/web/app/view/BaseMap.js +++ b/web/app/view/BaseMap.js @@ -28,7 +28,7 @@ Ext.define('Traccar.view.BaseMap', { return this.mapView; }, - initMap: function() { + initMap: function () { var user, server, layer, type, bingKey, lat, lon, zoom, target; user = Traccar.app.getUser(); diff --git a/web/app/view/BasePermissionsController.js b/web/app/view/BasePermissionsController.js index 713d91770..3cdc2e4dc 100644 --- a/web/app/view/BasePermissionsController.js +++ b/web/app/view/BasePermissionsController.js @@ -19,10 +19,10 @@ Ext.define('Traccar.view.BasePermissionsController', { alias: 'controller.basePermissionsController', init: function () { - var params = {}; + var params = {}, linkStoreName, storeName; params[this.getView().baseObjectName] = this.getView().baseObject; - var linkStoreName = this.getView().linkStoreName; - var storeName = this.getView().storeName; + linkStoreName = this.getView().linkStoreName; + storeName = this.getView().storeName; linkStoreName = (typeof linkStoreName === 'undefined') ? storeName : linkStoreName; this.getView().setStore(Ext.getStore(storeName)); this.getView().getStore().load({ diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index cf31dd7bb..ca3e24661 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -86,15 +86,16 @@ Ext.define('Traccar.view.DevicesController', { }, onGeofencesClick: function () { - var admin = Traccar.app.getUser().get('admin'); - var device = this.getView().getSelectionModel().getSelection()[0]; + var admin, device; + admin = Traccar.app.getUser().get('admin'); + device = this.getView().getSelectionModel().getSelection()[0]; Ext.create('Traccar.view.BaseWindow', { title: Strings.sharedGeofences, items: { xtype: 'deviceGeofencesView', baseObjectName: 'deviceId', linkObjectName: 'geofenceId', - storeName: (admin) ? 'AllGeofences' : 'Geofences', + storeName: 'Geofences', urlApi: '/api/devices/geofences', baseObject: device.getData().id } @@ -115,19 +116,24 @@ Ext.define('Traccar.view.DevicesController', { }, onFollowClick: function (button, pressed) { + var device; if (pressed) { - var device = this.getView().getSelectionModel().getSelection()[0]; + device = this.getView().getSelectionModel().getSelection()[0]; this.fireEvent('selectDevice', device, true); } }, - onSelectionChange: function (selected) { + updateButtons: function (selected) { var empty = selected.getCount() === 0; this.lookupReference('toolbarEditButton').setDisabled(empty); this.lookupReference('toolbarRemoveButton').setDisabled(empty); this.lookupReference('toolbarGeofencesButton').setDisabled(empty); this.lookupReference('deviceCommandButton').setDisabled(empty || (selected.getLastSelected().get('status') !== 'online')); - if (!empty) { + }, + + onSelectionChange: function (selected) { + this.updateButtons(selected); + if (selected.getCount() > 0) { this.fireEvent('selectDevice', selected.getLastSelected(), true); } }, @@ -143,6 +149,6 @@ Ext.define('Traccar.view.DevicesController', { }, onUpdateDevice: function (store, data) { - this.onSelectionChange(this.getView().getSelectionModel()); + this.updateButtons(this.getView().getSelectionModel()); } }); diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js index 165daf40d..573836bc9 100644 --- a/web/app/view/GeofenceMap.js +++ b/web/app/view/GeofenceMap.js @@ -57,7 +57,7 @@ Ext.define('Traccar.view.GeofenceMap', { map = this.map; this.features = new ol.Collection(); - if (this.area !== "") { + if (this.area !== '') { geometry = Traccar.GeofenceConverter.wktToGeometry(this.mapView, this.area); this.features.push(new ol.Feature(geometry)); if (geometry instanceof ol.geom.Circle) { @@ -90,7 +90,7 @@ Ext.define('Traccar.view.GeofenceMap', { map.addInteraction(new ol.interaction.Modify({ features: this.features, - deleteCondition: function(event) { + deleteCondition: function (event) { return ol.events.condition.shiftKeyOnly(event) && ol.events.condition.singleClick(event); } })); diff --git a/web/app/view/GroupsController.js b/web/app/view/GroupsController.js index bc713bb6d..1764423d7 100644 --- a/web/app/view/GroupsController.js +++ b/web/app/view/GroupsController.js @@ -60,15 +60,16 @@ Ext.define('Traccar.view.GroupsController', { }, onGeofencesClick: function () { - var admin = Traccar.app.getUser().get('admin'); - var group = this.getView().getSelectionModel().getSelection()[0]; + var admin, group; + admin = Traccar.app.getUser().get('admin'); + group = this.getView().getSelectionModel().getSelection()[0]; Ext.create('Traccar.view.BaseWindow', { title: Strings.sharedGeofences, items: { xtype: 'groupGeofencesView', baseObjectName: 'groupId', linkObjectName: 'geofenceId', - storeName: (admin) ? 'AllGeofences' : 'Geofences', + storeName: admin ? 'AllGeofences' : 'Geofences', urlApi: '/api/groups/geofences', baseObject: group.getData().id } diff --git a/web/app/view/Notifications.js b/web/app/view/Notifications.js index ae4e459b1..9d9e68471 100644 --- a/web/app/view/Notifications.js +++ b/web/app/view/Notifications.js @@ -26,7 +26,7 @@ Ext.define('Traccar.view.Notifications', { store: 'AllNotifications', selModel: { - selType: 'cellmodel', + selType: 'cellmodel' }, viewConfig:{ @@ -51,7 +51,7 @@ Ext.define('Traccar.view.Notifications', { checkChange: 'onCheckChange' }, renderer: function (value, metaData, record) { - var fields = this.dataIndex.split('\.',2); + var fields = this.dataIndex.split('\.', 2); return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData); } }, { @@ -64,9 +64,8 @@ Ext.define('Traccar.view.Notifications', { checkChange: 'onCheckChange' }, renderer: function (value, metaData, record) { - var fields = this.dataIndex.split('\.',2); + var fields = this.dataIndex.split('\.', 2); return (new Ext.ux.CheckColumn()).renderer(record.get(fields[0])[fields[1]], metaData); } - }], - + }] }); diff --git a/web/app/view/NotificationsController.js b/web/app/view/NotificationsController.js index a7c4290ca..90479fe07 100644 --- a/web/app/view/NotificationsController.js +++ b/web/app/view/NotificationsController.js @@ -47,11 +47,12 @@ Ext.define('Traccar.view.NotificationsController', { }, onBeforeCheckChange: function (column, rowIndex, checked, eOpts) { - var fields = column.dataIndex.split('\.',2); - var record = this.getView().getStore().getAt(rowIndex); - var data = record.get(fields[0]); + var fields, record, data; + fields = column.dataIndex.split('\.', 2); + record = this.getView().getStore().getAt(rowIndex); + data = record.get(fields[0]); if (!data[fields[1]]) { - data[fields[1]] = "true"; + data[fields[1]] = 'true'; } else { delete data[fields[1]]; } diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index b51997262..378cc0681 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -89,9 +89,18 @@ Ext.define('Traccar.view.UserDialog', { fieldLabel: Strings.settingsTwelveHourFormat, allowBlank: false }] - }, { - xtype: 'button', + }], + + buttons: [{ text : Strings.sharedAttributes, handler: 'showAttributesView' + }, { + xtype: 'tbfill' + }, { + text: Strings.sharedSave, + handler: 'onSaveClick' + }, { + text: Strings.sharedCancel, + handler: 'closeView' }] }); |