Browse Source

Hide/disable NAPALM tabs as appropriate

Jeremy Stretch 7 years ago
parent
commit
a45bfaf3da
1 changed files with 10 additions and 4 deletions
  1. 10 4
      netbox/templates/dcim/inc/device_header.html

+ 10 - 4
netbox/templates/dcim/inc/device_header.html

@@ -45,9 +45,15 @@
 <ul class="nav nav-tabs" style="margin-bottom: 20px">
     <li role="presentation"{% if active_tab == 'info' %} class="active"{% endif %}><a href="{% url 'dcim:device' pk=device.pk %}">Info</a></li>
     <li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}><a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory</a></li>
-    {% if perms.dcim.napalm_read and device.status == 1 and device.platform.napalm_driver and device.primary_ip %}
-        <li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}><a href="{% url 'dcim:device_status' pk=device.pk %}">Status</a></li>
-        <li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}><a href="{% url 'dcim:device_lldp_neighbors' pk=device.pk %}">LLDP Neighbors</a></li>
-        <li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}><a href="{% url 'dcim:device_config' pk=device.pk %}">Configuration</a></li>
+    {% if perms.dcim.napalm_read %}
+        {% if device.status == 1 and device.platform.napalm_driver and device.primary_ip %}
+            <li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}><a href="{% url 'dcim:device_status' pk=device.pk %}">Status</a></li>
+            <li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}><a href="{% url 'dcim:device_lldp_neighbors' pk=device.pk %}">LLDP Neighbors</a></li>
+            <li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}><a href="{% url 'dcim:device_config' pk=device.pk %}">Configuration</a></li>
+        {% else %}
+            <li role="presentation" class="disabled"><a href="#">Status</a></li>
+            <li role="presentation" class="disabled"><a href="#">LLDP Neighbors</a></li>
+            <li role="presentation" class="disabled"><a href="#">Configuration</a></li>
+        {% endif %}
     {% endif %}
 </ul>