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: mr12.5

Change-Id: I2862d5922aa1df99d11b2d6d58dcd8e161160253
(cherry picked from commit c06b09d717)
mr12.5.1
Debora Crescenzo 1 year ago committed by Crescenzo Debora
parent b652feca2b
commit ce93f546be

@ -120,8 +120,8 @@ export async function deleteMapping ({ dispatch, commit, state, rootGetters }, p
await cfDeleteDestinationSet(payload.destinationset_id)
} catch (e) {
if (e.code === 404 && e.message === 'Entity \'cfdestinationset\' not found.') {
// This happens when CF was set by Admin therefore current
// csc user doesn't have rights to delete the entity
// 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 {
showGlobalError(e.message)
@ -309,7 +309,17 @@ export async function deleteSourceSet ({ dispatch, commit, rootGetters, state },
fieldPath: payload.mapping.type,
value: updatedMapping
})
await cfDeleteSourceSet(payload.id)
try {
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()
commit('dataSucceeded', {
mappings: updatedMappings,
@ -410,8 +420,8 @@ export async function deleteTimeSet ({ dispatch, commit, rootGetters, state }, p
await cfDeleteTimeSet(payload.id)
} catch (e) {
if (e.code === 404 && e.message === 'Entity \'cftimeset\' not found.') {
// This happens when CF was set by Admin therefore current
// csc user doesn't have rights to delete the entity
// 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 {
showGlobalError(e.message)
@ -494,8 +504,8 @@ export async function updateTimeSetDateRange ({ dispatch, commit }, payload) {
await cfUpdateTimeSetDateRange(payload.id, payload.date)
} catch (e) {
if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') {
// This happens when CF was set by Admin therefore current
// csc user doesn't have rights to delete the entity
// This happens when entity was set by Admin therefore current
// csc user doesn't have rights to edit the entity.
showGlobalWarning(i18n.global.tc('Entity belongs to admin'))
} else {
showGlobalError(e.message)
@ -534,8 +544,8 @@ export async function updateTimeSetWeekdays ({ dispatch, commit }, payload) {
await cfUpdateTimeSetWeekdays(payload.id, payload.weekdays)
} catch (e) {
if (e.code === 404 && e.message === 'Entity \'timeset\' not found.') {
// This happens when CF was set by Admin therefore current
// csc user doesn't have rights to delete the entity
// 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 {
showGlobalError(e.message)

Loading…
Cancel
Save