MT#62062 Reload CF after amending source set Bugfix

When a PBX Seat user tries to delete a sorce set that
was previously added by a PBX admin the backend
return an error as the entity doesn't belong to the
Seat user. In this scenario the source set is not
delete from the DB and it is removed from the relevant
mapping. The missing try/catch didn't allow the
code to reload the updated resources to show the
changes.
NGCP-Flow: mr13.1

Change-Id: I4b213a5857af25fe9264cbc9c695790e335b9ee9
(cherry picked from commit 433fa6cd68)
mr13.1.1
Debora Crescenzo 3 months ago committed by Crescenzo Debora
parent 8ae5507317
commit d260edc18a

@ -120,8 +120,8 @@ export async function deleteMapping ({ dispatch, commit, state, rootGetters }, p
await cfDeleteDestinationSet(payload.destinationset_id) await cfDeleteDestinationSet(payload.destinationset_id)
} catch (e) { } catch (e) {
if (e.code === 404 && e.message === 'Entity \'cfdestinationset\' not found.') { if (e.code === 404 && e.message === 'Entity \'cfdestinationset\' not found.') {
// This happens when CF was set by Admin therefore current // This happens when entity was set by Admin therefore current
// csc user doesn't have rights to delete the entity // csc user doesn't have rights to delete the entity from DB.
showGlobalWarning(i18n.global.tc('Entity belongs to admin')) showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else { } else {
showGlobalError(e.message) showGlobalError(e.message)
@ -309,7 +309,17 @@ export async function deleteSourceSet ({ dispatch, commit, rootGetters, state },
fieldPath: payload.mapping.type, fieldPath: payload.mapping.type,
value: updatedMapping value: updatedMapping
}) })
try {
await cfDeleteSourceSet(payload.id) await cfDeleteSourceSet(payload.id)
} catch (e) {
if (e.code === 404 && e.message === 'Entity \'sourceset\' not found.') {
// This happens when entity was set by Admin therefore current
// csc user doesn't have rights to delete the entity from DB.
showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else {
throw e
}
}
const sourceSets = await cfLoadSourceSets() const sourceSets = await cfLoadSourceSets()
commit('dataSucceeded', { commit('dataSucceeded', {
mappings: updatedMappings, mappings: updatedMappings,
@ -410,8 +420,8 @@ export async function deleteTimeSet ({ dispatch, commit, rootGetters, state }, p
await cfDeleteTimeSet(payload.id) await cfDeleteTimeSet(payload.id)
} catch (e) { } catch (e) {
if (e.code === 404 && e.message === 'Entity \'cftimeset\' not found.') { if (e.code === 404 && e.message === 'Entity \'cftimeset\' not found.') {
// This happens when CF was set by Admin therefore current // This happens when entity was set by Admin therefore current
// csc user doesn't have rights to delete the entity // csc user doesn't have rights to delete the entity from DB.
showGlobalWarning(i18n.global.tc('Entity belongs to admin')) showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else { } else {
showGlobalError(e.message) showGlobalError(e.message)
@ -456,8 +466,6 @@ export async function doNotRingPrimaryNumber ({ commit, rootGetters, state }, pa
} }
export async function updateRingTimeout ({ commit, rootGetters, state }, payload) { export async function updateRingTimeout ({ commit, rootGetters, state }, payload) {
// eslint-disable-next-line no-console
console.debug('aaa')
const updatedMappings = await patchReplaceFull({ const updatedMappings = await patchReplaceFull({
resource: 'cfmappings', resource: 'cfmappings',
resourceId: (payload.subscriberId) ? payload.subscriberId : rootGetters['user/getSubscriberId'], resourceId: (payload.subscriberId) ? payload.subscriberId : rootGetters['user/getSubscriberId'],
@ -494,8 +502,8 @@ export async function updateTimeSetDateRange ({ dispatch, commit }, payload) {
await cfUpdateTimeSetDateRange(payload.id, payload.date) await cfUpdateTimeSetDateRange(payload.id, payload.date)
} catch (e) { } catch (e) {
if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') { if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') {
// This happens when CF was set by Admin therefore current // This happens when entity was set by Admin therefore current
// csc user doesn't have rights to delete the entity // csc user doesn't have rights to edit the entity.
showGlobalWarning(i18n.global.tc('Entity belongs to admin')) showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else { } else {
showGlobalError(e.message) showGlobalError(e.message)
@ -534,8 +542,8 @@ export async function updateTimeSetWeekdays ({ dispatch, commit }, payload) {
await cfUpdateTimeSetWeekdays(payload.id, payload.weekdays) await cfUpdateTimeSetWeekdays(payload.id, payload.weekdays)
} catch (e) { } catch (e) {
if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') { if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') {
// This happens when CF was set by Admin therefore current // This happens when entity was set by Admin therefore current
// csc user doesn't have rights to delete the entity // csc user doesn't have rights to delete the entity from DB.
showGlobalWarning(i18n.global.tc('Entity belongs to admin')) showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else { } else {
showGlobalError(e.message) showGlobalError(e.message)

Loading…
Cancel
Save