vm-list.html 6.3 KB
Newer Older
Kálmán Viktor committed
1 2
{% extends "dashboard/base.html" %}
{% load i18n %}
3 4 5

{% block title-page %}{% trans "Virtual machines" %}{% endblock %}

Kálmán Viktor committed
6
{% block content %}
7

Kálmán Viktor committed
8 9 10 11
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
12 13
        <div class="pull-right table-sorting">
          {% trans "Sorting ... " %}
14
          <!--<i class="fa fa-refresh fa-spin fa-2x"></i>-->
15
        </div>
16
        <h3 class="no-margin"><i class="fa fa-desktop"></i> {% trans "Virtual machines" %}</h3>
Kálmán Viktor committed
17 18
      </div>
      <div class="panel-body">
19 20 21 22 23
        <div class="row">
          <div class="col-md-8 vm-list-group-control" id="vm-mass-ops">
            <strong>{% trans "Group actions" %}</strong>
            <button id="vm-list-group-select-all" class="btn btn-info btn-xs">{% trans "Select all" %}</button>
            {% for o in ops %}
24
              <a href="{{ o.get_url }}" class="btn btn-xs btn-{{ o.effect }} mass-operation"
25 26 27 28 29 30 31 32 33 34 35
               title="{{ o.name|capfirst }}" disabled>
                <i class="fa fa-{{ o.icon }}"></i>
              </a>
            {% endfor %}
          </div><!-- .vm-list-group-control -->
          <div class="col-md-4" id="vm-list-search">
            <form action="" method="GET">
              <div class="input-group">
                {{ search_form.s }}
                <div class="input-group-btn">
                  {{ search_form.stype }}
36
                </div>
37
                <label class="input-group-addon input-tags" title="{% trans "Include deleted VMs" %}"
38 39
                  id="vm-list-search-checkbox-span" data-container="body">
                  {{ search_form.include_deleted }}
40
                </label>
41
                <div class="input-group-btn">
42
                  <button type="submit" class="btn btn-primary input-tags">
43 44 45 46 47 48 49 50
                    <i class="fa fa-search"></i>
                  </button>
                </div>
              </div><!-- .input-group -->
            </form>
          </div><!-- .col-md-4 #vm-list-search -->
        </div><!-- .row -->
      </div><!-- .panel-body -->
Kálmán Viktor committed
51
      <div class="panel-body">
52 53
        <table class="table table-bordered table-striped table-hover vm-list-table"
         id="vm-list-table">
54
          <thead><tr>
55
              <th data-sort="int" class="orderable pk sortable vm-list-table-thin" style="min-width: 50px;">
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
                {% trans "ID" as t %}
                {% include "dashboard/vm-list/header-link.html" with name=t sort="pk" %}
              </th>
              <th data-sort="string" class="name orderable sortable">
                {% trans "Name" as t %}
                {% include "dashboard/vm-list/header-link.html" with name=t sort="name" %}
              </th>
              <th data-sort="string">
                {% trans "State" as t %}
                {% include "dashboard/vm-list/header-link.html" with name=t sort="status" %}
              </th>
              <th data-sort="string" class="orderable sortable">
                {% trans "Owner" as t %}
                {% include "dashboard/vm-list/header-link.html" with name=t sort="owner" %}
              </th>
71 72 73 74 75 76 77 78 79 80 81 82 83 84
              <th data-sort="string" class="orderable sortable">
                {% trans "Lease" as t %}
                {% include "dashboard/vm-list/header-link.html" with name=t sort="lease" %}
              </th>
              {% if user.is_superuser %}
                <th data-sort="string" class="orderable sortable">
                  {% trans "IP address" as t %}
                  {% include "dashboard/vm-list/header-link.html" with name=t sort="ip_addr" %}
                </th>
                <th data-sort="string" class="orderable sortable">
                  {% trans "Node" as t %}
                  {% include "dashboard/vm-list/header-link.html" with name=t sort="node" %}
                </th>
              {% endif %}
85 86
          </tr></thead><tbody>
          {% for i in object_list %}
87
          <tr class="{% cycle 'odd' 'even' %}" data-vm-pk="{{ i.pk }}">
88 89
            <td class="pk"><div id="vm-{{i.pk}}">{{i.pk}}</div> </td>
            <td class="name"><a class="real-link" href="{% url "dashboard.views.detail" i.pk %}">{{ i.name }}</a>  </td>
90
            <td class="state">
91
              <i class="fa fa-fw
92
                {% if show_acts_in_progress and i.is_in_status_change %}
93 94 95 96 97
                  fa-spin fa-spinner
                {% else %}
                {{ i.get_status_icon }}{% endif %}"></i>
              <span>{{ i.get_status_display }}</span>
            </td>
98
            <td>
99 100 101 102 103 104
              {% if i.owner.profile %}
                {{ i.owner.profile.get_display_name }}
              {% else %}
                {{ i.owner.username }}
              {% endif %}
              {# include "dashboard/_display-name.html" with user=i.owner show_org=True #}
105
            </td>
106 107
            <td class="lease "data-sort-value="{{ i.lease.name }}">
              {{ i.lease.name }}
108
            </td>
109
            {% if user.is_superuser %}
110 111 112
            <td class="ip_addr "data-sort-value="{{ i.ipv4 }}">
              {{ i.ipv4|default:"-" }}
            </td>
113 114 115
            <td class="node "data-sort-value="{{ i.node.normalized_name }}">
              {{ i.node.name|default:"-" }}
            </td>
116
            {% endif %}
117 118
          </tr>
          {% empty %}
119
          <tr>
120
            <td colspan="7">
121 122 123 124 125 126 127
              {% if request.GET.s %}
                <strong>{% trans "No result." %}</strong>
              {% else %}
                <strong>{% trans "You have no virtual machines." %}</strong>
              {% endif %}
            </td>
          </tr>
128 129 130
          {% endfor %}
        </tbody>
      </table>
131 132 133
    </div>
  </div>
</div>
134 135
</div>

136 137 138
<div class="alert alert-info">
  You can filter the list by certain attributes (owner, name, status, tags) in the following way: "owner:John Doe name:my little server". If you don't specify any attribute names the filtering will be done by name.
</div>
139

140
<div class="alert alert-info">
141 142
  {% trans "You can select multiple vm instances while holding down the <strong>CTRL</strong> key." %}
  {% trans "If you want to select multiple instances by one click select an instance then hold down <strong>SHIFT</strong> key and select another one!" %}
143 144
</div>

145 146 147
{% endblock %}

{% block extra_js %}
148
  <script src="{{ STATIC_URL}}dashboard/vm-list.js"></script>
149
  <script src="{{ STATIC_URL}}dashboard/js/stupidtable.min.js"></script>
Kálmán Viktor committed
150
{% endblock %}