From ecf40e1525c07ca029d4a5ff8d4c251707d7cccd Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 25 Jun 2020 11:00:25 -0400 Subject: [PATCH] Add/update device component templates --- netbox/templates/dcim/consoleport.html | 95 +++++++++++++++++ netbox/templates/dcim/consoleserverport.html | 95 +++++++++++++++++ netbox/templates/dcim/device_component.html | 39 +++++++ netbox/templates/dcim/devicebay.html | 62 +++++++++++ netbox/templates/dcim/frontport.html | 83 +++++++++++++++ netbox/templates/dcim/interface.html | 79 ++++---------- netbox/templates/dcim/poweroutlet.html | 103 +++++++++++++++++++ netbox/templates/dcim/powerport.html | 103 +++++++++++++++++++ netbox/templates/dcim/rearport.html | 77 ++++++++++++++ 9 files changed, 679 insertions(+), 57 deletions(-) create mode 100644 netbox/templates/dcim/consoleport.html create mode 100644 netbox/templates/dcim/consoleserverport.html create mode 100644 netbox/templates/dcim/device_component.html create mode 100644 netbox/templates/dcim/devicebay.html create mode 100644 netbox/templates/dcim/frontport.html create mode 100644 netbox/templates/dcim/poweroutlet.html create mode 100644 netbox/templates/dcim/powerport.html create mode 100644 netbox/templates/dcim/rearport.html diff --git a/netbox/templates/dcim/consoleport.html b/netbox/templates/dcim/consoleport.html new file mode 100644 index 000000000..f1f2c4c1c --- /dev/null +++ b/netbox/templates/dcim/consoleport.html @@ -0,0 +1,95 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Console Port +
+ + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Description{{ instance.description|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + {% if instance.connected_endpoint %} + + + + + + + + + + + + + + + + + {% endif %} + + + + + + + + +
Device + {{ instance.connected_endpoint.device }} +
Name + {{ instance.connected_endpoint.name }} +
Type{{ instance.connected_endpoint.get_type_display|placeholder }}
Description{{ instance.connected_endpoint.description|placeholder }}
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.connection_status %} + {{ instance.get_connection_status_display }} + {% else %} + {{ instance.get_connection_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/consoleserverport.html b/netbox/templates/dcim/consoleserverport.html new file mode 100644 index 000000000..8d7ca0b43 --- /dev/null +++ b/netbox/templates/dcim/consoleserverport.html @@ -0,0 +1,95 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Console Server Port +
+ + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Description{{ instance.description|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + {% if instance.connected_endpoint %} + + + + + + + + + + + + + + + + + {% endif %} + + + + + + + + +
Device + {{ instance.connected_endpoint.device }} +
Name + {{ instance.connected_endpoint.name }} +
Type{{ instance.connected_endpoint.get_type_display|placeholder }}
Description{{ instance.connected_endpoint.description|placeholder }}
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.connection_status %} + {{ instance.get_connection_status_display }} + {% else %} + {{ instance.get_connection_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/device_component.html b/netbox/templates/dcim/device_component.html new file mode 100644 index 000000000..d2a1ad660 --- /dev/null +++ b/netbox/templates/dcim/device_component.html @@ -0,0 +1,39 @@ +{% extends 'base.html' %} +{% load helpers %} +{% load perms %} + +{% block header %} +
+ +
+
+ {% if request.user|can_change:instance %} + + Edit + + {% endif %} + {% if request.user|can_delete:instance %} + + Delete + + {% endif %} +
+

{% block title %}{{ instance.device }} / {{ instance }}{% endblock %}

+ +{% endblock %} diff --git a/netbox/templates/dcim/devicebay.html b/netbox/templates/dcim/devicebay.html new file mode 100644 index 000000000..b257cd471 --- /dev/null +++ b/netbox/templates/dcim/devicebay.html @@ -0,0 +1,62 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Device Bay +
+ + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Description{{ instance.description|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Installed Device +
+ {% if instance.installed_device %} + {% with device=instance.installed_device %} + + + + + + + + + +
Device + {{ device }} +
Device Type{{ device.device_type }}
+ {% endwith %} + {% else %} +
+ None +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/frontport.html b/netbox/templates/dcim/frontport.html new file mode 100644 index 000000000..33ce03eb8 --- /dev/null +++ b/netbox/templates/dcim/frontport.html @@ -0,0 +1,83 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Front Port +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Rear Port + {{ instance.rear_port }} +
Rear Port Position{{ instance.rear_port_position }}
Description{{ instance.description|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + + + + + + + + +
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.cable.status %} + {{ instance.cable.get_status_display }} + {% else %} + {{ instance.cable.get_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 5165169ff..b3163c413 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -1,41 +1,6 @@ -{% extends 'base.html' %} +{% extends 'dcim/device_component.html' %} {% load helpers %} -{% block header %} -
-
- -
-
-
- {% if perms.dcim.change_interface %} - - Edit - - {% endif %} - {% if perms.dcim.delete_interface %} - - Delete - - {% endif %} -
-

{% block title %}{{ interface.device }} / {{ interface.name }}{% endblock %}

- -{% endblock %} - {% block content %}
@@ -47,25 +12,25 @@ Device - {{ interface.device }} + {{ instance.device }} Name - {{ interface.name }} + {{ instance.name }} Label - {{ interface.label|placeholder }} + {{ instance.label|placeholder }} Type - {{ interface.get_type_display }} + {{ instance.get_type_display }} Enabled - {% if interface.enabled %} + {% if instance.enabled %} {% else %} @@ -75,8 +40,8 @@ LAG - {% if interface.lag%} - {{ interface.lag }} + {% if instance.lag%} + {{ instance.lag }} {% else %} None {% endif %} @@ -84,31 +49,31 @@ Description - {{ interface.description|placeholder }} + {{ instance.description|placeholder }} MTU - {{ interface.mtu|placeholder }} + {{ instance.mtu|placeholder }} MAC Address - {{ interface.mac_address|placeholder }} + {{ instance.mac_address|placeholder }} 802.1Q Mode - {{ interface.get_mode_display }} + {{ instance.get_mode_display }}
- {% include 'extras/inc/tags_panel.html' with tags=interface.tags.all %} + {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
- {% if interface.is_connectable %} + {% if instance.is_connectable %}
Connection
- {% if interface.cable %} + {% if instance.cable %} {% if connected_interface %} @@ -182,8 +147,8 @@ @@ -191,10 +156,10 @@ @@ -206,7 +171,7 @@ {% endif %} {% endif %} - {% if interface.is_lag %} + {% if instance.is_lag %}
LAG Members
Cable - {{ interface.cable }} - + {{ instance.cable }} +
Connection Status - {% if interface.connection_status %} - {{ interface.get_connection_status_display }} + {% if instance.connection_status %} + {{ instance.get_connection_status_display }} {% else %} - {{ interface.get_connection_status_display }} + {{ instance.get_connection_status_display }} {% endif %}
@@ -218,7 +183,7 @@ - {% for member in interface.member_interfaces.all %} + {% for member in instance.member_interfaces.all %}
{{ member.device }} diff --git a/netbox/templates/dcim/poweroutlet.html b/netbox/templates/dcim/poweroutlet.html new file mode 100644 index 000000000..519bd01df --- /dev/null +++ b/netbox/templates/dcim/poweroutlet.html @@ -0,0 +1,103 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Power Outlet +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Description{{ instance.description|placeholder }}
Power Port{{ instance.power_port }}
Feed Leg{{ instance.get_feed_leg_display }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + {% if instance.connected_endpoint %} + + + + + + + + + + + + + + + + + {% endif %} + + + + + + + + +
Device + {{ instance.connected_endpoint.device }} +
Name + {{ instance.connected_endpoint.name }} +
Type{{ instance.connected_endpoint.get_type_display|placeholder }}
Description{{ instance.connected_endpoint.description|placeholder }}
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.connection_status %} + {{ instance.get_connection_status_display }} + {% else %} + {{ instance.get_connection_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/powerport.html b/netbox/templates/dcim/powerport.html new file mode 100644 index 000000000..e7c103c9d --- /dev/null +++ b/netbox/templates/dcim/powerport.html @@ -0,0 +1,103 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Power Port +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Description{{ instance.description|placeholder }}
Maximum Draw{{ instance.maximum_draw|placeholder }}
Allocated Draw{{ instance.allocated_draw|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + {% if instance.connected_endpoint %} + + + + + + + + + + + + + + + + + {% endif %} + + + + + + + + +
Device + {{ instance.connected_endpoint.device }} +
Name + {{ instance.connected_endpoint.name }} +
Type{{ instance.connected_endpoint.get_type_display|placeholder }}
Description{{ instance.connected_endpoint.description|placeholder }}
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.connection_status %} + {{ instance.get_connection_status_display }} + {% else %} + {{ instance.get_connection_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %} diff --git a/netbox/templates/dcim/rearport.html b/netbox/templates/dcim/rearport.html new file mode 100644 index 000000000..480f26d2c --- /dev/null +++ b/netbox/templates/dcim/rearport.html @@ -0,0 +1,77 @@ +{% extends 'dcim/device_component.html' %} +{% load helpers %} + +{% block content %} +
+
+
+
+ Rear Port +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Device + {{ instance.device }} +
Name{{ instance.name }}
Label{{ instance.label|placeholder }}
Type{{ instance.get_type_display }}
Positions{{ instance.positions }}
Description{{ instance.description|placeholder }}
+
+ {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} +
+
+
+
+ Connection +
+ {% if instance.cable %} + + + + + + + + + +
Cable + {{ instance.cable }} + + + +
Connection Status + {% if instance.cable.status %} + {{ instance.cable.get_status_display }} + {% else %} + {{ instance.cable.get_status_display }} + {% endif %} +
+ {% else %} +
+ Not connected +
+ {% endif %} +
+
+
+{% endblock %}