iDebugAll / nextbox-ui-plugin

A topology visualization plugin for Netbox powered by NextUI Toolkit
MIT License
468 stars 60 forks source link

New icons #79

Open aruhri opened 2 years ago

aruhri commented 2 years ago

I would appreciate, if there were more available icons like

or in other words is there a possibility to enhace the iconset by config?

richardmeilinger commented 2 years ago

You can register custom icons at the plugin.

1) Clone the repo as described here

https://github.com/iDebugAll/nextbox-ui-plugin#package-installation-from-source-code

2) Download icon to nextbox-ui-plugin/nextbox_ui_plugin/static/nextbox_ui_plugin/img

3) Modify nextbox-ui-plugin/nextbox_ui_plugin/static/nextbox_ui_plugin/next_app.js

topo.registerIcon("dead_node", "/static/nextbox_ui_plugin/img/dead_node.png", 49, 49);
topo.registerIcon("server", "/static/nextbox_ui_plugin/img/server.png", 35, 35);

3) reinstall the plugin

pip3 install /opt/netbox/nextbox-ui-plugin/
python3 netbox/manage.py collectstatic --no-input

4) Edit netbox config netbox/netbox/configuration.py

PLUGINS_CONFIG = {
    'nextbox_ui_plugin': {
#        'layers_sort_order': (
#            ADD YOUR SETTINGS HERE
#            layer_sort_order is a tuple
#        ),
#        'icon_model_map': {
#            ADD YOUR SETTINGS HERE
#            icon_model_map is a dict
#        },
        'icon_role_map': {
#            ADD YOUR SETTINGS HERE
#            icon_role_map is a dict
             'firewall': 'dead_node',
             'server': 'server',
       },
#        'undisplayed_device_role_slugs': (
# #          ADD YOUR SETTINGS HERE
#            undisplayed_device_role_slugs value is a list or a tuple
#            Listed device role slugs are hidden on initial view load,
#            you may then hide/display any layer with a control button.
#        ),
#        'undisplayed_device_tags': (
#           ADD YOUR SETTINGS HERE
#           undisplayed_device_tags value is a list or a tuple of regex strings.
#           Devices with tags matching any of listed regular expressions are hidden
#           on initial view load, you may then hide/display any layer with a control button.
#        ),
#        'select_layers_list_include_device_tags': (
#           ADD YOUR SETTINGS HERE
#           select_layers_list_include_device_tags value is a list or a tuple of regex strings.
#           Use this parameter to control tags listed in Select Layers menu.
#           If specified, it works as allow list.
#        ),
#        'select_layers_list_exclude_device_tags': (
#           ADD YOUR SETTINGS HERE
#           select_layers_list_exclude_device_tags value is a list or a tuple of regex strings.
#           Use this parameter to control tags listed in Select Layers menu.
#           If specified, it filters out matched tags from the list, except ones mathcing 'undisplayed_device_tags'.
#        ),
#        'DISPLAY_PASSIVE_DEVICES': True|False,
         'DISPLAY_PASSIVE_DEVICES': True,
#        'DISPLAY_LOGICAL_MULTICABLE_LINKS': True|False,
#        'DISPLAY_UNCONNECTED': True|False,
#        'INITIAL_LAYOUT': 'vertical'|'horizontal'|'auto'
         'INITIAL_LAYOUT': 'auto'
    }
}

5) Restart Netbox Service

6) Now it should display a custom icon

image