diff options
Diffstat (limited to 'web/share/js/kvm/msd.js')
-rw-r--r-- | web/share/js/kvm/msd.js | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/web/share/js/kvm/msd.js b/web/share/js/kvm/msd.js index 9d454d97..8ef89dcb 100644 --- a/web/share/js/kvm/msd.js +++ b/web/share/js/kvm/msd.js @@ -236,23 +236,20 @@ export function Msd() { let s = __state; let online = (s && s.online); - $("msd-image-name").innerHTML = ((online && s.drive.image) ? s.drive.image.name : "None"); - $("msd-image-size").innerHTML = ((online && s.drive.image) ? tools.formatSize(s.drive.image.size) : "None"); if (online) { let size_str = tools.formatSize(s.storage.size); let used = s.storage.size - s.storage.free; let used_str = tools.formatSize(used); - $("msd-storage-size").innerHTML = size_str; - tools.progress.setValue($("msd-storage-progress"), `Storage: ${used_str} of ${size_str}`, used / s.storage.size * 100); + let percent = used / s.storage.size * 100; + tools.progress.setValue($("msd-storage-progress"), `Storage: ${used_str} of ${size_str}`, percent); } else { - $("msd-storage-size").innerHTML = "Unavailable"; tools.progress.setValue($("msd-storage-progress"), "Storage: unavailable", 0); } - tools.el.setEnabled($("msd-image-selector"), (online && s.features.multi && !s.drive.connected && !s.busy)); + tools.el.setEnabled($("msd-image-selector"), (online && !s.drive.connected && !s.busy)); __applyStateImageSelector(); - tools.el.setEnabled($("msd-download-button"), (online && s.features.multi && s.drive.image && !s.drive.connected && !s.busy)); - tools.el.setEnabled($("msd-remove-button"), (online && s.features.multi && s.drive.image && !s.drive.connected && !s.busy)); + tools.el.setEnabled($("msd-download-button"), (online && s.drive.image && !s.drive.connected && !s.busy)); + tools.el.setEnabled($("msd-remove-button"), (online && s.drive.image && !s.drive.connected && !s.busy)); tools.radio.setEnabled("msd-mode-radio", (online && s.features.cdrom && !s.drive.connected && !s.busy)); tools.radio.setValue("msd-mode-radio", `${Number(online && s.features.cdrom && s.drive.cdrom)}`); @@ -260,7 +257,7 @@ export function Msd() { tools.el.setEnabled($("msd-rw-switch"), (online && s.features.rw && !s.drive.connected && !s.busy)); $("msd-rw-switch").checked = (online && s.features.rw && s.drive.rw); - tools.el.setEnabled($("msd-connect-button"), (online && (!s.features.multi || s.drive.image) && !s.drive.connected && !s.busy)); + tools.el.setEnabled($("msd-connect-button"), (online && s.drive.image && !s.drive.connected && !s.busy)); tools.el.setEnabled($("msd-disconnect-button"), (online && s.drive.connected && !s.busy)); tools.el.setEnabled($("msd-select-new-button"), (online && !s.drive.connected && !__http && !s.busy)); @@ -297,12 +294,6 @@ export function Msd() { if (s) { tools.feature.setEnabled($("msd-dropdown"), s.enabled); tools.feature.setEnabled($("msd-reset-button"), s.enabled); - for (let el of $$$(".msd-single-storage")) { - tools.feature.setEnabled(el, !s.features.multi); - } - for (let el of $$$(".msd-multi-storage")) { - tools.feature.setEnabled(el, s.features.multi); - } for (let el of $$$(".msd-cdrom-emulation")) { tools.feature.setEnabled(el, s.features.cdrom); } @@ -317,13 +308,13 @@ export function Msd() { tools.hidden.setVisible($("msd-message-too-big-for-cdrom"), (online && s.features.cdrom && s.drive.cdrom && s.drive.image && s.drive.image.size >= 2359296000)); tools.hidden.setVisible($("msd-message-out-of-storage"), - (online && s.features.multi && s.drive.image && !s.drive.image.in_storage)); + (online && s.drive.image && !s.drive.image.in_storage)); tools.hidden.setVisible($("msd-message-rw-enabled"), (online && s.features.rw && s.drive.rw)); tools.hidden.setVisible($("msd-message-another-user-uploads"), (online && s.storage.uploading && !__http)); tools.hidden.setVisible($("msd-message-downloads"), - (online && s.features.multi && s.storage.downloading)); + (online && s.storage.downloading)); }; var __applyStateStatus = function() { @@ -339,7 +330,7 @@ export function Msd() { } else if (online && s.storage.uploading) { led_cls = "led-yellow-rotating-fast"; msg = "Uploading new image"; - } else if (online && s.features.multi && s.storage.downloading) { + } else if (online && s.storage.downloading) { led_cls = "led-yellow-rotating-fast"; msg = "Serving the image to download"; } else if (online) { // Sic! @@ -359,7 +350,7 @@ export function Msd() { el.options.length = 1; // Cleanup return; } - if (!s.features.multi || s.storage.uploading || s.storage.downloading) { + if (s.storage.uploading || s.storage.downloading) { return; } |