diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-26 12:28:03 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-07-26 12:28:03 +1200 |
commit | cfa8225c8298fd933d92f62928edbd1f6f9096fc (patch) | |
tree | 0b9792071a84ccaab8716b3b4abb46694d6aeff7 /web | |
parent | 430528f29c0b572770ec43f43ac285a354ba08de (diff) | |
download | traccar-server-cfa8225c8298fd933d92f62928edbd1f6f9096fc.tar.gz traccar-server-cfa8225c8298fd933d92f62928edbd1f6f9096fc.tar.bz2 traccar-server-cfa8225c8298fd933d92f62928edbd1f6f9096fc.zip |
Extra parameters for commands
Diffstat (limited to 'web')
-rw-r--r-- | web/app/Application.js | 3 | ||||
-rw-r--r-- | web/app/store/TimeUnits.js | 25 | ||||
-rw-r--r-- | web/app/view/command/CommandDialog.js | 23 | ||||
-rw-r--r-- | web/app/view/command/CommandDialogController.js | 21 | ||||
-rw-r--r-- | web/l10n/en.js | 7 |
5 files changed, 73 insertions, 6 deletions
diff --git a/web/app/Application.js b/web/app/Application.js index 7e5a8ff97..b93ef2f28 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -41,7 +41,8 @@ Ext.define('Traccar.Application', { 'MapTypes', 'DistanceUnits', 'SpeedUnits', - 'CommandTypes' + 'CommandTypes', + 'TimeUnits' ], controllers: [ diff --git a/web/app/store/TimeUnits.js b/web/app/store/TimeUnits.js new file mode 100644 index 000000000..e8cda7b26 --- /dev/null +++ b/web/app/store/TimeUnits.js @@ -0,0 +1,25 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.store.TimeUnits', { + extend: 'Ext.data.Store', + fields: ['multiplier', 'name'], + data : [ + {'multiplier': 1, 'name': strings.shared_second}, + {'multiplier': 60, 'name': strings.shared_minute}, + {'multiplier': 3600, 'name': strings.shared_hour} + ] +}); diff --git a/web/app/view/command/CommandDialog.js b/web/app/view/command/CommandDialog.js index ef99c4db6..7f4b3c592 100644 --- a/web/app/view/command/CommandDialog.js +++ b/web/app/view/command/CommandDialog.js @@ -37,7 +37,28 @@ Ext.define('Traccar.view.command.CommandDialog', { fieldLabel: strings.command_type, store: 'CommandTypes', displayField: 'name', - valueField: 'key' + valueField: 'key', + listeners: { + select: 'onSelect' + } + }, { + xtype: 'fieldcontainer', + reference: 'paramPositionFix', + name: 'other', + hidden: true, + + items: [{ + xtype: 'numberfield', + fieldLabel: strings.command_frequency, + name: 'frequency' + }, { + xtype: 'combobox', + fieldLabel: strings.command_unit, + name: 'unit', + store: 'TimeUnits', + displayField: 'name', + valueField: 'multiplier' + }] }] }, diff --git a/web/app/view/command/CommandDialogController.js b/web/app/view/command/CommandDialogController.js index 08624bf73..14d4ba2e0 100644 --- a/web/app/view/command/CommandDialogController.js +++ b/web/app/view/command/CommandDialogController.js @@ -18,10 +18,25 @@ Ext.define('Traccar.view.command.CommandDialogController', { extend: 'Ext.app.ViewController', alias: 'controller.commanddialog', + onSelect: function(selected) { + this.lookupReference('paramPositionFix').setHidden(selected.getValue() !== 'positionFix'); + }, + onSendClick: function(button) { - var dialog = button.up('window').down('form'); - dialog.updateRecord(); - var record = dialog.getRecord(); + var other; + var form = button.up('window').down('form'); + form.updateRecord(); + var record = form.getRecord(); + + if (record.get('type') === 'positionFix') { + other = this.lookupReference('paramPositionFix'); + var value = other.down('numberfield[name="frequency"]').getValue(); + value *= other.down('combobox[name="unit"]').getValue(); + + record.set('other', { + frequency: value + }); + } Ext.Ajax.request({ scope: this, diff --git a/web/l10n/en.js b/web/l10n/en.js index c1f7360a5..b25fc7231 100644 --- a/web/l10n/en.js +++ b/web/l10n/en.js @@ -10,6 +10,9 @@ var strings = { shared_mi: 'mi', shared_kph: 'km/h', shared_mph: 'mph', + shared_hour: 'Hour', + shared_minute: 'Minute', + shared_second: 'Second', error_title: 'Error', error_unknown: 'Unknown error', @@ -76,5 +79,7 @@ var strings = { command_position_stop: 'Position Stop', command_position_fix: 'Position Fix', command_engine_stop: 'Engine Stop', - command_engine_resume: 'Engine Resume' + command_engine_resume: 'Engine Resume', + command_frequency: 'Frequency', + command_unit: 'Unit' }; |