test
This commit is contained in:
parent
cd1e53f67a
commit
ffcee6564e
|
@ -9,7 +9,7 @@
|
||||||
<of-discovery-request-summary *ngIf="discoverZone" @discoveryFilterAnim [discoverZone]="discoverZone"></of-discovery-request-summary>
|
<of-discovery-request-summary *ngIf="discoverZone" @discoveryFilterAnim [discoverZone]="discoverZone"></of-discovery-request-summary>
|
||||||
</p-accordionTab>
|
</p-accordionTab>
|
||||||
<p-accordionTab header="Filter" [selected]="requested" [disabled]="!requested">
|
<p-accordionTab header="Filter" [selected]="requested" [disabled]="!requested">
|
||||||
<of-discovery-search-filter #discoveryFilter></of-discovery-search-filter>
|
<of-discovery-search-filter #discoveryFilter (search)="filterWord=$event" (serviceSelect)="filterServices=$event"></of-discovery-search-filter>
|
||||||
</p-accordionTab>
|
</p-accordionTab>
|
||||||
</p-accordion>
|
</p-accordion>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,7 +19,12 @@
|
||||||
<button class="ui-button-danger ui-button-width-fit" type="button" label="Stop" icon="ui-icon-close" pButton (click)="onStop()"
|
<button class="ui-button-danger ui-button-width-fit" type="button" label="Stop" icon="ui-icon-close" pButton (click)="onStop()"
|
||||||
[disabled]="!started"></button>
|
[disabled]="!started"></button>
|
||||||
<!-- <of-discovery-result *ngIf="requested else info" [started]="requested" (stop)="onRequestDiscoveryStop($event)"></of-discovery-result> -->
|
<!-- <of-discovery-result *ngIf="requested else info" [started]="requested" (stop)="onRequestDiscoveryStop($event)"></of-discovery-result> -->
|
||||||
<of-discovery-result #discoveryResult *ngIf="requested else info" [probeHost]="selectedProbe" [started]="requested"></of-discovery-result>
|
<of-discovery-result #discoveryResult *ngIf="requested else info"
|
||||||
|
[probeHost]="selectedProbe"
|
||||||
|
[started]="requested"
|
||||||
|
[filterWord]="filterWord"
|
||||||
|
[filterServices]="filterServices"
|
||||||
|
></of-discovery-result>
|
||||||
</p-panel>
|
</p-panel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,6 +28,9 @@ export class DiscoveryComponent implements OnDestroy {
|
||||||
requested: boolean;
|
requested: boolean;
|
||||||
discoverZone: DiscoverZone;
|
discoverZone: DiscoverZone;
|
||||||
|
|
||||||
|
filterWord: string;
|
||||||
|
filterServices: Service[];
|
||||||
|
|
||||||
@ViewChild('discoveryResult') discoveryResult: SearchResultComponent;
|
@ViewChild('discoveryResult') discoveryResult: SearchResultComponent;
|
||||||
@ViewChild('discoveryFilter') discoveryFilter: SearchFilterComponent;
|
@ViewChild('discoveryFilter') discoveryFilter: SearchFilterComponent;
|
||||||
|
|
||||||
|
@ -48,9 +51,9 @@ export class DiscoveryComponent implements OnDestroy {
|
||||||
onRequestDiscovery(dz: DiscoverZone) {
|
onRequestDiscovery(dz: DiscoverZone) {
|
||||||
this.requested = true;
|
this.requested = true;
|
||||||
this.discoverZone = dz;
|
this.discoverZone = dz;
|
||||||
|
// this.discoveryService.discoverZone(this.selectedProbe.probe.probeKey, dz);
|
||||||
this.discoverySubscription = this.discoverySubscriber.observable().pipe(
|
this.discoverySubscription = this.discoverySubscriber.observable().pipe(
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.discoveryService.discoverZone(this.selectedProbe.probe.probeKey, dz);
|
|
||||||
}),
|
}),
|
||||||
map((discoveryNotify: DiscoveryNotify) => {
|
map((discoveryNotify: DiscoveryNotify) => {
|
||||||
switch (discoveryNotify.method) {
|
switch (discoveryNotify.method) {
|
||||||
|
@ -69,22 +72,22 @@ export class DiscoveryComponent implements OnDestroy {
|
||||||
}
|
}
|
||||||
case 'DiscoveryService.discoveredZone': {
|
case 'DiscoveryService.discoveredZone': {
|
||||||
const zone = discoveryNotify.params as Zone;
|
const zone = discoveryNotify.params as Zone;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'DiscoveryService.discoveredHost': {
|
case 'DiscoveryService.discoveredHost': {
|
||||||
const host = discoveryNotify.params as Host;
|
const host = discoveryNotify.params as Host;
|
||||||
|
this.discoveryResult.addHost(host);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'DiscoveryService.discoveredPort': {
|
case 'DiscoveryService.discoveredPort': {
|
||||||
const port = discoveryNotify.params as Port;
|
const port = discoveryNotify.params as Port;
|
||||||
|
this.discoveryResult.addPort(port);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'DiscoveryService.discoveredService': {
|
case 'DiscoveryService.discoveredService': {
|
||||||
const service = discoveryNotify.params as Service;
|
const service = discoveryNotify.params as Service;
|
||||||
|
this.discoveryFilter.addService(service);
|
||||||
|
this.discoveryResult.addService(service);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<div class="ui-g">
|
<div class="ui-g">
|
||||||
<div class="ui-g-12">
|
|
||||||
<label>IP Adress</label>
|
<input #filterWord type="text" [(ngModel)]="searchWord" pInputText (keyup)="onSearch($event)"/>
|
||||||
<input type="hidden" >
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12">
|
|
||||||
<of-ip-input [hostIp]="startHostIp" (inputIp)="onInputIP($event, 0)" [title]="'Start'"></of-ip-input>
|
|
||||||
</div>
|
|
||||||
<div class="ui-g-12 ui-bottom-space-20">
|
|
||||||
<of-ip-input [hostIp]="endHostIp" (inputIp)="onInputIP($event, 1)" [title]="'End'"></of-ip-input>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui-g" @discoveryResultAnim>
|
<div class="ui-g" @discoveryResultAnim>
|
||||||
<p-toggleButton *ngFor="let service of services" offLabel="{{service.description}}" onLabel="{{service.description}}" [style]="{'width':'150px'}" ></p-toggleButton>
|
<p-toggleButton *ngFor="let service of services" offLabel="{{service.description}}" onLabel="{{service.description}}" [style]="{'width':'150px'}"></p-toggleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,6 +1,8 @@
|
||||||
import {
|
import {
|
||||||
AfterContentInit, Component,
|
Component,
|
||||||
OnInit
|
OnInit,
|
||||||
|
Output,
|
||||||
|
EventEmitter
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Anim } from './animation';
|
import { Anim } from './animation';
|
||||||
import { Service } from '@overflow/commons-typescript/model/discovery';
|
import { Service } from '@overflow/commons-typescript/model/discovery';
|
||||||
|
@ -10,12 +12,13 @@ import { Service } from '@overflow/commons-typescript/model/discovery';
|
||||||
templateUrl: './search-filter.component.html',
|
templateUrl: './search-filter.component.html',
|
||||||
animations: Anim
|
animations: Anim
|
||||||
})
|
})
|
||||||
export class SearchFilterComponent implements OnInit, AfterContentInit {
|
export class SearchFilterComponent implements OnInit {
|
||||||
|
|
||||||
startHostIp: string;
|
|
||||||
endHostIp: string;
|
|
||||||
|
|
||||||
services: Service[] = [];
|
services: Service[] = [];
|
||||||
|
searchWord: string;
|
||||||
|
|
||||||
|
@Output() search = new EventEmitter<string>();
|
||||||
|
@Output() serviceSelect = new EventEmitter<Service[]>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
|
@ -24,11 +27,11 @@ export class SearchFilterComponent implements OnInit, AfterContentInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
onSearch(e) {
|
||||||
}
|
if (e.code !== 'Enter') {
|
||||||
|
return;
|
||||||
onInputIP(event, idx) {
|
}
|
||||||
|
this.search.emit(this.searchWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
addService(service: Service) {
|
addService(service: Service) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<div>
|
<div>
|
||||||
<button pButton type="button" label="TestHost" (click)="tempHost()"></button>
|
<button pButton type="button" label="TestHost" (click)="tempHost()"></button>
|
||||||
<button pButton type="button" label="TestService" (click)="tempService()"></button>
|
<button pButton type="button" label="TestService" (click)="tempService()"></button>
|
||||||
|
<button pButton type="button" label="tempPort" (click)="tempPort()"></button>
|
||||||
|
|
||||||
<p-tree [value]="zoneNode" layout="vertical">
|
<p-tree [value]="zoneNode" layout="vertical">
|
||||||
|
|
||||||
|
@ -15,8 +16,10 @@
|
||||||
<!-- HOST node template -->
|
<!-- HOST node template -->
|
||||||
<ng-template let-node pTemplate="HOST">
|
<ng-template let-node pTemplate="HOST">
|
||||||
<div @discoveryResultAnim>
|
<div @discoveryResultAnim>
|
||||||
<p-toggleButton onLabel="{{node.label}}" offLabel="{{node.label}}" onIcon="fa-check" offIcon="fa-square" [style]="{'width':'150px'}"
|
<div>
|
||||||
(onChange)="onTargetSelect($event, node.data)"></p-toggleButton>
|
<p-toggleButton onLabel="{{node.label}} {{node.data.openPorts.length}}" offLabel="{{node.label}} {{node.data.openPorts.length}}"
|
||||||
|
onIcon="fa-check" offIcon="fa-square" [style]="{'width':'200px'}" (onChange)="onTargetSelect($event, node.data)"></p-toggleButton>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@ import { ProbeHost } from '@overflow/commons-typescript/model/probe';
|
||||||
export class SearchResultComponent implements OnInit {
|
export class SearchResultComponent implements OnInit {
|
||||||
|
|
||||||
@Input() probeHost: ProbeHost;
|
@Input() probeHost: ProbeHost;
|
||||||
|
@Input() filterWord: string;
|
||||||
|
@Input() filterServices: Service[];
|
||||||
|
|
||||||
@Output() stop = new EventEmitter();
|
@Output() stop = new EventEmitter();
|
||||||
@Input() started: boolean; // Temporary
|
@Input() started: boolean; // Temporary
|
||||||
|
|
||||||
|
@ -51,7 +54,21 @@ export class SearchResultComponent implements OnInit {
|
||||||
id: this.tempHostId++,
|
id: this.tempHostId++,
|
||||||
ipv4: '192.168.1.' + idx,
|
ipv4: '192.168.1.' + idx,
|
||||||
};
|
};
|
||||||
this.addHostNode(host);
|
this.addHost(host);
|
||||||
|
}
|
||||||
|
|
||||||
|
tempPort() {
|
||||||
|
const idx = Math.floor(Math.random() * (5000));
|
||||||
|
const hostId = Math.floor(Math.random() * (this.tempHostId - 1));
|
||||||
|
const port: Port = {
|
||||||
|
id: idx,
|
||||||
|
portNumber: idx,
|
||||||
|
portType: idx % 2 === 0 ? 'TCP' : 'UDP',
|
||||||
|
host: {
|
||||||
|
id: hostId
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.addPort(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
tempService() {
|
tempService() {
|
||||||
|
@ -68,10 +85,10 @@ export class SearchResultComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.addServiceNode(service);
|
this.addService(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
addHostNode(host: Host) {
|
addHost(host: Host) {
|
||||||
const idx = this.findHostIndex(host);
|
const idx = this.findHostIndex(host);
|
||||||
this.hostNode.splice(idx, 0, {
|
this.hostNode.splice(idx, 0, {
|
||||||
type: 'HOST',
|
type: 'HOST',
|
||||||
|
@ -79,12 +96,13 @@ export class SearchResultComponent implements OnInit {
|
||||||
data: {
|
data: {
|
||||||
id: host.id,
|
id: host.id,
|
||||||
ip: this.convertIPtoNumber(host.ipv4),
|
ip: this.convertIPtoNumber(host.ipv4),
|
||||||
|
openPorts: []
|
||||||
},
|
},
|
||||||
expanded: true,
|
expanded: true,
|
||||||
children: []
|
children: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addServiceNode(service: Service) {
|
addService(service: Service) {
|
||||||
const targetHostNode = this.findHostNodeByService(service);
|
const targetHostNode = this.findHostNodeByService(service);
|
||||||
const idx = this.findServiceIndex(targetHostNode.children, service);
|
const idx = this.findServiceIndex(targetHostNode.children, service);
|
||||||
targetHostNode.children[idx] = {
|
targetHostNode.children[idx] = {
|
||||||
|
@ -97,7 +115,14 @@ export class SearchResultComponent implements OnInit {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
addPort(port: Port) {
|
||||||
|
this.hostNode.forEach(node => {
|
||||||
|
if (node.data.id === port.host.id ) {
|
||||||
|
node.data.openPorts.push(port);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onTargetSelect(e, data) {
|
onTargetSelect(e, data) {
|
||||||
if (e.checked) {
|
if (e.checked) {
|
||||||
|
@ -148,4 +173,8 @@ export class SearchResultComponent implements OnInit {
|
||||||
return prev + curr;
|
return prev + curr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkFilter(label: string) {
|
||||||
|
return label.indexOf(this.filterWord) > 0 ? true : false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
restBaseURL: 'http://192.168.1.101:19080/webapp',
|
restBaseURL: 'http://192.168.1.101:19080/webapp',
|
||||||
webappRPCConfig: {
|
webappRPCConfig: {
|
||||||
url: 'ws://192.168.1.101:19090/webapp',
|
url: 'ws://192.168.1.103:19090/webapp',
|
||||||
reconnectInterval: 5000,
|
reconnectInterval: 5000,
|
||||||
reconnectRetry: 10,
|
reconnectRetry: 10,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user