Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1617 (pull request #417)
Browse files Browse the repository at this point in the history
Fixed issue with redirect on contention resolution

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
rmathis committed Nov 15, 2019
2 parents a388a22 + a55fadd commit 66bed4e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
10 changes: 8 additions & 2 deletions ui/src/app/metadata/provider/effect/collection.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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(<MetadataProvider>{ ...obj })),
reject: (obj) => this.store.dispatch(new ResetChanges())
reject: (obj) => this.gotoConfiguration(current)
})))
)
)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
3 changes: 2 additions & 1 deletion ui/src/app/metadata/provider/reducer/entity.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function reducer(state = initialState, action: EntityActionUnion | Provid
...state,
changes: {
...initialState.changes
}
},
saving: false
};
}
case EntityActionTypes.UPDATE_PROVIDER: {
Expand Down
17 changes: 11 additions & 6 deletions ui/src/app/metadata/resolver/effect/entity.effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export class EntityEffects {
})
);

@Effect()
@Effect({dispatch: false})
cancelChanges$ = this.actions$.pipe(
ofType<Cancel>(ResolverEntityActionTypes.CANCEL),
map(() => new provider.LoadResolverRequest()),
map(() => new Clear()),
tap(() => this.router.navigate(['dashboard']))
);

Expand All @@ -59,11 +59,11 @@ export class EntityEffects {
ofType<provider.UpdateResolverConflict>(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)
})))
);
})
Expand All @@ -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'])
}
}

0 comments on commit 66bed4e

Please sign in to comment.