2018-04-25 09:04:47 +00:00
|
|
|
import { Component, OnInit, AfterContentInit, Input, OnChanges } from '@angular/core';
|
|
|
|
import { Store, select } from '@ngrx/store';
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RPCClientError } from '@loafer/ng-rpc';
|
2018-04-25 09:04:47 +00:00
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
import * as DetailStore from '@overflow/probe/store/probe-host';
|
|
|
|
import { ProbeHostSelector } from '@overflow/probe/store';
|
2018-05-02 08:09:39 +00:00
|
|
|
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
|
2018-04-25 09:04:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-probe-summary',
|
|
|
|
templateUrl: './probe-summary.component.html',
|
|
|
|
})
|
|
|
|
export class ProbeSummaryComponent implements OnInit, AfterContentInit, OnChanges {
|
|
|
|
|
2018-04-26 12:18:25 +00:00
|
|
|
@Input() probe: Object;
|
2018-04-25 09:04:47 +00:00
|
|
|
@Input() visible: boolean;
|
|
|
|
|
|
|
|
probeHost$ = this.detailStore.pipe(select(ProbeHostSelector.select('probeHost')));
|
|
|
|
probeHost: ProbeHost;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private detailStore: Store<DetailStore.State>,
|
|
|
|
) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.probeHost$.subscribe(
|
|
|
|
(probeHost: ProbeHost) => {
|
|
|
|
if (probeHost) {
|
2018-04-26 12:18:25 +00:00
|
|
|
console.log(probeHost);
|
|
|
|
this.probeHost = probeHost;
|
2018-04-25 09:04:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
(error: RPCClientError) => {
|
|
|
|
console.log(error.response.message);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ngAfterContentInit() {
|
2018-04-26 12:18:25 +00:00
|
|
|
console.log('$$$$$$$$$$');
|
|
|
|
console.log(this.probe);
|
|
|
|
console.log('$$$$$$$$$$');
|
2018-05-16 10:02:48 +00:00
|
|
|
// this.detailStore.dispatch(
|
|
|
|
// new DetailStore.ReadByProbe(this.probe)
|
|
|
|
// );
|
2018-04-25 09:04:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnChanges() {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|