aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/app/Application.js2
-rw-r--r--web/app/store/SupportedCommands.js (renamed from web/app/store/CommandTypes.js)33
-rw-r--r--web/app/view/CommandDialog.js4
-rw-r--r--web/app/view/DevicesController.js7
4 files changed, 25 insertions, 21 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 69ce8f891..f68ef981e 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -45,7 +45,7 @@ Ext.define('Traccar.Application', {
'MapTypes',
'DistanceUnits',
'SpeedUnits',
- 'CommandTypes',
+ 'SupportedCommands',
'TimeUnits',
'Languages'
],
diff --git a/web/app/store/CommandTypes.js b/web/app/store/SupportedCommands.js
index 3f5094266..612909180 100644
--- a/web/app/store/CommandTypes.js
+++ b/web/app/store/SupportedCommands.js
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,21 +14,22 @@
* limitations under the License.
*/
-Ext.define('Traccar.store.CommandTypes', {
+Ext.define('Traccar.store.SupportedCommands', {
extend: 'Ext.data.Store',
- fields: ['key', 'name'],
+ fields: [
+ { type: 'string', name: 'key'}
+ ],
- data: [{
- key: 'positionPeriodic',
- name: Strings.commandPositionPeriodic
- }, {
- key: 'positionStop',
- name: Strings.commandPositionStop
- }, {
- key: 'engineStop',
- name: Strings.commandEngineStop
- }, {
- key: 'engineResume',
- name: Strings.commandEngineResume
- }]
+ listeners: {
+ 'beforeload' : function(store, eOpts) {
+ var proxy;
+ proxy = store.getProxy();
+ proxy.setUrl('/api/supportedcommands?deviceId' + proxy.extraParams.deviceId);
+ }
+ },
+
+ proxy: {
+ type: 'rest',
+ url: ''
+ }
});
diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js
index 66cd190ea..05412f39c 100644
--- a/web/app/view/CommandDialog.js
+++ b/web/app/view/CommandDialog.js
@@ -30,8 +30,8 @@ Ext.define('Traccar.view.CommandDialog', {
xtype: 'combobox',
name: 'type',
fieldLabel: Strings.commandType,
- store: 'CommandTypes',
- displayField: 'name',
+ store: 'SupportedCommands',
+ displayField: 'key',
valueField: 'key',
listeners: {
select: 'onSelect'
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index 10918c13a..9dee0ff7c 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -80,11 +80,14 @@ Ext.define('Traccar.view.DevicesController', {
},
onCommandClick: function () {
- var device, command, dialog;
+ var device, deviceId, command, dialog, comboStore;
device = this.getView().getSelectionModel().getSelection()[0];
+ deviceId = device.get('id');
command = Ext.create('Traccar.model.Command');
- command.set('deviceId', device.get('id'));
+ command.set('deviceId', deviceId);
dialog = Ext.create('Traccar.view.CommandDialog');
+ comboStore = dialog.down('form').down('combobox').getStore();
+ comboStore.getProxy().setExtraParam('deviceId', deviceId);
dialog.down('form').loadRecord(command);
dialog.show();
},