member_webapp/@overflow/probe/component/probe-detail.component.ts

58 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-05-31 18:45:40 +09:00
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
2018-05-25 18:18:06 +09:00
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
2018-05-31 18:45:40 +09:00
import { Store, select } from '@ngrx/store';
import { Observable, of, Subscription } from 'rxjs';
2018-06-04 17:55:47 +09:00
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
2018-06-01 18:45:28 +09:00
import { AuthSelector } from '@overflow/shared/auth/store';
2018-05-31 18:45:40 +09:00
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { ProbeHostService } from '../service/probe-host.service';
2018-04-06 22:02:46 +09:00
@Component({
selector: 'of-probe-detail',
2018-05-31 18:45:40 +09:00
templateUrl: './probe-detail.component.html',
2018-04-06 22:02:46 +09:00
})
2018-05-31 18:45:40 +09:00
export class ProbeDetailComponent implements OnInit {
@Input() probeHostID;
pending$: Observable<boolean>;
probeHost: ProbeHost;
error$: Observable<any>;
2018-04-06 22:02:46 +09:00
2018-05-25 18:18:06 +09:00
@Output() discovery = new EventEmitter<number>();
2018-04-06 22:02:46 +09:00
2018-05-31 18:45:40 +09:00
constructor(
private store: Store<any>,
2018-06-01 12:59:38 +09:00
private probeHostService: ProbeHostService,
2018-05-31 18:45:40 +09:00
) {
2018-04-27 16:31:27 +09:00
}
2018-05-31 18:45:40 +09:00
ngOnInit() {
this.probeHostService.read(this.probeHostID)
2018-06-01 12:59:38 +09:00
.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);
}),
2018-06-04 17:55:47 +09:00
take(1),
).subscribe();
2018-05-26 18:59:57 +09:00
}
2018-06-04 17:25:29 +09:00
modifiedGeneral(probe: Probe) {
2018-05-26 18:59:57 +09:00
2018-04-06 22:02:46 +09:00
}
2018-06-04 17:25:29 +09:00
remove(probeHost: ProbeHost) {
2018-05-25 20:02:27 +09:00
}
2018-04-06 22:02:46 +09:00
}
2018-04-06 20:02:18 +09:00