GUI stoppig when plenty of deletions
Change-Id: If39748ad5a9cfdf1a5262419a56a007dd5288efd
Issue-ID: NONRTRIC-599
Signed-off-by: maximesson <maxime.bonneau@est.tech>
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 c0e437d..95d1040 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,11 +22,12 @@
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 } from "rxjs";
+import { EMPTY, forkJoin, of, pipe, Subscription, concat, Observable } from "rxjs";
import { BehaviorSubject } from "rxjs/BehaviorSubject";
-import { mergeMap, finalize, map, tap, concatMap, delay, skip } from "rxjs/operators";
+import { mergeMap, finalize, map, tap, concatMap, delay, skip, catchError } from "rxjs/operators";
import { ConsumerService } from "@services/ei/consumer.service";
import { UiService } from "@services/ui/ui.service";
+import { EmptyObservable } from 'rxjs/observable/EmptyObservable';
export interface Job {
jobId: string;
@@ -100,12 +101,21 @@
forkJoin(jobIds.map((jobId) => {
return forkJoin([
of(jobId),
- this.consumerService.getJobInfo(jobId),
- this.consumerService.getConsumerStatus(jobId)
+ this.consumerService.getJobInfo(jobId).pipe(
+ catchError(err => {
+ return of([-1]);
+ })),
+ this.consumerService.getConsumerStatus(jobId).pipe(
+ catchError(err => {
+ return of([-1]);
+ })),
])
}))
),
- finalize(() => this.loadingSubject$.next(false))
+ finalize(() => {
+ this.loadingSubject$.next(false)
+ })
+
);
const whenToRefresh$ = of('').pipe(
@@ -188,7 +198,7 @@
}
isArrayIncluding(data: string[], filter: string): boolean {
- if(!data)
+ if (!data)
return true;
for (let i = 0; i < data.length; i++) {
return this.isDataIncluding(data[i], filter);
@@ -217,13 +227,15 @@
this.clearFilter();
let jobList = [];
res.forEach(element => {
- let jobObj = <Job>{};
- jobObj.jobId = element[0];
- jobObj.owner = element[1].job_owner;
- jobObj.targetUri = element[1].job_result_uri;
- jobObj.typeId = element[1].info_type_id;
- jobObj.prodIds = (element[2].producers) ? element[2].producers : ["No Producers"];
- jobList = jobList.concat(jobObj);
+ if(element[1] != -1 && element[2] != -1){
+ let jobObj = <Job>{};
+ jobObj.jobId = element[0];
+ jobObj.owner = element[1].job_owner;
+ jobObj.targetUri = element[1].job_result_uri;
+ jobObj.typeId = element[1].info_type_id;
+ jobObj.prodIds = (element[2].producers) ? element[2].producers : ["No Producers"];
+ jobList = jobList.concat(jobObj);
+ }
});
this.jobsSubject$.next(jobList);
diff --git a/webapp-frontend/src/app/interceptor.mock.ts b/webapp-frontend/src/app/interceptor.mock.ts
index d40a0fc..844513b 100644
--- a/webapp-frontend/src/app/interceptor.mock.ts
+++ b/webapp-frontend/src/app/interceptor.mock.ts
@@ -19,6 +19,7 @@
*/
import {
+ HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
@@ -26,7 +27,7 @@
HttpResponse,
} from "@angular/common/http";
import { Injectable, Injector } from "@angular/core";
-import { Observable, of } from "rxjs";
+import { Observable, of, throwError } from "rxjs";
import * as policyinstance1 from "./mock/policy-instance-1.json";
import * as noTypePolicies from "./mock/no-type-policies.json";
import * as type0Policies from "./mock/type0-policies.json";
@@ -228,7 +229,7 @@
}
}
- if (result) {
+ if (result) {
console.log(
"Mock answering http call :" + request.method + " " + request.url,
request.method === "PUT" ? request.body : null
@@ -258,4 +259,5 @@
}
return result;
}
+
}
diff --git a/webapp-frontend/src/app/interceptor.ts b/webapp-frontend/src/app/interceptor.ts
index db5f447..65ce887 100644
--- a/webapp-frontend/src/app/interceptor.ts
+++ b/webapp-frontend/src/app/interceptor.ts
@@ -33,11 +33,11 @@
console.log('Interceptor Invoked' + request.url);
return next.handle(request).pipe(
catchError((error: HttpErrorResponse) => {
- console.error("Error from error interceptor", error);
+ console.error("Error from error interceptor", error);
- // show dialog for error message
- this.notificationService.error(error.message);
- return throwError(error);
+ // show dialog for error message
+ this.notificationService.error(error.message);
+ return throwError(error);
})
) as Observable<HttpEvent<any>>;
}
diff --git a/webapp-frontend/src/app/services/ei/consumer.service.ts b/webapp-frontend/src/app/services/ei/consumer.service.ts
index 19ec3cb..cbafb52 100644
--- a/webapp-frontend/src/app/services/ei/consumer.service.ts
+++ b/webapp-frontend/src/app/services/ei/consumer.service.ts
@@ -19,7 +19,7 @@
*/
import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
+import { HttpBackend, HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ConsumerStatus, JobInfo } from '@interfaces/consumer.types';
@@ -34,6 +34,7 @@
private basePath = '/data-consumer/v1';
readonly jobsPath = 'info-jobs';
readonly consumerStatusPath = 'status';
+ private customHttpClient: HttpClient;
private buildPath(...args: any[]) {
let result = this.basePath;
@@ -43,8 +44,9 @@
return result;
}
- constructor(private httpClient: HttpClient) {
+ constructor(private httpClient: HttpClient, backend: HttpBackend) {
// injects to variable httpClient
+ this.customHttpClient = new HttpClient(backend);
}
getJobIds(): Observable<string[]> {