Revision a09987c3 ui/static/synnefo.js
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 |
} |
Also available in: Unified diff