1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add plugin buttons & content to device component views

This commit is contained in:
Jeremy Stretch
2020-06-25 13:27:01 -04:00
parent 103a44991a
commit 5aa2a6eefe
9 changed files with 272 additions and 206 deletions

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -34,6 +35,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -90,6 +92,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -34,6 +35,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -90,6 +92,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% load helpers %} {% load helpers %}
{% load perms %} {% load perms %}
{% load plugins %}
{% block header %} {% block header %}
<div class="row noprint"> <div class="row noprint">
@ -14,6 +15,7 @@
</div> </div>
</div> </div>
<div class="pull-right noprint"> <div class="pull-right noprint">
{% plugin_buttons instance %}
{% if request.user|can_change:instance %} {% if request.user|can_change:instance %}
<a href="{% url instance|url_name:"edit" pk=instance.pk %}" class="btn btn-warning"> <a href="{% url instance|url_name:"edit" pk=instance.pk %}" class="btn btn-warning">
<span class="fa fa-pencil" aria-hidden="true"></span> Edit <span class="fa fa-pencil" aria-hidden="true"></span> Edit

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -30,6 +31,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -57,6 +59,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -44,6 +45,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -78,6 +80,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,219 +1,227 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<strong>Interface</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>Enabled</td>
<td>
{% 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>
{% endif %}
</td>
</tr>
<tr>
<td>LAG</td>
<td>
{% if instance.lag%}
<a href="{{ instance.lag.get_absolute_url }}">{{ instance.lag }}</a>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<td>Description</td>
<td>{{ instance.description|placeholder }} </td>
</tr>
<tr>
<td>MTU</td>
<td>{{ instance.mtu|placeholder }}</td>
</tr>
<tr>
<td>MAC Address</td>
<td><span class="text-monospace">{{ instance.mac_address|placeholder }}</span></td>
</tr>
<tr>
<td>802.1Q Mode</td>
<td>{{ instance.get_mode_display }}</td>
</tr>
</table>
</div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
</div>
<div class="col-md-6">
{% if instance.is_connectable %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<strong>Connection</strong> <strong>Interface</strong>
</div> </div>
{% if instance.cable %} <table class="table table-hover panel-body attr-table">
<table class="table table-hover panel-body attr-table"> <tr>
{% if connected_interface %} <td>Device</td>
<tr> <td>
<td>Device</td> <a href="{{ instance.device.get_absolute_url }}">{{ instance.device }}</a>
<td> </td>
<a href="{{ connected_interface.device.get_absolute_url }}">{{ connected_interface.device }}</a> </tr>
</td> <tr>
</tr> <td>Name</td>
<tr> <td>{{ instance.name }}</td>
<td>Name</td> </tr>
<td> <tr>
<a href="{{ connected_interface.get_absolute_url }}">{{ connected_interface.name }}</a> <td>Label</td>
</td> <td>{{ instance.label|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>Type</td> <td>Type</td>
<td>{{ connected_interface.get_type_display }}</td> <td>{{ instance.get_type_display }}</td>
</tr> </tr>
<tr> <tr>
<td>Enabled</td> <td>Enabled</td>
<td> <td>
{% if connected_interface.enabled %} {% if instance.enabled %}
<span class="text-success"><i class="fa fa-check"></i></span> <span class="text-success"><i class="fa fa-check"></i></span>
{% else %} {% else %}
<span class="text-danger"><i class="fa fa-close"></i></span> <span class="text-danger"><i class="fa fa-close"></i></span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>LAG</td> <td>LAG</td>
<td> <td>
{% if connected_interface.lag%} {% if instance.lag%}
<a href="{{ connected_interface.lag.get_absolute_url }}">{{ connected_interface.lag }}</a> <a href="{{ instance.lag.get_absolute_url }}">{{ instance.lag }}</a>
{% else %} {% else %}
<span class="text-muted">None</span> <span class="text-muted">None</span>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Description</td> <td>Description</td>
<td>{{ connected_interface.description|placeholder }}</td> <td>{{ instance.description|placeholder }} </td>
</tr> </tr>
<tr> <tr>
<td>MTU</td> <td>MTU</td>
<td>{{ connected_interface.mtu|placeholder }}</td> <td>{{ instance.mtu|placeholder }}</td>
</tr> </tr>
<tr> <tr>
<td>MAC Address</td> <td>MAC Address</td>
<td>{{ connected_interface.mac_address|placeholder }}</td> <td><span class="text-monospace">{{ instance.mac_address|placeholder }}</span></td>
</tr> </tr>
<tr> <tr>
<td>802.1Q Mode</td> <td>802.1Q Mode</td>
<td>{{ connected_interface.get_mode_display }}</td> <td>{{ instance.get_mode_display }}</td>
</tr> </tr>
{% elif connected_circuittermination %}
{% with ct=connected_circuittermination %}
<tr>
<td>Provider</td>
<td><a href="{{ ct.circuit.provider.get_absolute_url }}">{{ ct.circuit.provider }}</a></td>
</tr>
<tr>
<td>Circuit</td>
<td><a href="{{ ct.circuit.get_absolute_url }}">{{ ct.circuit }}</a></td>
</tr>
<tr>
<td>Side</td>
<td>{{ ct.term_side }}</td>
</tr>
{% endwith %}
{% endif %}
<tr>
<td>Cable</td>
<td>
<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>
</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>
{% endif %}
{% 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">
<thead>
<tr>
<th>Parent</th>
<th>Interface</th>
<th>Type</th>
</tr>
</thead>
<tbody>
{% for member in instance.member_interfaces.all %}
<tr>
<td>
<a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a>
</td>
<td>
<a href="{{ member.get_absolute_url }}">{{ member }}</a>
</td>
<td>
{{ member.get_type_display }}
</td>
</tr>
{% empty %}
<tr>
<td colspan="3" class="text-muted">No member interfaces</td>
</tr>
{% endfor %}
</tbody>
</table> </table>
</div> </div>
{% endif %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div>
<div class="col-md-6">
{% if instance.is_connectable %}
<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 connected_interface %}
<tr>
<td>Device</td>
<td>
<a href="{{ connected_interface.device.get_absolute_url }}">{{ connected_interface.device }}</a>
</td>
</tr>
<tr>
<td>Name</td>
<td>
<a href="{{ connected_interface.get_absolute_url }}">{{ connected_interface.name }}</a>
</td>
</tr>
<tr>
<td>Type</td>
<td>{{ connected_interface.get_type_display }}</td>
</tr>
<tr>
<td>Enabled</td>
<td>
{% if connected_interface.enabled %}
<span class="text-success"><i class="fa fa-check"></i></span>
{% else %}
<span class="text-danger"><i class="fa fa-close"></i></span>
{% endif %}
</td>
</tr>
<tr>
<td>LAG</td>
<td>
{% if connected_interface.lag%}
<a href="{{ connected_interface.lag.get_absolute_url }}">{{ connected_interface.lag }}</a>
{% else %}
<span class="text-muted">None</span>
{% endif %}
</td>
</tr>
<tr>
<td>Description</td>
<td>{{ connected_interface.description|placeholder }}</td>
</tr>
<tr>
<td>MTU</td>
<td>{{ connected_interface.mtu|placeholder }}</td>
</tr>
<tr>
<td>MAC Address</td>
<td>{{ connected_interface.mac_address|placeholder }}</td>
</tr>
<tr>
<td>802.1Q Mode</td>
<td>{{ connected_interface.get_mode_display }}</td>
</tr>
{% elif connected_circuittermination %}
{% with ct=connected_circuittermination %}
<tr>
<td>Provider</td>
<td><a href="{{ ct.circuit.provider.get_absolute_url }}">{{ ct.circuit.provider }}</a></td>
</tr>
<tr>
<td>Circuit</td>
<td><a href="{{ ct.circuit.get_absolute_url }}">{{ ct.circuit }}</a></td>
</tr>
<tr>
<td>Side</td>
<td>{{ ct.term_side }}</td>
</tr>
{% endwith %}
{% endif %}
<tr>
<td>Cable</td>
<td>
<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>
</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>
{% endif %}
{% 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">
<thead>
<tr>
<th>Parent</th>
<th>Interface</th>
<th>Type</th>
</tr>
</thead>
<tbody>
{% for member in instance.member_interfaces.all %}
<tr>
<td>
<a href="{{ member.device.get_absolute_url }}">{{ member.device }}</a>
</td>
<td>
<a href="{{ member.get_absolute_url }}">{{ member }}</a>
</td>
<td>
{{ member.get_type_display }}
</td>
</tr>
{% empty %}
<tr>
<td colspan="3" class="text-muted">No member interfaces</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% plugin_right_page device %}
</div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-md-12">
<div class="col-md-12"> {% include 'panel_table.html' with table=ipaddress_table heading="IP Addresses" %}
{% include 'panel_table.html' with table=ipaddress_table heading="IP Addresses" %} </div>
</div> </div>
</div> <div class="row">
<div class="row"> <div class="col-md-12">
<div class="col-md-12"> {% include 'panel_table.html' with table=vlan_table heading="VLANs" %}
{% include 'panel_table.html' with table=vlan_table heading="VLANs" %} </div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div>
</div> </div>
</div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -42,6 +43,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -98,6 +100,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -42,6 +43,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -98,6 +100,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% extends 'dcim/device_component.html' %} {% extends 'dcim/device_component.html' %}
{% load helpers %} {% load helpers %}
{% load plugins %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
@ -38,6 +39,7 @@
</table> </table>
</div> </div>
{% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %} {% include 'extras/inc/tags_panel.html' with tags=instance.tags.all %}
{% plugin_left_page instance %}
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
@ -72,6 +74,12 @@
</div> </div>
{% endif %} {% endif %}
</div> </div>
{% plugin_right_page instance %}
</div>
</div>
<div class="row">
<div class="col-md-12">
{% plugin_full_width_page instance %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}