#424 work - network page
This commit is contained in:
@@ -471,6 +471,10 @@
|
|||||||
|
|
||||||
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
setCache('devicesListNew', JSON.stringify(devicesListnew))
|
||||||
|
|
||||||
|
// init global variable
|
||||||
|
deviceListGlobal = devicesListnew;
|
||||||
|
|
||||||
|
|
||||||
// create tree
|
// create tree
|
||||||
initTree(getHierarchy());
|
initTree(getHierarchy());
|
||||||
|
|
||||||
@@ -484,20 +488,6 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Tree functionality
|
// Tree functionality
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
function getDevicesList()
|
|
||||||
{
|
|
||||||
// Read cache
|
|
||||||
devicesList = getCache('devicesListNew');
|
|
||||||
|
|
||||||
if (devicesList != '') {
|
|
||||||
devicesList = JSON.parse (devicesList);
|
|
||||||
} else {
|
|
||||||
devicesList = [];
|
|
||||||
}
|
|
||||||
return devicesList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
var leafNodesCount = 0;
|
var leafNodesCount = 0;
|
||||||
@@ -505,6 +495,7 @@
|
|||||||
var parentNodesCount = 0;
|
var parentNodesCount = 0;
|
||||||
var hiddenMacs = []; // hidden children
|
var hiddenMacs = []; // hidden children
|
||||||
var hiddenChildren = [];
|
var hiddenChildren = [];
|
||||||
|
var deviceListGlobal = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -559,14 +550,12 @@
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getHierarchy()
|
function getHierarchy()
|
||||||
{
|
{
|
||||||
list = getDevicesList();
|
for(i in deviceListGlobal)
|
||||||
|
|
||||||
for(i in list)
|
|
||||||
{
|
{
|
||||||
if(list[i].mac == 'Internet')
|
if(deviceListGlobal[i].mac == 'Internet')
|
||||||
{
|
{
|
||||||
return (getChildren(list[i], list, ''))
|
return (getChildren(deviceListGlobal[i], deviceListGlobal, ''))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -587,8 +576,6 @@
|
|||||||
removeItemFromArray(hiddenMacs, parentMac)
|
removeItemFromArray(hiddenMacs, parentMac)
|
||||||
}
|
}
|
||||||
|
|
||||||
list = getDevicesList();
|
|
||||||
|
|
||||||
// updatedTree = myHierarchy;
|
// updatedTree = myHierarchy;
|
||||||
updatedTree = getHierarchy()
|
updatedTree = getHierarchy()
|
||||||
|
|
||||||
@@ -638,6 +625,8 @@
|
|||||||
|
|
||||||
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`)
|
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`)
|
||||||
|
|
||||||
|
console.log('here')
|
||||||
|
|
||||||
myTree = Treeviz.create({
|
myTree = Treeviz.create({
|
||||||
htmlId: "networkTree",
|
htmlId: "networkTree",
|
||||||
|
|
||||||
@@ -689,6 +678,10 @@
|
|||||||
onNodeClick: (nodeData) => handleNodeClick(nodeData),
|
onNodeClick: (nodeData) => handleNodeClick(nodeData),
|
||||||
relationnalField: "children",
|
relationnalField: "children",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('vvvv')
|
||||||
|
console.log(myHierarchy)
|
||||||
|
console.log('^^^^^^^')
|
||||||
|
|
||||||
myTree.refresh(myHierarchy);
|
myTree.refresh(myHierarchy);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user