Merge branch 'bug/13917' into release/0.10.2
[ganeti_webmgr.git] / ganeti_web / templates / ganeti / overview.html
blob8968ff3bf965ba2958fe0f3cbb34ce8957b1da01
1 {% extends "menu_base.html" %}
2 {% load i18n %}
3 {% load webmgr_tags %}
5 {% block title %}{%trans "Overview" %}{% endblock %}
7 {% block head %}
8 <script type="text/javascript" src="{{STATIC_URL}}/js/jquery.ajax.delete.js"></script>
9 <script type="text/javascript" src="{{STATIC_URL}}/js/jquery.tablesorter.min.js"></script>
10 <script type="text/javascript" src="{{STATIC_URL}}/js/jquery.progressbar.js"></script>
11 <script src="{{STATIC_URL}}/js/disableSingletonDropdown.js"
12 type="text/javascript"></script>
13 <script type="text/javascript">
14 var CLUSTER_RESOURCES_PBAR = {
15 steps: 0,
16 showText: true,
17 textFormat: 'fraction',
18 // XXX there's issue, bars doesn't scale the progress to the given width
19 width: 120,
20 boxImage: '{{STATIC_URL}}/images/progressbar/progressbar.gif',
21 barImage: {
22 0: '{{STATIC_URL}}/images/progressbar/progressbg_green.gif',
23 30: '{{STATIC_URL}}/images/progressbar/progressbg_yellow.gif',
24 50: '{{STATIC_URL}}/images/progressbar/progressbg_orange.gif',
25 75: '{{STATIC_URL}}/images/progressbar/progressbg_red.gif'
28 $(document).ready(function() {
29 $("#clusters .ram, #clusters .disk").each(function(){
30 var $this = $(this);
31 if ($this.html() != 'unknown') {
32 $this.progressBar(CLUSTER_RESOURCES_PBAR);
34 else
35 { $this.html("<div align='center'><i>unknown</i></div>");
37 });
38 $("#clusters").tablesorter();
39 $("#errors_list table").tablesorter();
40 $("#errors_list a.clear").live("click", function(event){
41 event.preventDefault();
42 var row = this.parentNode.parentNode;
43 $.post(this.href, function(){
44 $(row).remove();
45 if($("#errors_list tr").length==0) {
46 $("#errors_list").remove();
48 });
49 });
51 $("#usage_summary select").change(function(){
52 var val = $(this).val();
53 $.get("{% url used_resources %}", {id:val}, function(html){
54 $("#usage_summary table").replaceWith(html);
55 });
57 $("#usage_summary select").attr("id","user_select");
59 });
61 </script>
62 {% endblock %}
64 {% block content %}
65 <h1>{% trans "Overview" %}</h1>
67 {% if admin or create_vm %}
68 <div id="cluster_summary">
69 <h2>{% trans "Cluster Status" %}</h2>
70 <table id="clusters" class="sorted">
71 <thead>
72 <tr>
73 <th>{% trans "Cluster" %}</th>
74 <th>{% trans "Version" %}</th>
75 <th>{% trans "Memory Allocated [GiB]" %}</th>
76 <th>{% trans "Disk Allocated [GiB]" %}</th>
77 <th>{% trans "Nodes" %}</th>
78 <th>{% trans "VMs" %}</th>
79 </tr>
80 </thead>
81 <tbody>
82 {% for cluster in cluster_list %}
83 {% with cluster.info as info %}
84 <tr id="cluster_{{cluster.id}}">
85 <td class="name">
86 {% if cluster.error %}<div class="icon_error" title='{% trans "Ganeti API Error" %}: {{cluster.error}}'></div>{% endif %}
87 <a href="{% url cluster-detail cluster.slug %}">
88 {{ cluster.hostname|abbreviate_fqdn }}
89 </a>
90 </td>
91 <td>
92 {% if info.software_version %}
93 v{{ info.software_version }}
94 {% else %}
95 <i>unknown</i>
96 {% endif %}
97 </td>
98 <td class="ram">{% cluster_memory cluster %}</td>
99 <td class="disk">{% cluster_disk cluster %}</td>
100 <td title="Running/All">{% format_online_nodes cluster %}</td>
101 <td title="Running/All">{% format_running_vms cluster %}</td>
102 </tr>
103 {% endwith %}
104 {% empty %}
105 <tr class="none"><td colspan="100%">{% trans "No Clusters" %}</td></tr>
106 {% endfor %}
107 </tbody>
108 </table>
109 </div>
110 {% endif %}
112 <div id="vm_summary">
113 <h2>{% trans "Virtual Machine Status" %}</h2>
114 <table>
115 <thead>
116 <tr>
117 <th>{% trans "Cluster" %}</th>
118 <th>{% trans "Running" %}</th>
119 <th>{% trans "Total" %}</th>
120 </tr>
121 </thead>
122 <tbody>
123 {% for hostname, dict in vm_summary.items %}
124 <tr>
125 <td>
126 {% if view_cluster %}
127 <a href="{% url cluster-detail dict.cluster__slug %}">
128 {{hostname|abbreviate_fqdn}}
129 </a>
130 {% else %}
131 {{hostname|abbreviate_fqdn}}
132 {% endif %}
133 </td>
134 <td>{{dict.running}}</td>
135 <td>{{dict.total}}</td>
136 </tr>
137 {% empty %}
138 <tr><td colspan="100%" class="none">{% trans "You do not have access to any virtual machines" %}</td></tr>
139 {% endfor %}
140 </tbody>
141 </table>
142 </div>
144 <div id="usage_summary">
145 <h2>{% trans "Resource Usage" %}:
147 <select>
148 {% for persona in personas %}
149 <option value="{{persona.clusteruser_ptr_id}}">{{persona.name}}</option>
150 {% endfor %}
151 </select>
153 </h2>
154 {% include "ganeti/overview/used_resources.html" %}
155 </div>
157 {% if orphaned or import_ready or missing %}
158 <div id="administration">
159 <h2>{% trans "Administration" %}</h2>
160 <table style="width: auto;">
161 {% if orphaned %}
162 <tr>
163 <th>Orphaned VMs</th>
164 <td><a href="{% url import-orphans %}">{% trans "Adopt" %} {{ orphaned }}</a></td>
165 </tr>
166 {% endif %}
168 {% if import_ready %}
169 <tr>
170 <th>{% trans "VMs ready to import" %}</th>
171 <td><a href="{% url import-missing_db %}">{% trans "Import" %} {{ import_ready }}</a></td>
172 </tr>
173 {% endif %}
175 {% if missing %}
176 <tr>
177 <th>{% trans "VMs missing from ganeti" %}</th>
178 <td><a href="{% url import-missing %}">{% trans "Remove" %} {{ missing }}</a></td>
179 </tr>
180 {% endif %}
181 </table>
182 </div>
183 {% endif %}
184 {% endblock %}