app/src/commons/component/zone-detail.component.ts

30 lines
588 B
TypeScript
Raw Normal View History

2018-09-11 10:33:00 +00:00
import { Component, Input, OnInit } from '@angular/core';
import { Zone, Host } from '@overflow/model/discovery';
2018-09-09 10:20:21 +00:00
2018-09-11 10:33:00 +00:00
const IPCIDR = require('ip-cidr');
2018-09-09 10:20:21 +00:00
@Component({
selector: 'app-zone-detail',
templateUrl: './zone-detail.component.html',
styleUrls: ['./zone-detail.component.scss'],
})
2018-09-11 10:33:00 +00:00
export class ZoneDetailComponent implements OnInit {
2018-09-09 10:20:21 +00:00
@Input() zone: Zone;
2018-09-11 10:33:00 +00:00
ipRange: string;
2018-09-09 10:20:21 +00:00
constructor(
) {
}
2018-09-11 10:33:00 +00:00
ngOnInit(): void {
if (!this.zone) {
return;
}
const cidr = new IPCIDR(this.zone.network);
this.ipRange = cidr.start() + ' - ' + cidr.end();
}
2018-09-09 10:20:21 +00:00
}