Autorefresh stops working when service restart 29/6929/1
authorychacon <yennifer.chacon@est.tech>
Mon, 25 Oct 2021 07:29:53 +0000 (09:29 +0200)
committerychacon <yennifer.chacon@est.tech>
Mon, 25 Oct 2021 07:29:53 +0000 (09:29 +0200)
Issue-ID: NONRTRIC-614
Signed-off-by: ychacon <yennifer.chacon@est.tech>
Change-Id: I1d09e43e37bca5f5c3f400e6a87542606b78017d

webapp-frontend/src/app/ei-coordinator/jobs-list/jobs-list.component.ts
webapp-frontend/src/app/interceptor.ts

index fce9e61..ca39330 100644 (file)
@@ -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[];
       }),
index 3bceb5e..cade60d 100644 (file)
@@ -31,23 +31,16 @@ export class HttpRequestInterceptor implements HttpInterceptor {
 
     intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
         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<HttpEvent<any>>;
-        } else {
-            return next.handle(request).pipe(
-                catchError((error: HttpErrorResponse) => {
-                    console.error("Error from error interceptor", error);
-                    return throwError(error);
-                })
-            ) as Observable<HttpEvent<any>>;
-        }
+                }
+                return throwError(error);
+            })
+        ) as Observable<HttpEvent<any>>;
     }
 }