Skip to content

Commit

Permalink
MSPB-215: add support for teammate device (#405)
Browse files Browse the repository at this point in the history
* mspb-215: add templates for teammate device

* mspb-215: add support for teammate device

* show teammate device based on config

* update extra devices key and devices array
  • Loading branch information
mavriciomart authored Mar 23, 2022
1 parent 5997007 commit b5ef830
Show file tree
Hide file tree
Showing 10 changed files with 271 additions and 34 deletions.
7 changes: 7 additions & 0 deletions i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@
"new": "New Softphone",
"deviceName": "Device Name"
},
"teammate": {
"addTitle": "Adding a TeamMate Device",
"editTitle": "Editing TeamMate Device: {{name}}",
"new": "New TeamMate Device",
"deviceName": "Device Name"
},
"ata": {
"addTitle": "Adding an ATA",
"editTitle": "Editing ATA: {{name}}",
Expand Down Expand Up @@ -459,6 +465,7 @@
"smartphone": "Smartphone",
"mobile": "Business Mobile",
"softphone": "Soft Phone",
"teammate": "TeamMate",
"landline": "Landline",
"fax": "Fax",
"ata": "ATA",
Expand Down
52 changes: 38 additions & 14 deletions submodules/devices/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ define(function(require) {
return _.every([dest, src], _.isArray) ? src : undefined;
};

var showTeammateDevice = _
.chain(monster.config)
.get('allowedExtraDeviceTypes', [])
.includes('teammate')
.value();

var app = {

requests: {
Expand All @@ -32,23 +38,24 @@ define(function(require) {
appFlags: {
devices: {
iconClassesByDeviceTypes: {
application: 'icon-telicon-apps',
ata: 'icon-telicon-ata',
cellphone: 'fa fa-phone',
fax: 'icon-telicon-fax',
landline: 'icon-telicon-home',
mobile: 'icon-telicon-sprint-phone',
sip_device: 'icon-telicon-voip-phone',
sip_uri: 'icon-telicon-voip-phone',
smartphone: 'icon-telicon-mobile-phone',
softphone: 'icon-telicon-soft-phone'
application: 'apps',
ata: 'device-ata',
cellphone: 'phone',
fax: 'device-fax',
landline: 'home',
mobile: 'device-sprint-phone',
sip_device: 'device-voip-phone',
sip_uri: 'device-voip-phone',
smartphone: 'device-mobile',
softphone: 'device-soft-phone',
teammate: 'device-mst'
},
/**
* Lists device types allowed to be added by devicesRenderAdd.
* The order is important and controls the list rendered in DOM.
* @type {Array}
*/
addableDeviceTypes: [
addableDeviceTypes: _.flatten([[
'sip_device',
'cellphone',
'smartphone',
Expand All @@ -57,12 +64,14 @@ define(function(require) {
'fax',
'ata',
'sip_uri'
],
], showTeammateDevice ? [
'teammate'
] : []]),
/**
* Lists device types allowed to be edited by devicesRenderEdit.
* @type {Array}
*/
editableDeviceTypes: [
editableDeviceTypes: _.flatten([[
'ata',
'cellphone',
'fax',
Expand All @@ -73,6 +82,9 @@ define(function(require) {
'smartphone',
'softphone'
],
showTeammateDevice ? [
'teammate'
] : []]),
provisionerConfigFlags: monster.config.whitelabel.provisioner
}
},
Expand Down Expand Up @@ -1218,7 +1230,19 @@ define(function(require) {
]))
},
smartphone: _.merge({}, sipSettings, callForwardSettings),
softphone: _.merge({}, sipSettings)
softphone: _.merge({}, sipSettings),
teammate: _.merge({
media: {
encryption: {
enforce_security: true,
webrtc: false,
methods: ['srtp']
},
audio: {
codecs: ['PCMU', 'PCMA']
}
}
}, sipSettings)
};

return _.get(defaultsPerType, type, {});
Expand Down
17 changes: 12 additions & 5 deletions submodules/devices/devices.scss
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@
line-height: 55px;
}

#devices_container .devices-grid .grid-row .grid-cell.type .first-line > i {
font-size: 24px;
#devices_container .devices-grid .grid-row .grid-cell.type .first-line > svg {
width: 24px;
height: 24px;
}

#devices_container .devices-grid .grid-row .grid-cell.type .second-line {
Expand All @@ -192,13 +193,13 @@
line-height: 20px;
}

#devices_container .devices-grid .grid-row .grid-cell.registered i {
#devices_container .devices-grid .grid-row .grid-cell.registered svg {
color: #44CC44;
}
#devices_container .devices-grid .grid-row .grid-cell.unregistered i {
#devices_container .devices-grid .grid-row .grid-cell.unregistered svg {
color: #EE1212;
}
#devices_container .devices-grid .grid-row .grid-cell.disabled i {
#devices_container .devices-grid .grid-row .grid-cell.disabled svg {
color: #333333;
}

Expand Down Expand Up @@ -276,6 +277,12 @@
vertical-align: middle;
}

.voip-edit-device-popup .edit-device .title-bar .device-title .device-icon > svg {
height: 48px;
width: 48px;
vertical-align: middle;
}

.voip-edit-device-popup .edit-device .title-bar .device-title .device-image {
border-radius: 2px;
border: 1px solid #CCC;
Expand Down
182 changes: 182 additions & 0 deletions submodules/devices/views/devices-teammate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<div class="edit-device" data-id="{{id}}">
<div class="title-bar clearfix">
<div class="device-title pull-left">
<div class="device-icon">
{{telicon "device-mst"}}
</div>

{{#if id}}
<div class="device-model">{{name}}</div>
{{else}}
<div class="device-model">{{i18n.devices.teammate.new}}</div>
{{/if}}
</div>

<ul class="nav nav-pills pull-right">
<li class="tabs-main-selector main-section active">
<a class="tabs-selector change-section" data-section="basic" href="javascript:void(0)">
{{ i18n.devices.popupSettings.basicTitle }}
</a>
</li>
<li class="tabs-main-selector main-section dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">
{{ i18n.devices.popupSettings.advancedTitle }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a class="tabs-selector change-section" data-section="restrictions" href="javascript:void(0)">
<i class="fa fa-ban"></i>
{{ i18n.devices.popupSettings.restrictions.menuTitle }}
</a>
</li>
{{#if showEmergencyCallerId}}
<li>
<a class="tabs-selector change-section" data-section="callerId" href="javascript:void(0)">
<i class="fa fa-ambulance"></i>
{{ i18n.devices.popupSettings.callerId.menuTitle }}
</a>
</li>
{{/if}}
<li>
<a class="tabs-selector change-section" data-section="miscellaneous" href="javascript:void(0)">
<i class="fa fa-cogs"></i>
{{ i18n.devices.popupSettings.miscellaneous.menuTitle }}
</a>
</li>
</ul>
</li>
</ul>
</div>

<div class="content">
<form id="form_device" class="form-horizontal">
<div class="tabs-section active" data-section="basic">
<div class="control-group">
<label class="control-label" for="name">{{ i18n.devices.teammate.deviceName }}</label>
<div class="controls">
<input type="text" id="name" name="name" value="{{name}}">
</div>
</div>

<div class="control-group">
<label class="control-label" for="sip_username">{{ i18n.devices.sip.username }}</label>
<div class="controls">
<input type="text" id="sip_username" name="sip.username" value="{{sip.username}}">
</div>
</div>

<div class="control-group">
<label class="control-label" for="sip_password">{{ i18n.devices.sip.password }}</label>
<div class="controls">
<input type="password" id="sip_password" name="sip.password" value="{{sip.password}}">
</div>
</div>

<div class="control-group">
<label class="control-label" for="sip_username">{{ i18n.devices.sip.realm }}</label>
<div class="controls">
<span class="displayed-realm">{{ extra.sip.realm }}</span>
</div>
</div>
</div>

<div class="tabs-section clearfix" data-section="restrictions">
<div class="restrictions-container">
<div class="restriction-matcher-div">
<i class="help-popover fa fa-question-circle fa-lg" data-original-title="{{i18n.devices.popupSettings.restrictions.matcher.help}}" data-placement="top" data-toggle="tooltip"></i>
<input type="text" class="restriction-matcher-input" placeholder="{{i18n.devices.popupSettings.restrictions.matcher.placeholder}}" />
<button type="button" class="monster-button monster-button-primary restriction-matcher-button">{{i18n.devices.popupSettings.restrictions.matcher.button}}</button>
</div>
<div class="title">
{{ i18n.devices.popupSettings.restrictions.sectionTitle }}
</div>
<div class="restriction-list">
{{#each extra.restrictions}}
<div class="control-group restriction-line{{#if this.disabled}} disabled{{/if}}" data-restriction="{{@key}}">
<label class="control-label">{{this.friendly_name}}
{{#if this.help}}
<i class="help-popover fa fa-question-circle" data-original-title="{{this.help}}" data-placement="top" data-toggle="tooltip"></i>
{{/if}}
</label>
<div class="controls">
<div class="switch">
{{#monsterSwitch}}
<input class="restrictions-switch" type="checkbox" name="call_restriction.{{@key}}.action" data-on="{{@root.i18n.devices.popupSettings.restrictions.allow}}" data-off="{{@root.i18n.devices.popupSettings.restrictions.deny}}" {{#compare this.action '===' 'inherit'}}{{#unless this.disabled}} checked{{/unless}}{{/compare}}{{#if this.disabled}} disabled{{/if}}></input>
{{/monsterSwitch}}
</div>
<i class="restriction-matcher-sign fa-lg fa fa-check monster-green"></i>
</div>
</div>
{{/each}}
</div>
<div class="restriction-message help-box">
</div>
{{#if extra.hasDisabledRestrictions}}
{{#monsterText 'info' 'disabled-restrictions-info'}}
<p>{{ i18n.devices.popupSettings.restrictions.disabledRestrictionsInfo }}</p>
{{/monsterText}}
{{/if}}
</div>
</div>

{{#if showEmergencyCallerId}}
<div class="tabs-section clearfix" data-section="callerId">
<div class="title">
{{ i18n.devices.popupSettings.callerId.sectionTitle }}
</div>

{{#if extra.hasE911Numbers}}
<div class="control-group">
<label class="control-label">{{ i18n.devices.popupSettings.callerId.emergency }}</label>
<div class="controls emergency-number"></div>
</div>
<div class="control-group number-address">
<label class="control-label">{{i18n.devices.popupSettings.callerId.address}}</label>
<div class="controls">
<p></p>
</div>
</div>
{{else}}
{{#monsterText 'error'}}
{{ i18n.devices.popupSettings.callerId.noE911Numbers }}
{{/monsterText}}
{{/if}}
</div>
{{/if}}

<div class="tabs-section clearfix" data-section="miscellaneous">
<div class="title">
{{ i18n.devices.popupSettings.miscellaneous.sectionTitle }}
</div>

<div class="control-group">
<label class="control-label checkbox">
{{#monsterCheckbox i18n.devices.popupSettings.miscellaneous.unregisterNotifications.label }}
<input type="checkbox" name="extra.notify_unregister" id="notify_unregister" {{#unless suppress_unregister_notifications}}checked{{/unless}} />
{{/monsterCheckbox}}
<i class="help-popover fa fa-question-circle fa-lg" data-original-title="{{i18n.devices.popupSettings.miscellaneous.unregisterNotifications.help}}" data-placement="top" data-toggle="tooltip"></i>
</label>
</div>

</div>
</form>
</div>

<div class="actions clearfix">
{{#if id}}
<a id="delete_device" class="monster-link"><i class="fa fa-trash-o monster-red"></i>{{ i18n.devices.deleteDevice }}</a>
{{/if}}

<div class="pull-right">
<a class="cancel-link monster-link blue" href="javascript:void(0);">{{ i18n.cancel }}</a>
<button type="button" class="monster-button monster-button-success save">
{{#if id}}
{{ i18n.saveChanges }}
{{else}}
{{ i18n.devices.createDevice }}
{{/if}}
</button>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion submodules/devices/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
{{#each deviceTypesToAdd}}
<li>
<a class="create-device" data-type="{{type}}">
<i class="{{icon}}"></i>
<i>
{{telicon icon}}
</i>
{{tryI18n @root.i18n.devices.types type}}
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion submodules/devices/views/row.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="devices-cells">
<div class="type grid-cell centered {{classStatus}}">
<div class="first-line">
<i class="{{friendlyIconClass}} fa fa-device"></i>
{{telicon friendlyIconClass}}
</div>
<div class="second-line">
{{friendlyType}}
Expand Down
3 changes: 2 additions & 1 deletion submodules/myOffice/myOffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ define(function(require) {
'landline',
'fax',
'ata',
'application'
'application',
'teammate'
],
userCountByServicePlanRole = _
.chain(data.users)
Expand Down
Loading

0 comments on commit b5ef830

Please sign in to comment.