detail.html 5.35 KB
Newer Older
1
{% extends "dashboard/base.html" %}
2 3
{% load pipeline %}
{% load sizefieldtags %}
4 5 6 7
{% load i18n %}
{% load render_table from django_tables2 %}
{% load crispy_forms_tags %}

8
{% block title-page %}{% trans "Storage" %}{% endblock %}
9 10 11 12 13 14 15

{% block content %}

<div class="row">
  <div class="col-md-5">
    <div class="panel panel-default">
      <div class="panel-heading">
16
        <h3 class="no-margin"><i class="fa fa-database"></i> {% trans "Datastore" %}</h3>
17 18 19 20 21 22 23 24 25
      </div>
      <div class="panel-body">
        {% crispy form %}
      </div><!-- .panel-body -->
    </div>
  </div>
  <div class="col-md-7">
    <div class="panel panel-default">
      <div class="panel-heading">
26
        <h3 class="no-margin"><i class="fa fa-bar-chart"></i> {% trans "Statistics" %}</h3>
27 28 29 30 31 32 33 34 35
      </div>
      <div class="panel-body">
        <div class="progress">
          <div class="progress-bar progress-bar-success progress-bar-stripped"
            role="progressbar" style="min-width: 30px; width: {{ stats.used_percent }}%">
            {{ stats.used_percent }}%
          </div>
        </div>
        <div class="text-muted text-center">
36
          {{ stats.used_space}}/{{ stats.total_space }}
37 38
        </div>

39 40 41 42
        <h3>
          {% trans "Missing disks" %}
          <small>{% trans "disk objects without images files" %}</small>
        </h3>
43 44 45 46 47
        {% for m in missing_disks %}
          <p>
          {{ m }} - {{ m.filename }}
          </p>
          {% empty %}
48
          {% trans "None" %}
49 50
        {% endfor %}

51 52 53 54
        <h3>
          {% trans "Orphan disks" %}
          <small>{% trans "image files without disk object in the database" %}</small>
        </h3>
55
        {% for o in orphan_disks %}
56 57 58
          <p>
            {{ o }}
          </p>
59
          {% empty %}
60
          {% trans "None" %}
61 62 63 64 65 66 67 68 69 70
        {% endfor %}
      </div><!-- .panel-body -->
    </div>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
71
        <h3 class="no-margin"><i class="fa fa-file"></i> {% trans "Disks" %}</h3>
72 73
      </div>
      <div class="panel-body">
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
        <div class="row">
          <div class="col-md-9">
            <ul class="nav nav-pills" style="margin: 5px 0 20px 0;">
              <li class="disabled"><a href="#">{% trans "Filter by type" %}</a></li>
              <li {% if not request.GET.filter %} class="active"{% endif %}>
              <a href="{{ request.path }}?s={{ request.GET.s }}">{% trans "ALL" %}</a>
              </li>
              {% for f in filter_names %}
                <li{% if request.GET.filter == f.0 %} class="active"{% endif %}>
                <a href="?filter={{ f.0 }}&s={{ request.GET.s }}">{{ f.1|capfirst }}</a>
                </li>
              {% endfor %}
            </ul>
          </div>
          <div class="col-md-3">
            <form action="" method="GET" id="network-host-list-form">
              <div class="input-group">
91
                <input type="text" name="s" class="form-control"
92
                value="{{ request.GET.s }}" placeholder="{% trans "Search..." %}"/>
93
                <input type="hidden" name="filter" value="{{ request.GET.filter }}"/>
94 95 96 97 98 99 100
                <span class="input-group-btn">
                  <button class="btn btn-primary"><i class="fa fa-search"></i></button>
                </span>
              </div>
            </form>
          </div>
        </div><!-- .row -->
101 102 103 104 105 106 107 108
        <div class="table-responsive">
          {% render_table disk_table %}
        </div>
      </div><!-- .panel-body -->
    </div>
  </div>
</div>

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="no-margin">
          <i class="fa fa-pie-chart"></i>
          {% trans "Disk usage breakdown" %}
        </h3>
      </div>
      <div class="panel-body">
        <div class="row">
          <div class="col-md-9">
            <canvas id="datastore-chart"></canvas>
          </div>
          <div class="col-md-3">
            <div id="datastore-chart-legend"></div>
          </div>
        </div>
        <div id="chart-data" data-data='{
          "data": [{{stats.template_actual_size}},
                   {{stats.vm_actual_size}},
                   {{stats.dumps}},
                   {{stats.iso_raw}},
                   {{stats.trash}}],
          "readable_data": ["{{stats.template_actual_size|filesize}}",
                            "{{stats.vm_actual_size|filesize}}",
                            "{{stats.dumps|filesize}}",
                            "{{stats.dumps|filesize}}",
                            "{{stats.iso_raw|filesize}}",
                            "{{stats.trash|filesize}}"],
          "labels": ["{% trans "Templates" %}",
                     "{% trans "Virtual machines" %}",
                     "{% trans "Memory dumps" %}",
                     "{% trans "ISO + Raw images" %}",
                     "{% trans "Trash" %}"]
          }
          '>
        </div>
        <div>
148
          {% trans "Total disk usage of virtual machines" %}:
149 150
          <strong>{{ stats.vm_actual_size|filesize }}</strong>
          <br />
151
          {% trans "Total virtual disk usage of virtual machines" %}:
152 153 154 155 156 157 158 159 160 161 162
          <strong>{{ stats.vm_size|filesize}}</strong>
        </div>
      </div><!-- .panel-body -->
    </div>
  </div>
</div>

{% endblock %}

{% block extra_js %}
  {% javascript "datastore" %}
163
{% endblock %}