From 6df2d69eb856ba1cdcbab5aa2ef70405c17c742f Mon Sep 17 00:00:00 2001 From: Sergii Leonenko Date: Mon, 7 Dec 2020 22:59:05 +0200 Subject: [PATCH] TT#96352 - CSC: As a Customer, I want change my Mail2Fax settings AC: If not already exists: Can see a separate main menu item "Fax Settings" Can click the separate main menu item and land on a page "Fax Settings" (route=/user/fax-settings) Can see settings if the feature enabled Can decide either to use SecretKey or ACL to manage authentication Can set a custom secret key/token Can set the renew interval (never, daily, weekly, monthly) Can see/read the "Last Secret Key Modify Time" Can add email addresses to get notified about expired key (secret_renew_notify) Can remove email addresses Can add ACL Rule (email, ip, destination, use-regexp flag) Can edit ACL Rule (email, ip, destination, use-regexp flag) Can remove ACL Rule Change-Id: I6bc25ab2f73d0dfae3fab224b11396ecdd17ab39 --- src/api/fax.js | 27 ++ src/boot/i18n.js | 1 + src/components/CscMainMenuTop.vue | 5 +- src/components/CscTooltip.vue | 55 +++ src/components/form/CscInputSaveable.vue | 1 + .../CallForward/CscAddDestinationForm.vue | 4 +- ...nation.vue => CscFaxToMailDestination.vue} | 8 +- ...rm.vue => CscFaxToMailDestinationForm.vue} | 4 +- .../FaxSettings/CscFaxToMailSettings.vue | 272 +++++++++++++ .../pages/FaxSettings/CscMailToFaxACL.vue | 109 +++++ .../pages/FaxSettings/CscMailToFaxACLForm.vue | 177 +++++++++ .../CscMailToFaxRenewNotifyEmail.vue | 152 +++++++ .../CscMailToFaxRenewNotifyEmailForm.vue | 129 ++++++ .../FaxSettings/CscMailToFaxSettings.vue | 373 ++++++++++++++++++ src/css/app.styl | 6 + src/i18n/en.json | 15 +- src/layouts/CscLayoutMain.vue | 6 +- src/pages/CscPageFaxSettings.vue | 291 ++------------ src/plugins/rtc-engine.js | 28 +- src/router/routes.js | 8 + src/store/call-forward.js | 4 +- src/store/fax.js | 33 +- src/store/user.js | 6 +- 23 files changed, 1422 insertions(+), 292 deletions(-) create mode 100644 src/components/CscTooltip.vue rename src/components/pages/FaxSettings/{CscFax2MailDestination.vue => CscFaxToMailDestination.vue} (91%) rename src/components/pages/FaxSettings/{CscFax2MailDestinationForm.vue => CscFaxToMailDestinationForm.vue} (98%) create mode 100644 src/components/pages/FaxSettings/CscFaxToMailSettings.vue create mode 100644 src/components/pages/FaxSettings/CscMailToFaxACL.vue create mode 100644 src/components/pages/FaxSettings/CscMailToFaxACLForm.vue create mode 100644 src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmail.vue create mode 100644 src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmailForm.vue create mode 100644 src/components/pages/FaxSettings/CscMailToFaxSettings.vue diff --git a/src/api/fax.js b/src/api/fax.js index 10215509..946569b2 100644 --- a/src/api/fax.js +++ b/src/api/fax.js @@ -32,3 +32,30 @@ export async function setFaxServerField (options) { value: options.value }) } + +export async function getMailToFaxSettings (subscriberId) { + const result = await get({ + path: `api/mailtofaxsettings/${subscriberId}` + }) + const settings = _.clone(result) + delete settings._links + return settings +} + +export async function setMailToFaxSettingField (options) { + if (!['active', 'secret_key', 'secret_key_renew', 'secret_renew_notify', 'acl'].includes(options.field)) { + throw Error(`setMailToFaxSettingField: unknown field name ${options.field}`) + } + if (options.field === 'secret_renew_notify') { + // searching for duplicates + const destinationsIds = options.value.map(d => d.destination) + if ((new Set(destinationsIds)).size !== destinationsIds.length) { + throw Error(i18n.t('faxSettings.notifyEmailExists')) + } + } + return patchReplaceFull({ + path: `api/mailtofaxsettings/${options.subscriberId}`, + fieldPath: options.field, + value: options.value + }) +} diff --git a/src/boot/i18n.js b/src/boot/i18n.js index e8e7a3fa..61b5dccf 100644 --- a/src/boot/i18n.js +++ b/src/boot/i18n.js @@ -17,6 +17,7 @@ export const defaultLocale = 'en-US' export const i18n = new VueI18n({ locale: defaultLocale, fallbackLocale: defaultLocale, + formatFallbackMessages: true, messages }) diff --git a/src/components/CscMainMenuTop.vue b/src/components/CscMainMenuTop.vue index 2b8077d3..cebe6413 100644 --- a/src/components/CscMainMenuTop.vue +++ b/src/components/CscMainMenuTop.vue @@ -46,7 +46,8 @@ export default { computed: { ...mapGetters('user', [ 'isRtcEngineUiVisible', - 'isPbxEnabled' + 'isPbxEnabled', + 'hasFaxCapability' ]), items () { return [ @@ -129,7 +130,7 @@ export default { to: '/user/fax-settings', icon: 'fas fa-fax', label: this.$t('navigation.faxSettings.title'), - visible: true + visible: this.hasFaxCapability }, { icon: 'miscellaneous_services', diff --git a/src/components/CscTooltip.vue b/src/components/CscTooltip.vue new file mode 100644 index 00000000..a6a2e80f --- /dev/null +++ b/src/components/CscTooltip.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/components/form/CscInputSaveable.vue b/src/components/form/CscInputSaveable.vue index 4c78f4e8..c407819f 100644 --- a/src/components/form/CscInputSaveable.vue +++ b/src/components/form/CscInputSaveable.vue @@ -7,6 +7,7 @@ @input="$emit('input', $event)" @keyup.enter="$emit('save', $event)" > + + + diff --git a/src/components/pages/FaxSettings/CscMailToFaxACL.vue b/src/components/pages/FaxSettings/CscMailToFaxACL.vue new file mode 100644 index 00000000..f56097a0 --- /dev/null +++ b/src/components/pages/FaxSettings/CscMailToFaxACL.vue @@ -0,0 +1,109 @@ + + + diff --git a/src/components/pages/FaxSettings/CscMailToFaxACLForm.vue b/src/components/pages/FaxSettings/CscMailToFaxACLForm.vue new file mode 100644 index 00000000..ab84293b --- /dev/null +++ b/src/components/pages/FaxSettings/CscMailToFaxACLForm.vue @@ -0,0 +1,177 @@ + + + diff --git a/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmail.vue b/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmail.vue new file mode 100644 index 00000000..19a8936c --- /dev/null +++ b/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmail.vue @@ -0,0 +1,152 @@ + + + diff --git a/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmailForm.vue b/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmailForm.vue new file mode 100644 index 00000000..ad0be762 --- /dev/null +++ b/src/components/pages/FaxSettings/CscMailToFaxRenewNotifyEmailForm.vue @@ -0,0 +1,129 @@ + + + diff --git a/src/components/pages/FaxSettings/CscMailToFaxSettings.vue b/src/components/pages/FaxSettings/CscMailToFaxSettings.vue new file mode 100644 index 00000000..a98cdc65 --- /dev/null +++ b/src/components/pages/FaxSettings/CscMailToFaxSettings.vue @@ -0,0 +1,373 @@ + + + + + diff --git a/src/css/app.styl b/src/css/app.styl index c5823806..f216e03d 100644 --- a/src/css/app.styl +++ b/src/css/app.styl @@ -27,3 +27,9 @@ body.body--dark .csc-opt-center margin-top ($header-height * -2) + +.striped-list + > :nth-of-type(2n+1) + background-color $item-stripe-color + > :nth-of-type(2n) + background-color alpha($main-menu-background, 0.2) diff --git a/src/i18n/en.json b/src/i18n/en.json index 6643c61c..a8e424f2 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -764,7 +764,20 @@ "deleteDestinationTitle": "Remove Destination", "deleteDestinationText": "You are about to remove destination {destination}", "destinationEmailExists": "The Destination Email is already used", - "destinationItemTitle": "<{destination}> as {filetype}" + "destinationItemTitle": "<{destination}> as {filetype}", + "notifyEmailExists": "The Notify Email is already used", + "featureIsNotActive": "Mail To Fax feature is not active", + "destinations": "Destinations", + "secretKeyField": "Secret Key (empty=disabled)", + "lastModifyTime": "Last Modify Time", + "notModifiedYet": "Not modified yet", + "secretKeyRenew": "Secret Key Renew", + "secretKeyRenewNotify": "Secret Key Renew Notify", + "addEmail": "Add email", + "deleteRenewNotifyEmailTitle": "Remove secret key renew notify email", + "deleteRenewNotifyEmailText": "You are about to remove secret key renew notify email: {email}", + "ACL": "ACL", + "addACL": "Add ACL" }, "callSettings": { "musicOnHold": "Music on Hold", diff --git a/src/layouts/CscLayoutMain.vue b/src/layouts/CscLayoutMain.vue index c419b2e1..6eeca715 100644 --- a/src/layouts/CscLayoutMain.vue +++ b/src/layouts/CscLayoutMain.vue @@ -21,7 +21,7 @@ @click="$refs.mainMenu.show()" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Destinations: -
-
- -
-
- - {{ $t('faxSettings.addDestination') }} - -
-
-
- -
- - - - - - {{ $t('faxSettings.noDestinationsCreatedYet') }} - - - -
-
+ + + + + + +