member_webapp/@overflow/probe/component/probe-detail.component.ts
crusader 9990650925 ing
2018-06-04 17:55:47 +09:00

58 lines
1.4 KiB
TypeScript

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<boolean>;
probeHost: ProbeHost;
error$: Observable<any>;
@Output() discovery = new EventEmitter<number>();
constructor(
private store: Store<any>,
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) {
}
}