diff --git a/@overflow/discovery/component/search-result.component.html b/@overflow/discovery/component/search-result.component.html index 7466d94..dc5e054 100644 --- a/@overflow/discovery/component/search-result.component.html +++ b/@overflow/discovery/component/search-result.component.html @@ -15,13 +15,14 @@
-
+
-
{{node.label}}
+
@@ -29,20 +30,21 @@
-
+
+ onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px'}" (onChange)="onTargetSelect($event, node.data.target)">
-
{{node.label}} {{node.data.portType}}
+
- + \ No newline at end of file diff --git a/@overflow/discovery/component/search-result.component.ts b/@overflow/discovery/component/search-result.component.ts index b717d85..eb4eed0 100644 --- a/@overflow/discovery/component/search-result.component.ts +++ b/@overflow/discovery/component/search-result.component.ts @@ -36,8 +36,8 @@ export class SearchResultComponent implements OnInit, OnChanges { selectedItems: TreeNode[] = []; msgs: Message[]; - infraHosts = []; - infraServices = []; + discoveredHosts: Host[] = []; + discoveredServices: Service[] = []; constructor( ) { @@ -56,7 +56,7 @@ export class SearchResultComponent implements OnInit, OnChanges { ngOnChanges(changes: SimpleChanges): void { if (changes['finished'] && changes['finished'].currentValue === true) { - // this.saveInfras(); + this.saveInfras(); // TODO: Comes after save infra this.msgs = []; this.msgs.push({ @@ -68,6 +68,7 @@ export class SearchResultComponent implements OnInit, OnChanges { addHost(host: Host) { + this.discoveredHosts.push(host); const idx = this.findHostIndex(host); this.hostNode.splice(idx, 0, { type: 'HOST', @@ -77,7 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges { ipv6: host.ipv6, mac: host.mac, openPorts: [], - zone: host.zone, + target: host }, expanded: true, children: [] @@ -85,6 +86,7 @@ export class SearchResultComponent implements OnInit, OnChanges { } addService(service: Service) { + this.discoveredServices.push(service); const targetHostNode = this.findHostNodeByService(service); const idx = this.findServiceIndex(targetHostNode.children, service); targetHostNode.children.splice(idx, 0, { @@ -94,7 +96,7 @@ export class SearchResultComponent implements OnInit, OnChanges { name: service.serviceName, portType: service.port.portType, portNumber: service.port.portNumber, - host: service.port.host + target: service }, }); } @@ -160,50 +162,45 @@ export class SearchResultComponent implements OnInit, OnChanges { }); } - checkHighligtHost(label: string) { - if (!this.filterWord) { - return true; + checkHighligt(label: string) { + let highlight = true; + if (this.filterWord && (label.toUpperCase().indexOf(this.filterWord.toUpperCase()) < 0)) { + highlight = false; } - if (this.filterWord && - label.toUpperCase().indexOf(this.filterWord.toUpperCase()) > 0) { - return true; + if (this.filterServices[label] === false) { + highlight = false; } - return false; + return highlight; } - checkHighligtService(name: string) { - if (this.filterServices && (this.filterServices[name])) { - return true; - } - return false; - } + saveInfras() { + this.discoveredHosts.forEach(host => { + const infraHost: InfraHost = { + probe: this.probeHost.probe, + infraType: { + id: 2 + }, + os: {}, + ipv4: host.ipv4, + ipv6: host.ipv6, + mac: host.mac, + }; + }); - saveInfras(host: Host, service: Service) { - // Host - const infraHost: InfraHost = { - probe: this.probeHost.probe, - infraType: { - id: 2 - }, - os: {}, - ipv4: host.ipv4, - ipv6: host.ipv6, - mac: host.mac, - }; - - // Service - const infraService: InfraService = { - probe: this.probeHost.probe, - infraType: { - id: 7 - }, - host: { - }, - portType: service.port.portType, - port: service.port.portNumber, - vendor: { - } - }; + this.discoveredServices.forEach(service => { + const infraService: InfraService = { + probe: this.probeHost.probe, + infraType: { + id: 7 + }, + host: { + }, + portType: service.port.portType, + port: service.port.portNumber, + vendor: { + } + }; + }); } saveTargets() {