From a0836b6876f94ef596f02277323bf2c9017968a8 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 28 Dec 2021 11:06:34 -0500 Subject: [PATCH] Add inventory items panel to device component views --- netbox/templates/dcim/consoleport.html | 159 +++++++++--------- netbox/templates/dcim/consoleserverport.html | 1 + netbox/templates/dcim/frontport.html | 1 + .../dcim/inc/panels/inventory_items.html | 59 +++++++ netbox/templates/dcim/interface.html | 1 + netbox/templates/dcim/poweroutlet.html | 1 + netbox/templates/dcim/powerport.html | 1 + netbox/templates/dcim/rearport.html | 1 + 8 files changed, 145 insertions(+), 79 deletions(-) create mode 100644 netbox/templates/dcim/inc/panels/inventory_items.html diff --git a/netbox/templates/dcim/consoleport.html b/netbox/templates/dcim/consoleport.html index 38cfb90ae..ed3c649dd 100644 --- a/netbox/templates/dcim/consoleport.html +++ b/netbox/templates/dcim/consoleport.html @@ -58,91 +58,92 @@
{% if object.mark_connected %} - Marked as connected + Marked as connected {% elif object.cable %} - - - - - - {% if object.connected_endpoint %} +
Cable - {{ object.cable }} - - - -
- + - - - - - - - - - - - - - - - - - {% endif %} -
DeviceCable - {{ object.connected_endpoint.device }} + {{ object.cable }} + + +
Name - {{ object.connected_endpoint.name }} -
Type{{ object.connected_endpoint.get_type_display|placeholder }}
Description{{ object.connected_endpoint.description|placeholder }}
Path Status - {% if object.path.is_active %} - Reachable - {% else %} - Not Reachable - {% endif %} -
- {% else %} -
- Not Connected - {% if perms.dcim.add_cable %} - - {% endif %} -
- {% endif %} -
+ {% if object.connected_endpoint %} + + Device + + {{ object.connected_endpoint.device }} + + + + Name + + {{ object.connected_endpoint.name }} + + + + Type + {{ object.connected_endpoint.get_type_display|placeholder }} + + + Description + {{ object.connected_endpoint.description|placeholder }} + + + Path Status + + {% if object.path.is_active %} + Reachable + {% else %} + Not Reachable + {% endif %} + + + {% endif %} + + {% else %} +
+ Not Connected + {% if perms.dcim.add_cable %} + + {% endif %} +
+ {% endif %} + + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/consoleserverport.html b/netbox/templates/dcim/consoleserverport.html index b44c4a9b8..b64e352e7 100644 --- a/netbox/templates/dcim/consoleserverport.html +++ b/netbox/templates/dcim/consoleserverport.html @@ -143,6 +143,7 @@ {% endif %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/frontport.html b/netbox/templates/dcim/frontport.html index 05be82fc9..e11036f8a 100644 --- a/netbox/templates/dcim/frontport.html +++ b/netbox/templates/dcim/frontport.html @@ -129,6 +129,7 @@ {% endif %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/inc/panels/inventory_items.html b/netbox/templates/dcim/inc/panels/inventory_items.html new file mode 100644 index 000000000..c65b342b2 --- /dev/null +++ b/netbox/templates/dcim/inc/panels/inventory_items.html @@ -0,0 +1,59 @@ +{% load helpers %} + +
+
Inventory Items
+
+ + + + + + + + + + + {% for item in object.inventory_items.all %} + + + + + + + {% empty %} + + + + {% endfor %} + +
NameLabelRole
+ {{ item.name }} + + {{ item.label|placeholder }} + + {% if item.role %} + {{ item.role }} + {% else %} + + {% endif %} + + {% if perms.dcim.change_inventoryitem %} + + + + {% endif %} + {% if perms.ipam.delete_inventoryitem %} + + + + {% endif %} +
None
+
+ +
diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index bd0569c39..a8b8da5cb 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -448,6 +448,7 @@ {% endif %} {% include 'ipam/inc/panels/fhrp_groups.html' %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/poweroutlet.html b/netbox/templates/dcim/poweroutlet.html index 3f2c469af..90858c8d9 100644 --- a/netbox/templates/dcim/poweroutlet.html +++ b/netbox/templates/dcim/poweroutlet.html @@ -121,6 +121,7 @@ {% endif %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/powerport.html b/netbox/templates/dcim/powerport.html index f38edec8e..1ee85b6ba 100644 --- a/netbox/templates/dcim/powerport.html +++ b/netbox/templates/dcim/powerport.html @@ -131,6 +131,7 @@ {% endif %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/rearport.html b/netbox/templates/dcim/rearport.html index 311ccd7ff..c56bf0c4f 100644 --- a/netbox/templates/dcim/rearport.html +++ b/netbox/templates/dcim/rearport.html @@ -117,6 +117,7 @@ {% endif %} + {% include 'dcim/inc/panels/inventory_items.html' %} {% plugin_right_page object %}