ing
This commit is contained in:
@@ -8,34 +8,55 @@ import {
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { Store, select, StateObservable } from '@ngrx/store';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
|
||||
|
||||
import { RPCClientError } from '@loafer/ng-rpc';
|
||||
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { MetaCrawlerComponent } from '../../../../meta/component/abstract/meta-crawler.component';
|
||||
|
||||
import { MetaCrawlerService } from '../../../../meta/service/meta-crawler.service';
|
||||
|
||||
@Component({
|
||||
selector: 'of-service-selector',
|
||||
templateUrl: './service-selector.component.html',
|
||||
})
|
||||
export class ServiceSelectorComponent extends MetaCrawlerComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
export class ServiceSelectorComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
@Output() crawlerSelected = new EventEmitter<MetaCrawler>();
|
||||
@Input() includeServices;
|
||||
@Input() disabled: boolean;
|
||||
|
||||
metaCrawlers$: Observable<MetaCrawler[]>;
|
||||
pending$: Observable<boolean>;
|
||||
error$: Observable<any>;
|
||||
|
||||
constructor(
|
||||
protected store: Store<any>,
|
||||
protected metaCrawlerService: MetaCrawlerService,
|
||||
) {
|
||||
super(store, metaCrawlerService);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.metaCrawlers$ = this.metaCrawlerService.readAll()
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.pending$ = of(true);
|
||||
}),
|
||||
map((metaCrawlers: MetaCrawler[]) => {
|
||||
return metaCrawlers;
|
||||
}),
|
||||
catchError(error => {
|
||||
this.error$ = of(error);
|
||||
return of(null);
|
||||
}),
|
||||
tap(() => {
|
||||
this.pending$ = of(false);
|
||||
}),
|
||||
).take(1);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
super.ngOnDestroy();
|
||||
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
|
||||
Reference in New Issue
Block a user