Просмотр исходного кода

Add/update device component templates

Jeremy Stretch 5 лет назад
Родитель
Сommit
ecf40e1525

+ 95 - 0
netbox/templates/dcim/consoleport.html

@@ -0,0 +1,95 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Console Port</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        {% if instance.connected_endpoint %}
+                            <tr>
+                                <td>Device</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Name</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Type</td>
+                                <td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td>
+                            </tr>
+                            <tr>
+                                <td>Description</td>
+                                <td>{{ instance.connected_endpoint.description|placeholder }}</td>
+                            </tr>
+                        {% endif %}
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:consoleport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.connection_status %}
+                                    <span class="label label-success">{{ instance.get_connection_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.get_connection_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 95 - 0
netbox/templates/dcim/consoleserverport.html

@@ -0,0 +1,95 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Console Server Port</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        {% if instance.connected_endpoint %}
+                            <tr>
+                                <td>Device</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Name</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Type</td>
+                                <td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td>
+                            </tr>
+                            <tr>
+                                <td>Description</td>
+                                <td>{{ instance.connected_endpoint.description|placeholder }}</td>
+                            </tr>
+                        {% endif %}
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:consoleserverport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.connection_status %}
+                                    <span class="label label-success">{{ instance.get_connection_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.get_connection_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 39 - 0
netbox/templates/dcim/device_component.html

@@ -0,0 +1,39 @@
+{% extends 'base.html' %}
+{% load helpers %}
+{% load perms %}
+
+{% block header %}
+    <div class="row noprint">
+        <div class="col-md-12">
+            <ol class="breadcrumb">
+                <li><a href="{% url 'dcim:device_list' %}">Devices</a></li>
+                <li><a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a></li>
+                <li><a href="{% url instance|url_name:"list" %}?device_id={{ instance.device.pk }}">{{ instance|meta:"verbose_name_plural"|bettertitle }}</a></li>
+                <li>{{ instance }}</li>
+            </ol>
+        </div>
+    </div>
+    <div class="pull-right noprint">
+        {% if request.user|can_change:instance %}
+            <a href="{% url instance|url_name:"edit" pk=instance.pk %}" class="btn btn-warning">
+                <span class="fa fa-pencil" aria-hidden="true"></span> Edit
+            </a>
+        {% endif %}
+        {% if request.user|can_delete:instance %}
+            <a href="{% url instance|url_name:"delete" pk=instance.pk %}" class="btn btn-danger">
+                <span class="fa fa-trash" aria-hidden="true"></span> Delete
+            </a>
+        {% endif %}
+    </div>
+    <h1>{% block title %}{{ instance.device }} / {{ instance }}{% endblock %}</h1>
+    <ul class="nav nav-tabs">
+        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
+            <a href="{{ instance.get_absolute_url }}">{{ instance|meta:"verbose_name"|bettertitle }}</a>
+        </li>
+        {% if perms.extras.view_objectchange %}
+            <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
+                <a href="{% url instance|url_name:"changelog" pk=instance.pk %}">Change Log</a>
+            </li>
+        {% endif %}
+    </ul>
+{% endblock %}

+ 62 - 0
netbox/templates/dcim/devicebay.html

@@ -0,0 +1,62 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Device Bay</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Installed Device</strong>
+                </div>
+                {% if instance.installed_device %}
+                    {% with device=instance.installed_device %}
+                        <table class="table table-hover panel-body attr-table">
+                            <tr>
+                                <td>Device</td>
+                                <td>
+                                    <a href="{{ device.get_absolute_url }}">{{ device }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Device Type</td>
+                                <td>{{ device.device_type }}</td>
+                            </tr>
+                        </table>
+                    {% endwith %}
+                {% else %}
+                    <div class="panel-body text-muted">
+                        None
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 83 - 0
netbox/templates/dcim/frontport.html

@@ -0,0 +1,83 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Front Port</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Rear Port</td>
+                        <td>
+                            <a href="{{ instance.rear_port.get_absolute_url }}">{{ instance.rear_port }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Rear Port Position</td>
+                        <td>{{ instance.rear_port_position }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:frontport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.cable.status %}
+                                    <span class="label label-success">{{ instance.cable.get_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.cable.get_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 22 - 57
netbox/templates/dcim/interface.html

@@ -1,41 +1,6 @@
-{% extends 'base.html' %}
+{% extends 'dcim/device_component.html' %}
 {% load helpers %}
 
-{% block header %}
-    <div class="row noprint">
-        <div class="col-md-12">
-            <ol class="breadcrumb">
-                <li><a href="{% url 'dcim:device_list' %}">Devices</a></li>
-                <li><a href="{{ interface.device.get_absolute_url }}">{{ interface.device }}</a></li>
-                <li>{{ interface }}</li>
-            </ol>
-        </div>
-    </div>
-    <div class="pull-right noprint">
-        {% if perms.dcim.change_interface %}
-            <a href="{% url 'dcim:interface_edit' pk=interface.pk %}" class="btn btn-warning">
-                <span class="fa fa-pencil" aria-hidden="true"></span> Edit
-            </a>
-        {% endif %}
-        {% if perms.dcim.delete_interface %}
-            <a href="{% url 'dcim:interface_delete' pk=interface.pk %}" class="btn btn-danger">
-                <span class="fa fa-trash" aria-hidden="true"></span> Delete
-            </a>
-        {% endif %}
-    </div>
-    <h1>{% block title %}{{ interface.device }} / {{ interface.name }}{% endblock %}</h1>
-    <ul class="nav nav-tabs">
-        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
-            <a href="{{ interface.get_absolute_url }}">Interface</a>
-        </li>
-        {% if perms.extras.view_objectchange %}
-            <li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
-                <a href="{% url 'dcim:interface_changelog' pk=interface.pk %}">Change Log</a>
-            </li>
-        {% endif %}
-    </ul>
-{% endblock %}
-
 {% block content %}
 <div class="row">
 	<div class="col-md-6">
@@ -47,25 +12,25 @@
                 <tr>
                     <td>Device</td>
                     <td>
-                        <a href="{{ interface.device.get_absolute_url }}">{{ interface.device }}</a>
+                        <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
                     </td>
                 </tr>
                 <tr>
                     <td>Name</td>
-                    <td>{{ interface.name }}</td>
+                    <td>{{ instance.name }}</td>
                 </tr>
                 <tr>
                     <td>Label</td>
-                    <td>{{ interface.label|placeholder }}</td>
+                    <td>{{ instance.label|placeholder }}</td>
                 </tr>
                 <tr>
                     <td>Type</td>
-                    <td>{{ interface.get_type_display }}</td>
+                    <td>{{ instance.get_type_display }}</td>
                 </tr>
                 <tr>
                     <td>Enabled</td>
                     <td>
-                        {% if interface.enabled %}
+                        {% if instance.enabled %}
                             <span class="text-success"><i class="fa fa-check"></i></span>
                         {% else %}
                             <span class="text-danger"><i class="fa fa-close"></i></span>
@@ -75,8 +40,8 @@
                 <tr>
                     <td>LAG</td>
                     <td>
-                        {% if interface.lag%}
-                            <a href="{{ interface.lag.get_absolute_url }}">{{ interface.lag }}</a>
+                        {% if instance.lag%}
+                            <a href="{{ instance.lag.get_absolute_url }}">{{ instance.lag }}</a>
                         {% else %}
                             <span class="text-muted">None</span>
                         {% endif %}
@@ -84,31 +49,31 @@
                 </tr>
                 <tr>
                     <td>Description</td>
-                    <td>{{ interface.description|placeholder }} </td>
+                    <td>{{ instance.description|placeholder }} </td>
                 </tr>
                 <tr>
                     <td>MTU</td>
-                    <td>{{ interface.mtu|placeholder }}</td>
+                    <td>{{ instance.mtu|placeholder }}</td>
                 </tr>
                 <tr>
                     <td>MAC Address</td>
-                    <td><span class="text-monospace">{{ interface.mac_address|placeholder }}</span></td>
+                    <td><span class="text-monospace">{{ instance.mac_address|placeholder }}</span></td>
                 </tr>
                 <tr>
                     <td>802.1Q Mode</td>
-                    <td>{{ interface.get_mode_display }}</td>
+                    <td>{{ instance.get_mode_display }}</td>
                 </tr>
             </table>
         </div>
-        {% include 'extras/inc/tags_panel.html' with tags=interface.tags.all %}
+        {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
     </div>
 	<div class="col-md-6">
-        {% if interface.is_connectable %}
+        {% if instance.is_connectable %}
             <div class="panel panel-default">
                 <div class="panel-heading">
                     <strong>Connection</strong>
                 </div>
-                {% if interface.cable %}
+                {% if instance.cable %}
                     <table class="table table-hover panel-body attr-table">
                         {% if connected_interface %}
                             <tr>
@@ -182,8 +147,8 @@
                         <tr>
                             <td>Cable</td>
                             <td>
-                                <a href="{{ interface.cable.get_absolute_url }}">{{ interface.cable }}</a>
-                                <a href="{% url 'dcim:interface_trace' pk=interface.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:interface_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
                                     <i class="fa fa-share-alt" aria-hidden="true"></i>
                                 </a>
                             </td>
@@ -191,10 +156,10 @@
                         <tr>
                             <td>Connection Status</td>
                             <td>
-                                {% if interface.connection_status %}
-                                    <span class="label label-success">{{ interface.get_connection_status_display }}</span>
+                                {% if instance.connection_status %}
+                                    <span class="label label-success">{{ instance.get_connection_status_display }}</span>
                                 {% else %}
-                                    <span class="label label-info">{{ interface.get_connection_status_display }}</span>
+                                    <span class="label label-info">{{ instance.get_connection_status_display }}</span>
                                 {% endif %}
                             </td>
                         </tr>
@@ -206,7 +171,7 @@
                 {% endif %}
             </div>
         {% endif %}
-        {% if interface.is_lag %}
+        {% if instance.is_lag %}
             <div class="panel panel-default">
                 <div class="panel-heading"><strong>LAG Members</strong></div>
                 <table class="table table-hover table-headings panel-body">
@@ -218,7 +183,7 @@
                         </tr>
                     </thead>
                     <tbody>
-                        {% for member in interface.member_interfaces.all %}
+                        {% for member in instance.member_interfaces.all %}
                             <tr>
                                 <td>
                                     <a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a>

+ 103 - 0
netbox/templates/dcim/poweroutlet.html

@@ -0,0 +1,103 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Power Outlet</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Power Port</td>
+                        <td>{{ instance.power_port }}</td>
+                    </tr>
+                    <tr>
+                        <td>Feed Leg</td>
+                        <td>{{ instance.get_feed_leg_display }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        {% if instance.connected_endpoint %}
+                            <tr>
+                                <td>Device</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Name</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Type</td>
+                                <td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td>
+                            </tr>
+                            <tr>
+                                <td>Description</td>
+                                <td>{{ instance.connected_endpoint.description|placeholder }}</td>
+                            </tr>
+                        {% endif %}
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:poweroutlet_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.connection_status %}
+                                    <span class="label label-success">{{ instance.get_connection_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.get_connection_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 103 - 0
netbox/templates/dcim/powerport.html

@@ -0,0 +1,103 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Power Port</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Maximum Draw</td>
+                        <td>{{ instance.maximum_draw|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Allocated Draw</td>
+                        <td>{{ instance.allocated_draw|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        {% if instance.connected_endpoint %}
+                            <tr>
+                                <td>Device</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.device.get_absolute_url }}">{{ instance.connected_endpoint.device }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Name</td>
+                                <td>
+                                    <a href="{{ instance.connected_endpoint.get_absolute_url }}">{{ instance.connected_endpoint.name }}</a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>Type</td>
+                                <td>{{ instance.connected_endpoint.get_type_display|placeholder }}</td>
+                            </tr>
+                            <tr>
+                                <td>Description</td>
+                                <td>{{ instance.connected_endpoint.description|placeholder }}</td>
+                            </tr>
+                        {% endif %}
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:powerport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.connection_status %}
+                                    <span class="label label-success">{{ instance.get_connection_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.get_connection_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}

+ 77 - 0
netbox/templates/dcim/rearport.html

@@ -0,0 +1,77 @@
+{% extends 'dcim/device_component.html' %}
+{% load helpers %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Rear Port</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Device</td>
+                        <td>
+                            <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ instance.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Label</td>
+                        <td>{{ instance.label|placeholder }}</td>
+                    </tr>
+                    <tr>
+                        <td>Type</td>
+                        <td>{{ instance.get_type_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>Positions</td>
+                        <td>{{ instance.positions }}</td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>{{ instance.description|placeholder }}</td>
+                    </tr>
+                </table>
+            </div>
+            {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Connection</strong>
+                </div>
+                {% if instance.cable %}
+                    <table class="table table-hover panel-body attr-table">
+                        <tr>
+                            <td>Cable</td>
+                            <td>
+                                <a href="{{ instance.cable.get_absolute_url }}">{{ instance.cable }}</a>
+                                <a href="{% url 'dcim:rearport_trace' pk=instance.pk %}" class="btn btn-primary btn-xs" title="Trace">
+                                    <i class="fa fa-share-alt" aria-hidden="true"></i>
+                                </a>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>Connection Status</td>
+                            <td>
+                                {% if instance.cable.status %}
+                                    <span class="label label-success">{{ instance.cable.get_status_display }}</span>
+                                {% else %}
+                                    <span class="label label-info">{{ instance.cable.get_status_display }}</span>
+                                {% endif %}
+                            </td>
+                        </tr>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">
+                        Not connected
+                    </div>
+                {% endif %}
+            </div>
+        </div>
+    </div>
+{% endblock %}