nextbox-ui-plugin
nextbox-ui-plugin copied to clipboard
Select Layer in Topology Viewer doesn't work properly
After few attempts of debugging, I found the root cause. The problem is in file https://github.com/iDebugAll/nextbox-ui-plugin/blob/c5c893e9333c17c151fa30c926efdf6263cab596/nextbox_ui_plugin/static/nextbox_ui_plugin/next_app.js#L316
showHideDevicesByTag = function(deviceTag, isVisible) {
topologyData['nodes'].forEach(function(node){
if (node['tags'].length < 1) {
return;
};
node['tags'].forEach(function(tag){
if (tag == deviceTag) {
topo.graph().getVertex(node['id']).visible(isVisible);
return;
};
});
});
};
this function is to add items in graph indicated by layer selector ticker, it also removes items when unselected, the problem scenario can be produced by:
- create 3 new device X,Y,Z, X has tag A, Y has tag A + B, Z device has tag B.
- select device tag A, it will show X and Y.
- add select device tag B, it will show X, Y and Z.
- unselect tag B, it will remove Y and Z, which is wrong, it should only remove Z as Y has both A and B.
If there's no easy fix, I'd suggest leave all checkbox unchecked by default, and let user to add their desired items, because every action of unchecking a checkbox has a chance to remove wrong items.