codeout / inet-henge

Generate d3.js based Network Diagram from JSON data.
MIT License
258 stars 38 forks source link

Different meta in popup for different devices #23

Closed marhyno closed 3 years ago

marhyno commented 3 years ago

Is there a way to display different meta for different Nodes ? E.g. I have two nodes, one is router one is switch, both have different meta but I dont want to write all meta in Diagram init.

{
  "name": "Router",
  "meta": {
    "name": "router1",
    "hostname": "test",
    "tenant-ip": "123456,
    "admin-ip": "1.1.1.1",
    "loopback-ip": "2.2.2.2",
    "serial-number": "897564SDWQ",
    "ios-version": "16.12.2s",
    "software-type": "ios-xe",
    "hypervisor-hostname": "ESX123",
    "hypervisor-ip": "10.10.10.10",
    etc...
  },
  "icon": "../images/ios-xe.png"
},
{
  "name": "Switch",
  "group": "POD1",
  "meta": {
    "capabilities": "",
    "childAction": "",
    "clientEvent": "assigned",
    "configIssues": "",
etc...
  },
  "icon": "../images/nexus9k.png"
},
codeout commented 3 years ago

No, but undefined or blank string meta will be omitted even if you call init() like this:

diagram.init(
  'name',
  'hostname',
  'tenant-ip',
  'admin-ip',
  'loopback-ip',
  'serial-number',
  'ios-version',
  'software-type',
  'hypervisor-hostname',
  'hypervisor-ip',

  'capabilities',
  'childAction',
  'clientEvent',
  'configIssues',
);

image

image