import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe'; import { Store, select } from '@ngrx/store'; import { Observable, of, Subscription } from 'rxjs'; import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators'; import { AuthSelector } from '@overflow/shared/auth/store'; import { DomainMember } from '@overflow/commons-typescript/model/domain'; import { ProbeHostService } from '../service/probe-host.service'; @Component({ selector: 'of-probe-detail', templateUrl: './probe-detail.component.html', }) export class ProbeDetailComponent implements OnInit { @Input() probeHostID; pending$: Observable; probeHost: ProbeHost; error$: Observable; @Output() discovery = new EventEmitter(); constructor( private store: Store, private probeHostService: ProbeHostService, ) { } ngOnInit() { this.probeHostService.read(this.probeHostID) .pipe( tap(() => { this.pending$ = of(true); }), map((probeHost: ProbeHost) => { this.probeHost = probeHost; }), catchError(error => { this.error$ = of(error); return of(); }), tap(() => { this.pending$ = of(false); }), take(1), ).subscribe(); } modifiedGeneral(probe: Probe) { } remove(probeHost: ProbeHost) { } }