nextbox-ui-plugin icon indicating copy to clipboard operation
nextbox-ui-plugin copied to clipboard

Select Layer in Topology Viewer doesn't work properly

Open chz8494 opened this issue 4 years ago • 1 comments

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:

  1. create 3 new device X,Y,Z, X has tag A, Y has tag A + B, Z device has tag B.
  2. select device tag A, it will show X and Y.
  3. add select device tag B, it will show X, Y and Z.
  4. unselect tag B, it will remove Y and Z, which is wrong, it should only remove Z as Y has both A and B.

chz8494 avatar Aug 04 '21 21:08 chz8494

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.

chz8494 avatar Aug 05 '21 17:08 chz8494