{% extends 'generic/object.html' %}
{% load buttons %}
{% load helpers %}
{% load plugins %}

{% block breadcrumbs %}
  {{ block.super }}
  <li class="breadcrumb-item"><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ object.cluster.pk }}">{{ object.cluster }}</a></li>
{% endblock %}

{% block extra_controls %}
  {% if perms.virtualization.add_vminterface %}
    <a href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ object.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-sm btn-primary">
      <i class="mdi mdi-plus-thick"></i> Add Interfaces
    </a>
  {% endif %}
{% endblock %}

{% block extra_tabs %}
  {% with interface_count=object.interfaces.count %}
      {% if interface_count %}
          <li class="nav-item" role="presentation">
              <a class="nav-link{% if active_tab == 'interfaces' %} active{% endif %}" href="{% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}">Interfaces {% badge interface_count %}</a>
          </li>
      {% endif %}
  {% endwith %}
  {% if perms.extras.view_configcontext %}
    <li class="nav-item" role="presentation">
      <a class="nav-link{% if active_tab == 'config-context' %} active{% endif %}" href="{% url 'virtualization:virtualmachine_configcontext' pk=object.pk %}">Config Context</a>
    </li>
  {% endif %}
{% endblock %}
