mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
pikvm/pikvm#1518: web: switch: Toggle to disable MSD warning
This commit is contained in:
parent
54cb364c2e
commit
37e8aa2cec
@ -962,18 +962,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
<table class="kv">
|
<table class="kv">
|
||||||
<tr>
|
<tr>
|
||||||
<td>Ask ATX click confirmation:
|
<td>Ask ATX click confirmation:
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<div class="switch-box">
|
<div class="switch-box">
|
||||||
<input checked type="checkbox" id="switch-atx-ask-switch">
|
<input checked type="checkbox" id="switch-atx-ask-switch">
|
||||||
<label for="switch-atx-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
<label for="switch-atx-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
<tr>
|
||||||
|
<td>Confirm switching when the Drive is connected:
|
||||||
|
</td>
|
||||||
|
<td align="right">
|
||||||
|
<div class="switch-box">
|
||||||
|
<input checked type="checkbox" id="switch-msd-ask-switch">
|
||||||
|
<label for="switch-msd-ask-switch"><span class="switch-inner"></span><span class="switch"></span></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<hr>
|
<hr>
|
||||||
<table class="kv" id="switch-chain"></table>
|
<table class="kv" id="switch-chain"></table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -22,7 +22,11 @@ li.right.feature-disabled#switch-dropdown
|
|||||||
| when you decide to install it.
|
| when you decide to install it.
|
||||||
hr
|
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
|
hr
|
||||||
|
|
||||||
table.kv#switch-chain
|
table.kv#switch-chain
|
||||||
|
|||||||
@ -56,8 +56,8 @@ div.modal div.modal-window div.modal-header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.modal div.modal-window div.modal-content {
|
div.modal div.modal-window div.modal-content {
|
||||||
max-width: 500px;
|
max-width: 600px;
|
||||||
max-height: 500px;
|
max-height: 600px;
|
||||||
padding: 16px 9px 16px 9px;
|
padding: 16px 9px 16px 9px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ export function Switch() {
|
|||||||
tools.el.setOnClick($("switch-edid-copy-data-button"), __clickCopyEdidDataButton);
|
tools.el.setOnClick($("switch-edid-copy-data-button"), __clickCopyEdidDataButton);
|
||||||
|
|
||||||
tools.storage.bindSimpleSwitch($("switch-atx-ask-switch"), "switch.atx.ask", true);
|
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"]) {
|
for (let role of ["inactive", "active", "flashing", "beacon", "bootloader"]) {
|
||||||
let el_brightness = $(`switch-color-${role}-brightness-slider`);
|
let el_brightness = $(`switch-color-${role}-brightness-slider`);
|
||||||
@ -563,13 +564,24 @@ export function Switch() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var __switchActivePort = function(port) {
|
var __switchActivePort = function(port) {
|
||||||
|
let switch_port = () => __sendPost("api/switch/set_active", {"port": port});
|
||||||
if (__msd_connected) {
|
if (__msd_connected) {
|
||||||
wm.error(`
|
if ($("switch-msd-ask-switch").checked) {
|
||||||
Oops! Before port switching, please disconnect an active Mass Storage Drive image first.
|
wm.confirm(`
|
||||||
Otherwise, it will break a current USB operation (OS installation, Live CD, or whatever).
|
The Mass Storage Drive is active.<br><br>
|
||||||
`);
|
If you switch the port now, it will break a current USB disk operation<br>
|
||||||
|
(OS installation, Live CD, or whatever).<br><br>
|
||||||
|
Are you sure you want to continue a port switching?
|
||||||
|
`).then(function(ok) {
|
||||||
|
if (ok) {
|
||||||
|
switch_port();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
switch_port();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
__sendPost("api/switch/set_active", {"port": port});
|
switch_port();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -592,9 +604,7 @@ export function Switch() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var __atxClick = function(port, button) {
|
var __atxClick = function(port, button) {
|
||||||
let click_button = function() {
|
let click_button = () => __sendPost("api/switch/atx/click", {"port": port, "button": button});
|
||||||
__sendPost("api/switch/atx/click", {"port": port, "button": button});
|
|
||||||
};
|
|
||||||
if ($("switch-atx-ask-switch").checked) {
|
if ($("switch-atx-ask-switch").checked) {
|
||||||
wm.confirm(`
|
wm.confirm(`
|
||||||
Are you sure you want to press the <b>${tools.escape(button)}</b> button?<br>
|
Are you sure you want to press the <b>${tools.escape(button)}</b> button?<br>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user