Browse Source

UI-1917: Add button to unlock device on SmartPBX app

4.3
Joris Tirado 10 years ago
parent
commit
607c04b75e
4 changed files with 51 additions and 0 deletions
  1. +7
    -0
      i18n/en-US.json
  2. +6
    -0
      i18n/fr-FR.json
  3. +27
    -0
      submodules/devices/devices.js
  4. +11
    -0
      views/devices-sip_device.html

+ 7
- 0
i18n/en-US.json View File

@ -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": {


+ 6
- 0
i18n/fr-FR.json View File

@ -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": {


+ 27
- 0
submodules/devices/devices.js View File

@ -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,


+ 11
- 0
views/devices-sip_device.html View File

@ -249,6 +249,17 @@
<i class="help-popover fa fa-question-circle" data-original-title="{{ i18n.devices.popupSettings.miscellaneous.restart.help }}" data-placement="top" data-toggle="tooltip"></i>
</div>
</div>
{{#if isProvisionerConfigured}}
<div class="control-group">
<label class="control-label checkbox">{{ i18n.devices.popupSettings.miscellaneous.unlock.label }}</label>
<div class="controls">
<button id="unlock_device" type="button" class="monster-button-primary">
{{ i18n.devices.popupSettings.miscellaneous.unlock.button }}
</button>
</div>
</div>
{{/if}}
{{/if}}
</div>


Loading…
Cancel
Save