From fa121daf1da238b0ae89e79986592b72279cb781 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 19 Oct 2017 09:31:50 +0500 Subject: Adjusted to buffered commands --- web/app/view/dialog/SendCommandController.js | 3 +-- web/app/view/edit/DevicesController.js | 13 ++++++------- web/l10n/en.json | 1 + 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'web') diff --git a/web/app/view/dialog/SendCommandController.js b/web/app/view/dialog/SendCommandController.js index 567be94..c635158 100644 --- a/web/app/view/dialog/SendCommandController.js +++ b/web/app/view/dialog/SendCommandController.js @@ -59,14 +59,13 @@ Ext.define('Traccar.view.dialog.SendCommandController', { } this.lookupReference('newCommandFields').setDisabled(command.getId() !== 0); - this.lookupReference('textChannelCheckBox').setDisabled(command.getId() !== 0 || !this.getView().online); this.lookupReference('sendButton').setDisabled(command.getId() === 0); }, onSendResult: function (options, success, response) { if (success) { this.closeView(); - Traccar.app.showToast(Strings.commandSent); + Traccar.app.showToast(response.status === 202 ? Strings.commandQueued : Strings.commandSent); } else { Traccar.app.showError(response); } diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index a4bbd4b..a0bf9dc 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -70,30 +70,29 @@ Ext.define('Traccar.view.edit.DevicesController', { }, onCommandClick: function () { - var device, deviceId, dialog, typesStore, online, commandsStore; + var device, deviceId, dialog, typesStore, commandsStore; device = this.getView().getSelectionModel().getSelection()[0]; - online = device.get('status') === 'online'; deviceId = device.get('id'); dialog = Ext.create('Traccar.view.dialog.SendCommand'); dialog.deviceId = deviceId; - dialog.online = online; commandsStore = dialog.lookupReference('commandsComboBox').getStore(); commandsStore.getProxy().setExtraParam('deviceId', deviceId); if (!Traccar.app.getPreference('limitCommands', false)) { commandsStore.add({ id: 0, - description: Strings.sharedNew, - textChannel: !online + description: Strings.sharedNew }); - typesStore = dialog.lookupReference('commandType').getStore(); - typesStore.getProxy().setExtraParam('deviceId', deviceId); } commandsStore.load({ addRecords: true }); + typesStore = dialog.lookupReference('commandType').getStore(); + typesStore.getProxy().setExtraParam('deviceId', deviceId); + typesStore.load(); + dialog.show(); }, diff --git a/web/l10n/en.json b/web/l10n/en.json index 4ef0d42..29a0da5 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -243,6 +243,7 @@ "commandTitle": "Command", "commandSend": "Send", "commandSent": "Command has been sent", + "commandQueued": "Command has been queued", "commandUnit": "Unit", "commandCustom": "Custom command", "commandDeviceIdentification": "Device Identification", -- cgit v1.2.3