aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/CommandDialogController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/CommandDialogController.js')
-rw-r--r--web/app/view/CommandDialogController.js82
1 files changed, 39 insertions, 43 deletions
diff --git a/web/app/view/CommandDialogController.js b/web/app/view/CommandDialogController.js
index 39149c5a5..94df2ec42 100644
--- a/web/app/view/CommandDialogController.js
+++ b/web/app/view/CommandDialogController.js
@@ -13,49 +13,45 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-(function () {
- 'use strict';
-
- Ext.define('Traccar.view.CommandDialogController', {
- extend: 'Ext.app.ViewController',
- alias: 'controller.commandDialog',
-
- onSelect: function (selected) {
- this.lookupReference('paramPositionPeriodic').setHidden(
- selected.getValue() !== 'positionPeriodic');
- },
-
- onSendClick: function (button) {
- var attributes, value, record, form;
-
- form = button.up('window').down('form');
- form.updateRecord();
- record = form.getRecord();
-
- if (record.get('type') === 'positionPeriodic') {
- attributes = this.lookupReference('paramPositionPeriodic');
- value = attributes.down('numberfield[name="frequency"]').getValue();
- value *= attributes.down('combobox[name="unit"]').getValue();
-
- record.set('attributes', {
- frequency: value
- });
- }
-
- Ext.Ajax.request({
- scope: this,
- url: '/api/command/send',
- jsonData: record.getData(),
- callback: this.onSendResult
- });
- },
- onSendResult: function (options, success, response) {
- if (Traccar.ErrorManager.check(success, response)) {
- Ext.toast(Strings.commandSent);
- this.closeView();
- }
+Ext.define('Traccar.view.CommandDialogController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.commandDialog',
+
+ onSelect: function (selected) {
+ this.lookupReference('paramPositionPeriodic').setHidden(
+ selected.getValue() !== 'positionPeriodic');
+ },
+
+ onSendClick: function (button) {
+ var attributes, value, record, form;
+
+ form = button.up('window').down('form');
+ form.updateRecord();
+ record = form.getRecord();
+
+ if (record.get('type') === 'positionPeriodic') {
+ attributes = this.lookupReference('paramPositionPeriodic');
+ value = attributes.down('numberfield[name="frequency"]').getValue();
+ value *= attributes.down('combobox[name="unit"]').getValue();
+
+ record.set('attributes', {
+ frequency: value
+ });
}
- });
-})();
+ Ext.Ajax.request({
+ scope: this,
+ url: '/api/command/send',
+ jsonData: record.getData(),
+ callback: this.onSendResult
+ });
+ },
+
+ onSendResult: function (options, success, response) {
+ if (Traccar.ErrorManager.check(success, response)) {
+ Ext.toast(Strings.commandSent);
+ this.closeView();
+ }
+ }
+});