diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/kvm/index.html | 10 | ||||
-rw-r--r-- | web/share/css/main.css | 4 | ||||
-rw-r--r-- | web/share/js/kvm/atx.js | 8 | ||||
-rw-r--r-- | web/share/js/kvm/msd.js | 34 |
4 files changed, 38 insertions, 18 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index 81293eb2..53bc8bcd 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -129,7 +129,7 @@ <hr> <button disabled data-force-hide-menu id="stream-reset-button">• Reset stream</button> <button disabled data-force-hide-menu id="hid-reset-button">• Reset keyboard & mouse</button> - <button disabled data-force-hide-menu id="msd-reset-button">• Reset mass storage</button> + <button disabled data-force-hide-menu id="msd-reset-button" class="feature-disabled">• Reset mass storage</button> </div> <hr> <div class="menu-item-content-buttons"> @@ -138,7 +138,7 @@ </div> </li> - <li class="menu-right-items"> + <li id="atx-dropdown" class="menu-right-items feature-disabled"> <a class="menu-item" href="#"> <img data-dont-hide-menu id="atx-power-led" class="led-gray" src="../share/svg/atx-power-led.svg" /> <img data-dont-hide-menu id="atx-hdd-led" class="led-gray" src="../share/svg/atx-hdd-led.svg" /> @@ -152,18 +152,18 @@ </div> </li> - <li class="menu-right-items"> + <li id="msd-dropdown" class="menu-right-items feature-disabled"> <a class="menu-item" href="#"> <img data-dont-hide-menu id="msd-led" class="led-gray" src="../share/svg/msd-led.svg" /> Mass Storage ↴ </a> <div data-dont-hide-menu id="msd-menu" class="menu-item-content"> - <div id="msd-not-in-operate" class="msd-message"> + <div id="msd-offline" class="msd-message"> <div class="menu-item-content-text"> <table> <tr> <td><img src="../share/svg/warning.svg" /></td> - <td><b>Mass Storage Device is not operational</b></td> + <td><b>Mass Storage Device is offline</b></td> </tr> </table> </div> diff --git a/web/share/css/main.css b/web/share/css/main.css index 6f50d63e..507fe16b 100644 --- a/web/share/css/main.css +++ b/web/share/css/main.css @@ -208,3 +208,7 @@ ul.footer li.footer-right { ul.footer li a { color: var(--cs-page-obscure-fg); } + +.feature-disabled { + display: none; +} diff --git a/web/share/js/kvm/atx.js b/web/share/js/kvm/atx.js index a81abe45..3c3b5ead 100644 --- a/web/share/js/kvm/atx.js +++ b/web/share/js/kvm/atx.js @@ -37,6 +37,14 @@ function Atx() { /************************************************************************/ self.setState = function(state) { + if (state) { + if (state.enabled) { + $("atx-dropdown").classList.remove("feature-disabled"); + } else { + $("atx-dropdown").classList.add("feature-disabled"); + } + } + $("atx-power-led").className = ((state && state.leds.power) ? "led-green" : "led-gray"); $("atx-hdd-led").className = ((state && state.leds.hdd) ? "led-red" : "led-gray"); diff --git a/web/share/js/kvm/msd.js b/web/share/js/kvm/msd.js index 7f00162a..246fc2ad 100644 --- a/web/share/js/kvm/msd.js +++ b/web/share/js/kvm/msd.js @@ -112,6 +112,14 @@ function Msd() { var __applyState = function() { if (__state) { + if (__state.enabled) { + $("msd-dropdown").classList.remove("feature-disabled"); + $("msd-reset-button").classList.remove("feature-disabled"); + } else { + $("msd-dropdown").classList.add("feature-disabled"); + $("msd-reset-button").classList.add("feature-disabled"); + } + if (__state.connected_to === "server") { $("msd-another-another-user-uploads").style.display = "none"; $("msd-led").className = "led-green"; @@ -125,29 +133,29 @@ function Msd() { } else { $("msd-another-another-user-uploads").style.display = "none"; $("msd-led").className = "led-gray"; - if (__state.in_operate) { + if (__state.online) { $("msd-status").innerHTML = $("msd-led").title = "Connected to KVM"; } else { $("msd-status").innerHTML = $("msd-led").title = "Unavailable"; } } - $("msd-not-in-operate").style.display = (__state.in_operate ? "none" : "block"); + $("msd-offline").style.display = (__state.online ? "none" : "block"); $("msd-current-image-broken").style.display = ( - __state.in_operate && __state.info.image && + __state.online && __state.info.image && !__state.info.image.complete && !__state.busy ? "block" : "none" ); - $("msd-current-image-name").innerHTML = (__state.in_operate && __state.info.image ? __state.info.image.name : "None"); - $("msd-current-image-size").innerHTML = (__state.in_operate && __state.info.image ? __formatSize(__state.info.image.size) : "None"); - $("msd-storage-size").innerHTML = (__state.in_operate ? __formatSize(__state.info.size) : "Unavailable"); + $("msd-current-image-name").innerHTML = (__state.online && __state.info.image ? __state.info.image.name : "None"); + $("msd-current-image-size").innerHTML = (__state.online && __state.info.image ? __formatSize(__state.info.image.size) : "None"); + $("msd-storage-size").innerHTML = (__state.online ? __formatSize(__state.info.size) : "Unavailable"); - wm.switchDisabled($("msd-switch-to-kvm-button"), (!__state.in_operate || __state.connected_to === "kvm" || __state.busy)); - wm.switchDisabled($("msd-switch-to-server-button"), (!__state.in_operate || __state.connected_to === "server" || __state.busy)); - wm.switchDisabled($("msd-select-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || __upload_http)); - wm.switchDisabled($("msd-upload-new-image-button"), (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || !__image_file)); - wm.switchDisabled($("msd-abort-uploading-button"), (!__state.in_operate || !__upload_http)); - wm.switchDisabled($("msd-reset-button"), (!__state.in_operate || __upload_http)); + wm.switchDisabled($("msd-switch-to-kvm-button"), (!__state.online || __state.connected_to === "kvm" || __state.busy)); + wm.switchDisabled($("msd-switch-to-server-button"), (!__state.online || __state.connected_to === "server" || __state.busy)); + wm.switchDisabled($("msd-select-new-image-button"), (!__state.online || __state.connected_to !== "kvm" || __state.busy || __upload_http)); + wm.switchDisabled($("msd-upload-new-image-button"), (!__state.online || __state.connected_to !== "kvm" || __state.busy || !__image_file)); + wm.switchDisabled($("msd-abort-uploading-button"), (!__state.online || !__upload_http)); + wm.switchDisabled($("msd-reset-button"), (!__state.online || __upload_http)); $("msd-new-image").style.display = (__image_file ? "block" : "none"); $("msd-progress").setAttribute("data-label", "Waiting for upload ..."); @@ -160,7 +168,7 @@ function Msd() { $("msd-led").className = "led-gray"; $("msd-status").innerHTML = ""; $("msd-led").title = ""; - $("msd-not-in-operate").style.display = "none"; + $("msd-offline").style.display = "none"; $("msd-current-image-broken").style.display = "none"; $("msd-current-image-name").innerHTML = ""; $("msd-current-image-size").innerHTML = ""; |