member_webapp/@overflow/probe/container/probe-selector-container.component.ts
2018-05-28 21:12:11 +09:00

34 lines
1.2 KiB
TypeScript

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';
import { ProbeSelectorContainerSelector } from '@overflow/probe/store';
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() {
this.probeHosts$ = this.store.pipe(select(ProbeSelectorContainerSelector.selectAll));
this.store.select(AuthContainerSelector.selectDomainMember).subscribe(
(domainMember: DomainMember) => {
this.store.dispatch(new ProbeEntityStore.ReadAllByDomainID(domainMember.domain.id));
}
);
}
}