{% extends 'generic/object_detail.html' %}
{% load helpers %}

{% block content_left_page %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Cluster</strong>
            </div>
            <table class="table table-hover panel-body attr-table">
                <tr>
                    <td>Name</td>
                    <td>{{ object.name }}</td>
                </tr>
                <tr>
                    <td>Type</td>
                    <td>{{ object.cluster_type|hyperlinked_object }}</td>
                </tr>
                <tr>
                    <td>Group</td>
                    <td>{{ object.cluster_group|hyperlinked_object }}</td>
                </tr>
                <tr>
                    <td>Tenant</td>
                    <td>{{ object.tenant|hyperlinked_object }}</td>
                </tr>
                <tr>
                    <td>Location</td>
                    <td>{% include 'dcim/inc/location_hierarchy.html' with location=object.location %}</td>
                </tr>
                <tr>
                    <td>Virtual Machines</td>
                    <td><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ object.pk }}">{{ object.virtual_machines.count }}</a></td>
                </tr>
            </table>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Comments</strong>
            </div>
            <div class="panel-body rendered-markdown">
                {% if object.comments %}
                    {{ object.comments|render_markdown }}
                {% else %}
                    <span class="text-muted">None</span>
                {% endif %}
            </div>
        </div>
{% endblock content_left_page %}

{% block content_right_page %}
        <div class="panel panel-default">
            <div class="panel-heading">
                <strong>Host Devices</strong>
            </div>
            {% if perms.virtualization.change_cluster %}
                <form action="{% url 'virtualization:cluster_remove_devices' pk=object.pk %}" method="post">
                {% csrf_token %}
            {% endif %}
            {% include 'responsive_table.html' with table=device_table %}
            {% if perms.virtualization.change_cluster %}
                <div class="panel-footer noprint">
                    <div class="pull-right">
                        <a href="{% url 'virtualization:cluster_add_devices' pk=object.pk %}?location={{ object.location.pk }}" class="btn btn-primary btn-xs">
                            <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
                            Add devices
                        </a>
                    </div>
                    <button type="submit" name="_remove" class="btn btn-danger primary btn-xs">
                        <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
                        Remove devices
                    </button>
                </div>
                </form>
            {% endif %}
        </div>
{% endblock content_right_page %}
