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