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(); 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); } }