From 59ca94e19a09ebba891ef50d64e5cbef38fd96cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Gonz=C3=A1lez?= Date: Thu, 28 May 2020 13:07:56 -0600 Subject: [PATCH] [4.3] MSPB-101: Add save and apply button in edit device form (#204) * Add save and apply button in edit device form * Use single button with dropup in edit device actions * Do not show dropup when the device edited is not privisionable * Show droup button just if the edited device is register --- i18n/en-US.json | 1 + submodules/devices/devices.js | 15 ++++++++++- submodules/devices/devices.scss | 15 +++++++++-- .../devices/views/devices-sip_device.html | 27 ++++++++++++++----- 4 files changed, 48 insertions(+), 10 deletions(-) diff --git a/i18n/en-US.json b/i18n/en-US.json index 3cd5886..bafa738 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -169,6 +169,7 @@ "basicSectionTitle": "Basic Settings", "dragAndDrop": "To select a codec, drag and drop from the available codecs box to selected codecs box", "noOwner": "- No Owner -", + "saveAndApply": "Save and Apply", "options": { "menuTitle": "Options" }, diff --git a/submodules/devices/devices.js b/submodules/devices/devices.js index f9fdece..f22e6a7 100644 --- a/submodules/devices/devices.js +++ b/submodules/devices/devices.js @@ -581,13 +581,26 @@ define(function(require) { templateDevice.find('.feature-key-value:not(.active)').remove(); var $this = $(this), + hasToRestart = !!$this.data('extra'), dataToSave = self.devicesMergeData(data, templateDevice, audioCodecs, videoCodecs); + if ($this.hasClass('disabled')) { + return; + } + $this.prop('disabled', 'disabled'); self.devicesSaveDevice(dataToSave, function(data) { - popup.dialog('close').remove(); + if (hasToRestart) { + self.devicesRestart(data.id, function() { + monster.ui.toast({ + type: 'success', + message: self.i18n.active().devices.popupSettings.miscellaneous.restart.success + }); + }); + } + popup.dialog('close').remove(); callbackSave && callbackSave(data); }, function() { $this.prop('disabled', false); diff --git a/submodules/devices/devices.scss b/submodules/devices/devices.scss index 348a1e8..1635346 100644 --- a/submodules/devices/devices.scss +++ b/submodules/devices/devices.scss @@ -234,8 +234,19 @@ padding: 15px; } -.voip-edit-device-popup .edit-device .actions button { - margin-left: 10px; +.voip-edit-device-popup .edit-device .actions{ + button { + &.save { + font-size: 15px; + margin-left: 10px; + } + } + + a { + &.save.disabled { + color: $french-gray; + } + } } .voip-edit-device-popup .edit-device .title-bar { diff --git a/submodules/devices/views/devices-sip_device.html b/submodules/devices/views/devices-sip_device.html index a828255..6b19b0f 100644 --- a/submodules/devices/views/devices-sip_device.html +++ b/submodules/devices/views/devices-sip_device.html @@ -436,13 +436,26 @@
{{ i18n.cancel }} - + +
+ + {{#if extra.isRegistered}} + + + {{/if}} +