diff options
author | Maxim Devaev <[email protected]> | 2022-07-23 18:34:58 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-07-24 05:38:26 +0300 |
commit | 0e3ebac3627fe5039957d2d48d68d8620ff9384f (patch) | |
tree | 2792d2c261edffedf8bd8675f6ad8a5ea1bb56a3 /web/share | |
parent | de140537254a517559c78de048791a197011c1f6 (diff) |
reading images api
Diffstat (limited to 'web/share')
-rw-r--r-- | web/share/js/kvm/msd.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/web/share/js/kvm/msd.js b/web/share/js/kvm/msd.js index aff901d5..4e85239f 100644 --- a/web/share/js/kvm/msd.js +++ b/web/share/js/kvm/msd.js @@ -39,6 +39,7 @@ export function Msd() { $("msd-led").title = "Unknown state"; $("msd-image-selector").onchange = __selectImage; + tools.el.setOnClick($("msd-download-button"), __clickDownloadButton); tools.el.setOnClick($("msd-remove-button"), __clickRemoveButton); tools.radio.setOnClick("msd-mode-radio", __clickModeRadio); @@ -67,10 +68,16 @@ export function Msd() { var __selectImage = function() { tools.el.setEnabled($("msd-image-selector"), false); + tools.el.setEnabled($("msd-download-button"), false); tools.el.setEnabled($("msd-remove-button"), false); __sendParam("image", $("msd-image-selector").value); }; + var __clickDownloadButton = function() { + let name = $("msd-image-selector").value; + window.open(`/api/msd/read?image=${name}`); + }; + var __clickRemoveButton = function() { let name = $("msd-image-selector").value; wm.confirm(`Are you sure you want to remove the image<br><b>${name}</b> from PiKVM?`).then(function(ok) { @@ -244,6 +251,7 @@ export function Msd() { tools.el.setEnabled($("msd-image-selector"), (online && s.features.multi && !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.radio.setEnabled("msd-mode-radio", (online && s.features.cdrom && !s.drive.connected && !s.busy)); |