Browse Source

Restrict function key options for line key mod (#245)

4.3
Fernando González 5 years ago
committed by GitHub
parent
commit
ac0f600896
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 9 deletions
  1. +12
    -6
      submodules/devices/devices.js
  2. +11
    -3
      submodules/devices/views/devices-sip_device.html

+ 12
- 6
submodules/devices/devices.js View File

@ -942,8 +942,7 @@ define(function(require) {
),
defaultLineKeys = _.get(
self.appFlags.devices.provisionerConfigFlags,
['brands', _.get(data.device, 'provision.endpoint_brand'), 'lineKeys'],
[1]
['brands', _.get(data.device, 'provision.endpoint_brand'), 'lineKeys']
),
isClassifierDisabledByAccount = function isClassifierDisabledByAccount(classifier) {
return _.get(data.accountLimits, ['call_restriction', classifier, 'action']) === 'deny';
@ -1078,7 +1077,7 @@ define(function(require) {
return _.merge({
id: type,
type: camelCasedType,
lineKeys: defaultLineKeys,
lineKeys: defaultLineKeys || [1],
actions: _
.chain([
'presence',
@ -1094,13 +1093,20 @@ define(function(require) {
})
.concat(['none'])
.map(function(action) {
var i18n = self.i18n.active().devices.popupSettings.keys;
var i18n = self.i18n.active().devices.popupSettings.keys,
hasDefaultLineKeys = !!defaultLineKeys,
allowedDefaultLineKeyActions = ['none', 'line'];
return {
return _.merge({
id: action,
info: _.get(i18n, ['info', 'types', action]),
label: _.get(i18n, ['types', action])
};
},
type === 'combo_keys' && hasDefaultLineKeys && !_.includes(allowedDefaultLineKeyActions, action) ? {
isActionRestringed: true
}
: {}
);
})
// Sort alphabetically while keeping `none` as first item
.sort(function(a, b) {


+ 11
- 3
submodules/devices/views/devices-sip_device.html View File

@ -366,9 +366,17 @@
<select name="provision.keys.{{../id}}[{{@index}}].type" class="feature-key-type span2">
{{#select type}}
{{#each ../actions}}
<option value="{{id}}">
{{label}}
</option>
{{#ifInArray ../keyNumber ../../lineKeys}}
{{#unless isActionRestringed}}
<option value="{{id}}">
{{label}}
</option>
{{/unless}}
{{else}}
<option value="{{id}}">
{{label}}
</option>
{{/ifInArray}}
{{/each}}
{{/select}}
</select>


Loading…
Cancel
Save