Files
xen-orchestra/views/servers/index.templet
Julien Fontanet 451e96e848 Better representation for VMs memory usage in host page (fixes #14).
The scale is not logarithmic but the order is respected.
2013-05-23 17:53:47 +02:00

76 lines
2.2 KiB
Plaintext

{**
* This file is a part of Xen Orchestra Web.
*
* Xen Orchestra Web is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* Xen Orchestra Web is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xen Orchestra Web. If not, see
* <http://www.gnu.org/licenses/>.
*
* @author Olivier Lambert <olivier.lambert@vates.fr>
* @license http://www.gnu.org/licenses/agpl-3.0-standalone.html GNU AGPLv3
*
* @package Xen Orchestra Web
*}
{extends "/_base.templet"}
{block title}Server overview{/block}
{block extra_scripts}
<script src="{$base_path}/js/backbone.js"></script>
<script src="{$base_path}/js/marionette.js"></script>
<script>
var pools = {$pools|json};
</script>
<script src="{$base_path}/js/servers/index.js"></script>
{/block}
{block body}
<script type="text/html" id="tpl-pool">
<table class="table table-bordered table-hover table-striped">
<caption><h3 class="center"><%= name %></h3></caption>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Memory</th>
<th>Addresses</th>
<th>Uptime</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</script>
<script type="text/html" id="tpl-host">
<% var mem_usage = 100-Math.round(100*memory.free/memory.total) %>
<td><a href="{$base_path}/servers/<%= id %>"><%= name %></a></td>
<td><%= description || "<i>none</i>" %></td>
<td>
<div class="progress progress-info progress-small" title="<%= mem_usage %>%">
<div class="bar" style="width: <%= mem_usage %>%"></div>
</div>
</td>
<td><%= IPs.length ? IPs.join(', ') : '<i>none</i>' %></td>
<td><%=
start_time
? Math.round((Date.now()/1000-start_time)/8640)/10 + ' days'
: '<i>N/A</i>'
%></td>
</script>
<div class="container">
<div class="row" id="region-main"></div>
</div>
{/block body}