Pārlūkot izejas kodu

Closes #5942: Add button to add a new IP address on interface view

Jeremy Stretch 5 gadi atpakaļ
vecāks
revīzija
358d7ac562

+ 2 - 0
docs/release-notes/version-2.10.md

@@ -7,6 +7,8 @@
 * [#5592](https://github.com/netbox-community/netbox/issues/5592) - Add IP addresses count to VRF view
 * [#5630](https://github.com/netbox-community/netbox/issues/5630) - Add QSFP+ (64GFC) FibreChannel Interface option
 * [#5884](https://github.com/netbox-community/netbox/issues/5884) - Enable custom links for device components
+* [#5914](https://github.com/netbox-community/netbox/issues/5914) - Add edit/delete buttons for IP addresses on interface view
+* [#5942](https://github.com/netbox-community/netbox/issues/5942) - Add button to add a new IP address on interface view
 
 ### Bug Fixes
 

+ 18 - 1
netbox/templates/dcim/interface.html

@@ -1,6 +1,7 @@
 {% extends 'dcim/device_component.html' %}
 {% load helpers %}
 {% load plugins %}
+{% load render_table from django_tables2 %}
 
 {% block content %}
     <div class="row">
@@ -226,7 +227,23 @@
     </div>
     <div class="row">
         <div class="col-md-12">
-            {% include 'panel_table.html' with table=ipaddress_table heading="IP Addresses" %}
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>IP Addresses</strong>
+                </div>
+                {% if ipaddress_table.rows %}
+                    {% render_table ipaddress_table 'inc/table.html' %}
+                {% else %}
+                    <div class="panel-body text-muted">None</div>
+                {% endif %}
+                {% if perms.ipam.add_ipaddress %}
+                    <div class="panel-footer text-right noprint">
+                        <a href="{% url 'ipam:ipaddress_add' %}?device={{ object.device.pk }}&interface={{ object.pk }}" class="btn btn-xs btn-primary">
+                            <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add IP Address
+                        </a>
+                    </div>
+                {% endif %}
+            </div>
         </div>
     </div>
     <div class="row">

+ 18 - 1
netbox/templates/virtualization/vminterface.html

@@ -1,6 +1,7 @@
 {% extends 'base.html' %}
 {% load helpers %}
 {% load plugins %}
+{% load render_table from django_tables2 %}
 
 {% block header %}
     <div class="row noprint">
@@ -93,7 +94,23 @@
 </div>
 <div class="row">
     <div class="col-md-12">
-        {% include 'panel_table.html' with table=ipaddress_table heading="IP Addresses" %}
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                <strong>IP Addresses</strong>
+            </div>
+            {% if ipaddress_table.rows %}
+                {% render_table ipaddress_table 'inc/table.html' %}
+            {% else %}
+                <div class="panel-body text-muted">None</div>
+            {% endif %}
+            {% if perms.ipam.add_ipaddress %}
+                <div class="panel-footer text-right noprint">
+                    <a href="{% url 'ipam:ipaddress_add' %}?virtual_machine={{ object.virtual_machine.pk }}&vminterface={{ object.pk }}" class="btn btn-xs btn-primary">
+                        <span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add IP Address
+                    </a>
+                </div>
+            {% endif %}
+        </div>
     </div>
 </div>
 <div class="row">