diff options
author | Abyss777 <abyss@fox5.ru> | 2017-09-12 17:39:43 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-09-13 13:51:35 +0500 |
commit | a5d36c62facad98c409b9fcd4f8b92c3d47601ab (patch) | |
tree | 368a2ed169c1457a1cc2dd69a811f2dccc59ce04 /web/app/view/edit/DevicesController.js | |
parent | 31a6fed66b4f077d2b6443fdd34229befe8777c3 (diff) | |
download | trackermap-web-a5d36c62facad98c409b9fcd4f8b92c3d47601ab.tar.gz trackermap-web-a5d36c62facad98c409b9fcd4f8b92c3d47601ab.tar.bz2 trackermap-web-a5d36c62facad98c409b9fcd4f8b92c3d47601ab.zip |
Implement Saved Commands
Diffstat (limited to 'web/app/view/edit/DevicesController.js')
-rw-r--r-- | web/app/view/edit/DevicesController.js | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index df75b1d4..43bab228 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -20,11 +20,12 @@ Ext.define('Traccar.view.edit.DevicesController', { alias: 'controller.devices', requires: [ - 'Traccar.view.dialog.Command', + 'Traccar.view.dialog.SendCommand', 'Traccar.view.dialog.Device', - 'Traccar.view.permissions.DeviceGeofences', - 'Traccar.view.permissions.DeviceAttributes', - 'Traccar.view.permissions.DeviceDrivers', + 'Traccar.view.permissions.Geofences', + 'Traccar.view.permissions.ComputedAttributes', + 'Traccar.view.permissions.Drivers', + 'Traccar.view.permissions.SavedCommands', 'Traccar.view.BaseWindow', 'Traccar.model.Device', 'Traccar.model.Command' @@ -76,7 +77,7 @@ Ext.define('Traccar.view.edit.DevicesController', { Ext.create('Traccar.view.BaseWindow', { title: Strings.sharedGeofences, items: { - xtype: 'deviceGeofencesView', + xtype: 'linkGeofencesView', baseObjectName: 'deviceId', linkObjectName: 'geofenceId', storeName: 'Geofences', @@ -90,7 +91,7 @@ Ext.define('Traccar.view.edit.DevicesController', { Ext.create('Traccar.view.BaseWindow', { title: Strings.sharedComputedAttributes, items: { - xtype: 'deviceAttributesView', + xtype: 'linkComputedAttributesView', baseObjectName: 'deviceId', linkObjectName: 'attributeId', storeName: 'ComputedAttributes', @@ -104,7 +105,7 @@ Ext.define('Traccar.view.edit.DevicesController', { Ext.create('Traccar.view.BaseWindow', { title: Strings.sharedDrivers, items: { - xtype: 'deviceDriversView', + xtype: 'linkDriversView', baseObjectName: 'deviceId', linkObjectName: 'driverId', storeName: 'Drivers', @@ -114,22 +115,31 @@ Ext.define('Traccar.view.edit.DevicesController', { }, onCommandClick: function () { - var device, deviceId, command, dialog, typesStore, online; + var device, deviceId, dialog, typesStore, online, commandsStore; device = this.getView().getSelectionModel().getSelection()[0]; online = device.get('status') === 'online'; deviceId = device.get('id'); - command = Ext.create('Traccar.model.Command'); - command.set('deviceId', deviceId); - command.set('textChannel', !online); - - dialog = Ext.create('Traccar.view.dialog.Command'); - - typesStore = dialog.lookupReference('commandType').getStore(); - typesStore.getProxy().setExtraParam('deviceId', deviceId); + dialog = Ext.create('Traccar.view.dialog.SendCommand'); + dialog.deviceId = deviceId; + dialog.online = online; + + commandsStore = dialog.lookupReference('commandsComboBox').getStore(); + commandsStore.getProxy().setExtraParam('deviceId', deviceId); + commandsStore.removeAll(); + if (!Traccar.app.getPreference('limitCommands', false)) { + commandsStore.add({ + id: 0, + description: Strings.sharedNew, + textChannel: !online + }); + typesStore = dialog.lookupReference('commandType').getStore(); + typesStore.getProxy().setExtraParam('deviceId', deviceId); + } + commandsStore.load({ + addRecords: true + }); - dialog.down('form').loadRecord(command); - dialog.lookupReference('textChannelCheckBox').setDisabled(!online); dialog.show(); }, |