From c96e0382c83deae47e782f5a081ae431b715e365 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 12 Sep 2018 20:42:24 +0900 Subject: [PATCH] hostlist/portlist --- @overflow/model/discovery/Host.ts | 2 +- @overflow/model/discovery/Zone.ts | 2 +- src/app/pages/home/home-page.component.ts | 44 +++++++++++------------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/@overflow/model/discovery/Host.ts b/@overflow/model/discovery/Host.ts index 764bada..c0c9cbe 100644 --- a/@overflow/model/discovery/Host.ts +++ b/@overflow/model/discovery/Host.ts @@ -24,5 +24,5 @@ export interface Host { discoveredDate?: Date; zone?: Zone; - // portList?: Port[]; + portList?: any[]; } diff --git a/@overflow/model/discovery/Zone.ts b/@overflow/model/discovery/Zone.ts index e85429d..53ad0a5 100644 --- a/@overflow/model/discovery/Zone.ts +++ b/@overflow/model/discovery/Zone.ts @@ -11,5 +11,5 @@ export interface Zone { discoveredBy?: string[]; discoveredDate?: Date; - // hostList?: Host[]; + hostList?: any[]; } diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index b361222..514ebda 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -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; }