diff options
author | Devaev Maxim <[email protected]> | 2019-03-18 02:00:58 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-03-18 03:32:14 +0300 |
commit | d049400a97d7c0d785298f23c34bd4e3ed612f36 (patch) | |
tree | aaaa299770c0be464bcbd9728e60903202ca1e2f /web/share | |
parent | d1a6d79af5043ba8c0b2e085e0ca32922d8b23e1 (diff) |
optional msd and atx
Diffstat (limited to 'web/share')
-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 |
3 files changed, 33 insertions, 13 deletions
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 = ""; |