diff --git a/front/css/pialert.css b/front/css/pialert.css
index a9d952f1..9056cb17 100755
--- a/front/css/pialert.css
+++ b/front/css/pialert.css
@@ -795,7 +795,8 @@ input[readonly] {
#networkTree .netPort
{
float:left;
- display:inline;
+ display:inline;
+ text-align: center;
}
#networkTree .portBckgIcon
@@ -816,7 +817,8 @@ input[readonly] {
{
width: 25px;;
float:left;
- display:inline;
+ display:inline;
+ text-align: center;
}
#networkTree .netCollapse
{
diff --git a/front/network.php b/front/network.php
index a8c6ddcc..62080327 100755
--- a/front/network.php
+++ b/front/network.php
@@ -617,23 +617,20 @@
var sizeCoefficient = 1
function initTree(myHierarchy)
- {
+ {
// calculate the font size of the leaf nodes to fit everything into the tree area
leafNodesCount == 0 ? 1 : leafNodesCount;
- emSize = ((treeAreaHeight/(25*leafNodesCount)).toFixed(2));
- emSize = emSize > 1 ? 1 : emSize;
-
+ emSize = ((treeAreaHeight/(25*leafNodesCount)).toFixed(2));
+ emSize = emSize > 1 ? 1 : emSize;
+
// nodeHeight = ((emSize*100*0.30).toFixed(0))
nodeHeight = ((emSize*100*0.30).toFixed(0))
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`)
- console.log('here')
-
myTree = Treeviz.create({
htmlId: "networkTree",
-
- renderNode: nodeData => {
+ renderNode: nodeData => {
var fontSize = "font-size:"+emSize+"em;";
(!emptyArr.includes(nodeData.data.port )) ? port = nodeData.data.port : port = "";
@@ -641,52 +638,51 @@
(port == "" || port == 0 ) ? portBckgIcon = `` : portBckgIcon = ``;
// Build HTML for individual nodes in the network diagram
- deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ? "
" : "";
- devicePort = `${port}
${portBckgIcon}
`;
- collapseExpandIcon = nodeData.data.hiddenChildren ? "square-plus" :"square-minus";
- collapseExpandHtml = (nodeData.data.hasChildren) ? "
" : "";
- statusCss = " netStatus-" + nodeData.data.status;
+ deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ? `
` : "";
+ devicePort = `${port}
${portBckgIcon}
`;
+ collapseExpandIcon = nodeData.data.hiddenChildren ? "square-plus" : "square-minus";
+ collapseExpandHtml = nodeData.data.hasChildren ? `` : "";
+ statusCss = ` netStatus-${nodeData.data.status}`;
selectedNodeMac = $(".nav-tabs-custom .active a").attr('data-mytabmac')
- highlightedCss = nodeData.data.mac == selectedNodeMac ? " highlightedNode" : "";
+ highlightedCss = nodeData.data.mac == selectedNodeMac ? " highlightedNode" : "";
- return result = `\
- ${devicePort} ${deviceIcon}
- ${nodeData.data.name}\
-
- ${collapseExpandHtml}
-
`;
- },
+
+ ${devicePort} ${deviceIcon}
+ ${nodeData.data.name}
+
+ ${collapseExpandHtml}
+
+ `;
+ },
- onNodeClick: nodeData => {
- console.log(this)
- },
+ onNodeClick: nodeData => {
+ console.log(this)
+ },
mainAxisNodeSpacing: 'auto',
// mainAxisNodeSpacing: 3,
secondaryAxisNodeSpacing: 0.3,
- nodeHeight: nodeHeight.toString(),
+ nodeHeight: nodeHeight.toString(),
marginTop: '5',
hasZoom: false,
hasPan: false,
// marginLeft: '15',
idKey: "id",
- hasFlatData: false,
+ hasFlatData: false,
linkWidth: (nodeData) => 3,
linkColor: (nodeData) => "#ffcc80",
onNodeClick: (nodeData) => handleNodeClick(nodeData),
- relationnalField: "children",
+ relationnalField: "children",
});
-
console.log(myHierarchy)
-
-
- myTree.refresh(myHierarchy);
+
+ myTree.refresh(myHierarchy);
}
// ---------------------------------------------------------------------------