-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(telephony.guides): display guides based on ovhSubsidiary (#3576)
ref: MANAGER-5594 Signed-off-by: Cyrille Bourgois <[email protected]>
- Loading branch information
Showing
8 changed files
with
212 additions
and
200 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
packages/manager/apps/telecom/src/app/telecom/telephony/billingAccount/guides/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import angular from 'angular'; | ||
|
||
import ovhManagerCore from '@ovh-ux/manager-core'; | ||
|
||
import routing from './telecom-telephony-guides.routing'; | ||
|
||
const moduleName = 'ovhManagerTelecomTelephonyBillingAccountGuides'; | ||
|
||
angular.module(moduleName, [ovhManagerCore]).config(routing); | ||
|
||
export default moduleName; |
111 changes: 111 additions & 0 deletions
111
...com/src/app/telecom/telephony/billingAccount/guides/telecom-telephony-guides.constants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
export const GUIDES = { | ||
sections: [ | ||
{ | ||
label: 'telephony_guides_section_line', | ||
guides: [ | ||
{ | ||
label: 'telephony_guides_activate_services', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/activer-desactiver-services-depuis-telephone/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_configure_call_forward', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/comment-configurer-les-renvois-d-appels/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_configure_programmable_keys', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/configurer-touches-programmables/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_configure_exceptionnal_closures', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/configurer-plages-horaires-fermetures-exceptionnelles-ligne/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_configure_answering_machine', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/configurer-consulter-repondeur-ligne-ovh/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_configure_click2call', | ||
url: { | ||
FR: 'https://docs.ovh.com/fr/voip/configurer-utiliser-click2call/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_manage_abreviated_numbers', | ||
url: { | ||
FR: 'https://docs.ovh.com/fr/voip/gerer-numeros-abreges-ligne-sip/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_manage_simultaneous_calling', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/gerer-utiliser-appels-simultanes/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_manage_number_presentation', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/gerer-la-presentation-du-numero-sur-votre-ligne-sip/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_import_phonebook', | ||
url: { | ||
FR: 'https://docs.ovh.com/fr/voip/importer_un_carnet_de_contacts/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_intercom_mode', | ||
url: { | ||
FR: 'https://docs.ovh.com/fr/voip/mode-intercom/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_update_sounds', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/modifier-musiques-sonneries-ligne/', | ||
}, | ||
}, | ||
{ | ||
label: 'telephony_guides_restrict_sip_line', | ||
url: { | ||
FR: 'https://docs.ovh.com/fr/voip/restreindre-ligne-sip-par-ip/', | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
label: 'telephony_guides_section_phone_troubleshooting', | ||
guides: [ | ||
{ | ||
label: 'telephony_guides_phone_troubleshooting_pap', | ||
url: { | ||
FR: | ||
'https://docs.ovh.com/fr/voip/depannage-telephone-plug-and-phone/', | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
export default { | ||
GUIDES, | ||
}; |
79 changes: 42 additions & 37 deletions
79
...om/src/app/telecom/telephony/billingAccount/guides/telecom-telephony-guides.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
import flatten from 'lodash/flatten'; | ||
import map from 'lodash/map'; | ||
import { GUIDES } from './telecom-telephony-guides.constants'; | ||
|
||
import { Environment } from '@ovh-ux/manager-config'; | ||
export default class TelecomTelephonyGuidesCtrl { | ||
/* @ngInject */ | ||
constructor(SessionService) { | ||
this.SessionService = SessionService; | ||
} | ||
|
||
angular.module('managerApp').controller( | ||
'TelecomTelephonyGuidesCtrl', | ||
class TelecomTelephonyGuidesCtrl { | ||
constructor(TELEPHONY_GUIDES) { | ||
this.constant = { TELEPHONY_GUIDES }; | ||
} | ||
$onInit() { | ||
this.loading = { | ||
init: true, | ||
}; | ||
this.guides = { sections: [] }; | ||
|
||
$onInit() { | ||
this.loading = { | ||
init: false, | ||
}; | ||
this.guides = null; | ||
this.language = null; | ||
this.count = null; | ||
this.SessionService.getUser().then(({ ovhSubsidiary }) => { | ||
this.language = ovhSubsidiary; | ||
|
||
this.guides = { | ||
sections: GUIDES.sections.reduce((sections, section) => { | ||
const filteredSection = { | ||
...section, | ||
guides: section.guides | ||
.filter((guide) => guide.url[ovhSubsidiary]) | ||
.map((guide) => ({ | ||
...guide, | ||
url: guide.url[ovhSubsidiary], | ||
})), | ||
}; | ||
|
||
this.guides = this.constant.TELEPHONY_GUIDES; | ||
this.language = Environment.getUserLanguage(); | ||
this.countGuides(); | ||
} | ||
if (filteredSection.guides.length > 0) { | ||
return [...sections, filteredSection]; | ||
} | ||
return sections; | ||
}, []), | ||
}; | ||
|
||
/** | ||
* Count guides. | ||
*/ | ||
countGuides() { | ||
this.count = flatten( | ||
map(this.guides.sections, (section) => section.guides), | ||
).length; | ||
} | ||
this.loading.init = false; | ||
}); | ||
} | ||
|
||
/** | ||
* Has guides helper. | ||
* @return {Boolean} | ||
*/ | ||
hasGuides() { | ||
return this.count > 0; | ||
} | ||
}, | ||
); | ||
/** | ||
* Has guides helper. | ||
* @return {Boolean} | ||
*/ | ||
hasGuides() { | ||
return this.guides.sections.length > 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
...ccount/guides/telecom-telephony-guides.js → ...uides/telecom-telephony-guides.routing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
angular.module('managerApp').config(($stateProvider) => { | ||
import controller from './telecom-telephony-guides.controller'; | ||
import template from './telecom-telephony-guides.html'; | ||
|
||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('telecom.telephony.billingAccount.guides', { | ||
url: '/guides', | ||
views: { | ||
'[email protected]': { | ||
templateUrl: | ||
'app/telecom/telephony/billingAccount/guides/telecom-telephony-guides.html', | ||
controller: 'TelecomTelephonyGuidesCtrl', | ||
template, | ||
controller, | ||
controllerAs: '$ctrl', | ||
}, | ||
}, | ||
translations: { value: ['.', '../guides'], format: 'json' }, | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.