Fixes #903: Only alert on missing criticial connections if present in the parent device type

This commit is contained in:
Jeremy Stretch 2017-02-17 15:10:08 -05:00
parent 102cf52a16
commit 4d26fc7e7c

View File

@ -240,38 +240,44 @@
{% for iface in mgmt_interfaces %} {% for iface in mgmt_interfaces %}
{% include 'dcim/inc/interface.html' with icon='wrench' %} {% include 'dcim/inc/interface.html' with icon='wrench' %}
{% empty %} {% empty %}
{% if device.device_type.interface_templates.exists %}
<tr> <tr>
<td colspan="5" class="alert-warning"> <td colspan="6" class="alert-warning">
<i class="fa fa-fw fa-warning"></i> No management interfaces defined <i class="fa fa-fw fa-warning"></i> No management interfaces defined
{% if perms.dcim.add_interface %} {% if perms.dcim.add_interface %}
<a href="{% url 'dcim:interface_add' pk=device.pk %}?mgmt_only=1" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> <a href="{% url 'dcim:interface_add' pk=device.pk %}?mgmt_only=1" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
{% for cp in console_ports %} {% for cp in console_ports %}
{% include 'dcim/inc/consoleport.html' %} {% include 'dcim/inc/consoleport.html' %}
{% empty %} {% empty %}
{% if device.device_type.console_port_templates.exists %}
<tr> <tr>
<td colspan="5" class="alert-warning"> <td colspan="6" class="alert-warning">
<i class="fa fa-fw fa-warning"></i> No console ports defined <i class="fa fa-fw fa-warning"></i> No console ports defined
{% if perms.dcim.add_consoleport %} {% if perms.dcim.add_consoleport %}
<a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> <a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
{% for pp in power_ports %} {% for pp in power_ports %}
{% include 'dcim/inc/powerport.html' %} {% include 'dcim/inc/powerport.html' %}
{% empty %} {% empty %}
{% if device.device_type.power_port_templates.exists %}
<tr> <tr>
<td colspan="5" class="alert-warning"> <td colspan="6" class="alert-warning">
<i class="fa fa-fw fa-warning"></i> No power ports defined <i class="fa fa-fw fa-warning"></i> No power ports defined
{% if perms.dcim.add_powerport %} {% if perms.dcim.add_powerport %}
<a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> <a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
{% endif %} {% endif %}
</td> </td>
</tr> </tr>
{% endif %}
{% endfor %} {% endfor %}
</table> </table>
{% if perms.dcim.add_interface or perms.dcim.add_consoleport or perms.dcim.add_powerport %} {% if perms.dcim.add_interface or perms.dcim.add_consoleport or perms.dcim.add_powerport %}