diff --git a/front/network.php b/front/network.php index ee850b85..00b132b9 100755 --- a/front/network.php +++ b/front/network.php @@ -502,7 +502,8 @@ // --------------------------------------------------------------------------- var leafNodesCount = 0; - var treeLoadedAlready = false; + var visibleNodesCount = 0; + var parentNodesCount = 0; var hiddenMacs = []; // hidden children var hiddenChildren = []; @@ -519,17 +520,24 @@ { //... of the current node if(list[i].parentMac == node.mac && !hiddenMacs.includes(list[i].parentMac)) - { + { + visibleNodesCount++ + // and process them children.push(getChildren(list[i], list, path + ((path == "") ? "" : '|') + list[i].parentMac, hiddenMacs)) + } } // note the total number of leaf nodes to calculate the font scaling - if(!treeLoadedAlready && children.length == 0) + if(children.length == 0) { leafNodesCount++ - } + } else + { + parentNodesCount++ + } + return { name: node.name, @@ -602,10 +610,17 @@ // --------------------------------------------------------------------------- var myTree; var treeAreaHeight = 600; + var emSize; + var nodeHeight; + function initTree(myHierarchy) { - // to prevent font scaling everytime we collapse/expand a subtree - treeLoadedAlready = true; + // calculate the font size of the leaf nodes to fit everything into the tree area + leafNodesCount == 0 ? 1 : leafNodesCount; + emSize = ((600/(20*leafNodesCount)).toFixed(2)); + emSize = emSize > 1 ? 1 : emSize; + + nodeHeight = ((emSize*100*0.30).toFixed(0)) $("#networkTree").attr('style', "height:"+treeAreaHeight+"px; width:1070px") @@ -613,17 +628,11 @@ htmlId: "networkTree", renderNode: nodeData => { + var fontSize = "font-size:"+emSize+"em;"; - // calculate the font size of the leaf nodes to fit everything into the tree area - leafNodesCount == 0 ? 1 : leafNodesCount; - emSize = ((600/(20*leafNodesCount)).toFixed(2)); - emSize = emSize > 1 ? 1 : emSize; - - var fontSize = (nodeData.data.hasChildren) ? "" : "font-size:"+emSize+"em;"; - - deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ? "
/home/pi/pialert/front/api/ folder and thus on the pialert_url/api/File_name` url.',
+'ENABLE_API_description' => 'If enabled the app will start publishing and updating simple API endpoints under the /home/pi/pialert/front/api/ folder and thus on the pialert_url/api/File_name url.',
'API_RUN_name' => 'Scheduling updates',
'API_RUN_description' => 'Scheduling settings to specify when the API endpoints should be updated. If set to schedule then endpoints will be updated on a specified cron-like schedule specified by the API_RUN_SCHD setting. Otherwise if set to interval endpoints will be updated every N seconds specified by the API_RUN_INTERVAL setting.',
'API_RUN_SCHD_name' => 'Schedule',