diff --git a/i18n/en-US.json b/i18n/en-US.json index 7093c46..cbe4941 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -213,6 +213,13 @@ "unregisterNotifications": { "label": "Notify when unregistered", "help": "Do you want to notify the administrator each time this device unregisters?" + }, + "__comment": "UI-1917: Add button to unlock device on SmartPBX app", + "__version": "3.22", + "unlock": { + "label": "Allow Reprovision", + "button": "Unlock", + "success": "This device is unlocked for the next 24 hours" } }, "restrictions": { diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json index 65f3616..dc65014 100644 --- a/i18n/fr-FR.json +++ b/i18n/fr-FR.json @@ -173,6 +173,12 @@ "button": "Redémarrer", "help": "Ce bouton envoie une requête de redémarrage. Cette action n'est disponible que pour les appareils qui sont actuellement connectés à la plateforme.", "success": "Vous avez envoyé une requête de redémarrage avec succès!" + }, + + "unlock": { + "label": "Autoriser la mise à jour", + "button": "Déverrouiller", + "success": "Ce téléphone est déverrouillé pour les prochaines 24 heures" } }, "restrictions": { diff --git a/submodules/devices/devices.js b/submodules/devices/devices.js index 632d4f0..bf568c3 100644 --- a/submodules/devices/devices.js +++ b/submodules/devices/devices.js @@ -12,6 +12,11 @@ define(function(require){ 'url': 'ui/{brand}/{family}/{model}', 'verb': 'GET', generateError: false + }, + 'provisioner.devices.unlock': { + 'apiRoot': monster.config.api.provisioner, + 'url': 'locks/{accountId}/{macAddress}', + 'verb': 'DELETE' } }, @@ -269,6 +274,7 @@ define(function(require){ type = data.device_type, popupTitle = mode === 'edit' ? monster.template(self, '!' + self.i18n.active().devices[type].editTitle, { name: data.name }) : self.i18n.active().devices[type].addTitle, templateDevice = $(monster.template(self, 'devices-'+type, $.extend(true, {}, data, { + isProvisionerConfigured: monster.config.api.hasOwnProperty('provisioner'), showEmergencyCnam: monster.util.isNumberFeatureEnabled('cnam') && monster.util.isNumberFeatureEnabled('e911') }))), deviceForm = templateDevice.find('#form_device'); @@ -378,6 +384,12 @@ define(function(require){ } }); + templateDevice.find('#unlock_device').on('click', function() { + self.devicesUnlock(data.mac_address.replace(/\:/g, ''), function() { + toastr.success(self.i18n.active().devices.popupSettings.miscellaneous.unlock.success); + }); + }); + templateDevice.find('.actions .save').on('click', function() { if(monster.ui.valid(deviceForm)) { templateDevice.find('.feature-key-value:not(.active)').remove(); @@ -528,6 +540,21 @@ define(function(require){ }); }, + devicesUnlock: function(macAddress, callback) { + var self = this; + + monster.request({ + resource: 'provisioner.devices.unlock', + data: { + accountId: self.accountId, + macAddress: macAddress + }, + success: function(data, status) { + callback && callback(); + } + }); + }, + devicesMergeData: function(originalData, template, audioCodecs, videoCodecs) { var self = this, hasCodecs = $.inArray(originalData.device_type, ['sip_device', 'landline', 'fax', 'ata', 'softphone', 'smartphone', 'mobile', 'sip_uri']) > -1, diff --git a/views/devices-sip_device.html b/views/devices-sip_device.html index f39d78e..a22e56c 100644 --- a/views/devices-sip_device.html +++ b/views/devices-sip_device.html @@ -249,6 +249,17 @@ + + {{#if isProvisionerConfigured}} +
+ +
+ +
+
+ {{/if}} {{/if}}