add inframap
This commit is contained in:
parent
a35945e010
commit
aacd439d04
|
@ -52,8 +52,8 @@
|
|||
|
||||
</div>
|
||||
<p-footer>
|
||||
<button pButton type="button" label="Save" icon="fa-check"></button>
|
||||
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary"></button>
|
||||
<!-- <button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary" (click)="display=false"></button> -->
|
||||
<button pButton type="button" label="Start" icon="fa-check" (click)="discovery()"></button>
|
||||
</p-footer>
|
||||
</p-card>
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
|||
</div>
|
||||
<p-footer>
|
||||
<button pButton type="button" label="Save" icon="fa-check"></button>
|
||||
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary"></button>
|
||||
<!-- <button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary"></button> -->
|
||||
</p-footer>
|
||||
</p-card>
|
||||
|
||||
|
|
|
@ -102,39 +102,39 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
|
||||
this.treeNodes = this.convertViewHost(this.testObj);
|
||||
|
||||
this.settingSucceed$.subscribe(
|
||||
(succeed: boolean) => {
|
||||
if (succeed) {
|
||||
this.started = true;
|
||||
}
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error.response.message);
|
||||
}
|
||||
);
|
||||
// this.settingSucceed$.subscribe(
|
||||
// (succeed: boolean) => {
|
||||
// if (succeed) {
|
||||
// this.started = true;
|
||||
// }
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error.response.message);
|
||||
// }
|
||||
// );
|
||||
|
||||
this.probe$.subscribe(
|
||||
(probe: Probe) => {
|
||||
if (probe != null) {
|
||||
this.probe = probe;
|
||||
}
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error.response.message);
|
||||
}
|
||||
);
|
||||
// this.probe$.subscribe(
|
||||
// (probe: Probe) => {
|
||||
// if (probe != null) {
|
||||
// this.probe = probe;
|
||||
// }
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error.response.message);
|
||||
// }
|
||||
// );
|
||||
|
||||
this.discoveryResult$.subscribe(
|
||||
(zones: Map<string, Zone>) => {
|
||||
console.log('ZoneZoneZoneZoneZoneZoneZone');
|
||||
// console.log(JSON.stringify(zones));
|
||||
this.convertTreeViewZone(zones);
|
||||
this.zones = zones;
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error.response.message);
|
||||
}
|
||||
);
|
||||
// this.discoveryResult$.subscribe(
|
||||
// (zones: Map<string, Zone>) => {
|
||||
// console.log('ZoneZoneZoneZoneZoneZoneZone');
|
||||
// // console.log(JSON.stringify(zones));
|
||||
// this.convertTreeViewZone(zones);
|
||||
// this.zones = zones;
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error.response.message);
|
||||
// }
|
||||
// );
|
||||
|
||||
}
|
||||
|
||||
|
@ -190,41 +190,41 @@ export class SettingComponent implements OnInit, AfterContentInit {
|
|||
}
|
||||
|
||||
discovery() {
|
||||
let discoveryPort: DiscoveryPort = null;
|
||||
let discoveryService: DiscoveryService = null;
|
||||
// let discoveryPort: DiscoveryPort = null;
|
||||
// let discoveryService: DiscoveryService = null;
|
||||
|
||||
if (this.serviceChecked) {
|
||||
const services = new Array();
|
||||
for (const service of this.includeServices) {
|
||||
services.push(service.name);
|
||||
}
|
||||
discoveryService = {
|
||||
includeServices: services,
|
||||
};
|
||||
}
|
||||
if (this.portChecked) {
|
||||
discoveryPort = {
|
||||
firstScanRange: this.startPort,
|
||||
lastScanRange: this.endPort,
|
||||
includeTCP: this.tcpChecked,
|
||||
includeUDP: this.udpChecked,
|
||||
excludePorts: null,
|
||||
discoveryService: discoveryService
|
||||
};
|
||||
}
|
||||
const discoveryZone: DiscoveryZone = {
|
||||
discoveryHost: {
|
||||
firstScanRange: this.startIP,
|
||||
lastScanRange: this.endIP,
|
||||
discoveryPort: discoveryPort,
|
||||
},
|
||||
};
|
||||
// if (this.serviceChecked) {
|
||||
// const services = new Array();
|
||||
// for (const service of this.includeServices) {
|
||||
// services.push(service.name);
|
||||
// }
|
||||
// discoveryService = {
|
||||
// includeServices: services,
|
||||
// };
|
||||
// }
|
||||
// if (this.portChecked) {
|
||||
// discoveryPort = {
|
||||
// firstScanRange: this.startPort,
|
||||
// lastScanRange: this.endPort,
|
||||
// includeTCP: this.tcpChecked,
|
||||
// includeUDP: this.udpChecked,
|
||||
// excludePorts: null,
|
||||
// discoveryService: discoveryService
|
||||
// };
|
||||
// }
|
||||
// const discoveryZone: DiscoveryZone = {
|
||||
// discoveryHost: {
|
||||
// firstScanRange: this.startIP,
|
||||
// lastScanRange: this.endIP,
|
||||
// discoveryPort: discoveryPort,
|
||||
// },
|
||||
// };
|
||||
|
||||
console.log(discoveryZone);
|
||||
// console.log(discoveryZone);
|
||||
|
||||
console.log('start discovery - ' + this.probe.probeKey);
|
||||
this.discoverstore.dispatch(new DiscoverStore.DiscoverZone(
|
||||
{ probeID: this.probe.probeKey, discoveryZone: discoveryZone }));
|
||||
// console.log('start discovery - ' + this.probe.probeKey);
|
||||
// this.discoverstore.dispatch(new DiscoverStore.DiscoverZone(
|
||||
// { probeID: this.probe.probeKey, discoveryZone: discoveryZone }));
|
||||
|
||||
this.started = true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,38 @@
|
|||
<div>map</div>
|
||||
|
||||
|
||||
|
||||
<p-dialog header="Discovery" [width]="700" [(visible)]="display">
|
||||
<of-discovery-setting></of-discovery-setting>
|
||||
</p-dialog>
|
||||
|
||||
<button type="text" (click)="showDialog()" pButton icon="fa-external-link-square" label="Show"></button>
|
||||
|
||||
|
||||
<p-tree [value]="infraTree" [style]="{width: '360px'}" selectionMode="single" [(selection)]="selectedTree" ></p-tree>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <div fxLayoutAlign="end" [style.margin]="'10px 10px'">
|
||||
<form class="form">
|
||||
<mat-form-field class="full-width">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Component, OnInit, AfterViewInit, AfterContentInit, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { TreeNode } from 'primeng/primeng';
|
||||
|
||||
@Component({
|
||||
selector: 'of-infra-map',
|
||||
|
@ -7,6 +8,10 @@ import { Router } from '@angular/router';
|
|||
})
|
||||
export class MapComponent implements OnInit, AfterContentInit {
|
||||
|
||||
infraTree: TreeNode[] = testInfraList;
|
||||
|
||||
display = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
) {
|
||||
|
@ -18,4 +23,155 @@ export class MapComponent implements OnInit, AfterContentInit {
|
|||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
showDialog() {
|
||||
this.display = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const testInfraList = [{
|
||||
label: 'Infra',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Zone - 192.168.1.0/24',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Host - 192.168.1.106 - Snoop Host',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - WMI, SSH, SNMP',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
{
|
||||
label: 'Service - FTP(21)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - FTP, Sensor',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
},
|
||||
{
|
||||
label: 'Host - 192.168.1.103 - Geek Host',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - WMI, SSH, SNMP',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
{
|
||||
label: 'Service - MySQL(3306)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - MySQL, PING',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Service - PostgreSQL(5555)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - PostgreSQL, PING',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
}],
|
||||
},
|
||||
{
|
||||
label: 'Zone - 192.168.10.0/24',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Host - 192.168.10.106 - Snoop Host',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - WMI, SSH, SNMP',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
{
|
||||
label: 'Service - FTP(21)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - FTP, Sensor',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
},
|
||||
{
|
||||
label: 'Host - 192.168.10.103 - Geek Host',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - WMI, SSH, SNMP',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
{
|
||||
label: 'Service - MySQL(3306)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - MySQL, PING',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Service - PostgreSQL(5555)',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
children: [{
|
||||
label: 'Sensors - PostgreSQL, PING',
|
||||
expandedIcon: 'fa-folder-open',
|
||||
collapsedIcon: 'fa-folder',
|
||||
expanded : true,
|
||||
},
|
||||
],
|
||||
}],
|
||||
}],
|
||||
}],
|
||||
}];
|
||||
|
|
|
@ -5,6 +5,8 @@ import { COMPONENTS } from './component';
|
|||
import { SERVICES } from './service';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module';
|
||||
import { DiscoveryModule } from 'packages/discovery/discovery.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -12,6 +14,7 @@ import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module';
|
|||
InfraStoreModule,
|
||||
FormsModule,
|
||||
PrimeNGModules,
|
||||
DiscoveryModule
|
||||
],
|
||||
declarations: [
|
||||
COMPONENTS,
|
||||
|
|
Loading…
Reference in New Issue
Block a user