- this.eiSvc.getEIJobs()
- .pipe(
- catchError((her: HttpErrorResponse) => {
- this.notificationService.error('Failed to get EI jobs: ' + her.error);
- return of([]);
- }),
- finalize(() => this.loadingSubject.next(false))
- )
- .subscribe((instances: EIJob[]) => {
- this.rowCount = instances.length;
- this.eiJobSubject.next(instances);
- });
- }
-
- connect(): BehaviorSubject<EIJob[]> {
- return this.eiJobSubject;
+ this.jobs = [];
+ this.eiSvc.getProducerIds().pipe(
+ mergeMap(prodIds =>
+ forkJoin(prodIds.map(id => this.eiSvc.getJobsForProducer(id)))),
+ mergeMap(result => result),
+ finalize(() => this.loadingSubject.next(false))
+ ).subscribe(result => {
+ this.jobs = this.jobs.concat(result);
+ this.jobsSubject.next(this.jobs);
+ } );
+ this.rowCount = this.jobs.length;