app/src/commons/component/zone-detail.component.ts
insanity 9ada8bf45b .
2018-09-13 20:01:01 +09:00

34 lines
736 B
TypeScript

import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
import { Zone, Host } from '@overflow/model/discovery';
const IPCIDR = require('ip-cidr');
@Component({
selector: 'app-zone-detail',
templateUrl: './zone-detail.component.html',
styleUrls: ['./zone-detail.component.scss'],
})
export class ZoneDetailComponent implements OnInit {
@Input() zone: Zone;
@Output() otherHostSelect = new EventEmitter<Host>();
ipRange: string;
constructor(
) {
}
ngOnInit(): void {
if (!this.zone) {
return;
}
const cidr = new IPCIDR(this.zone.network);
this.ipRange = cidr.start() + ' - ' + cidr.end();
}
hostSelected(host: Host) {
this.otherHostSelect.emit(host);
}
}