Revision a09987c3
b/ui/static/synnefo.js | ||
---|---|---|
1534 | 1534 |
|
1535 | 1535 |
// get stats |
1536 | 1536 |
function get_server_stats(serverID) { |
1537 |
|
|
1538 |
// do not update stats if machine in build state |
|
1539 |
var vm = get_machine(serverID); |
|
1540 |
if (vm.status == "BUILD" && vm.stats_timeout) { |
|
1541 |
els = get_current_view_stats_elements(vm.id); |
|
1542 |
els.cpu.img.hide(); |
|
1543 |
els.net.img.hide(); |
|
1544 |
|
|
1545 |
els.cpu.busy.show(); |
|
1546 |
els.net.busy.show(); |
|
1547 |
return; |
|
1548 |
} |
|
1549 |
|
|
1537 | 1550 |
$.ajax({ |
1538 | 1551 |
url: API_URL + '/servers/' + serverID + '/stats', |
1539 | 1552 |
cache: false, |
... | ... | |
1562 | 1575 |
|
1563 | 1576 |
// set timeout function to update machine stats |
1564 | 1577 |
function set_stats_update_handler(vm_id, interval) { |
1565 |
console.log("setting stats update interval:", vm_id, interval); |
|
1566 |
window.setTimeout(function(){ |
|
1578 |
var vm = get_machine(vm_id); |
|
1579 |
|
|
1580 |
if (vm.stats_timeout) { |
|
1581 |
window.clearTimeout(vm.stats_timeout); |
|
1582 |
} |
|
1583 |
|
|
1584 |
vm.stats_timeout = window.setTimeout(function(){ |
|
1567 | 1585 |
get_server_stats(vm_id); |
1568 | 1586 |
}, interval * 1000); |
1569 | 1587 |
} |
b/ui/templates/machines_icon.html | ||
---|---|---|
77 | 77 |
<div class="vm-stats metadata-column"> |
78 | 78 |
<div class='stat-label'>{% trans "CPU" %}</div> |
79 | 79 |
<div class='stat-content cpu-cont'> |
80 |
<img src="./static/icons/indicators/small/progress.gif" class="cpu bar" />
|
|
80 |
<img src="./static/placeholder.png" class="cpu bar" />
|
|
81 | 81 |
<img src="./static/icons/indicators/small/progress.gif" class="stat-busy" /> |
82 | 82 |
<div class='stat-error'>{% trans "Could not fetch CPU stats graph." %}</div> |
83 | 83 |
</div> |
84 | 84 |
<div class='stat-label'>{% trans "Net" %}</div> |
85 | 85 |
<div class='stat-content net-cont'> |
86 |
<img src="./static/icons/indicators/small/progress.gif" class="net bar" />
|
|
86 |
<img src="./static/placeholder.png" class="net bar" />
|
|
87 | 87 |
<img src="./static/icons/indicators/small/progress.gif" class="stat-busy" /> |
88 | 88 |
<div class='stat-error'>{% trans "Could not fetch Net stats graph." %}</div> |
89 | 89 |
</div> |
... | ... | |
266 | 266 |
} else { |
267 | 267 |
// reset stats |
268 | 268 |
$(this).closest('.machine-container').find('.vm-stats div.stat-error').hide(); |
269 |
$(this).closest('.machine-container').find('.vm-stats img.cpu').attr('src', './static/icons/indicators/small/progress.gif').show(); |
|
270 |
$(this).closest('.machine-container').find('.vm-stats img.net').attr('src', './static/icons/indicators/small/progress.gif').show(); |
|
271 | 269 |
// get new stats |
272 | 270 |
var serverID = $(this).closest('.machine-container').attr('id'); |
273 | 271 |
get_server_stats(serverID); |
b/ui/templates/machines_single.html | ||
---|---|---|
148 | 148 |
{% trans "CPU Utilization" %} |
149 | 149 |
</div> |
150 | 150 |
<div class="cpu-graph"> |
151 |
<img src="./static/icons/indicators/small/progress.gif" class="stats series" />
|
|
151 |
<img src="./static/placeholder.png" class="stats series" />
|
|
152 | 152 |
<img src="./static/icons/indicators/small/progress.gif" class="stat-busy" /> |
153 | 153 |
<div class='stat-error'>{% trans "Could not fetch CPU stats graph." %}</div> |
154 | 154 |
</div> |
... | ... | |
158 | 158 |
{% trans "Network Utilization" %} |
159 | 159 |
</div> |
160 | 160 |
<div class="network-graph"> |
161 |
<img src="./static/icons/indicators/small/progress.gif" class="stats series" />
|
|
161 |
<img src="./static/placeholder.png" class="stats series" />
|
|
162 | 162 |
<img src="./static/icons/indicators/small/progress.gif" class="stat-busy" /> |
163 | 163 |
<div class='stat-error'>{% trans "Could not fetch Net stats graph." %}</div> |
164 | 164 |
</div> |
Also available in: Unified diff