mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 16:36:06 +00:00
fix(instances): the VM page says when its host stops answering
The VM page polls the VM's state every 5 s and reloads when it changes. When the host stopped answering, the poll failed and nothing changed on the page: it kept showing the last state, figures and actions as if they were current. A notice now says that the page could not be refreshed and may be out of date while the poll fails (a host that does not answer, a session that ended); it goes away with the next answer. Checked on compute1 in headless Chromium with its libvirt port dropped and restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
6cdda6d4f3
commit
139e43e4c4
7 changed files with 358 additions and 335 deletions
|
|
@ -3,9 +3,13 @@ backgroundJobRunning = false;
|
|||
// not "status": that is window.status, which the browser may not keep
|
||||
var vm_summary = document.getElementById("vm-summary");
|
||||
var vm_status = Number(vm_summary.dataset.status);
|
||||
var host_lost = document.getElementById("vm-host-lost");
|
||||
var status_poll = pollWhileVisible(5000, function () {
|
||||
return $.getJSON(vm_summary.dataset.statusUrl);
|
||||
// a failed read (a host that does not answer, a session that ended) leaves the
|
||||
// page as it was: it says so until a read is answered
|
||||
return $.getJSON(vm_summary.dataset.statusUrl).fail(function () { host_lost.hidden = false; });
|
||||
}, function get_status(data) {
|
||||
host_lost.hidden = true;
|
||||
// the page in use (a dialog open, a field in use, an XML edit not saved): the reload waits (poll.js)
|
||||
if (data['status'] != vm_status && !backgroundJobRunning && !pageInUse()) {
|
||||
window.location.reload();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue