summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-07-23 06:57:38 +0300
committerMaxim Devaev <[email protected]>2022-07-24 05:38:26 +0300
commit477e6f05e44d3c83ff19a97f1454ac1ba9191e70 (patch)
treea976dcd5550ad549699f54b5c10a0e68cececb6e /web
parentaa5a538c64f8ef8fe268bf1f78b44a0d70f14389 (diff)
writable msd
Diffstat (limited to 'web')
-rw-r--r--web/kvm/index.html11
-rw-r--r--web/kvm/navbar-msd.pug3
-rw-r--r--web/share/js/kvm/msd.js12
3 files changed, 26 insertions, 0 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html
index 3b908aee..093133ee 100644
--- a/web/kvm/index.html
+++ b/web/kvm/index.html
@@ -437,6 +437,17 @@
</td>
</tr>
</table>
+ <table class="kv msd-rw feature-disabled">
+ <tr>
+ <td>Read-write mode:</td>
+ <td align="right">
+ <div class="switch-box">
+ <input disabled type="checkbox" id="msd-rw-switch">
+ <label for="msd-rw-switch"><span class="switch-inner"></span><span class="switch"></span></label>
+ </div>
+ </td>
+ </tr>
+ </table>
<div class="msd-multi-storage feature-disabled">
<hr>
<div class="text">
diff --git a/web/kvm/navbar-msd.pug b/web/kvm/navbar-msd.pug
index b2cd5b99..68d764c3 100644
--- a/web/kvm/navbar-msd.pug
+++ b/web/kvm/navbar-msd.pug
@@ -47,6 +47,9 @@ li(id="msd-dropdown" class="right feature-disabled")
label(for="msd-mode-radio-cdrom") CD-ROM
input(type="radio" id="msd-mode-radio-flash" name="msd-mode-radio" value="0")
label(for="msd-mode-radio-flash") Flash
+ table(class="kv msd-rw feature-disabled")
+ tr
+ +menu_switch_notable("msd-rw-switch", "Read-write mode", false, false)
div(class="msd-multi-storage feature-disabled")
hr
div(class="text")
diff --git a/web/share/js/kvm/msd.js b/web/share/js/kvm/msd.js
index 3575f0c4..aff901d5 100644
--- a/web/share/js/kvm/msd.js
+++ b/web/share/js/kvm/msd.js
@@ -43,6 +43,8 @@ export function Msd() {
tools.radio.setOnClick("msd-mode-radio", __clickModeRadio);
+ tools.el.setOnClick($("msd-rw-switch"), __clickRwSwitch);
+
tools.el.setOnClick($("msd-select-new-button"), __toggleSelectSub);
$("msd-new-file").onchange = __selectNewFile;
$("msd-new-url").oninput = __selectNewUrl;
@@ -88,6 +90,10 @@ export function Msd() {
__sendParam("cdrom", tools.radio.getValue("msd-mode-radio"));
};
+ var __clickRwSwitch = function() {
+ __sendParam("rw", $("msd-rw-switch").checked);
+ };
+
var __sendParam = function(name, value) {
let http = tools.makeRequest("POST", `/api/msd/set_params?${name}=${encodeURIComponent(value)}`, function() {
if (http.readyState === 4) {
@@ -243,6 +249,9 @@ export function Msd() {
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)}`);
+ 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-disconnect-button"), (online && s.drive.connected && !s.busy));
@@ -289,6 +298,9 @@ export function Msd() {
for (let el of $$$(".msd-cdrom-emulation")) {
tools.feature.setEnabled(el, s.features.cdrom);
}
+ for (let el of $$$(".msd-rw")) {
+ tools.feature.setEnabled(el, s.features.rw);
+ }
}
tools.hidden.setVisible($("msd-message-offline"), (s && !s.online));