mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #1876: Added explanatory title text to disabled NAPALM buttons on device view
This commit is contained in:
@ -43,17 +43,23 @@
|
|||||||
<h1>{{ device }}</h1>
|
<h1>{{ device }}</h1>
|
||||||
{% include 'inc/created_updated.html' with obj=device %}
|
{% include 'inc/created_updated.html' with obj=device %}
|
||||||
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
<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 == 'info' %} class="active"{% endif %}>
|
||||||
<li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}><a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory</a></li>
|
<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 %}
|
{% if perms.dcim.napalm_read %}
|
||||||
{% if device.status == 1 and device.platform.napalm_driver and device.primary_ip %}
|
{% if device.status != 1 %}
|
||||||
<li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}><a href="{% url 'dcim:device_status' pk=device.pk %}">Status</a></li>
|
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
|
||||||
<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>
|
{% elif not device.platform %}
|
||||||
<li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}><a href="{% url 'dcim:device_config' pk=device.pk %}">Configuration</a></li>
|
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
|
||||||
|
{% elif not device.platform.napalm_driver %}
|
||||||
|
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
|
||||||
|
{% elif not device.primary_ip %}
|
||||||
|
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No primary IP address assigned to this device' %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li role="presentation" class="disabled"><a href="#">Status</a></li>
|
{% include 'dcim/inc/device_napalm_tabs.html' %}
|
||||||
<li role="presentation" class="disabled"><a href="#">LLDP Neighbors</a></li>
|
|
||||||
<li role="presentation" class="disabled"><a href="#">Configuration</a></li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
15
netbox/templates/dcim/inc/device_napalm_tabs.html
Normal file
15
netbox/templates/dcim/inc/device_napalm_tabs.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% if not disabled_message %}
|
||||||
|
<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="#" title="{{ disabled_message }}">Status</a></li>
|
||||||
|
<li role="presentation" class="disabled"><a href="#" title="{{ disabled_message }}">LLDP Neighbors</a></li>
|
||||||
|
<li role="presentation" class="disabled"><a href="#" title="{{ disabled_message }}">Configuration</a></li>
|
||||||
|
{% endif %}
|
Reference in New Issue
Block a user