From 7d6446a2e0d6988f8c426d182d5a7a17c02f167d 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) --- 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 | 143 ++++++++++++++---- src/pages/CscPagePbxMsConfigs.vue | 26 +++- src/store/pbx-devices.js | 4 +- src/store/pbx.js | 116 ++++++++++---- src/store/user.js | 10 +- 12 files changed, 377 insertions(+), 107 deletions(-) diff --git a/src/api/common.js b/src/api/common.js index ae6d4517..6100166d 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -116,8 +116,8 @@ export async function getList (options) { options = _.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 015881c1..cbee261f 100644 --- a/src/api/pbx-config.js +++ b/src/api/pbx-config.js @@ -52,8 +52,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 c5416d9f..9fe9b1d2 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 db2f3680..83b9f4bb 100644 --- a/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue +++ b/src/components/pages/PbxConfiguration/CscPbxDeviceFilters.vue @@ -90,6 +90,8 @@ import _ from 'lodash' import CscPbxModelSelect from '../PbxConfiguration/CscPbxModelSelect' import CscPbxAutoAttendantSelection from './CscPbxAutoAttendantSelection' import { mapActions, mapState } from 'vuex' +import { RequestState } from 'src/store/common' +import { showGlobalError } from 'src/helpers/ui' export default { name: 'CscPbxDeviceFilters', @@ -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 435f3fdd..d4a6d10f 100644 --- a/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue +++ b/src/components/pages/PbxConfiguration/CscPbxModelSelect.vue @@ -49,10 +49,11 @@ > - + /> @@ -120,15 +121,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 5a7c7ce0..3a690591 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 4e2c3cc0..3ff52058 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 a6aa72b8..81e572b8 100644 --- a/src/pages/CscPagePbxDevices.vue +++ b/src/pages/CscPagePbxDevices.vue @@ -3,9 +3,7 @@ id="csc-page-pbx-devices" class="q-pa-lg" > - + -