Skip to content

Commit

Permalink
#10766: Remove error notified by GeoFence when moving a rule for geof…
Browse files Browse the repository at this point in the history
…ence 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
  • Loading branch information
mahmoudadel54 committed Jan 22, 2025
1 parent ca1bdef commit b76e2a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/client/observables/rulesmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit b76e2a6

Please sign in to comment.