summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/project/instances/templates/instances/_flavors_and_quotas.html
blob: 1f4b272a46c5c2337f6361f8aa8c90b6d292b1a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{% load i18n horizon humanize bootstrap %}

{% block help_message %}
{% endblock %}

<h4>{% trans "Flavor Details" %}</h4>
<table class="flavor_table table table-striped table-fixed">
  <tbody>
    <tr><td class="flavor_name">{% trans "Name" %}</td><td><span id="flavor_name" class="truncate"></span></td></tr>
    <tr><td class="flavor_name">{% trans "VCPUs" %}</td><td><span id="flavor_vcpus"></span></td></tr>
    <tr><td class="flavor_name">{% trans "Root Disk" %}</td><td><span id="flavor_disk"></span> {% trans "GB" %}</td></tr>
    <tr><td class="flavor_name">{% trans "Ephemeral Disk" %}</td><td><span id="flavor_ephemeral"></span> {% trans "GB" %}</td></tr>
    <tr><td class="flavor_name">{% trans "Total Disk" %}</td><td><span id="flavor_disk_total"></span> {% trans "GB" %}</td></tr>
    <tr><td class="flavor_name">{% trans "RAM" %}</td><td><span id="flavor_ram"></span> {% trans "MB" %}</td></tr>
  </tbody>
</table>

<div class="quota-dynamic">
  <h4>{% trans "Project Limits" %}</h4>
  <div class="quota_title">
    <strong class="pull-left">{% trans "Number of Instances" %}</strong>
    <span class="pull-right">
      {% blocktrans trimmed with used=usages.instances.used|intcomma quota=usages.instances.quota|intcomma|quotainf %}
      {{ used }} of {{ quota }} Used
      {% endblocktrans %}
    </span>
  </div>

 {{ minifyspace }}
  <div id="{{ resize_instance|yesno:"quota_resize_instance,quota_instances" }}"
       class="quota_bar"
       data-progress-indicator-flavor
       data-quota-limit="{{ usages.instances.quota }}"
       data-quota-used="{{ usages.instances.used }}">
    {% widthratio usages.instances.used usages.instances.quota 100 as instance_percent %}
    {% bs_progress_bar instance_percent 0 %}
  </div>
 {{ endminifyspace }}

  <div class="quota_title">
    <strong class="pull-left">{% trans "Number of VCPUs" %}</strong>
    <span class="pull-right">
      {% blocktrans trimmed with used=usages.cores.used|intcomma quota=usages.cores.quota|intcomma|quotainf %}
      {{ used }} of {{ quota }} Used
      {% endblocktrans %}
    </span>
  </div>

  {{ minifyspace }}
  <div id="quota_vcpus"
       class="quota_bar"
       data-progress-indicator-flavor
       data-quota-limit="{{ usages.cores.quota }}"
       data-quota-used="{{ usages.cores.used }}">
    {% widthratio usages.cores.used usages.cores.quota 100 as vcpu_percent %}
    {% bs_progress_bar vcpu_percent 0 %}
  </div>
  {{ endminifyspace }}

  <div class="quota_title">
    <strong class="pull-left">{% trans "Total RAM" %}</strong>
    <span class="pull-right">
      {% blocktrans trimmed with used=usages.ram.used|intcomma quota=usages.ram.quota|intcomma|quotainf %}
      {{ used }} of {{ quota }} MB Used
      {% endblocktrans %}
    </span>
  </div>

  {{ minifyspace }}
  <div id="quota_ram"
       class="quota_bar"
       data-progress-indicator-flavor
       data-quota-limit="{{ usages.ram.quota }}"
       data-quota-used="{{ usages.ram.used }}">
    {% widthratio usages.ram.used usages.ram.quota 100 as vcpu_percent %}
    {% bs_progress_bar vcpu_percent 0 %}
  </div>
  {{ endminifyspace }}

  {% if cinder_enabled %}
  <div class="quota_title">
    <strong class="pull-left">{% trans "Number of Volumes" %}</strong>
    <span class="pull-right">
      {% blocktrans with used=usages.volumes.used|intcomma quota=usages.volumes.quota|intcomma|quotainf %}
      {{ used }} of {{ quota }} Used
      {% endblocktrans %}
    </span>
  </div>
  <div id="quota_volume"
       class="quota_bar"
       data-progress-indicator-flavor
       data-quota-limit="{{ usages.volumes.quota }}"
       data-quota-used="{{ usages.volumes.used }}">
    {% widthratio usages.volumes.used usages.volumes.quota 100 as volume_percent %}
    {% bs_progress_bar volume_percent 0 %}
  </div>

  <div class="quota_title">
    <strong class="pull-left">{% trans "Total Volume Storage" %}</strong>
    <span class="pull-right">
      {% blocktrans with used=usages.gigabytes.used|intcomma quota=usages.gigabytes.quota|intcomma|quotainf %}
      {{ used }} of {{ quota }} GiB Used
      {% endblocktrans %}
    </span>
  </div>
  <div id="quota_volume_storage"
       class="quota_bar"
       data-progress-indicator-flavor
       data-quota-limit="{{ usages.gigabytes.quota }}"
       data-quota-used="{{ usages.gigabytes.used }}">
     {% widthratio usages.gigabytes.used usages.gigabytes.quota 100 as volume_storage_percent %}
     {% bs_progress_bar volume_storage_percent 0 %}
  </div>
  {% endif %}

</div>


<script type="text/javascript" charset="utf-8">
  some_disabled_msg = '{{_("Some flavors not meeting minimum boot source requirements have been disabled.")|escapejs }}';
  all_disabled_msg = '{{_("No flavors meet minimum criteria for selected boot source.")|escapejs }}';

  if(typeof horizon.Quota !== 'undefined') {
    horizon.Quota.initWithFlavors({{ flavors|safe|default:"{}" }});
    horizon.Quota.initWithImages({{ images|safe|default:"{}"}}, some_disabled_msg, all_disabled_msg);
  } else {
    addHorizonLoadEvent(function() {
      horizon.Quota.initWithFlavors({{ flavors|safe|default:"{}" }});
      horizon.Quota.initWithImages({{ images|safe|default:"{}"}}, some_disabled_msg, all_disabled_msg);
    });
  }
</script>