From 9719fd1ef45af74023e526ff7e31e6e17dfb41d7 Mon Sep 17 00:00:00 2001 From: ychacon Date: Mon, 25 Oct 2021 09:29:53 +0200 Subject: [PATCH] Autorefresh stops working when service restart Issue-ID: NONRTRIC-614 Signed-off-by: ychacon Change-Id: I1d09e43e37bca5f5c3f400e6a87542606b78017d --- .../jobs-list/jobs-list.component.ts | 3 ++- webapp-frontend/src/app/interceptor.ts | 25 ++++++++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/webapp-frontend/src/app/ei-coordinator/jobs-list/jobs-list.component.ts b/webapp-frontend/src/app/ei-coordinator/jobs-list/jobs-list.component.ts index fce9e61..ca39330 100644 --- a/webapp-frontend/src/app/ei-coordinator/jobs-list/jobs-list.component.ts +++ b/webapp-frontend/src/app/ei-coordinator/jobs-list/jobs-list.component.ts @@ -22,7 +22,7 @@ import { FormControl, FormGroup } from "@angular/forms"; import { MatPaginator } from "@angular/material/paginator"; import { Sort } from "@angular/material/sort"; import { MatTableDataSource } from "@angular/material/table"; -import { EMPTY, forkJoin, of, pipe, Subscription, concat, Observable } from "rxjs"; +import { EMPTY, forkJoin, of, Subscription, concat } from "rxjs"; import { BehaviorSubject } from "rxjs/BehaviorSubject"; import { mergeMap, finalize, map, tap, concatMap, delay, skip, catchError } from "rxjs/operators"; import { ConsumerService } from "@services/ei/consumer.service"; @@ -101,6 +101,7 @@ export class JobsListComponent implements OnInit { dataSubscription(): Subscription { const jobsInfo$ = this.consumerService.getJobIds().pipe( + catchError(_ => { return EMPTY }), tap((_) => { this.jobList = [] as Job[]; }), diff --git a/webapp-frontend/src/app/interceptor.ts b/webapp-frontend/src/app/interceptor.ts index 3bceb5e..cade60d 100644 --- a/webapp-frontend/src/app/interceptor.ts +++ b/webapp-frontend/src/app/interceptor.ts @@ -31,23 +31,16 @@ export class HttpRequestInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable> { console.log('Interceptor Invoked' + request.url); - if (!request.url.includes("info-jobs")) { - return next.handle(request).pipe( - catchError((error: HttpErrorResponse) => { - console.error("Error from error interceptor", error); - + return next.handle(request).pipe( + catchError((error: HttpErrorResponse) => { + console.error("Error from error interceptor", error); + + if (!request.url.includes("info-jobs") && error.status != 404) { // show dialog for error message this.notificationService.error(error.message); - return throwError(error); - }) - ) as Observable>; - } else { - return next.handle(request).pipe( - catchError((error: HttpErrorResponse) => { - console.error("Error from error interceptor", error); - return throwError(error); - }) - ) as Observable>; - } + } + return throwError(error); + }) + ) as Observable>; } } -- 2.16.6