mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
feat(instances): the Guest Info tab shows how full the guest's file systems are
A disk filling up inside a guest was seen only from the guest. The Guest Info tab now lists, from the guest agent, each mounted file system with its type and used / total size, a bar turning amber from 85 %. File systems the agent gives no size of (pseudo ones, Windows' System Reserved) are left out; an agent without the command still shows the rest of the tab.
This commit is contained in:
parent
981ff7b294
commit
46931bdbdb
10 changed files with 544 additions and 401 deletions
|
|
@ -33,11 +33,40 @@
|
|||
$('#oskernelversion').text(data['kernel-version'] || '');
|
||||
$('#osversion').text(data.version || '');
|
||||
$('#ostimezone').text(data.zone ? data.zone + " / " + data.offset : '');
|
||||
show_filesystems(data.filesystems || []);
|
||||
}).fail(function (xhr) {
|
||||
var message = xhr.responseJSON && xhr.responseJSON.error;
|
||||
error.text(message || silent).removeClass('d-none');
|
||||
show_filesystems([]);
|
||||
});
|
||||
}
|
||||
// each file system: its mount point, type, and how full it is (a bar, amber from 85 %)
|
||||
function show_filesystems(filesystems) {
|
||||
var table = document.getElementById('osfilesystems');
|
||||
var body = table.tBodies[0];
|
||||
body.replaceChildren();
|
||||
filesystems.forEach(function (fs) {
|
||||
var row = body.insertRow();
|
||||
row.insertCell().textContent = fs.mountpoint;
|
||||
row.insertCell().textContent = fs.type;
|
||||
var used = row.insertCell();
|
||||
used.textContent = fs.used_text + " / " + fs.total_text;
|
||||
var bar = document.createElement('div');
|
||||
bar.className = 'progress mt-1';
|
||||
bar.style.setProperty('--bs-progress-height', '0.3rem');
|
||||
bar.setAttribute('role', 'progressbar');
|
||||
bar.setAttribute('aria-valuenow', fs.percent);
|
||||
bar.setAttribute('aria-valuemin', 0);
|
||||
bar.setAttribute('aria-valuemax', 100);
|
||||
bar.setAttribute('aria-label', fs.mountpoint);
|
||||
var fill = document.createElement('div');
|
||||
fill.className = 'progress-bar' + (fs.percent >= 85 ? ' bg-warning' : '');
|
||||
fill.style.width = fs.percent + '%';
|
||||
bar.appendChild(fill);
|
||||
used.appendChild(bar);
|
||||
});
|
||||
table.hidden = filesystems.length === 0;
|
||||
}
|
||||
function get_osinfo() {
|
||||
show_tab('#settings');
|
||||
show_tab('#osinfo');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue