infra in progress

This commit is contained in:
insanity 2018-06-07 15:07:45 +09:00
parent 531e8dfa0a
commit facedbb13c
24 changed files with 941 additions and 797 deletions

View File

@ -1,13 +1,7 @@
import { InfraMapComponent } from './infra-map.component'; import { InfraMapComponent } from './infra-map.component';
// import { InfraProbeSummaryComponent } from './infra-probe-summary.component'; import { InfraTreeComponent } from './infra-tree.component';
import { InfraHostComponent } from './infra-host.component';
import { InfraHostSummaryComponent } from './infra-host-summary.component';
import { InfraServiceSummaryComponent } from './infra-service-summary.component';
export const COMPONENTS = [ export const COMPONENTS = [
InfraMapComponent, InfraMapComponent,
// InfraProbeSummaryComponent, InfraTreeComponent
InfraHostComponent,
InfraHostSummaryComponent,
InfraServiceSummaryComponent,
]; ];

View File

@ -1,13 +1,9 @@
<!--<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [(visible)]="display" >-->
<!--<of-discovery-setting [visible]="display" (close)="closeDialog()"></of-discovery-setting>-->
<!--</p-dialog>-->
<div class="ui-g"> <div class="ui-g">
<h1>Map</h1> <h1>Map</h1>
<div class="ui-g-12 ui-g-nopad"> <div class="ui-g-12 ui-g-nopad">
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12 ui-md-5 ui-g-nopad ui-bottom-space-10"> <div class="ui-g-12 ui-md-5 ui-g-nopad ui-bottom-space-10">
<button pButton type="button" class="ui-button-large ui-button-width-fit" icon="ui-icon-play-arrow" label="Discovery" (click)="showDialog()"></button> <button pButton type="button" class="ui-button-large ui-button-width-fit" icon="ui-icon-play-arrow" label="Discovery" (click)="onDiscovery()"></button>
</div> </div>
<div class="ui-g-12 ui-md-7 ui-g-nopad"> <div class="ui-g-12 ui-md-7 ui-g-nopad">
<div style="float: right;"> <div style="float: right;">
@ -24,153 +20,14 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="ui-g-12 ui-g-nopad">
<p-tree [value]="infraTree" selectionMode="single" [(selection)]="selectedTree" (onNodeSelect)="onNodeSelect($event)" [contextMenu]="cm"
[pTooltip]="desiredTooltip">
<ng-template let-node pTemplate="default"> <p-tabView (onChange)="onProbeChange($event)" [activeIndex]="probeTabIdx" class="ui-tab-bgcolor">
<div>{{node.label}}</div> <p-tabPanel [header]="item.label" *ngFor="let item of tabs; let i = index" [selected]="i == 0" cache="true">
</ng-template> <ng-template pTemplate="content">
<ng-template let-node pTemplate="infra">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="probe">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="host">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
<!-- <div>{{node.obj.infraType.name}}</div> -->
</div>
</ng-template>
<ng-template let-node pTemplate="service">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="sensor">
<div (contextmenu)="nodeMenu($event, node)">
<div> <div>
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>{{node.label}} <of-infra-tree></of-infra-tree>
</div>
<div>
{{node.obj.itemCount}} SensorItems
</div>
</div> </div>
</ng-template> </ng-template>
</p-tabPanel>
</p-tree> </p-tabView>
</div> </div>
</div>
<p-contextMenu #cmProbe [model]="contextMenuProbe"></p-contextMenu>
<p-contextMenu #cmHost [model]="contextMenuHost"></p-contextMenu>
<p-contextMenu #cmService [model]="contextMenuService"></p-contextMenu>
<p-contextMenu #cmSensor [model]="contextMenuSensor"></p-contextMenu>
<!-- <p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="true" [closeOnEscape]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog> -->
<p-dialog header="Rename Probe" [(visible)]="renameProbeVisible" [modal]="true" [responsive]="true" [width]="350" [minWidth]="200"
[minY]="70">
<span class="md-inputfield">
<input #probeAlias type="text" pInputText placeholder="Enter new alias.">
</span>
<p-footer>
<button type="button" pButton icon="fa-check" (click)="onSaveProbeName(probeAlias.value)" label="Save"></button>
<button type="button" pButton icon="fa-close" (click)="renameProbeVisible=false" label="Cancel"></button>
</p-footer>
</p-dialog>
<!-- <div fxLayoutAlign="end" [style.margin]="'10px 10px'">
<form class="form">
<mat-form-field class="full-width">
<input matInput placeholder="Search" [(ngModel)]="searchWord" (ngModelChange)="handleSearch($event)" [ngModelOptions]="{standalone: true}">
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
</form>
</div>
<div fxLayoutAlign="end" [style.margin]="'10px 10px'">
** probe가 설치된 host와 그 probe가 가장 상위에 나와야 함 **
<div class="box up"></div>Up
<div class="box down"></div>Down
<div class="box warn"></div>Warn
<div class="box error"></div>Error
</div>
<div *ngIf="loading" fxLayoutAlign="center">
<mat-spinner></mat-spinner>
</div>
<div *ngIf="!loading" class="search-result" infinite-scroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false">
<div class="infra-list mat-elevation-z4 " *ngFor="let infra of hostDataList">
<mat-toolbar>
<mat-toolbar-row>
<span matTooltip="showHostInfo(infra)">IP : {{infra.host.ip}}</span>
<span class="pull-right"></span>
<span style="margin-right: 20px">
</span>
<button mat-raised-button color="primary" fxLayoutAlign="end" (click)="addSensor(infra)">Add Sensor</button>
</mat-toolbar-row>
</mat-toolbar>
<mat-card-content *ngFor="let service of infra.services">
<mat-grid-list cols="6" rowHeight="9:1">
<mat-grid-tile [rowspan]="2" style="background-color: lightcoral">
{{service.vendor.name}}
</mat-grid-tile>
<mat-grid-tile [colspan]="3" style="background-color: lightblue">
<div class="grid-left-align">
Port : {{service.port}} | {{service.portType}} {{service.tlsType ? '| TLS' : ''}}
</div>
</mat-grid-tile>
<mat-grid-tile [rowspan]="2" style="background-color: lightgray">
<span class="pull-right"></span>
<button mat-button fxLayoutAlign="end" (click)="addSensor(infra)">Add Sensor</button>
</mat-grid-tile>
<mat-grid-tile [colspan]="3" style="background-color: lightgreen">
<div class="grid-left-align">
</div>
</mat-grid-tile>
</mat-grid-list>
</mat-card-content>
</div>
</div> -->

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfraMapComponent } from './infra-map.component';
describe('InfraMapComponent', () => {
let component: InfraMapComponent;
let fixture: ComponentFixture<InfraMapComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [InfraMapComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfraMapComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,630 +1,116 @@
import { import {
Component, Component, OnInit, EventEmitter, Output, Input, OnChanges, SimpleChanges,
OnInit,
AfterContentInit,
ViewChild
} from '@angular/core'; } from '@angular/core';
import { ProbeHostService } from '@overflow/probe/service/probe-host.service';
import { Observable, of, Subscription } from 'rxjs'; import { Store, select } from '@ngrx/store';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators'; import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators';
import { TreeNode, MenuItem, ContextMenu } from 'primeng/primeng';
import { Target } from '@overflow/commons-typescript/model/target';
import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain';
import { AuthSelector } from '@overflow/shared/auth/store'; import { AuthSelector } from '@overflow/shared/auth/store';
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { Observable, Subscription, of } from 'rxjs';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { MenuItem } from 'primeng/primeng';
import { InfraService } from '../service/infra.service';
import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
import { Page } from '@overflow/commons-typescript/model/commons/Page';
import { Infra } from '@overflow/commons-typescript/model/infra';
import { Sensor } from '@overflow/commons-typescript/model/sensor';
import { Router } from '@angular/router';
interface HostData {
id: string;
target?: Target;
host: InfraHost;
services: InfraService[];
}
@Component({ @Component({
selector: 'of-infra-map', selector: 'of-infra-map',
templateUrl: './infra-map.component.html' templateUrl: './infra-map.component.html',
providers: [
ProbeHostService
]
}) })
export class InfraMapComponent implements OnInit, AfterContentInit { export class InfraMapComponent implements OnInit {
infras$: Observable<Infra>;
infras: Infra[];
pending$: Observable<boolean>; pending$: Observable<boolean>;
error$: Observable<any>; error$: Observable<any>;
infraTree: TreeNode[] = []; tabs: MenuItem[];
probeHosts: ProbeHost[];
display = false; probeTabIdx: number;
loading = false;
renameProbeVisible = false;
totalList: Infra[];
hostDataList: HostData[] = new Array();
sensorMap: Map<number, Array<Sensor>> = new Map();
targetTreeMap: Map<number, TreeNode> = new Map();
DEFAULT_EXPANDED: Boolean = true;
contextMenuProbe: MenuItem[];
contextMenuHost: MenuItem[];
contextMenuService: MenuItem[];
contextMenuSensor: MenuItem[];
@ViewChild('cmProbe') cmProbe: ContextMenu;
@ViewChild('cmHost') cmHost: ContextMenu;
@ViewChild('cmService') cmService: ContextMenu;
@ViewChild('cmSensor') cmSensor: ContextMenu;
selectedNode: TreeNode = null;
sensorSettingDisplay = false;
target: Target = null;
constructor( constructor(
private router: Router private store: Store<any>,
// private infraService: InfraService, private probeHostService: ProbeHostService,
private infraService: InfraService,
) { ) {
}
ngOnInit() {
this.initContextMenu();
} }
ngAfterContentInit() { ngOnInit(): void {
this.getProbes();
} }
getProbes() {
initContextMenu() { this.store.pipe(
this.contextMenuProbe = [ tap(() => {
{ label: 'Probe Menu', command: (event) => this.closeContextMenu() }, this.pending$ = of(true);
{ label: 'View this Probe', icon: 'fa-plus', command: (event) => this.viewInfo() }, }),
{ label: 'Discovery', icon: 'fa-plus', command: (event) => this.discovery() }, select(AuthSelector.selectDomainMember),
{ label: 'Edit Alias', icon: 'fa-plus', command: (event) => this.editProbeAlias() }, exhaustMap((domainMember: DomainMember) =>
]; this.probeHostService.readAllByDomainID(domainMember.domain.id)
this.contextMenuHost = [ .pipe(
{ label: 'Host Menu', command: (event) => this.closeContextMenu() }, map((probeHosts: ProbeHost[]) => {
{ label: 'View this Host', icon: 'fa-plus', command: (event) => this.viewInfo() }, this.probeHosts = probeHosts;
{ label: 'Add sensor', icon: 'fa-plus', command: (event) => this.addSensorWithTarget() }, this.generateTabs();
{ label: 'Traceroute', icon: 'fa-plus', command: (event) => this.testTraceroute() }, this.getInfras(probeHosts[0].probe.id);
{ label: 'ARP Test', icon: 'fa-plus', command: (event) => this.testARP() }, }),
{ label: 'Ping Test', icon: 'fa-plus', command: (event) => this.testPing() }, catchError(error => {
]; this.error$ = of(error);
this.contextMenuService = [ return of();
{ label: 'Service Menu', command: (event) => this.closeContextMenu() }, })
{ label: 'View this Service', icon: 'fa-plus', command: (event) => this.viewInfo() }, )
{ label: 'Add sensor', icon: 'fa-plus', command: (event) => this.addSensorWithTarget() }, ),
]; tap(() => {
this.contextMenuSensor = [ this.pending$ = of(false);
{ label: 'Sensor Menu', command: (event) => this.closeContextMenu() }, }),
{ label: 'View this Sensor', icon: 'fa-plus', command: (event) => this.viewInfo() }, take(1),
{ label: 'Edit', icon: 'fa-plus', command: (event) => this.editSensor() }, ).subscribe();
{ label: 'Remove', icon: 'fa-plus', command: (event) => this.removeSensor() },
];
} }
closeContextMenu() { generateTabs() {
this.cmProbe.hide(); this.tabs = [];
this.cmHost.hide(); this.probeHosts.forEach((ph, i) => {
this.cmService.hide(); this.tabs.push({
this.cmSensor.hide(); label: ph.probe.cidr
});
});
} }
searchObj(treeList: any[], target: Target, searchList: any[]) { onProbeChange(event) {
this.getInfras(this.probeHosts[event.index].probe.id);
if (treeList === undefined || treeList === null) {
return;
} }
for (const t of treeList) { getInfras(probeID: number) {
if (t.obj !== undefined && t.obj == null) { const pageParams: PageParams = {
if (t.obj.target.id === target.id) { pageNo: 0,
searchList.push(t); countPerPage: 99999,
} else { sortCol: 'id',
this.searchObj(t.children, target, searchList); sortDirection: 'descending'
}
}
}
}
addTreeForSensor(sensorList: Array<Sensor>) {
if (sensorList === undefined || sensorList === null || sensorList.length <= 0) {
return;
}
// const tInfraTree = _.clone(this.infraTree);
// const it = tInfraTree[0];
// const it = this.infraTree[0];
// // for (const it of this.infraTree) {
// if (it.children === null || it.children === undefined) {
// it.children = [];
// }
// for (const itt of this.infraTree) {
// }
// }
for (const sensor of sensorList) {
const st = {
label: 'Sensors - ' + sensor.metaCrawler.name,
type: 'sensor',
obj: sensor,
expanded: true
}; };
this.infraService.readAllByProbeID(probeID, pageParams)
// FIXME:: target test id .... .pipe(
const tt = this.targetTreeMap.get(4); tap(() => {
// const tt = this.targetTreeMap.get(sensor.target.id); this.pending$ = of(true);
if (tt !== undefined && tt !== null) { }),
tt.children.push(st); map((infraPage: Page<Infra>) => {
this.infras = infraPage.content;
console.log(this.infras);
}),
catchError(error => {
this.error$ = of(error);
return of();
}),
tap(() => {
this.pending$ = of(false);
}),
take(1),
).subscribe();
} }
onDiscovery() {
// it.children.push(st);
} }
// this.infraTree = tInfraTree;
} }
generateInfraHostData(filterStr?: string): TreeNode[] {
const itl: TreeNode[] = [];
const probeMap: Map<number, InfraHost[]> = new Map();
const hostMap: Map<string, InfraService[]> = new Map();
this.loading = true;
this.sortInfraToMap(probeMap, hostMap, filterStr);
this.targetTreeMap.clear();
const infraTree: TreeNode = this.generateInfraTree(probeMap, hostMap);
for (const infra of this.totalList) {
this.getSensorByInfra(infra);
}
this.loading = false;
itl.push(infraTree);
return itl;
}
generateInfraTree(probeMap: Map<number, InfraHost[]>, hostMap: Map<string, InfraService[]>): TreeNode {
const infraTree = {
label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [],
};
probeMap.forEach((ifhl: InfraHost[], key: number) => {
const tp = {
label: ifhl[0].probe.displayName,
type: 'probe',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: {
id: key
},
children: [],
};
ifhl.map((ih: InfraHost, idx: number) => {
const th = {
label: 'Host - ' + ih.ipv4,
type: 'host',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: ih,
children: [],
};
this.targetTreeMap.set(ih.target.id, th);
if (hostMap.has(ih.ipv4)) {
const ifsl = hostMap.get(ih.ipv4);
for (let i = 0; i < ifsl.length; ++i) {
const ts = {
label: 'Service - ' + ifsl[i].metaInfraVendor.name,
type: 'service',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: ifsl[i],
children: [],
};
this.targetTreeMap.set(ifsl[i].target.id, ts);
th.children.push(ts);
}
}
tp.children.push(th);
});
// ProbeTree.children.push(tp);
infraTree.children.push(tp);
});
return infraTree;
}
sortInfraToMap(probeMap: Map<number, InfraHost[]>, hostMap: Map<string, InfraService[]>, filterStr: string) {
for (const infra of this.totalList) {
const infraType = infra.metaInfraType.name;
if (infraType === 'HOST') {
const infraHost: InfraHost = infra;
if (filterStr && String(infraHost.ipv4).indexOf(filterStr) < 0) {
continue;
}
if (probeMap.has(infraHost.probe.id) === false) {
probeMap.set(infraHost.probe.id, []);
}
const ihl: InfraHost[] = probeMap.get(infraHost.probe.id);
ihl.push(infraHost);
probeMap.set(infraHost.probe.id, ihl);
} else if (infraType === 'OS_SERVICE') {
const infraService: InfraService = infra;
if (filterStr && this.checkFilterString(infraService, filterStr)) {
continue;
}
if (hostMap.has(infraService.infraHost.ipv4) === false) {
hostMap.set(infraService.infraHost.ipv4, []);
}
const isl = hostMap.get(infraService.infraHost.ipv4);
isl.push(infraService);
}
}
}
getSensorByInfra(infra: Infra) {
// const pageParams: PageParams = {
// pageNo: '0',
// countPerPage: '10',
// sortCol: 'id',
// sortDirection: 'descending'
// };
// this.sensorListStore.dispatch(new SensorListStore.ReadAllByInfra({ id: String(infra.id), pageParams: pageParams }));
}
checkFilterString(infraService: InfraService, filterStr: string) {
const upperCased = filterStr.toUpperCase().toUpperCase();
if (infraService.metaInfraVendor.name.toUpperCase().indexOf(upperCased) < 0 &&
String(infraService.port).toUpperCase().indexOf(upperCased) < 0 &&
infraService.portType.toUpperCase().indexOf(upperCased)) {
return true;
}
return false;
}
getExistHost(infraHost: InfraHost): HostData {
let node = null;
for (const data of this.hostDataList) {
if (data.host.ipv4 === infraHost.ipv4) {
node = data;
}
}
return node;
}
showDialog() {
// this.display = true;
this.router.navigateByUrl('/discovery');
}
// closeDialog() {
// this.display = false;
// }
expandAll() {
this.infraTree.forEach(node => {
this.expandRecursive(node, true);
});
}
collapseAll() {
this.infraTree.forEach(node => {
this.expandRecursive(node, false);
});
}
private expandRecursive(node: TreeNode, isExpand: boolean) {
node.expanded = isExpand;
if (node.children) {
node.children.forEach(childNode => {
this.expandRecursive(childNode, isExpand);
});
}
}
onNodeSelect(event) {
// const nodeType = event.node.type;
// this.selectedNode = event.node;
// if (nodeType === 'probe') {
// this.router.navigate(['probe', event.node.obj.id, 'info']);
// } else if (nodeType === 'host' || nodeType === 'service') {
// this.router.navigate(['target', event.node.obj.id, 'info']);
// } else if (nodeType === 'sensor') {
// this.router.navigate(['sensor', event.node.obj.id, 'info']);
// }
}
viewInfo() {
this.onNodeSelect({
node : this.selectedNode,
});
}
nodeMenu(event: MouseEvent, node: any) {
this.selectedNode = node;
this.cmProbe.hide();
this.cmHost.hide();
this.cmService.hide();
this.cmSensor.hide();
if (node.type === 'probe') {
this.cmProbe.show(event);
} else if (node.type === 'host') {
this.cmHost.show(event);
} else if (node.type === 'service') {
this.cmService.show(event);
} else if (node.type === 'sensor') {
this.cmSensor.show(event);
}
return false;
}
testTraceroute() {
}
testARP() {
}
testPing() {
}
editProbeAlias() {
this.renameProbeVisible = true;
}
editSensor() {
}
removeSensor() {
}
discovery() {
this.display = true;
}
addSensorWithTarget() {
this.target = this.selectedNode['obj'].target;
this.sensorSettingDisplay = true;
}
onSensorSettingClose() {
this.target = null;
this.sensorSettingDisplay = false;
}
onSaveProbeName(value) {
const probeName = this.selectedNode.label;
console.log(probeName);
}
}
const testInfraList = [
{
label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [
{
label: 'Zone - 192.168.1.0/24',
type: 'zone',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [
{
label: 'Host - 192.168.1.106 - Snoop Host',
type: '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
}
]
}
]
}
]
}
]
}
];

View File

@ -0,0 +1 @@
TREE

View File

@ -0,0 +1,15 @@
import {
Component
} from '@angular/core';
@Component({
selector: 'of-infra-tree',
templateUrl: './infra-tree.component.html',
})
export class InfraTreeComponent {
constructor(
) {
}
}

View File

@ -0,0 +1,176 @@
<!--<p-dialog [showHeader]="false" [closeOnEscape]="false" [modal]="true" header="Discovery" [width]="800" [(visible)]="display" >-->
<!--<of-discovery-setting [visible]="display" (close)="closeDialog()"></of-discovery-setting>-->
<!--</p-dialog>-->
<div class="ui-g">
<h1>Map</h1>
<div class="ui-g-12 ui-g-nopad">
<div class="ui-g">
<div class="ui-g-12 ui-md-5 ui-g-nopad ui-bottom-space-10">
<button pButton type="button" class="ui-button-large ui-button-width-fit" icon="ui-icon-play-arrow" label="Discovery" (click)="showDialog()"></button>
</div>
<div class="ui-g-12 ui-md-7 ui-g-nopad">
<div style="float: right;">
<button pButton type="button" class="ui-button-secondary ui-button-width-fit" label="Expand all" style="margin-top: 16px;"
(click)="expandAll()"></button>
<button pButton type="button" class="ui-button-secondary ui-button-width-fit" label="Collapse all" style="margin-top: 16px;"
(click)="collapseAll()"></button>
</div>
<div style="float: right; margin: 30px 15px 0 0;">
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>Up
<i class="fa ui-icon-stop ui-status-icon ui-status-fatal"></i>Down
<i class="fa ui-icon-stop ui-status-icon ui-status-warn"></i>Warn
<i class="fa ui-icon-stop ui-status-icon ui-status-error"></i>Error
</div>
</div>
</div>
</div>
<div class="ui-g-12 ui-g-nopad">
<p-tree [value]="infraTree" selectionMode="single" [(selection)]="selectedTree" (onNodeSelect)="onNodeSelect($event)" [contextMenu]="cm"
[pTooltip]="desiredTooltip">
<ng-template let-node pTemplate="default">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="infra">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="probe">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="host">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
<!-- <div>{{node.obj.infraType.name}}</div> -->
</div>
</ng-template>
<ng-template let-node pTemplate="service">
<div (contextmenu)="nodeMenu($event, node)">
<div>{{node.label}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="sensor">
<div (contextmenu)="nodeMenu($event, node)">
<div>
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>{{node.label}}
</div>
<div>
{{node.obj.itemCount}} SensorItems
</div>
</div>
</ng-template>
</p-tree>
</div>
</div>
<p-contextMenu #cmProbe [model]="contextMenuProbe"></p-contextMenu>
<p-contextMenu #cmHost [model]="contextMenuHost"></p-contextMenu>
<p-contextMenu #cmService [model]="contextMenuService"></p-contextMenu>
<p-contextMenu #cmSensor [model]="contextMenuSensor"></p-contextMenu>
<!-- <p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="true" [closeOnEscape]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog> -->
<p-dialog header="Rename Probe" [(visible)]="renameProbeVisible" [modal]="true" [responsive]="true" [width]="350" [minWidth]="200"
[minY]="70">
<span class="md-inputfield">
<input #probeAlias type="text" pInputText placeholder="Enter new alias.">
</span>
<p-footer>
<button type="button" pButton icon="fa-check" (click)="onSaveProbeName(probeAlias.value)" label="Save"></button>
<button type="button" pButton icon="fa-close" (click)="renameProbeVisible=false" label="Cancel"></button>
</p-footer>
</p-dialog>
<!-- <div fxLayoutAlign="end" [style.margin]="'10px 10px'">
<form class="form">
<mat-form-field class="full-width">
<input matInput placeholder="Search" [(ngModel)]="searchWord" (ngModelChange)="handleSearch($event)" [ngModelOptions]="{standalone: true}">
<mat-icon matSuffix>search</mat-icon>
</mat-form-field>
</form>
</div>
<div fxLayoutAlign="end" [style.margin]="'10px 10px'">
** probe가 설치된 host와 그 probe가 가장 상위에 나와야 함 **
<div class="box up"></div>Up
<div class="box down"></div>Down
<div class="box warn"></div>Warn
<div class="box error"></div>Error
</div>
<div *ngIf="loading" fxLayoutAlign="center">
<mat-spinner></mat-spinner>
</div>
<div *ngIf="!loading" class="search-result" infinite-scroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false">
<div class="infra-list mat-elevation-z4 " *ngFor="let infra of hostDataList">
<mat-toolbar>
<mat-toolbar-row>
<span matTooltip="showHostInfo(infra)">IP : {{infra.host.ip}}</span>
<span class="pull-right"></span>
<span style="margin-right: 20px">
</span>
<button mat-raised-button color="primary" fxLayoutAlign="end" (click)="addSensor(infra)">Add Sensor</button>
</mat-toolbar-row>
</mat-toolbar>
<mat-card-content *ngFor="let service of infra.services">
<mat-grid-list cols="6" rowHeight="9:1">
<mat-grid-tile [rowspan]="2" style="background-color: lightcoral">
{{service.vendor.name}}
</mat-grid-tile>
<mat-grid-tile [colspan]="3" style="background-color: lightblue">
<div class="grid-left-align">
Port : {{service.port}} | {{service.portType}} {{service.tlsType ? '| TLS' : ''}}
</div>
</mat-grid-tile>
<mat-grid-tile [rowspan]="2" style="background-color: lightgray">
<span class="pull-right"></span>
<button mat-button fxLayoutAlign="end" (click)="addSensor(infra)">Add Sensor</button>
</mat-grid-tile>
<mat-grid-tile [colspan]="3" style="background-color: lightgreen">
<div class="grid-left-align">
</div>
</mat-grid-tile>
</mat-grid-list>
</mat-card-content>
</div>
</div> -->

View File

@ -0,0 +1,630 @@
import {
Component,
OnInit,
AfterContentInit,
ViewChild
} from '@angular/core';
import { Observable, of, Subscription } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { TreeNode, MenuItem, ContextMenu } from 'primeng/primeng';
import { Target } from '@overflow/commons-typescript/model/target';
import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
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 {
id: string;
target?: Target;
host: InfraHost;
services: InfraService[];
}
@Component({
selector: 'of-infra-map',
templateUrl: './infra-map.component.html'
})
export class InfraMapComponent implements OnInit, AfterContentInit {
infras$: Observable<Infra>;
pending$: Observable<boolean>;
error$: Observable<any>;
infraTree: TreeNode[] = [];
display = false;
loading = false;
renameProbeVisible = false;
totalList: Infra[];
hostDataList: HostData[] = new Array();
sensorMap: Map<number, Array<Sensor>> = new Map();
targetTreeMap: Map<number, TreeNode> = new Map();
DEFAULT_EXPANDED: Boolean = true;
contextMenuProbe: MenuItem[];
contextMenuHost: MenuItem[];
contextMenuService: MenuItem[];
contextMenuSensor: MenuItem[];
@ViewChild('cmProbe') cmProbe: ContextMenu;
@ViewChild('cmHost') cmHost: ContextMenu;
@ViewChild('cmService') cmService: ContextMenu;
@ViewChild('cmSensor') cmSensor: ContextMenu;
selectedNode: TreeNode = null;
sensorSettingDisplay = false;
target: Target = null;
constructor(
private router: Router
// private infraService: InfraService,
) {
}
ngOnInit() {
this.initContextMenu();
}
ngAfterContentInit() {
}
initContextMenu() {
this.contextMenuProbe = [
{ label: 'Probe Menu', command: (event) => this.closeContextMenu() },
{ label: 'View this Probe', icon: 'fa-plus', command: (event) => this.viewInfo() },
{ label: 'Discovery', icon: 'fa-plus', command: (event) => this.discovery() },
{ label: 'Edit Alias', icon: 'fa-plus', command: (event) => this.editProbeAlias() },
];
this.contextMenuHost = [
{ label: 'Host Menu', command: (event) => this.closeContextMenu() },
{ label: 'View this Host', icon: 'fa-plus', command: (event) => this.viewInfo() },
{ label: 'Add sensor', icon: 'fa-plus', command: (event) => this.addSensorWithTarget() },
{ label: 'Traceroute', icon: 'fa-plus', command: (event) => this.testTraceroute() },
{ label: 'ARP Test', icon: 'fa-plus', command: (event) => this.testARP() },
{ label: 'Ping Test', icon: 'fa-plus', command: (event) => this.testPing() },
];
this.contextMenuService = [
{ label: 'Service Menu', command: (event) => this.closeContextMenu() },
{ label: 'View this Service', icon: 'fa-plus', command: (event) => this.viewInfo() },
{ label: 'Add sensor', icon: 'fa-plus', command: (event) => this.addSensorWithTarget() },
];
this.contextMenuSensor = [
{ label: 'Sensor Menu', command: (event) => this.closeContextMenu() },
{ label: 'View this Sensor', icon: 'fa-plus', command: (event) => this.viewInfo() },
{ label: 'Edit', icon: 'fa-plus', command: (event) => this.editSensor() },
{ label: 'Remove', icon: 'fa-plus', command: (event) => this.removeSensor() },
];
}
closeContextMenu() {
this.cmProbe.hide();
this.cmHost.hide();
this.cmService.hide();
this.cmSensor.hide();
}
searchObj(treeList: any[], target: Target, searchList: any[]) {
if (treeList === undefined || treeList === null) {
return;
}
for (const t of treeList) {
if (t.obj !== undefined && t.obj == null) {
if (t.obj.target.id === target.id) {
searchList.push(t);
} else {
this.searchObj(t.children, target, searchList);
}
}
}
}
addTreeForSensor(sensorList: Array<Sensor>) {
if (sensorList === undefined || sensorList === null || sensorList.length <= 0) {
return;
}
// const tInfraTree = _.clone(this.infraTree);
// const it = tInfraTree[0];
// const it = this.infraTree[0];
// // for (const it of this.infraTree) {
// if (it.children === null || it.children === undefined) {
// it.children = [];
// }
// for (const itt of this.infraTree) {
// }
// }
for (const sensor of sensorList) {
const st = {
label: 'Sensors - ' + sensor.metaCrawler.name,
type: 'sensor',
obj: sensor,
expanded: true
};
// FIXME:: target test id ....
const tt = this.targetTreeMap.get(4);
// const tt = this.targetTreeMap.get(sensor.target.id);
if (tt !== undefined && tt !== null) {
tt.children.push(st);
}
// it.children.push(st);
}
// this.infraTree = tInfraTree;
}
generateInfraHostData(filterStr?: string): TreeNode[] {
const itl: TreeNode[] = [];
const probeMap: Map<number, InfraHost[]> = new Map();
const hostMap: Map<string, InfraService[]> = new Map();
this.loading = true;
this.sortInfraToMap(probeMap, hostMap, filterStr);
this.targetTreeMap.clear();
const infraTree: TreeNode = this.generateInfraTree(probeMap, hostMap);
for (const infra of this.totalList) {
this.getSensorByInfra(infra);
}
this.loading = false;
itl.push(infraTree);
return itl;
}
generateInfraTree(probeMap: Map<number, InfraHost[]>, hostMap: Map<string, InfraService[]>): TreeNode {
const infraTree = {
label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [],
};
probeMap.forEach((ifhl: InfraHost[], key: number) => {
const tp = {
label: ifhl[0].probe.displayName,
type: 'probe',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: {
id: key
},
children: [],
};
ifhl.map((ih: InfraHost, idx: number) => {
const th = {
label: 'Host - ' + ih.ipv4,
type: 'host',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: ih,
children: [],
};
this.targetTreeMap.set(ih.target.id, th);
if (hostMap.has(ih.ipv4)) {
const ifsl = hostMap.get(ih.ipv4);
for (let i = 0; i < ifsl.length; ++i) {
const ts = {
label: 'Service - ' + ifsl[i].metaInfraVendor.name,
type: 'service',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(),
obj: ifsl[i],
children: [],
};
this.targetTreeMap.set(ifsl[i].target.id, ts);
th.children.push(ts);
}
}
tp.children.push(th);
});
// ProbeTree.children.push(tp);
infraTree.children.push(tp);
});
return infraTree;
}
sortInfraToMap(probeMap: Map<number, InfraHost[]>, hostMap: Map<string, InfraService[]>, filterStr: string) {
for (const infra of this.totalList) {
const infraType = infra.metaInfraType.name;
if (infraType === 'HOST') {
const infraHost: InfraHost = infra;
if (filterStr && String(infraHost.ipv4).indexOf(filterStr) < 0) {
continue;
}
if (probeMap.has(infraHost.probe.id) === false) {
probeMap.set(infraHost.probe.id, []);
}
const ihl: InfraHost[] = probeMap.get(infraHost.probe.id);
ihl.push(infraHost);
probeMap.set(infraHost.probe.id, ihl);
} else if (infraType === 'OS_SERVICE') {
const infraService: InfraService = infra;
if (filterStr && this.checkFilterString(infraService, filterStr)) {
continue;
}
if (hostMap.has(infraService.infraHost.ipv4) === false) {
hostMap.set(infraService.infraHost.ipv4, []);
}
const isl = hostMap.get(infraService.infraHost.ipv4);
isl.push(infraService);
}
}
}
getSensorByInfra(infra: Infra) {
// const pageParams: PageParams = {
// pageNo: '0',
// countPerPage: '10',
// sortCol: 'id',
// sortDirection: 'descending'
// };
// this.sensorListStore.dispatch(new SensorListStore.ReadAllByInfra({ id: String(infra.id), pageParams: pageParams }));
}
checkFilterString(infraService: InfraService, filterStr: string) {
const upperCased = filterStr.toUpperCase().toUpperCase();
if (infraService.metaInfraVendor.name.toUpperCase().indexOf(upperCased) < 0 &&
String(infraService.port).toUpperCase().indexOf(upperCased) < 0 &&
infraService.portType.toUpperCase().indexOf(upperCased)) {
return true;
}
return false;
}
getExistHost(infraHost: InfraHost): HostData {
let node = null;
for (const data of this.hostDataList) {
if (data.host.ipv4 === infraHost.ipv4) {
node = data;
}
}
return node;
}
showDialog() {
// this.display = true;
this.router.navigateByUrl('/discovery');
}
// closeDialog() {
// this.display = false;
// }
expandAll() {
this.infraTree.forEach(node => {
this.expandRecursive(node, true);
});
}
collapseAll() {
this.infraTree.forEach(node => {
this.expandRecursive(node, false);
});
}
private expandRecursive(node: TreeNode, isExpand: boolean) {
node.expanded = isExpand;
if (node.children) {
node.children.forEach(childNode => {
this.expandRecursive(childNode, isExpand);
});
}
}
onNodeSelect(event) {
// const nodeType = event.node.type;
// this.selectedNode = event.node;
// if (nodeType === 'probe') {
// this.router.navigate(['probe', event.node.obj.id, 'info']);
// } else if (nodeType === 'host' || nodeType === 'service') {
// this.router.navigate(['target', event.node.obj.id, 'info']);
// } else if (nodeType === 'sensor') {
// this.router.navigate(['sensor', event.node.obj.id, 'info']);
// }
}
viewInfo() {
this.onNodeSelect({
node : this.selectedNode,
});
}
nodeMenu(event: MouseEvent, node: any) {
this.selectedNode = node;
this.cmProbe.hide();
this.cmHost.hide();
this.cmService.hide();
this.cmSensor.hide();
if (node.type === 'probe') {
this.cmProbe.show(event);
} else if (node.type === 'host') {
this.cmHost.show(event);
} else if (node.type === 'service') {
this.cmService.show(event);
} else if (node.type === 'sensor') {
this.cmSensor.show(event);
}
return false;
}
testTraceroute() {
}
testARP() {
}
testPing() {
}
editProbeAlias() {
this.renameProbeVisible = true;
}
editSensor() {
}
removeSensor() {
}
discovery() {
this.display = true;
}
addSensorWithTarget() {
this.target = this.selectedNode['obj'].target;
this.sensorSettingDisplay = true;
}
onSensorSettingClose() {
this.target = null;
this.sensorSettingDisplay = false;
}
onSaveProbeName(value) {
const probeName = this.selectedNode.label;
console.log(probeName);
}
}
const testInfraList = [
{
label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [
{
label: 'Zone - 192.168.1.0/24',
type: 'zone',
expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder',
expanded: true,
children: [
{
label: 'Host - 192.168.1.106 - Snoop Host',
type: '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
}
]
}
]
}
]
}
]
}
];

View File

@ -5,9 +5,10 @@ import { SERVICES } from './service';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { DiscoveryModule } from '@overflow/discovery/discovery.module'; import { DiscoveryModule } from '@overflow/discovery/discovery.module';
import { SensorModule } from '@overflow/sensor/sensor.module'; import { SensorModule } from '@overflow/sensor/sensor.module';
// import { ProbeModule } from '@overflow/probe/probe.module'; import { ProbeModule } from '@overflow/probe/probe.module';
import { MetaModule } from '@overflow/meta/meta.module'; import { MetaModule } from '@overflow/meta/meta.module';
import { UIModule } from '@overflow/shared/ui/ui.module'; import { UIModule } from '@overflow/shared/ui/ui.module';
import { TabbarModule } from '@app/commons/component/layout/tabbar/app.tabbar.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -16,8 +17,9 @@ import { UIModule } from '@overflow/shared/ui/ui.module';
UIModule, UIModule,
DiscoveryModule, DiscoveryModule,
SensorModule, SensorModule,
// ProbeModule, ProbeModule,
MetaModule, MetaModule,
TabbarModule
], ],
declarations: [ declarations: [
COMPONENTS, COMPONENTS,

View File

@ -4,9 +4,9 @@ import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc'; import { RPCService } from '@loafer/ng-rpc';
import { Infra } from '@overflow/commons-typescript/model/infra'; import { Infra } from '@overflow/commons-typescript/model/infra';
// import { Page, PageParams } from 'app/commons/model';
import { Domain } from '@overflow/commons-typescript/model/domain'; import { Domain } from '@overflow/commons-typescript/model/domain';
import { Probe } from '@overflow/commons-typescript/model/probe'; import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
import { Page } from '@overflow/commons-typescript/model/commons/Page';
@Injectable() @Injectable()
export class InfraService { export class InfraService {
@ -21,11 +21,11 @@ export class InfraService {
// return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams); // return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams);
// } // }
// public readAllByProbe(probe: Probe, pageParams: PageParams): Observable<Page> { public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Infra>> {
// return this.rpcService.call('InfraService.readAllByProbe', probe, pageParams); return this.rpcService.call<Page<Infra>>('InfraService.readAllByProbeID', probeID, pageParams);
// } }
public read(id: string): Observable<Infra> { public read(id: string): Observable<Infra> {
return this.rpcService.call('InfraService.read', id); return this.rpcService.call<Infra>('InfraService.read', id);
} }
} }

View File

@ -1 +1 @@
<of-notification-badge [notificationPage]="notificationPage$ | async" (select)="onSelect($event)" (viewAll)="onViewAll($event)"></of-notification-badge> <!-- <of-notification-badge [notificationPage]="notificationPage$ | async" (select)="onSelect($event)" (viewAll)="onViewAll($event)"></of-notification-badge> -->

View File

@ -6,7 +6,7 @@ const routes: Routes = [
{ path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] }, { path: '', loadChildren: './pages/pages.module#PagesModule', canActivate: [AuthGuard] },
{ path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' },
{ path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' }, { path: 'error', loadChildren: './pages/error/error-page.module#ErrorPageModule' },
{ path: '**', redirectTo: 'error' }, // { path: '**', redirectTo: 'error' },
]; ];
@NgModule({ @NgModule({

View File

@ -135,7 +135,7 @@
<span class="topbar-item-name">Notifications</span> <span class="topbar-item-name">Notifications</span>
</a> </a>
<ul class="ultima-menu animated fadeInDown"> <ul class="ultima-menu animated fadeInDown">
<of-notification-badge-container (select)="onNotificationSelect($event)" (viewAll)="onViewAllNotification($event)"></of-notification-badge-container> <!-- <of-notification-badge-container (select)="onNotificationSelect($event)" (viewAll)="onViewAllNotification($event)"></of-notification-badge-container> -->
</ul> </ul>
</li> </li>
<!-- <li #notifications [ngClass]="{'active-top-menu':app.activeTopbarItem === notifications}"> <!-- <li #notifications [ngClass]="{'active-top-menu':app.activeTopbarItem === notifications}">

View File

@ -8,6 +8,10 @@ const routes: Routes = [
{ {
path: '', path: '',
component: InfraPageComponent, component: InfraPageComponent,
},
{
path: ':idx',
component: InfraPageComponent,
} }
]; ];

View File

@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
@Component({ @Component({
selector: 'of-infra-page', selector: 'of-infra-page',
@ -6,7 +7,10 @@ import { Component, OnInit } from '@angular/core';
}) })
export class InfraPageComponent implements OnInit { export class InfraPageComponent implements OnInit {
constructor( constructor(
private router: Router,
private route: ActivatedRoute
) { } ) { }
ngOnInit() { ngOnInit() {

View File

@ -5,9 +5,9 @@
export const environment = { export const environment = {
production: false, production: false,
restBaseURL: 'http://192.168.1.101:19080/webapp', restBaseURL: 'http://192.168.1.50:19080/webapp',
webappRPCConfig: { webappRPCConfig: {
url: 'ws://192.168.1.101:19090/webapp', url: 'ws://192.168.1.50:19090/webapp',
reconnectInterval: 5000, reconnectInterval: 5000,
reconnectRetry: 10, reconnectRetry: 10,
}, },