42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { Component, EventEmitter, Output, OnInit, AfterContentInit } from '@angular/core';
|
|
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
|
|
import { Observable } from 'rxjs';
|
|
import { Store, select } from '@ngrx/store';
|
|
import * as ProbeStore from '../store/probe';
|
|
import { ProbeSelector } from '../store';
|
|
import { AuthSelector } from '@overflow/member/store';
|
|
import { Domain } from '@overflow/commons-typescript/model/domain';
|
|
|
|
@Component({
|
|
selector: 'of-probe-list-container',
|
|
templateUrl: './probe-list-container.html',
|
|
})
|
|
export class ProbeListContainerComponent implements OnInit, AfterContentInit {
|
|
|
|
probeHosts$: Observable<ProbeHost[]>;
|
|
@Output() select = new EventEmitter();
|
|
|
|
constructor(private store: Store<ProbeStore.State>) {
|
|
this.probeHosts$ = store.pipe(select(ProbeSelector.select('probeHosts')));
|
|
}
|
|
|
|
onSelect(probeHost: ProbeHost) {
|
|
this.select.emit(probeHost);
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.store.select(AuthSelector.select('domain')).subscribe(
|
|
(domain: Domain) => {
|
|
this.store.dispatch(new ProbeStore.ReadAllByDomainID(domain.id));
|
|
},
|
|
(error) => {
|
|
console.log(error);
|
|
}
|
|
);
|
|
}
|
|
|
|
ngAfterContentInit() {
|
|
|
|
}
|
|
}
|