summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-07-23 18:34:58 +0300
committerMaxim Devaev <[email protected]>2022-07-24 05:38:26 +0300
commit0e3ebac3627fe5039957d2d48d68d8620ff9384f (patch)
tree2792d2c261edffedf8bd8675f6ad8a5ea1bb56a3 /web
parentde140537254a517559c78de048791a197011c1f6 (diff)
reading images api
Diffstat (limited to 'web')
-rw-r--r--web/kvm/index.html3
-rw-r--r--web/kvm/navbar-msd.pug1
-rw-r--r--web/share/js/kvm/msd.js8
3 files changed, 12 insertions, 0 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html
index 093133ee..ebcc824a 100644
--- a/web/kvm/index.html
+++ b/web/kvm/index.html
@@ -420,6 +420,9 @@
<select disabled id="msd-image-selector"></select>
</td>
<td>
+ <button disabled id="msd-download-button" title="Download image">&nbsp;&nbsp;&#128426;&nbsp;&nbsp;</button>
+ </td>
+ <td>
<button disabled id="msd-remove-button" title="Remove image"><b>&nbsp;&nbsp;&times;&nbsp;&nbsp;</b></button>
</td>
</tr>
diff --git a/web/kvm/navbar-msd.pug b/web/kvm/navbar-msd.pug
index 68d764c3..ae2e063e 100644
--- a/web/kvm/navbar-msd.pug
+++ b/web/kvm/navbar-msd.pug
@@ -37,6 +37,7 @@ li(id="msd-dropdown" class="right feature-disabled")
tr
td Image:
td(width="100%") #[select(disabled id="msd-image-selector")]
+ td #[button(disabled id="msd-download-button" title="Download image") &nbsp;&nbsp;&#128426;&nbsp;&nbsp;]
td #[button(disabled id="msd-remove-button" title="Remove image") #[b &nbsp;&nbsp;&times;&nbsp;&nbsp;]]
table(class="kv msd-cdrom-emulation feature-disabled")
tr
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));