member_webapp/@overflow/probe/component/selector/selector.component.ts

30 lines
714 B
TypeScript
Raw Normal View History

2018-05-28 09:58:13 +00:00
import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
@Component({
selector: 'of-probe-selector',
templateUrl: './selector.component.html',
})
export class ProbeSelectorComponent implements OnChanges {
@Output() select = new EventEmitter<ProbeHost>();
@Input() probeHosts: ProbeHost[];
@Input() probeHostID: number;
options: Probe[];
constructor() {
}
ngOnChanges(changes: SimpleChanges): void {
this.options = [];
for (const ph of this.probeHosts) {
this.options.push(ph.probe);
}
}
onProbeSelect(event) {
this.select.emit(event.data);
}
}