2018-04-11 13:05:09 +00:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
AfterViewInit,
|
|
|
|
AfterContentInit,
|
|
|
|
ViewChild
|
|
|
|
} from '@angular/core';
|
2018-04-10 12:37:09 +00:00
|
|
|
import { Router } from '@angular/router';
|
2018-04-11 12:26:51 +00:00
|
|
|
import { TreeNode } from 'primeng/primeng';
|
2018-04-10 12:37:09 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-infra-map',
|
2018-04-11 13:05:09 +00:00
|
|
|
templateUrl: './map.component.html'
|
2018-04-10 12:37:09 +00:00
|
|
|
})
|
|
|
|
export class MapComponent implements OnInit, AfterContentInit {
|
2018-04-11 12:26:51 +00:00
|
|
|
infraTree: TreeNode[] = testInfraList;
|
|
|
|
|
|
|
|
display = false;
|
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
constructor(private router: Router) {}
|
2018-04-10 12:37:09 +00:00
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
ngAfterContentInit() {}
|
2018-04-10 12:37:09 +00:00
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
ngOnInit() {}
|
2018-04-11 12:26:51 +00:00
|
|
|
|
|
|
|
showDialog() {
|
|
|
|
this.display = true;
|
2018-04-11 13:05:09 +00:00
|
|
|
}
|
2018-04-11 12:26:51 +00:00
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
expandAll() {
|
|
|
|
this.infraTree.forEach(node => {
|
|
|
|
this.expandRecursive(node, true);
|
|
|
|
});
|
|
|
|
}
|
2018-04-11 12:26:51 +00:00
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
collapseAll() {
|
|
|
|
this.infraTree.forEach(node => {
|
|
|
|
this.expandRecursive(node, false);
|
|
|
|
});
|
|
|
|
}
|
2018-04-11 12:26:51 +00:00
|
|
|
|
2018-04-11 13:05:09 +00:00
|
|
|
private expandRecursive(node: TreeNode, isExpand: boolean) {
|
|
|
|
node.expanded = isExpand;
|
|
|
|
if (node.children) {
|
|
|
|
node.children.forEach(childNode => {
|
|
|
|
this.expandRecursive(childNode, isExpand);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const testInfraList = [
|
2018-04-11 12:26:51 +00:00
|
|
|
{
|
2018-04-11 13:05:09 +00:00
|
|
|
label: 'Infra',
|
2018-04-11 12:26:51 +00:00
|
|
|
expandedIcon: 'fa-folder-open',
|
|
|
|
collapsedIcon: 'fa-folder',
|
2018-04-11 13:05:09 +00:00
|
|
|
expanded: true,
|
|
|
|
children: [
|
2018-04-11 12:26:51 +00:00
|
|
|
{
|
2018-04-11 13:05:09 +00:00
|
|
|
label: 'Zone - 192.168.1.0/24',
|
2018-04-11 12:26:51 +00:00
|
|
|
expandedIcon: 'fa-folder-open',
|
|
|
|
collapsedIcon: 'fa-folder',
|
2018-04-11 13:05:09 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2018-04-11 12:26:51 +00:00
|
|
|
},
|
|
|
|
{
|
2018-04-11 13:05:09 +00:00
|
|
|
label: 'Zone - 192.168.10.0/24',
|
2018-04-11 12:26:51 +00:00
|
|
|
expandedIcon: 'fa-folder-open',
|
|
|
|
collapsedIcon: 'fa-folder',
|
2018-04-11 13:05:09 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|