hostlist/portlist

This commit is contained in:
insanity 2018-09-12 20:42:24 +09:00
parent e59b841577
commit c96e0382c8
3 changed files with 24 additions and 24 deletions

View File

@ -24,5 +24,5 @@ export interface Host {
discoveredDate?: Date;
zone?: Zone;
// portList?: Port[];
portList?: any[];
}

View File

@ -11,5 +11,5 @@ export interface Zone {
discoveredBy?: string[];
discoveredDate?: Date;
// hostList?: Host[];
hostList?: any[];
}

View File

@ -250,28 +250,28 @@ export class HomePageComponent implements OnInit, OnDestroy {
console.log(node);
this.displaySidebar = true;
// switch (node.group) {
// case 'zone':
// var zone: Zone = node.target;
// zone.hostList = [];
// this.hosts.forEach(host => {
// if (host.zone.network === zone.network) {
// zone.hostList.push(host);
// }
// });
// break;
// case 'host':
// var host: Host = node.target;
// host.portList = [];
// this.ports.forEach(port => {
// if (port.host.address === host.address) {
// host.portList.push(port);
// }
// });
// break;
// default:
// break;
// }
switch (node.group) {
case 'zone':
var zone: Zone = node.target;
zone.hostList = [];
this.hosts.forEach(host => {
if (host.zone.network === zone.network) {
zone.hostList.push(host);
}
});
break;
case 'host':
var host: Host = node.target;
host.portList = [];
this.ports.forEach(port => {
if (port.host.address === host.address) {
host.portList.push(port);
}
});
break;
default:
break;
}
this.selectedNode = node;
}