From efe9d33cdc52fd6be6c6417ea13279fed769acad Mon Sep 17 00:00:00 2001 From: Alexander Haase Date: Sat, 19 Jul 2025 18:01:10 +0200 Subject: [PATCH 1/2] Remove navigation button colors To ensure consistency with the updated NetBox v4 design, the colors of the plugin menu buttons have been removed. --- netbox_routing/navigation/bgp.py | 13 ++++++------- netbox_routing/navigation/eigrp.py | 11 +++++------ netbox_routing/navigation/objects.py | 9 ++++----- netbox_routing/navigation/ospf.py | 11 ++++------- netbox_routing/navigation/static.py | 4 +--- 5 files changed, 20 insertions(+), 28 deletions(-) diff --git a/netbox_routing/navigation/bgp.py b/netbox_routing/navigation/bgp.py index 6539641..2b2ea87 100644 --- a/netbox_routing/navigation/bgp.py +++ b/netbox_routing/navigation/bgp.py @@ -1,4 +1,3 @@ -from netbox.choices import ButtonColorChoices as ColorChoices from netbox.plugins import PluginMenuItem, PluginMenuButton @@ -16,8 +15,8 @@ link_text='BGP Router', permissions=['netbox_routing.view_bgprouter'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgprouter_add', 'Add', COL_ADD, ColorChoices.GREEN), - # PluginMenuButton('plugins:netbox_routing:bgprouter_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:bgprouter_add', 'Add', COL_ADD), + # PluginMenuButton('plugins:netbox_routing:bgprouter_bulk_import', 'Import', COL_IMPORT), ) ) @@ -27,8 +26,8 @@ link_text='BGP Scope', permissions=['netbox_routing.view_bgpscope'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgpscope_add', 'Add', COL_ADD, ColorChoices.GREEN), - # PluginMenuButton('plugins:netbox_routing:bgpscope_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:bgpscope_add', 'Add', COL_ADD), + # PluginMenuButton('plugins:netbox_routing:bgpscope_bulk_import', 'Import', COL_IMPORT), ) ) @@ -38,8 +37,8 @@ link_text='BGP Address Family', permissions=['netbox_routing.view_bgpaddressfamily'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgpaddressfamily_add', 'Add', COL_ADD, ColorChoices.GREEN), - # PluginMenuButton('plugins:netbox_routing:bgpaf_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:bgpaddressfamily_add', 'Add', COL_ADD), + # PluginMenuButton('plugins:netbox_routing:bgpaf_bulk_import', 'Import', COL_IMPORT), ) ) diff --git a/netbox_routing/navigation/eigrp.py b/netbox_routing/navigation/eigrp.py index 34ebd5d..97c848f 100644 --- a/netbox_routing/navigation/eigrp.py +++ b/netbox_routing/navigation/eigrp.py @@ -1,4 +1,3 @@ -from netbox.choices import ButtonColorChoices as ColorChoices from netbox.plugins import PluginMenuItem, PluginMenuButton @@ -16,8 +15,8 @@ link_text='Routers', permissions=['netbox_routing.view_eigrprouter'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrprouter_add', 'Add', COL_ADD, ColorChoices.GREEN), - PluginMenuButton('plugins:netbox_routing:eigrprouter_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:eigrprouter_add', 'Add', COL_ADD), + PluginMenuButton('plugins:netbox_routing:eigrprouter_bulk_import', 'Import', COL_IMPORT), ) ) address_families = PluginMenuItem( @@ -25,7 +24,7 @@ link_text='Address Families', permissions=['netbox_routing.view_eigrpaddressfamily'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpaddressfamily_add', 'Add', COL_ADD, ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:eigrpaddressfamily_add', 'Add', COL_ADD), ) ) networks = PluginMenuItem( @@ -33,7 +32,7 @@ link_text='Networks', permissions=['netbox_routing.view_eigrpnetwork'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpnetwork_add', 'Add', COL_ADD, ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:eigrpnetwork_add', 'Add', COL_ADD), ) ) interfaces = PluginMenuItem( @@ -41,7 +40,7 @@ link_text='Interfaces', permissions=['netbox_routing.view_eigrpinterface'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpinterface_add', 'Add', COL_ADD, ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:eigrpinterface_add', 'Add', COL_ADD), ) ) diff --git a/netbox_routing/navigation/objects.py b/netbox_routing/navigation/objects.py index aa9edf2..78f3185 100644 --- a/netbox_routing/navigation/objects.py +++ b/netbox_routing/navigation/objects.py @@ -1,4 +1,3 @@ -from netbox.choices import ButtonColorChoices as ColorChoices from netbox.plugins import PluginMenuButton, PluginMenuItem @@ -16,8 +15,8 @@ link_text='Prefix Lists', permissions=['netbox_routing.view_prefixlist'], buttons=( - PluginMenuButton('plugins:netbox_routing:prefixlist_add', 'Add', COL_ADD, ColorChoices.GREEN), - PluginMenuButton('plugins:netbox_routing:prefixlist_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:prefixlist_add', 'Add', COL_ADD), + PluginMenuButton('plugins:netbox_routing:prefixlist_bulk_import', 'Import', COL_IMPORT), ) ) routemap = PluginMenuItem( @@ -25,8 +24,8 @@ link_text='Route Maps', permissions=['netbox_routing.view_routemap'], buttons=( - PluginMenuButton('plugins:netbox_routing:routemap_add', 'Add', COL_ADD, ColorChoices.GREEN), - PluginMenuButton('plugins:netbox_routing:routemap_bulk_import', 'Import', COL_IMPORT, ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:routemap_add', 'Add', COL_ADD), + PluginMenuButton('plugins:netbox_routing:routemap_bulk_import', 'Import', COL_IMPORT), ) ) diff --git a/netbox_routing/navigation/ospf.py b/netbox_routing/navigation/ospf.py index d7e4332..0ddb695 100644 --- a/netbox_routing/navigation/ospf.py +++ b/netbox_routing/navigation/ospf.py @@ -1,4 +1,3 @@ -from netbox.choices import ButtonColorChoices as ColorChoices from netbox.plugins import PluginMenuItem, PluginMenuButton @@ -12,12 +11,11 @@ link_text='Instances', permissions=['netbox_routing.view_ospfinstance'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfinstance_add', 'Add', 'mdi mdi-plus', ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:ospfinstance_add', 'Add', 'mdi mdi-plus'), PluginMenuButton( 'plugins:netbox_routing:ospfinstance_bulk_import', 'Import', 'mdi mdi-upload', - ColorChoices.CYAN ), ) ) @@ -26,8 +24,8 @@ link_text='Areas', permissions=['netbox_routing.view_ospfarea'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfarea_add', 'Add', 'mdi mdi-plus', ColorChoices.GREEN), - PluginMenuButton('plugins:netbox_routing:ospfarea_bulk_import', 'Import', 'mdi mdi-upload', ColorChoices.CYAN), + PluginMenuButton('plugins:netbox_routing:ospfarea_add', 'Add', 'mdi mdi-plus'), + PluginMenuButton('plugins:netbox_routing:ospfarea_bulk_import', 'Import', 'mdi mdi-upload'), ) ) ospf_interfaces = PluginMenuItem( @@ -35,12 +33,11 @@ link_text='Interfaces', permissions=['netbox_routing.view_ospfinterface'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfinterface_add', 'Add', 'mdi mdi-plus', ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:ospfinterface_add', 'Add', 'mdi mdi-plus'), PluginMenuButton( 'plugins:netbox_routing:ospfinterface_bulk_import', 'Import', 'mdi mdi-upload', - ColorChoices.CYAN ), ) ) diff --git a/netbox_routing/navigation/static.py b/netbox_routing/navigation/static.py index f5e9013..47c275e 100644 --- a/netbox_routing/navigation/static.py +++ b/netbox_routing/navigation/static.py @@ -1,4 +1,3 @@ -from netbox.choices import ButtonColorChoices as ColorChoices from netbox.plugins import PluginMenuItem, PluginMenuButton __all__ = ( @@ -10,12 +9,11 @@ link_text='Static Route', permissions=['netbox_routing.view_staticroute'], buttons=( - PluginMenuButton('plugins:netbox_routing:staticroute_add', 'Add', 'mdi mdi-plus', ColorChoices.GREEN), + PluginMenuButton('plugins:netbox_routing:staticroute_add', 'Add', 'mdi mdi-plus'), # PluginMenuButton( # 'plugins:netbox_routing:staticroute_bulk_import', # 'Import', # 'mdi mdi-upload', - # ColorChoices.CYAN # ), ) From 0108d86215cace6cc910c1f437747a7e693d0c50 Mon Sep 17 00:00:00 2001 From: Alexander Haase Date: Sat, 19 Jul 2025 18:24:26 +0200 Subject: [PATCH 2/2] Add permissions for menu buttons --- netbox_routing/navigation/bgp.py | 21 ++++++++++++-- netbox_routing/navigation/eigrp.py | 35 +++++++++++++++++++---- netbox_routing/navigation/objects.py | 28 ++++++++++++++++--- netbox_routing/navigation/ospf.py | 42 +++++++++++++++++++++------- netbox_routing/navigation/static.py | 7 ++++- 5 files changed, 110 insertions(+), 23 deletions(-) diff --git a/netbox_routing/navigation/bgp.py b/netbox_routing/navigation/bgp.py index 2b2ea87..9816cd1 100644 --- a/netbox_routing/navigation/bgp.py +++ b/netbox_routing/navigation/bgp.py @@ -15,7 +15,12 @@ link_text='BGP Router', permissions=['netbox_routing.view_bgprouter'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgprouter_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:bgprouter_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_bgprouter'], + ), # PluginMenuButton('plugins:netbox_routing:bgprouter_bulk_import', 'Import', COL_IMPORT), ) ) @@ -26,7 +31,12 @@ link_text='BGP Scope', permissions=['netbox_routing.view_bgpscope'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgpscope_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:bgpscope_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_bgpscope'], + ), # PluginMenuButton('plugins:netbox_routing:bgpscope_bulk_import', 'Import', COL_IMPORT), ) ) @@ -37,7 +47,12 @@ link_text='BGP Address Family', permissions=['netbox_routing.view_bgpaddressfamily'], buttons=( - PluginMenuButton('plugins:netbox_routing:bgpaddressfamily_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:bgpaddressfamily_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_bgpaddressfamily'], + ), # PluginMenuButton('plugins:netbox_routing:bgpaf_bulk_import', 'Import', COL_IMPORT), ) ) diff --git a/netbox_routing/navigation/eigrp.py b/netbox_routing/navigation/eigrp.py index 97c848f..a658934 100644 --- a/netbox_routing/navigation/eigrp.py +++ b/netbox_routing/navigation/eigrp.py @@ -15,8 +15,18 @@ link_text='Routers', permissions=['netbox_routing.view_eigrprouter'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrprouter_add', 'Add', COL_ADD), - PluginMenuButton('plugins:netbox_routing:eigrprouter_bulk_import', 'Import', COL_IMPORT), + PluginMenuButton( + link='plugins:netbox_routing:eigrprouter_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_eigrprouter'], + ), + PluginMenuButton( + link='plugins:netbox_routing:eigrprouter_bulk_import', + title='Import', + icon_class=COL_IMPORT, + permissions=['netbox_routing.add_eigrprouter'], + ), ) ) address_families = PluginMenuItem( @@ -24,7 +34,12 @@ link_text='Address Families', permissions=['netbox_routing.view_eigrpaddressfamily'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpaddressfamily_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:eigrpaddressfamily_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_eigrpaddressfamily'], + ), ) ) networks = PluginMenuItem( @@ -32,7 +47,12 @@ link_text='Networks', permissions=['netbox_routing.view_eigrpnetwork'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpnetwork_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:eigrpnetwork_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_eigrpnetwork'], + ), ) ) interfaces = PluginMenuItem( @@ -40,7 +60,12 @@ link_text='Interfaces', permissions=['netbox_routing.view_eigrpinterface'], buttons=( - PluginMenuButton('plugins:netbox_routing:eigrpinterface_add', 'Add', COL_ADD), + PluginMenuButton( + link='plugins:netbox_routing:eigrpinterface_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_eigrpinterface'], + ), ) ) diff --git a/netbox_routing/navigation/objects.py b/netbox_routing/navigation/objects.py index 78f3185..bf6420c 100644 --- a/netbox_routing/navigation/objects.py +++ b/netbox_routing/navigation/objects.py @@ -15,8 +15,18 @@ link_text='Prefix Lists', permissions=['netbox_routing.view_prefixlist'], buttons=( - PluginMenuButton('plugins:netbox_routing:prefixlist_add', 'Add', COL_ADD), - PluginMenuButton('plugins:netbox_routing:prefixlist_bulk_import', 'Import', COL_IMPORT), + PluginMenuButton( + link='plugins:netbox_routing:prefixlist_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_prefixlist'], + ), + PluginMenuButton( + link='plugins:netbox_routing:prefixlist_bulk_import', + title='Import', + icon_class=COL_IMPORT, + permissions=['netbox_routing.add_prefixlist'], + ), ) ) routemap = PluginMenuItem( @@ -24,8 +34,18 @@ link_text='Route Maps', permissions=['netbox_routing.view_routemap'], buttons=( - PluginMenuButton('plugins:netbox_routing:routemap_add', 'Add', COL_ADD), - PluginMenuButton('plugins:netbox_routing:routemap_bulk_import', 'Import', COL_IMPORT), + PluginMenuButton( + link='plugins:netbox_routing:routemap_add', + title='Add', + icon_class=COL_ADD, + permissions=['netbox_routing.add_routemap'], + ), + PluginMenuButton( + link='plugins:netbox_routing:routemap_bulk_import', + title='Import', + icon_class=COL_IMPORT, + permissions=['netbox_routing.add_routemap'], + ), ) ) diff --git a/netbox_routing/navigation/ospf.py b/netbox_routing/navigation/ospf.py index 0ddb695..0a2f75e 100644 --- a/netbox_routing/navigation/ospf.py +++ b/netbox_routing/navigation/ospf.py @@ -11,11 +11,17 @@ link_text='Instances', permissions=['netbox_routing.view_ospfinstance'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfinstance_add', 'Add', 'mdi mdi-plus'), PluginMenuButton( - 'plugins:netbox_routing:ospfinstance_bulk_import', - 'Import', - 'mdi mdi-upload', + link='plugins:netbox_routing:ospfinstance_add', + title='Add', + icon_class='mdi mdi-plus', + permissions=['netbox_routing.add_ospfinstance'], + ), + PluginMenuButton( + link='plugins:netbox_routing:ospfinstance_bulk_import', + title='Import', + icon_class='mdi mdi-upload', + permissions=['netbox_routing.add_ospfinstance'], ), ) ) @@ -24,8 +30,18 @@ link_text='Areas', permissions=['netbox_routing.view_ospfarea'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfarea_add', 'Add', 'mdi mdi-plus'), - PluginMenuButton('plugins:netbox_routing:ospfarea_bulk_import', 'Import', 'mdi mdi-upload'), + PluginMenuButton( + link='plugins:netbox_routing:ospfarea_add', + title='Add', + icon_class='mdi mdi-plus', + permissions=['netbox_routing.add_ospfarea'], + ), + PluginMenuButton( + link='plugins:netbox_routing:ospfarea_bulk_import', + title='Import', + icon_class='mdi mdi-upload', + permissions=['netbox_routing.add_ospfarea'], + ), ) ) ospf_interfaces = PluginMenuItem( @@ -33,11 +49,17 @@ link_text='Interfaces', permissions=['netbox_routing.view_ospfinterface'], buttons=( - PluginMenuButton('plugins:netbox_routing:ospfinterface_add', 'Add', 'mdi mdi-plus'), PluginMenuButton( - 'plugins:netbox_routing:ospfinterface_bulk_import', - 'Import', - 'mdi mdi-upload', + link='plugins:netbox_routing:ospfinterface_add', + title='Add', + icon_class='mdi mdi-plus', + permissions=['netbox_routing.add_ospfinterface'], + ), + PluginMenuButton( + link='plugins:netbox_routing:ospfinterface_bulk_import', + title='Import', + icon_class='mdi mdi-upload', + permissions=['netbox_routing.add_ospfinterface'], ), ) ) diff --git a/netbox_routing/navigation/static.py b/netbox_routing/navigation/static.py index 47c275e..f7a0a30 100644 --- a/netbox_routing/navigation/static.py +++ b/netbox_routing/navigation/static.py @@ -9,7 +9,12 @@ link_text='Static Route', permissions=['netbox_routing.view_staticroute'], buttons=( - PluginMenuButton('plugins:netbox_routing:staticroute_add', 'Add', 'mdi mdi-plus'), + PluginMenuButton( + link='plugins:netbox_routing:staticroute_add', + title='Add', + icon_class='mdi mdi-plus', + permissions=['netbox_routing.add_staticroute'], + ), # PluginMenuButton( # 'plugins:netbox_routing:staticroute_bulk_import', # 'Import',