Browse Source

Rx fixes.

pull/336/head
Sebastian Stehle 8 years ago
parent
commit
21a5ae5024
  1. 2
      src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs
  2. 2
      src/Squidex/app/features/administration/pages/event-consumers/event-consumers-page.component.ts
  3. 4
      src/Squidex/app/features/administration/pages/restore/restore-page.component.ts
  4. 4
      src/Squidex/app/features/administration/state/event-consumers.state.spec.ts
  5. 2
      src/Squidex/app/features/administration/state/event-consumers.state.ts
  6. 4
      src/Squidex/app/features/content/pages/content/content-history.component.ts
  7. 3
      src/Squidex/app/features/settings/pages/backups/backups-page.component.ts
  8. 8
      src/Squidex/app/shared/components/comments.component.ts
  9. 4
      src/Squidex/app/shared/components/history.component.ts

2
src/Squidex/Areas/Api/Controllers/EventConsumers/EventConsumersController.cs

@ -35,7 +35,7 @@ namespace Squidex.Areas.Api.Controllers.EventConsumers
{ {
var entities = await eventConsumerManagerGrain.GetConsumersAsync(); var entities = await eventConsumerManagerGrain.GetConsumersAsync();
var response = entities.Value.Select(EventConsumerDto.FromEventConsumerInfo).ToList(); var response = entities.Value.OrderBy(x => x.Name).Select(EventConsumerDto.FromEventConsumerInfo).ToList();
return Ok(response); return Ok(response);
} }

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

@ -38,7 +38,7 @@ export class EventConsumersPageComponent implements OnDestroy, OnInit {
this.eventConsumersState.load(false, true).pipe(onErrorResumeNext()).subscribe(); this.eventConsumersState.load(false, true).pipe(onErrorResumeNext()).subscribe();
this.timerSubscription = this.timerSubscription =
timer(2000, 2000).pipe(switchMap(x => this.eventConsumersState.load(true, true)), onErrorResumeNext()) timer(2000, 2000).pipe(switchMap(x => this.eventConsumersState.load(true, true).pipe(onErrorResumeNext())))
.subscribe(); .subscribe();
} }

4
src/Squidex/app/features/administration/pages/restore/restore-page.component.ts

@ -8,7 +8,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms'; import { FormBuilder } from '@angular/forms';
import { Subscription, timer } from 'rxjs'; import { Subscription, timer } from 'rxjs';
import { filter, switchMap } from 'rxjs/operators'; import { filter, onErrorResumeNext, switchMap } from 'rxjs/operators';
import { import {
AuthService, AuthService,
@ -43,7 +43,7 @@ export class RestorePageComponent implements OnDestroy, OnInit {
public ngOnInit() { public ngOnInit() {
this.timerSubscription = this.timerSubscription =
timer(0, 2000).pipe(switchMap(() => this.backupsService.getRestore()), filter(x => !!x)) timer(0, 2000).pipe(switchMap(() => this.backupsService.getRestore().pipe(onErrorResumeNext())), filter(x => !!x))
.subscribe(dto => { .subscribe(dto => {
this.restoreJob = dto!; this.restoreJob = dto!;
}); });

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

@ -53,11 +53,11 @@ describe('EventConsumersState', () => {
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 when silent is true', () => { it('should show notification on load error when silent is false', () => {
eventConsumersService.setup(x => x.getEventConsumers()) eventConsumersService.setup(x => x.getEventConsumers())
.returns(() => throwError({})); .returns(() => throwError({}));
eventConsumersState.load(true, true).pipe(onErrorResumeNext()).subscribe(); eventConsumersState.load(true, false).pipe(onErrorResumeNext()).subscribe();
expect().nothing(); expect().nothing();

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

@ -59,7 +59,7 @@ export class EventConsumersState extends State<Snapshot> {
}); });
}), }),
catchError(error => { catchError(error => {
if (silent) { if (!silent) {
this.dialogs.notifyError(error); this.dialogs.notifyError(error);
} }

4
src/Squidex/app/features/content/pages/content/content-history.component.ts

@ -8,7 +8,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { merge, Observable, timer } from 'rxjs'; import { merge, Observable, timer } from 'rxjs';
import { delay, switchMap } from 'rxjs/operators'; import { delay, onErrorResumeNext, switchMap } from 'rxjs/operators';
import { import {
allParams, allParams,
@ -51,7 +51,7 @@ export class ContentHistoryComponent {
timer(0, 10000), timer(0, 10000),
this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000)) this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000))
).pipe( ).pipe(
switchMap(() => this.historyService.getHistory(this.appsState.appName, this.channel))); switchMap(() => this.historyService.getHistory(this.appsState.appName, this.channel).pipe(onErrorResumeNext())));
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,

3
src/Squidex/app/features/settings/pages/backups/backups-page.component.ts

@ -37,8 +37,7 @@ export class BackupsPageComponent implements OnInit, OnDestroy {
this.backupsState.load(false, true).pipe(onErrorResumeNext()).subscribe(); this.backupsState.load(false, true).pipe(onErrorResumeNext()).subscribe();
this.timerSubscription = this.timerSubscription =
timer(3000, 3000).pipe( timer(3000, 3000).pipe(switchMap(t => this.backupsState.load(true, true).pipe(onErrorResumeNext())))
switchMap(t => this.backupsState.load(true, true)), onErrorResumeNext())
.subscribe(); .subscribe();
} }

8
src/Squidex/app/shared/components/comments.component.ts

@ -26,7 +26,7 @@ import {
templateUrl: './comments.component.html' templateUrl: './comments.component.html'
}) })
export class CommentsComponent implements OnDestroy, OnInit { export class CommentsComponent implements OnDestroy, OnInit {
private timer: Subscription; private timerSubscription: Subscription;
public state: CommentsState; public state: CommentsState;
@ -47,13 +47,15 @@ export class CommentsComponent implements OnDestroy, OnInit {
} }
public ngOnDestroy() { public ngOnDestroy() {
this.timer.unsubscribe(); this.timerSubscription.unsubscribe();
} }
public ngOnInit() { public ngOnInit() {
this.state = new CommentsState(this.appsState, this.commentsId, this.commentsService, this.dialogs); this.state = new CommentsState(this.appsState, this.commentsId, this.commentsService, this.dialogs);
this.timer = timer(0, 4000).pipe(switchMap(() => this.state.load()), onErrorResumeNext()).subscribe(); this.timerSubscription =
timer(0, 4000).pipe(switchMap(() => this.state.load().pipe(onErrorResumeNext())))
.subscribe();
} }
public delete(comment: CommentDto) { public delete(comment: CommentDto) {

4
src/Squidex/app/shared/components/history.component.ts

@ -8,7 +8,7 @@
import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { merge, Observable, timer } from 'rxjs'; import { merge, Observable, timer } from 'rxjs';
import { delay, switchMap } from 'rxjs/operators'; import { delay, onErrorResumeNext, switchMap } from 'rxjs/operators';
import { import {
allParams, allParams,
@ -33,7 +33,7 @@ export class HistoryComponent {
timer(0, 10000), timer(0, 10000),
this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000)) this.messageBus.of(HistoryChannelUpdated).pipe(delay(1000))
).pipe( ).pipe(
switchMap(() => this.historyService.getHistory(this.appsState.appName, this.channel))); switchMap(() => this.historyService.getHistory(this.appsState.appName, this.channel).pipe(onErrorResumeNext())));
constructor( constructor(
private readonly appsState: AppsState, private readonly appsState: AppsState,

Loading…
Cancel
Save