This commit is contained in:
insanity 2018-06-06 12:19:44 +09:00
parent e367ce3ee3
commit 1bbd827596
4 changed files with 22 additions and 20 deletions

View File

@ -15,7 +15,7 @@
<!-- HOST node template -->
<ng-template let-node pTemplate="HOST">
<div @discoveryResultAnim>
<div *ngIf="checkHighlight(node.label) else unhighlightHost">
<div *ngIf="checkHighlight(node.label, 0) else unhighlightHost">
<p-toggleButton onLabel="{{node.label}}" offLabel="{{node.label}}" onIcon="fa-check" offIcon="fa-square" [style]="{'width':'200px'}"
(onChange)="onTargetSelect($event, node)"></p-toggleButton>
</div>
@ -30,14 +30,14 @@
<!-- SERVICE node template -->
<ng-template let-node pTemplate="SERVICE">
<div @discoveryResultAnim>
<div *ngIf="checkHighligt(node.data.name) else unhighlightServ">
<div *ngIf="checkHighlight(node.data.name, 1) else unhighlightServ">
<p-toggleButton onLabel="{{node.label}} {{node.data.portType}}" offLabel="{{node.label}} {{node.data.portType}} {{node.data.portNumber}}"
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px'}" (onChange)="onTargetSelect($event, node.data.target)"></p-toggleButton>
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px'}" (onChange)="onTargetSelect($event, node)"></p-toggleButton>
</div>
<ng-template #unhighlightServ>
<p-toggleButton onLabel="{{node.label}} {{node.data.portType}}" offLabel="{{node.label}} {{node.data.portType}} {{node.data.portNumber}}"
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px', 'opacity': '0.2'}" (onChange)="onTargetSelect($event, node.data.target)"></p-toggleButton>
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px', 'opacity': '0.2'}" (onChange)="onTargetSelect($event, node)"></p-toggleButton>
</ng-template>
</div>

View File

@ -8,22 +8,22 @@ import {
} from '@angular/core';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { Subscription, Observable, of } from 'rxjs';
import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
import { TreeNode, Message, Tree } from 'primeng/primeng';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Anim } from './animation';
import { DiscoveryNotify } from '../subscriber/discovery.subscriber';
import { InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
import { TargetService } from '../../target/service/target.service';
import { TargetService } from '@overflow/target/service/target.service';
import { Target } from '@overflow/commons-typescript/model/target';
@Component({
selector: 'of-discovery-result',
templateUrl: './search-result.component.html',
animations: Anim
animations: Anim,
providers: [
TargetService
]
})
export class SearchResultComponent implements OnInit, OnChanges {
@ -118,7 +118,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
});
}
onTargetSelect(e, data) {
onTargetSelect(e, node: TreeNode) {
const data = node.data.target;
if (e.checked) {
this.selectedItems.push(data);
} else {
@ -171,12 +172,12 @@ export class SearchResultComponent implements OnInit, OnChanges {
});
}
checkHighlight(label: string) {
checkHighlight(label: string, type: number) {
let highlight = true;
if (this.filterWord && (label.toUpperCase().indexOf(this.filterWord.toUpperCase()) < 0)) {
highlight = false;
}
if (this.filterServices[label] === false) {
if (type === 1 && this.filterServices[label] === false) {
highlight = false;
}
return highlight;
@ -184,7 +185,6 @@ export class SearchResultComponent implements OnInit, OnChanges {
saveTargets() {
console.log(this.selectedItems);
const hosts: Host[] = [];
const services: Service[] = [];
this.selectedItems.forEach(value => {
@ -194,6 +194,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
services.push(value);
}
});
this.targetService.registDiscoveredTargets(this.probeHost.probe.id, null, null);
console.log(hosts);
console.log(services);
this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services);
}
}

View File

@ -6,8 +6,8 @@
<of-key-value [key]="'Authorized by'" [value]="probeHost.probe.authorizeMember.name"></of-key-value>
<!-- ProbeHost 정보 -->
<of-key-value [key]="'OS'" [value]="probeHost.host.os.vendor.name"></of-key-value>
<of-key-value [key]="'IPv4'" [value]="probeHost.host.ipv4"></of-key-value>
<of-key-value [key]="'IPv6'" [value]="probeHost.host.ipv6"></of-key-value>
<of-key-value [key]="'OS'" [value]="probeHost.infraHost.infraOS.metaInfraVendor.name"></of-key-value>
<of-key-value [key]="'IPv4'" [value]="probeHost.infraHost.ipv4"></of-key-value>
<of-key-value [key]="'IPv6'" [value]="probeHost.infraHost.ipv6"></of-key-value>
<of-key-value [key]="'Mac Address'" [value]="probeHost.mac"></of-key-value>
</div>

View File

@ -5,10 +5,10 @@
</div>
<div class="ui-g-12 ui-md-4 ui-nopad ui-key-value">
<of-key-value [key]="'Name'" [value]="probeHost.probe.displayName"></of-key-value>
<of-key-value [key]="'OS'" [value]="probeHost.host.os.vendor.name"></of-key-value>
<of-key-value [key]="'OS'" [value]="probeHost.infraHost.infraOS.metaInfraVendor.name"></of-key-value>
</div>
<div class="ui-g-12 ui-md-4 ui-nopad ui-key-value">
<of-key-value [key]="'IPv4'" [value]="probeHost.host.ipv4"></of-key-value>
<of-key-value [key]="'Mac Address'" [value]="probeHost.host.mac"></of-key-value>
<of-key-value [key]="'IPv4'" [value]="probeHost.infraHost.ipv4"></of-key-value>
<of-key-value [key]="'Mac Address'" [value]="probeHost.infraHost.mac"></of-key-value>
</div>
</div>