discovery
This commit is contained in:
parent
50ea7ecacb
commit
ef9e3d7d78
35
@overflow/discovery/component/discovery/animation.ts
Normal file
35
@overflow/discovery/component/discovery/animation.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { trigger, state, transition, style, animate, query, stagger, keyframes } from '@angular/animations';
|
||||||
|
|
||||||
|
export const Anim = [
|
||||||
|
trigger('discoveryFilterAnim', [
|
||||||
|
transition('void => *', [
|
||||||
|
query('*', style({ opacity: 0 }), { optional: true }),
|
||||||
|
query('*', stagger('3ms', [
|
||||||
|
animate('0.08s ease-in', keyframes([
|
||||||
|
style({ opacity: 0, transform: 'translateY(-75%)', offset: 0 }),
|
||||||
|
style({ opacity: .5, transform: 'translateY(35px)', offset: 0.3 }),
|
||||||
|
style({ opacity: 1, transform: 'translateY(0)', offset: 1.0 }),
|
||||||
|
]))]), { optional: true }),
|
||||||
|
]),
|
||||||
|
// transition('* => void', [
|
||||||
|
// query('*', style({ opacity: 1 }), { optional: true }),
|
||||||
|
// query('*', stagger('5ms', [
|
||||||
|
// animate('0.08s ease-in', keyframes([
|
||||||
|
// style({ opacity: 1, transform: 'translateY(0)', offset: 0 }),
|
||||||
|
// style({ opacity: .5, transform: 'translateY(35px)', offset: 0.3 }),
|
||||||
|
// style({ opacity: 0, transform: 'translateY(-75%)', offset: 1.0 }),
|
||||||
|
// ]))]), { optional: true }),
|
||||||
|
// ])
|
||||||
|
]),
|
||||||
|
trigger('discoveryResultAnim', [
|
||||||
|
transition('void => *', [
|
||||||
|
query('*', style({ opacity: 0 }), { optional: true }),
|
||||||
|
query('*', stagger('300ms', [
|
||||||
|
animate('0.08s ease-in', keyframes([
|
||||||
|
style({ opacity: 0, transform: 'translateY(-75%)', offset: 0 }),
|
||||||
|
style({ opacity: .5, transform: 'translateY(35px)', offset: 0.3 }),
|
||||||
|
style({ opacity: 1, transform: 'translateY(0)', offset: 1.0 }),
|
||||||
|
]))]), { optional: true }),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
];
|
|
@ -1,9 +1,10 @@
|
||||||
<div class="ui-g">
|
<div class="ui-g">
|
||||||
<div class="ui-g-12 ui-md-3">
|
<div class="ui-g-12 ui-md-3">
|
||||||
<p-accordion [multiple]="true">
|
<p-accordion [multiple]="true">
|
||||||
<p-accordionTab header="Discovery Settings" [selected]="selectedProbe">
|
<p-accordionTab header="Discovery Settings" [selected]="true">
|
||||||
<of-probe-summary *ngIf="requested" [probeHost]="selectedProbe"></of-probe-summary>
|
<span *ngIf="!selectedProbe">Choose a Probe to perform Discovery.</span>
|
||||||
<of-discovery-search-config *ngIf="!requested && selectedProbe" [probeHost]="selectedProbe" (requestDiscovery)="onRequestDiscovery($event)"></of-discovery-search-config>
|
<of-probe-summary *ngIf="requested" @discoveryFilterAnim [probeHost]="selectedProbe"></of-probe-summary>
|
||||||
|
<of-discovery-search-config *ngIf="!requested && selectedProbe" @discoveryFilterAnim [probeHost]="selectedProbe" (requestDiscovery)="onRequestDiscovery($event)"></of-discovery-search-config>
|
||||||
</p-accordionTab>
|
</p-accordionTab>
|
||||||
<p-accordionTab header="Filter" [selected]="requested" [disabled]="!requested">
|
<p-accordionTab header="Filter" [selected]="requested" [disabled]="!requested">
|
||||||
<of-discovery-search-filter></of-discovery-search-filter>
|
<of-discovery-search-filter></of-discovery-search-filter>
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
|
|
||||||
<div class="ui-g-12 ui-md-9" >
|
<div class="ui-g-12 ui-md-9" >
|
||||||
<p-panel>
|
<p-panel>
|
||||||
<of-discovery-result-container (stop)="onStop($event)"></of-discovery-result-container>
|
<of-discovery-result [started]="requested" (stop)="onStop($event)"></of-discovery-result>
|
||||||
</p-panel>
|
</p-panel>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -3,16 +3,18 @@ import {
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
|
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe';
|
||||||
import { DiscoverZone } from '@overflow/commons-typescript/model/discovery';
|
import { DiscoverZone } from '@overflow/commons-typescript/model/discovery';
|
||||||
|
import { Anim } from './animation';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-discovery',
|
selector: 'of-discovery',
|
||||||
templateUrl: './discovery.component.html',
|
templateUrl: './discovery.component.html',
|
||||||
|
animations: Anim
|
||||||
})
|
})
|
||||||
export class DiscoveryComponent {
|
export class DiscoveryComponent {
|
||||||
|
|
||||||
@Input() selectedProbe: ProbeHost;
|
@Input() selectedProbe: ProbeHost;
|
||||||
@Output() requestDiscovery = new EventEmitter<DiscoverZone>();
|
@Output() requestDiscovery = new EventEmitter<DiscoverZone>();
|
||||||
@Output() stop = new EventEmitter<DiscoverZone>();
|
@Output() requestStop = new EventEmitter();
|
||||||
|
|
||||||
requested: boolean;
|
requested: boolean;
|
||||||
|
|
||||||
|
@ -27,6 +29,6 @@ export class DiscoveryComponent {
|
||||||
|
|
||||||
onStop() {
|
onStop() {
|
||||||
this.requested = false;
|
this.requested = false;
|
||||||
this.stop.emit();
|
this.requestStop.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<of-ip-input [hostIp]="endIP" (inputIp)="onInputIP($event, 1)" [title]="'To'" [fixed]="fixedIPrange"></of-ip-input>
|
<of-ip-input [hostIp]="endIP" (inputIp)="onInputIP($event, 1)" [title]="'To'" [fixed]="fixedIPrange"></of-ip-input>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<p-multiSelect (onFocus)="onIPExcludeFocus()" [options]="ipArray" optionLabel="ip" [(ngModel)]="excludeIPs"
|
||||||
|
[panelStyle]="{minWidth:'12em'}" selectedItemsLabel="{0} hosts are excluded." maxSelectedLabels="2" defaultLabel="Add exclude IP"></p-multiSelect>
|
||||||
|
</div>
|
||||||
<div *ngIf="ipErrMsg" class="ui-message ui-messages-error ui-corner-all">
|
<div *ngIf="ipErrMsg" class="ui-message ui-messages-error ui-corner-all">
|
||||||
{{ipErrMsg}}
|
{{ipErrMsg}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,6 +66,9 @@
|
||||||
(keyup)="onInputPort(endPort.value, 1)">
|
(keyup)="onInputPort(endPort.value, 1)">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<a style="cursor: pointer" (click)="displayPortExclude = true">Add Exclude Ports</a>
|
||||||
|
</div>
|
||||||
<div *ngIf="portErrMsg" class="ui-message ui-messages-error ui-corner-all">
|
<div *ngIf="portErrMsg" class="ui-message ui-messages-error ui-corner-all">
|
||||||
{{portErrMsg}}
|
{{portErrMsg}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,6 +24,8 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
endIP: string;
|
endIP: string;
|
||||||
startPort: string;
|
startPort: string;
|
||||||
endPort: string;
|
endPort: string;
|
||||||
|
excludeIPs = [];
|
||||||
|
excludePorts = [];
|
||||||
includeServices = [];
|
includeServices = [];
|
||||||
|
|
||||||
hostChecked = true;
|
hostChecked = true;
|
||||||
|
@ -37,6 +39,7 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
portErrMsg: string;
|
portErrMsg: string;
|
||||||
|
|
||||||
fixedIPrange: number;
|
fixedIPrange: number;
|
||||||
|
ipArray = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
|
@ -55,8 +58,8 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.ipVer = 'v4';
|
this.ipVer = 'v4';
|
||||||
this.startIP = cidr.addressStart.address;
|
this.startIP = cidr.start();
|
||||||
this.endIP = cidr.addressEnd.address;
|
this.endIP = cidr.end();
|
||||||
this.startPort = '1';
|
this.startPort = '1';
|
||||||
this.endPort = '1024';
|
this.endPort = '1024';
|
||||||
// TODO: Initialize services
|
// TODO: Initialize services
|
||||||
|
@ -64,6 +67,33 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
this.checkEditableIPrange(cidr);
|
this.checkEditableIPrange(cidr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onIPExcludeFocus() {
|
||||||
|
const cidr = new CIDR(this.probeHost.probe.cidr);
|
||||||
|
this.ipArray = cidr.toArray().filter((value) => {
|
||||||
|
return this.inRange(value) || this.excludeIPs.find(obj => obj.ip === value);
|
||||||
|
}).map(value => {
|
||||||
|
return { ip: value };
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inRange(value) {
|
||||||
|
const min = this.startIP;
|
||||||
|
const max = this.endIP;
|
||||||
|
if (this.ipToNum(min) <= this.ipToNum(value) && this.ipToNum(max) >= this.ipToNum(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ipToNum(ip) {
|
||||||
|
return Number(
|
||||||
|
ip.split('.')
|
||||||
|
.map(d => ('000' + d).substr(-3))
|
||||||
|
.join('')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onRequestDiscovery() {
|
onRequestDiscovery() {
|
||||||
let discoverPort: DiscoverPort = null;
|
let discoverPort: DiscoverPort = null;
|
||||||
let discoverService: DiscoverService = null;
|
let discoverService: DiscoverService = null;
|
||||||
|
@ -171,14 +201,14 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
isValidIPregex(ip: string): boolean {
|
isValidIPregex(ip: string): boolean {
|
||||||
if (this.ipVer === 'ipv4') {
|
if (this.ipVer === 'v4') {
|
||||||
return /^(?=\d+\.\d+\.\d+\.\d+$)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.?){4}$/.test(ip);
|
return /^(?=\d+\.\d+\.\d+\.\d+$)(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\.?){4}$/.test(ip);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sortIP(ipAddressArray) {
|
sortIP(ipAddressArray) {
|
||||||
return ipAddressArray.sort(function (a, b) {
|
return ipAddressArray.sort((a, b) => {
|
||||||
a = a.split('.');
|
a = a.split('.');
|
||||||
b = b.split('.');
|
b = b.split('.');
|
||||||
for (let i = 0; i < a.length; i++) {
|
for (let i = 0; i < a.length; i++) {
|
||||||
|
@ -218,4 +248,12 @@ export class SearchConfigComponent implements OnChanges {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onSaveIPExclude() {
|
||||||
|
|
||||||
|
}
|
||||||
|
onSavePortExclude() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<of-ip-input [hostIp]="endHostIp" (inputIp)="onInputIP($event, 1)" [title]="'End'"></of-ip-input>
|
<of-ip-input [hostIp]="endHostIp" (inputIp)="onInputIP($event, 1)" [title]="'End'"></of-ip-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g">
|
<div class="ui-g" @discoveryFilterAnim>
|
||||||
<p-toggleButton offLabel="Oracle" onLabel="Oracle" [(ngModel)]="Oracle" [style]="{'width':'150px'}" ></p-toggleButton>
|
<p-toggleButton offLabel="Oracle" onLabel="Oracle" [(ngModel)]="Oracle" [style]="{'width':'150px'}" ></p-toggleButton>
|
||||||
<p-toggleButton offLabel="MYSQL" onLabel="MYSQL" [(ngModel)]="MYSQL" [style]="{'width':'150px'}"></p-toggleButton>
|
<p-toggleButton offLabel="MYSQL" onLabel="MYSQL" [(ngModel)]="MYSQL" [style]="{'width':'150px'}"></p-toggleButton>
|
||||||
<p-toggleButton offLabel="Tomcat" onLabel="Tomcat" [(ngModel)]="Tomcat" [style]="{'width':'150px'}"></p-toggleButton>
|
<p-toggleButton offLabel="Tomcat" onLabel="Tomcat" [(ngModel)]="Tomcat" [style]="{'width':'150px'}"></p-toggleButton>
|
||||||
|
|
|
@ -2,10 +2,12 @@ import {
|
||||||
AfterContentInit, Component,
|
AfterContentInit, Component,
|
||||||
OnInit
|
OnInit
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { Anim } from './animation';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-discovery-search-filter',
|
selector: 'of-discovery-search-filter',
|
||||||
templateUrl: './search-filter.component.html',
|
templateUrl: './search-filter.component.html',
|
||||||
|
animations: Anim
|
||||||
})
|
})
|
||||||
export class SearchFilterComponent implements OnInit, AfterContentInit {
|
export class SearchFilterComponent implements OnInit, AfterContentInit {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<div class="ui-g">
|
<div class="ui-g">
|
||||||
<p-button label="Stop" (click)="stop.emit()"></p-button>
|
<p-button label="Stop" (click)="onStop()"></p-button>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<div *ngFor="let data of tempData" class="ui-g-12 ui-md-12" @discoveryResultAnim>
|
||||||
|
<p-button label="TEST" icon="fa fa-check" iconPos="left"></p-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -1,19 +1,44 @@
|
||||||
import {
|
import {
|
||||||
AfterContentInit, Component, Input,
|
AfterContentInit, Component, Input,
|
||||||
OnInit,
|
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
Output
|
Output,
|
||||||
|
OnChanges,
|
||||||
|
SimpleChanges
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import { Anim } from './animation';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-discovery-result',
|
selector: 'of-discovery-result',
|
||||||
templateUrl: './search-result.component.html',
|
templateUrl: './search-result.component.html',
|
||||||
|
animations: Anim
|
||||||
})
|
})
|
||||||
export class SearchResultComponent {
|
export class SearchResultComponent implements OnChanges {
|
||||||
|
|
||||||
@Output() stop = new EventEmitter();
|
@Output() stop = new EventEmitter();
|
||||||
|
@Input() started: boolean;
|
||||||
|
|
||||||
|
tempData = [];
|
||||||
|
tempTimer;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
|
if (changes['started'] && changes['started'].currentValue) {
|
||||||
|
this.tempTimer = setInterval(() => { this.tempFunc(); }, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onStop() {
|
||||||
|
this.stop.emit();
|
||||||
|
clearInterval(this.tempTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
tempFunc() {
|
||||||
|
this.tempData.push({
|
||||||
|
name: 'aaa'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ export const COMPONENTS = [
|
||||||
SearchConfigComponent,
|
SearchConfigComponent,
|
||||||
SearchFilterComponent,
|
SearchFilterComponent,
|
||||||
SearchResultComponent,
|
SearchResultComponent,
|
||||||
IpInputComponent
|
IpInputComponent,
|
||||||
];
|
];
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<of-discovery-result></of-discovery-result>
|
|
|
@ -1,15 +0,0 @@
|
||||||
import {
|
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
} from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'of-discovery-result-container',
|
|
||||||
templateUrl: './discovery-result-container.component.html',
|
|
||||||
})
|
|
||||||
export class DiscoveryResultContainerComponent {
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +1,3 @@
|
||||||
<of-probe-selector-container [probeHostID]="probeHostID" (select)="onProbeSelect($event)"></of-probe-selector-container>
|
<of-probe-selector-container [probeHostID]="probeHostID" (select)="onProbeSelect($event)"></of-probe-selector-container>
|
||||||
<of-discovery [selectedProbe]="selectedProbe" (requestDiscovery)="onRequestDiscovery($event)"></of-discovery>
|
<of-discovery [selectedProbe]="selectedProbe" (requestDiscovery)="onRequestDiscovery($event)"
|
||||||
|
(requestStop)="onRequestStop($event)"></of-discovery>
|
|
@ -27,4 +27,8 @@ export class DiscoveryContainerComponent {
|
||||||
// this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
|
// this.discoverStore.dispatch(new DiscoverStore.DiscoverZone(
|
||||||
// { probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
|
// { probeID: this.selectedProbe.probeKey, discoverZone: discoverZone }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onRequestStop() {
|
||||||
|
console.log('onRequestStop');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import {DiscoveryContainerComponent} from './discovery/discovery-container.component';
|
import {DiscoveryContainerComponent} from './discovery/discovery-container.component';
|
||||||
import { DiscoveryResultContainerComponent } from './discovery-result/discovery-result-container.component';
|
|
||||||
|
|
||||||
export const CONTAINER_COMPONENTS = [
|
export const CONTAINER_COMPONENTS = [
|
||||||
DiscoveryContainerComponent,
|
DiscoveryContainerComponent,
|
||||||
DiscoveryResultContainerComponent
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div *ngIf="probeHost else info">
|
<div *ngIf="probeHost">
|
||||||
<of-key-value [key]="'CIDR'" [value]="probeHost.probe.cidr"></of-key-value>
|
<of-key-value [key]="'CIDR'" [value]="probeHost.probe.cidr"></of-key-value>
|
||||||
<of-key-value [key]="'Description'" [value]="probeHost.probe.description"></of-key-value>
|
<of-key-value [key]="'Description'" [value]="probeHost.probe.description"></of-key-value>
|
||||||
<of-key-value [key]="'Key'" [value]="probeHost.probe.probeKey"></of-key-value>
|
<of-key-value [key]="'Key'" [value]="probeHost.probe.probeKey"></of-key-value>
|
||||||
|
@ -9,7 +9,3 @@
|
||||||
<of-key-value [key]="'Mac Address'" [value]="probeHost.host.mac"></of-key-value>
|
<of-key-value [key]="'Mac Address'" [value]="probeHost.host.mac"></of-key-value>
|
||||||
<of-key-value [key]="'OS'" [value]="probeHost.host.os.vendor.name"></of-key-value>
|
<of-key-value [key]="'OS'" [value]="probeHost.host.os.vendor.name"></of-key-value>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-template #info>
|
|
||||||
Choose a Probe to perform Network Discovery.
|
|
||||||
</ng-template>
|
|
3654
package-lock.json
generated
3654
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -42,11 +42,12 @@
|
||||||
"angular-l10n": "^5.0.0",
|
"angular-l10n": "^5.0.0",
|
||||||
"angularx-qrcode": "^1.1.7",
|
"angularx-qrcode": "^1.1.7",
|
||||||
"chart.js": "^2.7.2",
|
"chart.js": "^2.7.2",
|
||||||
"ip-cidr": "^2.0.0",
|
|
||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
|
"ip-cidr": "^2.0.0",
|
||||||
"ip-range-check": "0.0.2",
|
"ip-range-check": "0.0.2",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
"ngx-cookie-service": "^1.0.10",
|
"ngx-cookie-service": "^1.0.10",
|
||||||
|
"node-cidr": "^1.0.0",
|
||||||
"openssl": "^1.1.0",
|
"openssl": "^1.1.0",
|
||||||
"primeng": "^5.2.4",
|
"primeng": "^5.2.4",
|
||||||
"reflect-metadata": "^0.1.12",
|
"reflect-metadata": "^0.1.12",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user