From a55faddfaa8409d4d4ed8e496e17f540afefc5a9 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Wed, 13 Nov 2019 14:32:12 -0700 Subject: [PATCH] Fixed issue with redirect on contention resolution --- .../provider/effect/collection.effect.ts | 10 ++++++++-- .../metadata/provider/reducer/entity.reducer.ts | 3 ++- .../metadata/resolver/effect/entity.effect.ts | 17 +++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ui/src/app/metadata/provider/effect/collection.effect.ts b/ui/src/app/metadata/provider/effect/collection.effect.ts index f319a3d20..1eb9e5093 100644 --- a/ui/src/app/metadata/provider/effect/collection.effect.ts +++ b/ui/src/app/metadata/provider/effect/collection.effect.ts @@ -42,6 +42,7 @@ import { Notification, NotificationType } from '../../../notification/model/noti import { WizardActionTypes, SetDisabled } from '../../../wizard/action/wizard.action'; import { I18nService } from '../../../i18n/service/i18n.service'; import * as fromI18n from '../../../i18n/reducer'; +import { ClearEditor } from '../action/editor.action'; /* istanbul ignore next */ @@ -57,7 +58,7 @@ export class CollectionEffects { this.providerService.find(current.resourceId).pipe( map(data => new ShowContentionAction(this.contentionService.getContention(current, changes, data, { resolve: (obj) => this.store.dispatch(new UpdateProviderRequest({ ...obj })), - reject: (obj) => this.store.dispatch(new ResetChanges()) + reject: (obj) => this.gotoConfiguration(current) }))) ) ) @@ -235,7 +236,6 @@ export class CollectionEffects { withLatestFrom(this.store.select(fromProvider.getProviderOrder)), map(([id, order]) => { const index = order.indexOf(id); - console.log(id, order); if (index > 0) { const newOrder = array_move(order, index, index - 1); return new SetOrderProviderRequest(newOrder); @@ -273,4 +273,10 @@ export class CollectionEffects { navigateToProvider(id) { this.router.navigate(['/', 'metadata', 'provider', id, 'configuration', 'options']); } + + gotoConfiguration(provider) { + this.store.dispatch(new ClearProvider()); + this.store.dispatch(new ClearEditor()); + this.navigateToProvider(provider.resourceId); + } } diff --git a/ui/src/app/metadata/provider/reducer/entity.reducer.ts b/ui/src/app/metadata/provider/reducer/entity.reducer.ts index faa90afd5..b47600d94 100644 --- a/ui/src/app/metadata/provider/reducer/entity.reducer.ts +++ b/ui/src/app/metadata/provider/reducer/entity.reducer.ts @@ -41,7 +41,8 @@ export function reducer(state = initialState, action: EntityActionUnion | Provid ...state, changes: { ...initialState.changes - } + }, + saving: false }; } case EntityActionTypes.UPDATE_PROVIDER: { diff --git a/ui/src/app/metadata/resolver/effect/entity.effect.ts b/ui/src/app/metadata/resolver/effect/entity.effect.ts index 4ad8bb586..badd1925c 100644 --- a/ui/src/app/metadata/resolver/effect/entity.effect.ts +++ b/ui/src/app/metadata/resolver/effect/entity.effect.ts @@ -40,10 +40,10 @@ export class EntityEffects { }) ); - @Effect() + @Effect({dispatch: false}) cancelChanges$ = this.actions$.pipe( ofType(ResolverEntityActionTypes.CANCEL), - map(() => new provider.LoadResolverRequest()), + map(() => new Clear()), tap(() => this.router.navigate(['dashboard'])) ); @@ -59,11 +59,11 @@ export class EntityEffects { ofType(ResolverCollectionActionTypes.UPDATE_RESOLVER_CONFLICT), map(action => action.payload), withLatestFrom(this.store.select(fromResolver.getSelectedResolver)), - switchMap(([filter, current]) => { - return this.service.find(filter.id).pipe( - map(data => new ShowContentionAction(this.contentionService.getContention(current, filter, data, { + switchMap(([resolver, current]) => { + return this.service.find(resolver.id).pipe( + map(data => new ShowContentionAction(this.contentionService.getContention(current, resolver, data, { resolve: (obj) => this.store.dispatch(new provider.UpdateResolverRequest(obj)), - reject: (obj) => this.store.dispatch(new Cancel()) + reject: (obj) => this.gotoConfiguration(resolver.id) }))) ); }) @@ -76,4 +76,9 @@ export class EntityEffects { private router: Router, private contentionService: ContentionService ) { } + + gotoConfiguration(id) { + this.store.dispatch(new Clear()); + this.router.navigate(['metadata', 'resolver', id, 'configuration']) + } }