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

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

{% block extra_controls %}
  {% if perms.virtualization.change_virtualmachine %}
    <div class="dropdown">
      <button id="add-components" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
        <i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
      </button>
      <ul class="dropdown-menu" aria-labelledby="add-components">
        {% if perms.virtualization.add_vminterface %}
          <li><a class="dropdown-item"  href="{% url 'virtualization:vminterface_add' %}?virtual_machine={{ object.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}">
            {% trans "Interfaces" %}
          </a></li>
        {% endif %}
        {% if perms.virtualization.add_virtualdisk %}
          <li><a class="dropdown-item"  href="{% url 'virtualization:virtualdisk_add' %}?virtual_machine={{ object.pk }}&return_url={% url 'virtualization:virtualmachine_disks' pk=object.pk %}">
            {% trans "Virtual Disks" %}
          </a></li>
        {% endif %}
      </ul>
    </div>
  {% endif %}
{% endblock %}
