From ee99017a28f6bc361cb81c06f95291a2368cd8b0 Mon Sep 17 00:00:00 2001 From: nidrissi-zouggari Date: Thu, 18 Dec 2025 13:26:25 +0100 Subject: [PATCH] MT#64124 Refresh Call Forwarding component on page change - Add resetCallForwardingState action to reset the state when the page changes Change-Id: I95a2cd4a7c7bce492969a42b81d37bd04524a8ab --- src/pages/CscPageCf.vue | 4 +++- src/store/call-forwarding/actions.js | 3 +++ src/store/call-forwarding/getters.js | 15 +++++++++------ src/store/call-forwarding/mutations.js | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/pages/CscPageCf.vue b/src/pages/CscPageCf.vue index 578998a1..e854cf91 100644 --- a/src/pages/CscPageCf.vue +++ b/src/pages/CscPageCf.vue @@ -134,6 +134,7 @@ export default { } }, async mounted () { + await this.resetCallForwardingState() await this.loadAnnouncements() await this.loadMappingsFull() }, @@ -141,7 +142,8 @@ export default { ...mapActions('callForwarding', [ 'loadMappingsFull', 'createMapping', - 'loadAnnouncements' + 'loadAnnouncements', + 'resetCallForwardingState' ]) } } diff --git a/src/store/call-forwarding/actions.js b/src/store/call-forwarding/actions.js index a3f52c1f..6139d2b8 100644 --- a/src/store/call-forwarding/actions.js +++ b/src/store/call-forwarding/actions.js @@ -780,3 +780,6 @@ export async function updateAnnouncement ({ dispatch, commit, state }, payload) destinationSets: destinationSets.items }) } +export function resetCallForwardingState ({ commit }) { + commit('resetState') +} diff --git a/src/store/call-forwarding/getters.js b/src/store/call-forwarding/getters.js index d6cb9bc5..e4109100 100644 --- a/src/store/call-forwarding/getters.js +++ b/src/store/call-forwarding/getters.js @@ -4,12 +4,15 @@ export function groups (state) { const types = ['cfu', 'cft', 'cfna', 'cfb'] const mappings = [] types.forEach((type) => { - state.mappings[type].forEach((mapping, index) => { - const clonedMapping = _.clone(mapping) - clonedMapping.type = type - clonedMapping.index = index - mappings.push(clonedMapping) - }) + const typeMapping = state.mappings?.[type] + if (Array.isArray(typeMapping)) { + typeMapping.forEach((mapping, index) => { + const clonedMapping = _.clone(mapping) + clonedMapping.type = type + clonedMapping.index = index + mappings.push(clonedMapping) + }) + } }) return mappings } diff --git a/src/store/call-forwarding/mutations.js b/src/store/call-forwarding/mutations.js index f85444fa..2894cb55 100644 --- a/src/store/call-forwarding/mutations.js +++ b/src/store/call-forwarding/mutations.js @@ -43,3 +43,21 @@ export function popupShow (state, popupId) { export function setAnnouncements (state, announcements) { state.announcements = announcements } +export function resetState (state) { + state.mappings = { + cfu: [], + cft: [], + cfna: [], + cfb: [], + cft_ringtimeout: null + } + state.bNumberSetMap = {} + state.destinationSetMap = {} + state.sourceSetMap = {} + state.timeSetMap = {} + state.bNumberSets = null + state.destinationSets = null + state.sourceSets = null + state.timeSets = null + state.announcements = [] +}