- this.eiSvc.getEIProducers()
- .pipe(
- catchError((her: HttpErrorResponse) => {
- this.notificationService.error('Failed to get producers: ' + her.error);
- return of([]);
- }),
- finalize(() => this.loadingSubject.next(false))
- )
- .subscribe((prods: EIProducer[]) => {
- console.log("Producers: " + prods);
- this.rowCount = prods.length;
- this.producerSubject.next(prods);
- });
- }
-
- connect(): Observable<EIProducer[]> {
- const dataMutations = [
- this.producerSubject.asObservable(),
- this.sort.sortChange
- ];
- return merge(...dataMutations).pipe(map(() => {
- return this.getSortedData([...this.producerSubject.getValue()]);
- }));
- }
-
- disconnect(): void {
- this.producerSubject.complete();
- this.loadingSubject.complete();
- }
-
- private getSortedData(data: EIProducer[]) {
- if (!this.sort || !this.sort.active || this.sort.direction === '') {
- return data;
- }