test
This commit is contained in:
parent
5077020864
commit
a432368a8e
|
@ -37,7 +37,8 @@ export class SearchFilterComponent implements OnInit {
|
|||
|
||||
addService(service: Service) {
|
||||
if (service.serviceName.indexOf('Not Supported Service') >= 0) {
|
||||
return;
|
||||
const tempName = service.serviceName.split('Perhaps ')[1].split('[')[0];
|
||||
service.serviceName = '*' + tempName;
|
||||
}
|
||||
let exist = false;
|
||||
this.services.forEach(value => {
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
<div @discoveryResultAnim>
|
||||
<div *ngIf="checkHighligtHost(node.label) else unhighlightHost">
|
||||
<p-toggleButton onLabel="{{node.label}}" offLabel="{{node.label}}" onIcon="fa-check" offIcon="fa-square" [style]="{'width':'200px'}"
|
||||
(onChange)="onTargetSelect($event, node.data)"></p-toggleButton>
|
||||
(onChange)="onTargetSelect($event, node)"></p-toggleButton>
|
||||
</div>
|
||||
|
||||
<ng-template #unhighlightHost>
|
||||
<div>{{node.label}}</div>
|
||||
<div style="opacity: 0.2">{{node.label}}</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
@ -31,11 +31,11 @@
|
|||
<div @discoveryResultAnim>
|
||||
<div *ngIf="checkHighligtService(node.data.name) 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)"></p-toggleButton>
|
||||
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'300px'}" (onChange)="onTargetSelect($event, node)"></p-toggleButton>
|
||||
</div>
|
||||
|
||||
<ng-template #unhighlightServ>
|
||||
<div>{{node.label}} {{node.data.portType}}</div>
|
||||
<div style="opacity: 0.2">{{node.label}} {{node.data.portType}}</div>
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -10,12 +10,13 @@ import {
|
|||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
|
||||
import { TreeNode, Message } from 'primeng/primeng';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'of-discovery-result',
|
||||
|
@ -32,9 +33,12 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
discoverySubscription: Subscription;
|
||||
zoneNode: TreeNode[] = [];
|
||||
hostNode: TreeNode[] = [];
|
||||
selectedItems = [];
|
||||
selectedItems: TreeNode[] = [];
|
||||
msgs: Message[];
|
||||
|
||||
infraHosts = [];
|
||||
infraServices = [];
|
||||
|
||||
constructor(
|
||||
) {
|
||||
}
|
||||
|
@ -52,6 +56,8 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (changes['finished'] && changes['finished'].currentValue === true) {
|
||||
// this.saveInfras();
|
||||
// TODO: Comes after save infra
|
||||
this.msgs = [];
|
||||
this.msgs.push({
|
||||
severity: 'success',
|
||||
|
@ -67,9 +73,11 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
type: 'HOST',
|
||||
label: host.ipv4,
|
||||
data: {
|
||||
id: host.id,
|
||||
ip: this.convertIPtoNumber(host.ipv4),
|
||||
openPorts: []
|
||||
ipv6: host.ipv6,
|
||||
mac: host.mac,
|
||||
openPorts: [],
|
||||
zone: host.zone,
|
||||
},
|
||||
expanded: true,
|
||||
children: []
|
||||
|
@ -83,10 +91,10 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
type: 'SERVICE',
|
||||
label: service.serviceName + ' (' + service.port.portNumber + ')',
|
||||
data: {
|
||||
id: service.id,
|
||||
name: service.serviceName,
|
||||
portType: service.port.portType,
|
||||
portNumber: service.port.portNumber,
|
||||
host: service.port.host
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -170,7 +178,44 @@ export class SearchResultComponent implements OnInit, OnChanges {
|
|||
return false;
|
||||
}
|
||||
|
||||
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: {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
saveTargets() {
|
||||
console.log(this.selectedItems);
|
||||
let node: TreeNode;
|
||||
for (node of this.selectedItems) {
|
||||
if (node.type === 'HOST') {
|
||||
// InfraHost
|
||||
} else if (node.type === 'SERVICE') {
|
||||
// InfraService
|
||||
// InfraOSPort?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain'
|
|||
import { AuthSelector } from '@overflow/shared/auth/store';
|
||||
|
||||
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
|
||||
interface HostData {
|
||||
|
@ -64,6 +65,7 @@ export class InfraMapComponent implements OnInit, AfterContentInit {
|
|||
|
||||
constructor(
|
||||
private store: Store<any>,
|
||||
private router: Router
|
||||
// private infraService: InfraService,
|
||||
) {
|
||||
|
||||
|
@ -353,7 +355,7 @@ export class InfraMapComponent implements OnInit, AfterContentInit {
|
|||
|
||||
showDialog() {
|
||||
// this.display = true;
|
||||
// this.router.navigateByUrl('/discovery');
|
||||
this.router.navigateByUrl('/discovery');
|
||||
}
|
||||
|
||||
// closeDialog() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user