2018-05-28 09:58:13 +00:00
|
|
|
import { Component, EventEmitter, Output, OnInit, Input } from '@angular/core';
|
|
|
|
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { Store, select } from '@ngrx/store';
|
|
|
|
import * as ProbeEntityStore from '@overflow/probe/store/entity/probe';
|
2018-05-28 12:12:11 +00:00
|
|
|
import { ProbeSelectorContainerSelector } from '@overflow/probe/store';
|
2018-05-28 09:58:13 +00:00
|
|
|
import { AuthContainerSelector } from '@overflow/shared/auth/store';
|
|
|
|
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-probe-selector-container',
|
|
|
|
templateUrl: './probe-selector-container.component.html',
|
|
|
|
})
|
|
|
|
export class ProbeSelectorContainerComponent implements OnInit {
|
|
|
|
|
|
|
|
probeHosts$: Observable<ProbeHost[]>;
|
|
|
|
@Output() select = new EventEmitter();
|
|
|
|
@Input() probeHostID: number;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private store: Store<any>,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
2018-05-28 12:12:11 +00:00
|
|
|
this.probeHosts$ = this.store.pipe(select(ProbeSelectorContainerSelector.selectAll));
|
2018-05-28 09:58:13 +00:00
|
|
|
this.store.select(AuthContainerSelector.selectDomainMember).subscribe(
|
|
|
|
(domainMember: DomainMember) => {
|
|
|
|
this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domainMember.domain.id));
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|