inet-henge icon indicating copy to clipboard operation
inet-henge copied to clipboard

Group nodes base on meta

Open adriaand007 opened this issue 5 years ago • 5 comments

Hi Awsome project Would it be posible to group nodes base on meta of the node

    { "name": "192.168.3.63", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.35.72", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.18.78", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.18.79", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.35.71", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.35.120", "icon": "./images/server.png", "meta": { "grouping": "GRP1" } },
    { "name": "192.168.32.142", "icon": "./images/server.png", "meta": { "grouping": "GRP2" } },
    { "name": "192.168.3.177", "icon": "./images/server.png", "meta": { "grouping": "GRP2" } },
    { "name": "192.168.3.176", "icon": "./images/server.png", "meta": { "grouping": "GRP2" } },
    { "name": "192.168.3.175", "icon": "./images/server.png", "meta": { "grouping": "GRP2" } },

Thank you

adriaand007 avatar Jul 03 '19 09:07 adriaand007

Hi, it could be done but not supported for now. Let me try. (or your PR would be greatly appreciated)

codeout avatar Jul 03 '19 10:07 codeout

Hi I'm no java developer but instead of using the options.pop regex to dfine grouping Maybe used the meta tag or tags as grouping. in src/node.js you already hanle the meta data surely you could then use it in the grouping like options.group_pattern = node.meta

adriaand007 avatar Jul 03 '19 12:07 adriaand007

Just pushed a newer version. Cloud you try it with the data below?

    { "name": "192.168.3.63", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.35.72", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.18.78", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.18.79", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.35.71", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.35.120", "icon": "./images/server.png", "group": "GRP1" },
    { "name": "192.168.32.142", "icon": "./images/server.png", "group": "GRP2" },
    { "name": "192.168.3.177", "icon": "./images/server.png", "group": "GRP2" },
    { "name": "192.168.3.176", "icon": "./images/server.png", "group": "GRP2" },
    { "name": "192.168.3.175", "icon": "./images/server.png", "group": "GRP2" },

image

We use meta especially for labeling and not good for grouping. Please use group instead.

Ref: https://github.com/codeout/inet-henge/#internal-groups

codeout avatar Jul 07 '19 14:07 codeout

Hi How do you get the icons scattered Mine is all in line ... image

Below is some of my code

adriaand007 avatar Jul 10 '19 18:07 adriaand007

Scattered manually. That inline layout is the initial state before calculation. If you add some links, inet-henge calculates them before rendering and diagram should be different.

codeout avatar Jul 11 '19 01:07 codeout