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

Fixes #2579: Add missing cable disconnect buttons for front/rear ports

Jeremy Stretch 7 лет назад
Родитель
Сommit
3bbf4a3352

+ 1 - 0
CHANGELOG.md

@@ -48,6 +48,7 @@ NetBox now supports modeling physical cables for console, power, and interface c
 * [#2572](https://github.com/digitalocean/netbox/issues/2572) - Add button to disconnect cable from circuit termination
 * [#2573](https://github.com/digitalocean/netbox/issues/2573) - Fix bulk console/power/interface disconnections
 * [#2574](https://github.com/digitalocean/netbox/issues/2574) - Remove duplicate interface links from topology maps
+* [#2579](https://github.com/digitalocean/netbox/issues/2579) - Add missing cable disconnect buttons for front/rear ports
 
 ## API Changes
 

+ 1 - 1
netbox/templates/dcim/inc/consoleport.html

@@ -31,7 +31,7 @@
     {# Actions #}
     <td class="text-right">
         {% if perms.dcim.change_consoleport %}
-            {% if cp.connected_endpoint %}
+            {% if cp.cable %}
                 {% if cp.connection_status %}
                     <a href="#" class="btn btn-warning btn-xs consoleport-toggle connected" title="Mark planned" data="{{ cp.pk }}">
                         <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>

+ 5 - 1
netbox/templates/dcim/inc/frontport.html

@@ -30,7 +30,11 @@
 
     {# Actions #}
     <td class="text-right">
-        {% if perms.dcim.add_cable %}
+        {% if frontport.cable and perms.dcim.delete_cable %}
+            <a href="{% url 'dcim:cable_delete' pk=frontport.cable.pk %}" title="Remove cable" class="btn btn-danger btn-xs">
+                <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
+            </a>
+        {% elif not frontport.cable and perms.dcim.add_cable %}
             <a href="{% url 'dcim:frontport_connect' termination_a_id=frontport.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-success btn-xs" title="Connect">
                 <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
             </a>

+ 1 - 1
netbox/templates/dcim/inc/powerport.html

@@ -31,7 +31,7 @@
     {# Actions #}
     <td class="text-right">
         {% if perms.dcim.change_powerport %}
-            {% if pp.connected_endpoint %}
+            {% if pp.cable %}
                 {% if pp.connection_status %}
                     <a href="#" class="btn btn-warning btn-xs powerport-toggle connected" title="Mark planned" data="{{ pp.pk }}">
                         <i class="glyphicon glyphicon-ban-circle" aria-hidden="true"></i>

+ 5 - 1
netbox/templates/dcim/inc/rearport.html

@@ -29,7 +29,11 @@
 
     {# Actions #}
     <td class="text-right">
-        {% if perms.dcim.add_cable %}
+        {% if rearport.cable and perms.dcim.delete_cable %}
+            <a href="{% url 'dcim:cable_delete' pk=rearport.cable.pk %}" title="Remove cable" class="btn btn-danger btn-xs">
+                <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
+            </a>
+        {% elif not rearport.cable and perms.dcim.add_cable %}
             <a href="{% url 'dcim:rearport_connect' termination_a_id=rearport.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-success btn-xs" title="Connect">
                 <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
             </a>