Browse Source

Changes reverted.

pull/282/head
Sebastian 9 years ago
parent
commit
aaa20a7a7f
  1. 6
      src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts
  2. 10
      src/Squidex/app/features/administration/state/event-consumers.state.spec.ts
  3. 14
      src/Squidex/app/features/administration/state/event-consumers.state.ts

6
src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts

@ -34,16 +34,16 @@ export class EventConsumersPageComponent implements OnDestroy, OnInit {
} }
public ngOnInit() { public ngOnInit() {
this.eventConsumersState.load().onErrorResumeNext().subscribe(); this.eventConsumersState.load(false, true).onErrorResumeNext().subscribe();
this.timerSubscription = this.timerSubscription =
Observable.timer(2000, 2000) Observable.timer(2000, 2000)
.switchMap(x => this.eventConsumersState.reloadSilently().onErrorResumeNext()) .switchMap(x => this.eventConsumersState.load().onErrorResumeNext())
.subscribe(); .subscribe();
} }
public reload() { public reload() {
this.eventConsumersState.reload().onErrorResumeNext().subscribe(); this.eventConsumersState.load(true, true).onErrorResumeNext().subscribe();
} }
public start(es: EventConsumerDto) { public start(es: EventConsumerDto) {

10
src/Squidex/app/features/administration/state/event-consumers.state.spec.ts

@ -42,17 +42,17 @@ describe('EventConsumersState', () => {
dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never()); dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.never());
}); });
it('should show notification on reload', () => { it('should show notification on load when flag is true', () => {
eventConsumersState.reload().subscribe(); eventConsumersState.load(true, true).subscribe();
dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once());
}); });
it('should show notification on load error', () => { it('should show notification on load error when flag is true', () => {
eventConsumersService.setup(x => x.getEventConsumers()) eventConsumersService.setup(x => x.getEventConsumers())
.returns(() => Observable.throw({})); .returns(() => Observable.throw({}));
eventConsumersState.load().onErrorResumeNext().subscribe(); eventConsumersState.load(true, true).onErrorResumeNext().subscribe();
dialogs.verify(x => x.notifyError(It.isAny()), Times.once()); dialogs.verify(x => x.notifyError(It.isAny()), Times.once());
}); });
@ -61,7 +61,7 @@ describe('EventConsumersState', () => {
eventConsumersService.setup(x => x.getEventConsumers()) eventConsumersService.setup(x => x.getEventConsumers())
.returns(() => Observable.throw({})); .returns(() => Observable.throw({}));
eventConsumersState.reloadSilently().onErrorResumeNext().subscribe(); eventConsumersState.load().onErrorResumeNext().subscribe();
dialogs.verify(x => x.notifyError(It.isAny()), Times.never()); dialogs.verify(x => x.notifyError(It.isAny()), Times.never());
}); });

14
src/Squidex/app/features/administration/state/event-consumers.state.ts

@ -41,19 +41,7 @@ export class EventConsumersState extends State<Snapshot> {
super({ eventConsumers: ImmutableArray.empty() }); super({ eventConsumers: ImmutableArray.empty() });
} }
public load() { public load(notifyLoad = false, notifyError = false): Observable<any> {
return this.loadInternal(true);
}
public reload() {
return this.loadInternal(true, true);
}
public reloadSilently() {
return this.loadInternal(false, false);
}
public loadInternal(notifyLoad = false, notifyError = false): Observable<any> {
return this.eventConsumersService.getEventConsumers() return this.eventConsumersService.getEventConsumers()
.do(dtos => { .do(dtos => {
if (notifyLoad) { if (notifyLoad) {

Loading…
Cancel
Save