From e1f06ec862041045c050adc2a325f92d9a4060d2 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 18 Feb 2022 10:09:51 -0500 Subject: [PATCH] Enable adding inventory items to components from device component list views --- netbox/dcim/tables/template_code.py | 50 ++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/netbox/dcim/tables/template_code.py b/netbox/dcim/tables/template_code.py index c575cf884..89d04c35d 100644 --- a/netbox/dcim/tables/template_code.py +++ b/netbox/dcim/tables/template_code.py @@ -112,6 +112,11 @@ MODULAR_COMPONENT_TEMPLATE_BUTTONS = """ # CONSOLEPORT_BUTTONS = """ +{% if perms.dcim.add_inventoryitem %} + + + +{% endif %} {% if record.cable %} {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %} @@ -139,6 +144,11 @@ CONSOLEPORT_BUTTONS = """ """ CONSOLESERVERPORT_BUTTONS = """ +{% if perms.dcim.add_inventoryitem %} + + + +{% endif %} {% if record.cable %} {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %} @@ -166,6 +176,11 @@ CONSOLESERVERPORT_BUTTONS = """ """ POWERPORT_BUTTONS = """ +{% if perms.dcim.add_inventoryitem %} + + + +{% endif %} {% if record.cable %} {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %} @@ -192,6 +207,11 @@ POWERPORT_BUTTONS = """ """ POWEROUTLET_BUTTONS = """ +{% if perms.dcim.add_inventoryitem %} + + + +{% endif %} {% if record.cable %} {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %} @@ -214,10 +234,20 @@ POWEROUTLET_BUTTONS = """ """ INTERFACE_BUTTONS = """ -{% if perms.ipam.add_ipaddress %} - - - +{% if perms.ipam.add_ipaddress or perms.dcim.add_inventoryitem %} + + + + {% endif %} {% if record.link %} @@ -240,7 +270,7 @@ INTERFACE_BUTTONS = """ {% if not record.mark_connected %} -