aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit/DevicesController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/edit/DevicesController.js')
-rw-r--r--web/app/view/edit/DevicesController.js46
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();
},