MT#64804 CF toggle bugfix

When toggling multiple CFs on/off in quick succession,
the PATCH request returns inconsistent results,
randomly multiplying resources.
To avoid this, we now retrieve the updated mappings
using cfLoadMappings() after the PATCH request and
we disable the toggle while other
csc-cf-mappings-full actions are performed

This is a temporary fix while the backend team resolves
the root cause, as the work is already in the pipeline.

The fix has been applied only to the setMappingEnabled
method, as it appears to be the only one affected due
to the possibility of multiple consecutive calls.

The fix has been applied only to the setMappingEnabled method, as it appears to be the only one affected due to the possibility of multiple consecutive calls.

Change-Id: Ideb999e3871ea6b7f8a0d1a3b5979cd2ad88706e
mr26.0
Debora Crescenzo 3 months ago committed by Crescenzo Debora
parent 83a5878aab
commit bc231de96f

@ -10,6 +10,7 @@
>
<q-toggle
:model-value="mapping.enabled"
:disable="loading || $wait.is(waitIdentifier)"
data-cy="csc-forwarding-toggle"
@update:model-value="toggleMappingEvent(mapping)"
/>

@ -13,6 +13,7 @@ import {
cfLoadAnnouncements,
cfLoadBNumberSets,
cfLoadDestinationSets,
cfLoadMappings,
cfLoadMappingsFull,
cfLoadSourceSets,
cfLoadTimeSets,
@ -157,13 +158,15 @@ export async function setMappingEnabled ({ dispatch, commit, state, rootGetters
enabled: !mappingsByType[payload.index].enabled
}
const updatedMappings = await cfUpdateMappingField({
await cfUpdateMappingField({
resource: 'cfmappings',
resourceId,
fieldPath: payload.type,
value: mappingsByType
})
const updatedMappings = await cfLoadMappings(resourceId)
commit('dataSucceeded', { mappings: updatedMappings })
} catch (e) {
showGlobalError(e.message)

Loading…
Cancel
Save