From b76e2a651b9c5c5101bf0182580502495fb3934c Mon Sep 17 00:00:00 2001 From: mahmoud adel <58145645+mahmoudadel54@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:17:23 +0200 Subject: [PATCH] #10766: Remove error notified by GeoFence when moving a rule for geofence stand-alone version only (#10767) Description: - fixing the shown error by moving the RULE_SAVED action to be after move rule in case full update and throw error only if addRule is failed --- web/client/observables/rulesmanager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/client/observables/rulesmanager.js b/web/client/observables/rulesmanager.js index 88c57fab29..3de5a85a05 100644 --- a/web/client/observables/rulesmanager.js +++ b/web/client/observables/rulesmanager.js @@ -61,12 +61,12 @@ const fullUpdate = (update$) => update$.filter(({rule: r, origRule: oR}) =>getUp .catch((e) => { const {priority: p, id: omit, ...oldRule} = origRule; oldRule.position = {value: p, position: "fixedPriority"}; - // We have to restore original rule and to throw the exception!! - return Rx.Observable.defer(() => GeoFence.addRule(oldRule)).concat(Rx.Observable.of({type: RULE_SAVED}).do(() => { throw (e); })); + // We have to restore original rule and throw the exception if failed!! + return Rx.Observable.defer(() => GeoFence.addRule(oldRule)).catch(() => { throw (e); }); }); }) .switchMap(({data: id}) => { - return Rx.Observable.defer(() => GeoFence.moveRules(rule.priority, [{id}])); + return Rx.Observable.defer(() => GeoFence.moveRules(rule.priority, [{id}])).concat(Rx.Observable.of({type: RULE_SAVED})); } )); const grantUpdate = (update$) => update$.filter(({rule: r, origRule: oR}) => getUpdateType(oR, r) === 'grant')