This commit is contained in:
insanity 2018-04-26 21:18:25 +09:00
parent e357030fe8
commit 282b02a0a7
4 changed files with 39 additions and 38 deletions

View File

@ -61,20 +61,8 @@
<p-contextMenu #cmService [model]="contextMenuService"></p-contextMenu> <p-contextMenu #cmService [model]="contextMenuService"></p-contextMenu>
<p-contextMenu #cmSensor [model]="contextMenuSensor"></p-contextMenu> <p-contextMenu #cmSensor [model]="contextMenuSensor"></p-contextMenu>
<p-sidebar [(visible)]="visibleSidebar" position="bottom" [baseZIndex]="10000" *ngIf="selectedNode" styleClass="ui-sidebar-md">
<div *ngIf="selectedNode.type === 'probe'">
<of-probe-summary [probe]="targetNodeForView" [visible]="visibleSidebar"></of-probe-summary>
</div>
<div *ngIf="selectedNode.type === 'host'">
<of-host-summary [host]="targetNodeForView" [visible]="visibleSidebar"></of-host-summary>
</div>
<div *ngIf="selectedNode.type === 'service'">
<of-service-summary [service]="targetNodeForView" [visible]="visibleSidebar"></of-service-summary>
</div>
</p-sidebar>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="true" [closeOnEscape]="false"> <p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="true" [closeOnEscape]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="targetNodeForView" (close)="onSensorSettingClose()"></of-sensor-setting> <of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog> </p-dialog>

View File

@ -69,6 +69,7 @@ export class MapComponent implements OnInit, AfterContentInit {
targetNodeForView: Object = null; targetNodeForView: Object = null;
sensorSettingDisplay = false; sensorSettingDisplay = false;
target: Target = null;
constructor(private router: Router, constructor(private router: Router,
private listStore: Store<ListStore.State>, private listStore: Store<ListStore.State>,
@ -98,10 +99,8 @@ export class MapComponent implements OnInit, AfterContentInit {
ngOnInit() { ngOnInit() {
this.infras$.subscribe( this.infras$.subscribe(
(page: Page) => { (page: Page) => {
console.log(page);
if (page !== null) { if (page !== null) {
this.totalList = page.content; this.totalList = page.content;
console.log(this.totalList);
this.infraTree = this.generateInfraHostData(); this.infraTree = this.generateInfraHostData();
} }
}, },
@ -113,7 +112,6 @@ export class MapComponent implements OnInit, AfterContentInit {
(page: Page) => { (page: Page) => {
if (page !== null) { if (page !== null) {
const sensorList = page.content; const sensorList = page.content;
console.log(sensorList);
this.addTreeForSensor(sensorList); this.addTreeForSensor(sensorList);
} }
}, },
@ -263,9 +261,8 @@ export class MapComponent implements OnInit, AfterContentInit {
}; };
probeMap.forEach((ifhl: InfraHost[], key: number) => { probeMap.forEach((ifhl: InfraHost[], key: number) => {
const tp = { const tp = {
label: 'Probe - ' + key, label: ifhl[0].probe.displayName,
type: 'probe', type: 'probe',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
@ -280,7 +277,7 @@ export class MapComponent implements OnInit, AfterContentInit {
ifhl.map((ih: InfraHost, idx: number) => { ifhl.map((ih: InfraHost, idx: number) => {
const th = { const th = {
label: 'Host - ' + ih.ip, label: 'Host - ' + ih.ipv4,
type: 'host', type: 'host',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
@ -291,9 +288,9 @@ export class MapComponent implements OnInit, AfterContentInit {
this.targetTreeMap.set(ih.target.id, th); this.targetTreeMap.set(ih.target.id, th);
if (hostMap.has(ih.ip)) { if (hostMap.has(ih.ipv4)) {
const ifsl = hostMap.get(ih.ip); const ifsl = hostMap.get(ih.ipv4);
@ -333,7 +330,7 @@ export class MapComponent implements OnInit, AfterContentInit {
const infraType = infra.infraType.name; const infraType = infra.infraType.name;
if (infraType === 'HOST') { if (infraType === 'HOST') {
const infraHost: InfraHost = infra; const infraHost: InfraHost = infra;
if (filterStr && String(infraHost.ip).indexOf(filterStr) < 0) { if (filterStr && String(infraHost.ipv4).indexOf(filterStr) < 0) {
continue; continue;
} }
@ -351,11 +348,11 @@ export class MapComponent implements OnInit, AfterContentInit {
continue; continue;
} }
if (hostMap.has(infraService.host.ip) === false) { if (hostMap.has(infraService.host.ipv4) === false) {
hostMap.set(infraService.host.ip, []); hostMap.set(infraService.host.ipv4, []);
} }
const isl = hostMap.get(infraService.host.ip); const isl = hostMap.get(infraService.host.ipv4);
isl.push(infraService); isl.push(infraService);
} }
@ -391,7 +388,7 @@ export class MapComponent implements OnInit, AfterContentInit {
getExistHost(infraHost: InfraHost): HostData { getExistHost(infraHost: InfraHost): HostData {
let node = null; let node = null;
for (const data of this.hostDataList) { for (const data of this.hostDataList) {
if (data.host.ip === infraHost.ip) { if (data.host.ipv4 === infraHost.ipv4) {
node = data; node = data;
} }
} }
@ -432,18 +429,18 @@ export class MapComponent implements OnInit, AfterContentInit {
this.selectedNode = event.node; this.selectedNode = event.node;
if (nodeType === 'probe') { if (nodeType === 'probe') {
this.router.navigate(['probe', event.node.obj.id, 'info']); this.router.navigate(['probe', event.node.obj.id, 'info']);
} else if (nodeType === 'host') { } else if (nodeType === 'host' || nodeType === 'service') {
this.router.navigate(['sensors'], { queryParams: { target: event.node.obj.target.id } });
} else if (nodeType === 'sensor') {
this.router.navigate(['sensor', event.node.obj.id, 'info']);
} }
} }
viewInfo() { viewInfo() {
const nodeType = this.selectedNode.type; const temp = {
if (nodeType !== 'probe' && nodeType !== 'host' && nodeType !== 'service') { node : this.selectedNode,
return; };
} this.onNodeSelect(temp);
this.targetNodeForView = this.selectedNode['obj'];
this.visibleSidebar = true;
} }
nodeMenu(event: MouseEvent, node: any) { nodeMenu(event: MouseEvent, node: any) {
@ -489,10 +486,12 @@ export class MapComponent implements OnInit, AfterContentInit {
} }
addSensorWithTarget() { addSensorWithTarget() {
this.target = this.selectedNode['obj'].target;
this.sensorSettingDisplay = true; this.sensorSettingDisplay = true;
} }
onSensorSettingClose() { onSensorSettingClose() {
this.target = null;
this.sensorSettingDisplay = false; this.sensorSettingDisplay = false;
} }
} }

View File

@ -1,3 +1,13 @@
<div *ngIf="probe"> <div *ngIf="probe && probeHost">
<b>probe host detail</b> <!-- Probe 정보 -->
<of-key-value [key]="'Probe Key'" [value]="probeHost.probe.probeKey"></of-key-value>
<of-key-value [key]="'Display Name'" [value]="probeHost.probe.displayName"></of-key-value>
<of-key-value [key]="'Authorized at'" [value]="probeHost.probe.authorizeDate"></of-key-value>
<of-key-value [key]="'Authorized by'" [value]="probeHost.probe.authorizeMember.name"></of-key-value>
<!-- ProbeHost 정보 -->
<of-key-value [key]="'OS'" [value]="probeHost.host.os.vendor.name"></of-key-value>
<of-key-value [key]="'IPv4'" [value]="probeHost.host.ipv4"></of-key-value>
<of-key-value [key]="'IPv6'" [value]="probeHost.host.ipv6"></of-key-value>
<of-key-value [key]="'Mac Address'" [value]="probeHost.mac"></of-key-value>
</div> </div>

View File

@ -13,7 +13,7 @@ import { Probe, ProbeHost } from 'packages/probe/model';
}) })
export class ProbeSummaryComponent implements OnInit, AfterContentInit, OnChanges { export class ProbeSummaryComponent implements OnInit, AfterContentInit, OnChanges {
@Input() probe: Probe; @Input() probe: Object;
@Input() visible: boolean; @Input() visible: boolean;
probeHost$ = this.detailStore.pipe(select(ProbeHostSelector.select('probeHost'))); probeHost$ = this.detailStore.pipe(select(ProbeHostSelector.select('probeHost')));
@ -27,7 +27,8 @@ export class ProbeSummaryComponent implements OnInit, AfterContentInit, OnChange
this.probeHost$.subscribe( this.probeHost$.subscribe(
(probeHost: ProbeHost) => { (probeHost: ProbeHost) => {
if (probeHost) { if (probeHost) {
this.probe = probeHost; console.log(probeHost);
this.probeHost = probeHost;
} }
}, },
(error: RPCClientError) => { (error: RPCClientError) => {
@ -37,6 +38,9 @@ export class ProbeSummaryComponent implements OnInit, AfterContentInit, OnChange
} }
ngAfterContentInit() { ngAfterContentInit() {
console.log('$$$$$$$$$$');
console.log(this.probe);
console.log('$$$$$$$$$$');
this.detailStore.dispatch( this.detailStore.dispatch(
new DetailStore.ReadByProbe(this.probe) new DetailStore.ReadByProbe(this.probe)
); );