map tree design

This commit is contained in:
insanity 2018-04-19 14:52:55 +09:00
parent 8025ad1d12
commit fcae5d70ce
2 changed files with 49 additions and 17 deletions

View File

@ -1,7 +1,7 @@
<div class="ui-g"> <div class="ui-g">
<h1>Map</h1> <h1>Map</h1>
<p-dialog header="Discovery" [width]="800" [(visible)]="display"> <p-dialog header="Discovery" [width]="800" [(visible)]="display">
<of-discovery-setting (close)="closeDialog()"></of-discovery-setting> <of-discovery-setting (close)="closeDialog()"></of-discovery-setting>
</p-dialog> </p-dialog>
<div class="ui-g-12 ui-g-nopad"> <div class="ui-g-12 ui-g-nopad">
<div class="ui-g"> <div class="ui-g">
@ -9,21 +9,49 @@
<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)="showDialog()"></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;">
<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="Expand all" style="margin-top: 16px;"
<button pButton type="button" class="ui-button-secondary ui-button-width-fit" label="Collapse all" style="margin-top: 16px;" (click)="collapseAll()"></button> (click)="expandAll()"></button>
</div> <button pButton type="button" class="ui-button-secondary ui-button-width-fit" label="Collapse all" style="margin-top: 16px;"
<div style="float: right; margin: 30px 15px 0 0;"> (click)="collapseAll()"></button>
<i class="fa ui-icon-stop ui-status-icon ui-status-success"></i>Up </div>
<i class="fa ui-icon-stop ui-status-icon ui-status-fatal"></i>Dwon <div style="float: right; margin: 30px 15px 0 0;">
<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-success"></i>Up
<i class="fa ui-icon-stop ui-status-icon ui-status-error"></i>Error <i class="fa ui-icon-stop ui-status-icon ui-status-fatal"></i>Dwon
</div> <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>
</div> </div>
<div class="ui-g-12 ui-g-nopad"> <div class="ui-g-12 ui-g-nopad">
<p-tree [value]="infraTree" selectionMode="single" [(selection)]="selectedTree" ></p-tree> <p-tree [value]="infraTree" selectionMode="single" [(selection)]="selectedTree">
<ng-template let-node pTemplate="default">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="infra">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="probe">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="host">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="service">
<div>{{node.label}}</div>
</ng-template>
<ng-template let-node pTemplate="sensor">
<p-button label="{{node.label}}"></p-button>
</ng-template>
</p-tree>
</div> </div>
</div> </div>

View File

@ -144,21 +144,18 @@ export class MapComponent implements OnInit, AfterContentInit {
// for (const itt of this.infraTree) { // for (const itt of this.infraTree) {
// } // }
// } // }
for (const sensor of sensorList) { for (const sensor of sensorList) {
const st = { const st = {
label: 'Sensors - ' + sensor.crawler.name, label: 'Sensors - ' + sensor.crawler.name,
expandedIcon: 'fa-folder-open', type: 'sensor',
collapsedIcon: 'fa-folder',
obj: sensor, obj: sensor,
expanded: true expanded: true
}; };
// FIXME:: target test id .... // FIXME:: target test id ....
const tt = this.targetTreeMap.get(3); const tt = this.targetTreeMap.get(4);
// const tt = this.targetTreeMap.get(sensor.target.id); // const tt = this.targetTreeMap.get(sensor.target.id);
if (tt !== undefined && tt !== null) { if (tt !== undefined && tt !== null) {
tt.children.push(st); tt.children.push(st);
@ -206,6 +203,7 @@ export class MapComponent implements OnInit, AfterContentInit {
const infraTree = { const infraTree = {
label: 'Infra', label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: true, expanded: true,
@ -216,6 +214,7 @@ export class MapComponent implements OnInit, AfterContentInit {
const tp = { const tp = {
label: 'Probe - ' + key, label: 'Probe - ' + key,
type: 'probe',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(), expanded: this.DEFAULT_EXPANDED.valueOf(),
@ -228,6 +227,7 @@ export class MapComponent implements OnInit, AfterContentInit {
const th = { const th = {
label: 'Host - ' + ih.ip, label: 'Host - ' + ih.ip,
type: 'host',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(), expanded: this.DEFAULT_EXPANDED.valueOf(),
@ -246,6 +246,7 @@ export class MapComponent implements OnInit, AfterContentInit {
for (let i = 0 ; i < ifsl.length; ++i) { for (let i = 0 ; i < ifsl.length; ++i) {
const ts = { const ts = {
label: 'Service - ' + ifsl[i].vendor.name, label: 'Service - ' + ifsl[i].vendor.name,
type: 'service',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: this.DEFAULT_EXPANDED.valueOf(), expanded: this.DEFAULT_EXPANDED.valueOf(),
@ -376,18 +377,21 @@ export class MapComponent implements OnInit, AfterContentInit {
const testInfraList = [ const testInfraList = [
{ {
label: 'Infra', label: 'Infra',
type: 'infra',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: true, expanded: true,
children: [ children: [
{ {
label: 'Zone - 192.168.1.0/24', label: 'Zone - 192.168.1.0/24',
type: 'zone',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: true, expanded: true,
children: [ children: [
{ {
label: 'Host - 192.168.1.106 - Snoop Host', label: 'Host - 192.168.1.106 - Snoop Host',
type: 'host',
expandedIcon: 'fa-folder-open', expandedIcon: 'fa-folder-open',
collapsedIcon: 'fa-folder', collapsedIcon: 'fa-folder',
expanded: true, expanded: true,