From f8a855c4cf64f722da94a371c50287448ffc6caf Mon Sep 17 00:00:00 2001 From: Debora Crescenzo Date: Tue, 27 May 2025 13:30:51 +0100 Subject: [PATCH] MT#62916 Pbx Devices Bugfix Listed here the changes: - change properties accessed directly from state with computed properties that handles null cases - Fix typos for subcriberListState and subcriberListError - Improve route watcher in CscPagePbxDeviceDetails - add a method to load only thumbnails instead of full set of data for the device profiles to improve performance. - removed 1000 rows for loadProfiles() as it was too slow. We expect max 150 devices so it was set to 300 rows. Note, more refactoring will be needed. Change-Id: Iefe0328052174f0bb93f8cdbae59f77257592592 (cherry picked from commit d8c1f097cc0b969ff339e4f6d66eb33ac0bae5dd) (cherry picked from commit 3665f43ee0d37e345e50767891353fffd472c59d) --- src/api/common.js | 4 +- src/api/pbx-config.js | 4 +- .../pages/PbxConfiguration/CscPbxDevice.vue | 17 ++- .../PbxConfiguration/CscPbxDeviceFilters.vue | 11 +- .../PbxConfiguration/CscPbxModelSelect.vue | 19 ++- src/pages/CscPagePbxCallQueues.vue | 14 ++ src/pages/CscPagePbxDeviceDetails.vue | 116 +++++++++++++--- src/pages/CscPagePbxDevices.vue | 128 +++++++++++++----- src/pages/CscPagePbxMsConfigs.vue | 26 +++- src/store/pbx-devices.js | 4 +- src/store/pbx.js | 116 ++++++++++++---- src/store/user.js | 5 +- 12 files changed, 361 insertions(+), 103 deletions(-) diff --git a/src/api/common.js b/src/api/common.js index 32fe92d1..e0523d2d 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -94,8 +94,8 @@ export async function getList (options) { const requestConfig = _.merge({ all: false, params: { - page: LIST_DEFAULT_PAGE, - rows: LIST_DEFAULT_ROWS + page: options.page || LIST_DEFAULT_PAGE, + rows: options.rows || LIST_DEFAULT_ROWS }, headers: GET_HEADERS }, options) diff --git a/src/api/pbx-config.js b/src/api/pbx-config.js index d7577902..73509e9e 100644 --- a/src/api/pbx-config.js +++ b/src/api/pbx-config.js @@ -48,8 +48,10 @@ export function getProfiles (options) { } export function getAllProfiles () { + // Replace 1000 rows with 300 as we expect to have max 150 profiles. return getProfiles({ - all: true + page: 1, + rows: 300 }) } diff --git a/src/components/pages/PbxConfiguration/CscPbxDevice.vue b/src/components/pages/PbxConfiguration/CscPbxDevice.vue index 6216615f..b62610db 100644 --- a/src/components/pages/PbxConfiguration/CscPbxDevice.vue +++ b/src/components/pages/PbxConfiguration/CscPbxDevice.vue @@ -9,10 +9,21 @@ center no-wrap > - + + + + diff --git a/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue b/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue index 7fbbad08..9dcdb34d 100644 --- a/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue +++ b/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue @@ -89,6 +89,8 @@ import CscPbxAutoAttendantSelection from 'components/pages/PbxConfiguration/CscPbxAutoAttendantSelection' import CscPbxModelSelect from 'components/pages/PbxConfiguration/CscPbxModelSelect' import _ from 'lodash' +import { showGlobalError } from 'src/helpers/ui' +import { RequestState } from 'src/store/common' import { mapActions, mapState } from 'vuex' export default { @@ -116,7 +118,9 @@ export default { ...mapState('pbx', [ 'deviceProfileMap', 'deviceProfileList', - 'subscriberList' + 'subscriberList', + 'subscriberListState', + 'subscriberListError' ]), subscribersOptions () { const options = [] @@ -191,6 +195,11 @@ export default { watch: { filterTypeModel () { this.typedFilter = null + }, + subscriberListState (state) { + if (state === RequestState.failed) { + showGlobalError(this.subscriberListError) + } } }, mounted () { diff --git a/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue b/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue index 3fad2556..ad8e4985 100644 --- a/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue +++ b/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue @@ -49,10 +49,11 @@ > - + /> @@ -118,15 +119,11 @@ export default { return _.get(this.deviceModelImageSmallMap, `${deviceModelId}.url`, null) }, options () { - const options = [] - this.profiles.forEach((profile) => { - options.push({ - label: profile.name, - value: profile.id, - model: profile.device_id - }) - }) - return options + return this.profiles.map((profile) => ({ + label: profile.name, + value: profile.id, + model: profile.device_id + })) } }, watch: { diff --git a/src/pages/CscPagePbxCallQueues.vue b/src/pages/CscPagePbxCallQueues.vue index 2ee1a458..d07c7992 100644 --- a/src/pages/CscPagePbxCallQueues.vue +++ b/src/pages/CscPagePbxCallQueues.vue @@ -150,6 +150,10 @@ export default { 'getCallQueueCreationToastMessage', 'getCallQueueUpdateToastMessage', 'getCallQueueRemovalToastMessage' + ]), + ...mapState('pbx', [ + 'subscriberListState', + 'subscriberListError' ]) }, watch: { @@ -175,6 +179,16 @@ export default { } else if (state === RequestState.failed) { showGlobalError(this.callQueueRemovalError) } + }, + callQueueListState (state) { + if (state === RequestState.failed) { + showGlobalError(this.callQueueListError) + } + }, + subscriberListState (state) { + if (state === RequestState.failed) { + showGlobalError(this.subscriberListError) + } } }, mounted () { diff --git a/src/pages/CscPagePbxDeviceDetails.vue b/src/pages/CscPagePbxDeviceDetails.vue index 24b1bf67..d1e7ca2b 100644 --- a/src/pages/CscPagePbxDeviceDetails.vue +++ b/src/pages/CscPagePbxDeviceDetails.vue @@ -175,10 +175,11 @@ v-if="!deviceSelected" /> { + const newProfile = this.deviceProfileMap[this.changes.profile_id] + if (newProfile && newProfile.device_id) { + this.loadDeviceModel({ + type: 'all', + deviceId: newProfile.device_id + }) + } }) } if (this.hasAdminNameChanged) { diff --git a/src/pages/CscPagePbxDevices.vue b/src/pages/CscPagePbxDevices.vue index fe643e7c..f85e2c8f 100644 --- a/src/pages/CscPagePbxDevices.vue +++ b/src/pages/CscPagePbxDevices.vue @@ -3,9 +3,7 @@ id="csc-page-pbx-devices" class="q-pa-lg" > - + -