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;
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(
}
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);
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);
*/
import {
+ HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
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";
}
}
- if (result) {
+ if (result) {
console.log(
"Mock answering http call :" + request.method + " " + request.url,
request.method === "PUT" ? request.body : null
}
return result;
}
+
}
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>>;
}
*/
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';
private basePath = '/data-consumer/v1';
readonly jobsPath = 'info-jobs';
readonly consumerStatusPath = 'status';
+ private customHttpClient: HttpClient;
private buildPath(...args: any[]) {
let result = this.basePath;
return result;
}
- constructor(private httpClient: HttpClient) {
+ constructor(private httpClient: HttpClient, backend: HttpBackend) {
// injects to variable httpClient
+ this.customHttpClient = new HttpClient(backend);
}
getJobIds(): Observable<string[]> {