diff --git a/web/kvm/index.html b/web/kvm/index.html
index 5cf84b51..94a2fe21 100644
--- a/web/kvm/index.html
+++ b/web/kvm/index.html
@@ -962,18 +962,28 @@
-
+
diff --git a/web/kvm/navbar-switch.pug b/web/kvm/navbar-switch.pug
index ded526c1..ab16f375 100644
--- a/web/kvm/navbar-switch.pug
+++ b/web/kvm/navbar-switch.pug
@@ -22,7 +22,11 @@ li.right.feature-disabled#switch-dropdown
| when you decide to install it.
hr
- +menu_switch_table("switch-atx-ask-switch", true, true) Ask ATX click confirmation:
+ table.kv
+ tr
+ +menu_switch_td2("switch-atx-ask-switch", true, true) Ask ATX click confirmation:
+ tr
+ +menu_switch_td2("switch-msd-ask-switch", true, true) Confirm switching when the Drive is connected:
hr
table.kv#switch-chain
diff --git a/web/share/css/modal.css b/web/share/css/modal.css
index cf2f350d..935280e4 100644
--- a/web/share/css/modal.css
+++ b/web/share/css/modal.css
@@ -56,8 +56,8 @@ div.modal div.modal-window div.modal-header {
}
div.modal div.modal-window div.modal-content {
- max-width: 500px;
- max-height: 500px;
+ max-width: 600px;
+ max-height: 600px;
padding: 16px 9px 16px 9px;
}
diff --git a/web/share/js/kvm/switch.js b/web/share/js/kvm/switch.js
index b2328772..3470e12d 100644
--- a/web/share/js/kvm/switch.js
+++ b/web/share/js/kvm/switch.js
@@ -46,6 +46,7 @@ export function Switch() {
tools.el.setOnClick($("switch-edid-copy-data-button"), __clickCopyEdidDataButton);
tools.storage.bindSimpleSwitch($("switch-atx-ask-switch"), "switch.atx.ask", true);
+ tools.storage.bindSimpleSwitch($("switch-msd-ask-switch"), "switch.msd.ask", true);
for (let role of ["inactive", "active", "flashing", "beacon", "bootloader"]) {
let el_brightness = $(`switch-color-${role}-brightness-slider`);
@@ -563,13 +564,24 @@ export function Switch() {
};
var __switchActivePort = function(port) {
+ let switch_port = () => __sendPost("api/switch/set_active", {"port": port});
if (__msd_connected) {
- wm.error(`
- Oops! Before port switching, please disconnect an active Mass Storage Drive image first.
- Otherwise, it will break a current USB operation (OS installation, Live CD, or whatever).
- `);
+ if ($("switch-msd-ask-switch").checked) {
+ wm.confirm(`
+ The Mass Storage Drive is active.
+ If you switch the port now, it will break a current USB disk operation
+ (OS installation, Live CD, or whatever).
+ Are you sure you want to continue a port switching?
+ `).then(function(ok) {
+ if (ok) {
+ switch_port();
+ }
+ });
+ } else {
+ switch_port();
+ }
} else {
- __sendPost("api/switch/set_active", {"port": port});
+ switch_port();
}
};
@@ -592,9 +604,7 @@ export function Switch() {
};
var __atxClick = function(port, button) {
- let click_button = function() {
- __sendPost("api/switch/atx/click", {"port": port, "button": button});
- };
+ let click_button = () => __sendPost("api/switch/atx/click", {"port": port, "button": button});
if ($("switch-atx-ask-switch").checked) {
wm.confirm(`
Are you sure you want to press the ${tools.escape(button)} button?