Browse Source

UI-377: Added restart feature to SmartPBX

4.3
Jean-Roch Maitre 11 years ago
parent
commit
03da3caa68
6 changed files with 65 additions and 7 deletions
  1. +8
    -0
      i18n/en-US.json
  2. +8
    -0
      i18n/fr-FR.json
  3. +5
    -0
      submodules/devices/devices.css
  4. +32
    -5
      submodules/devices/devices.js
  5. +1
    -1
      views/devices-row.html
  6. +11
    -1
      views/devices-sip_device.html

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

@ -186,6 +186,14 @@
"ignoreCompletedElsewhere": {
"label": "Ignore Completed Elsewhere",
"help": "When checked supporting phones will show a call missed if it was part of a ring group answered elsewhere."
},
"__comment": "UI-377: Adding Restart device feature",
"__version": "3.21",
"restart": {
"label": "Send a Restart request",
"button": "Restart",
"help": "This sends a request to restart the device. This action is only available if the device is currently registered to the platform.",
"success": "You successfully sent a Restart request to this device!"
}
},
"restrictions": {


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

@ -165,6 +165,14 @@
"ignoreCompletedElsewhere": {
"label": "Afficher les appels manqués des groupes d'Appels",
"help": "Si cette case est cochée, les téléphones ayant accès à cette fonctionnalité afficheront les appels manqués même s'ils viennent d'un Groupe d'Appel et que l'appel a été pris par un collègue"
},
"__comment": "UI-377: Adding Restart device feature",
"__version": "3.21",
"restart": {
"label": "Envoyer une requête de redémarrage",
"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!"
}
},
"restrictions": {


+ 5
- 0
submodules/devices/devices.css View File

@ -397,3 +397,8 @@
margin-left: 35px;
padding-top: 3px;
}
/* Restart Button */
.edit-device #restart_device {
margin-left: 10px;
}

+ 32
- 5
submodules/devices/devices.js View File

@ -127,10 +127,10 @@ define(function(require){
template.find('.settings').on('click', function() {
var $this = $(this),
dataDevice = {
id: $this.parents('.grid-row').data('id')
id: $this.parents('.grid-row').data('id'),
isRegistered: $this.parents('.grid-row').data('registered') === 'true'
};
self.devicesRenderEdit({ data: dataDevice, callbackSave: function(dataDevice) {
self.devicesRender({ deviceId: dataDevice.id });
}});
@ -365,6 +365,14 @@ define(function(require){
templateDevice.find('#rtp_method').toggle();
});
templateDevice.find('#restart_device').on('click', function() {
if(!$(this).hasClass('disabled')) {
self.devicesRestart(data.id, function() {
toastr.success(self.i18n.active().devices.popupSettings.miscellaneous.restart.success);
});
}
});
templateDevice.find('.actions .save').on('click', function() {
if(monster.ui.valid(deviceForm)) {
templateDevice.find('.feature-key-value:not(.active)').remove();
@ -498,6 +506,21 @@ define(function(require){
});
},
devicesRestart: function(deviceId, callback) {
var self = this;
self.callApi({
resource: 'device.restart',
data: {
accountId: self.accountId,
deviceId: deviceId
},
success: function(data) {
callback && callback(data.data);
}
});
},
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,
@ -612,7 +635,7 @@ define(function(require){
return mergedData;
},
devicesFormatData: function(data) {
devicesFormatData: function(data, dataList) {
var self = this,
defaults = {
extra: {
@ -763,6 +786,8 @@ define(function(require){
formattedData.media.video.codecs = data.device.media.video.codecs;
}
formattedData.extra.isRegistered = dataList.isRegistered;
return formattedData;
},
@ -807,7 +832,8 @@ define(function(require){
type: device.device_type,
friendlyType: self.i18n.active().devices.types[device.device_type],
registered: false,
classStatus: device.enabled ? 'unregistered' : 'disabled' /* Display a device in black if it's disabled, otherwise, until we know whether it's registered or not, we set the color to red */
classStatus: device.enabled ? 'unregistered' : 'disabled' /* Display a device in black if it's disabled, otherwise, until we know whether it's registered or not, we set the color to red */,
isRegistered: false
}
});
@ -820,6 +846,7 @@ define(function(require){
/* Now that we know if it's registered, we set the color to green */
if(device.enabled) {
device.classStatus = 'registered';
device.isRegistered = true;
}
}
});
@ -972,7 +999,7 @@ define(function(require){
}
},
function(error, results) {
var formattedData = self.devicesFormatData(results);
var formattedData = self.devicesFormatData(results, dataDevice);
callback && callback(formattedData);
}


+ 1
- 1
views/devices-row.html View File

@ -1,4 +1,4 @@
<div class="grid-row" data-id="{{id}}" data-search="{{userName}} {{friendlyType}} {{type}} {{name}} {{macAddress}}" data-assigned="{{isAssigned}}">
<div class="grid-row" data-id="{{id}}" data-search="{{userName}} {{friendlyType}} {{type}} {{name}} {{macAddress}}" data-assigned="{{isAssigned}}" data-registered="{{isRegistered}}">
<div class="devices-cells">
<div class="type grid-cell centered {{classStatus}}">
<div class="first-line">


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

@ -209,7 +209,7 @@
</label>
</div>
<div class="rtp-line">
<div class="rtp-line clearfix">
<div class="control-group">
<label class="control-label checkbox">
{{#monsterCheckbox i18n.devices.popupSettings.miscellaneous.rtp.enable }}
@ -227,6 +227,16 @@
</select>
</div>
</div>
{{#if provision}}
<div class="control-group">
<label class="control-label checkbox">{{ i18n.devices.popupSettings.miscellaneous.restart.label }}</label>
<div class="controls">
<button id="restart_device" type="button" class="monster-button monster-button-primary{{#unless extra.isRegistered}} disabled{{/unless}}">{{ i18n.devices.popupSettings.miscellaneous.restart.button }}</button>
<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}}
</div>
{{#if provision.feature_keys}}


Loading…
Cancel
Save