{% load i18n %}
<div class="panel panel-default">
  <div class="panel-heading">
    <div class="pull-right toolbar">
      <div class="btn-group">
        <a href="#index-graph-view" data-index-box="node" class="btn btn-default btn-xs"
          data-container="body"><i class="fa fa-dashboard"></i></a>
        <a href="#index-list-view" data-index-box="node" class="btn btn-default btn-xs disabled"
          data-container="body"><i class="fa fa-list"></i></a>
      </div>
      <span class="btn btn-default btn-xs infobtn" data-container="body" title="{% trans "List of compute nodes, also called worker nodes or hypervisors, which run the virtual machines." %}">
        <i class="fa fa-info-circle"></i>
      </span>
    </div>
    <h3 class="no-margin">
      <i class="fa fa-sitemap"></i> {% trans "Nodes" %}
    </h3>
  </div >
  <div class="list-group" id="node-list-view">
    <div id="dashboard-node-list">
      {% for i in nodes %}
      <a href="{{ i.get_absolute_url }}" class="list-group-item real-link
        {% if forloop.last and nodes|length < 5 %} list-group-item-last{% endif %}">
        <span class="index-node-list-name">
          <i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i>
           {{ i.name }}
        </span>
        <div style="clear: both;"></div>
      </a>
      {% endfor %}
    </div>

    <div class="list-group-item list-group-footer">
      <div class="row">
        <div class="col-xs-6">
          <form action="{% url "dashboard.views.node-list" %}" method="GET"
            id="dashboard-node-search-form">
            <div class="input-group input-group-sm">
              <input id="dashboard-node-search-input" type="text" class="form-control"
               name="s" placeholder="{% trans "Search..." %}" />
              <div class="input-group-btn">
                <button type="submit" class="btn btn-primary" title="{% trans "Search" %}" data-container="body">
                  <i class="fa fa-search"></i>
                </button>
              </div>
            </div>
          </form>
        </div>
        <div class="col-xs-6 text-right">
          <a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
            <i class="fa fa-chevron-circle-right"></i>
            {% if more_nodes > 0 %}
                {% blocktrans with count=more_nodes %}<strong>{{count}}</strong>  more{% endblocktrans %}
            {% else %}
                {% trans "list" %}
            {% endif %}
          </a>
          {% if request.user.is_superuser %}
          <a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}">
            <i class="fa fa-plus-circle"></i> {% trans "new" %}
          </a>
          {% endif  %}
        </div>
      </div>
    </div>
  </div><!-- #node-list-view -->

  <div class="panel-body" id="node-graph-view" style="display: none">
    <p class="pull-right">
      <input class="knob" data-fgColor="chartreuse"
      data-thickness=".4" data-width="60" data-height="60" data-readOnly="true"
      value="{% widthratio node_num.running sum_node_num 100 %}">
    </p>
    <p>
      {% blocktrans with running=node_num.running missing=node_num.missing disabled=node_num.disabled offline=node_num.offline %}
      <span class="big">
        <span class="big-tag">{{ running }}</span> running
      </span> +
      <span class="big-tag">{{ missing }}</span> missing +
      <br>
      <span class="big-tag">{{ disabled }}</span> disabled +
      <span class="big-tag">{{ offline }}</span> offline
      {% endblocktrans %}
    </p>
    <ul class="list-inline" id="dashboard-node-taglist">
      {% for i in nodes %}
      <li>
        <a href="{{ i.get_absolute_url }}" class="label {{i.get_status_label}}" >
        <i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> {{ i.name }}</a>
      </li>
      {% endfor %}
    </ul>

    <div class="clearfix"></div>
  </div>

</div>
