summaryrefslogtreecommitdiff
path: root/kvmd/web/js/msd.js
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-07-22 04:31:29 +0300
committerDevaev Maxim <[email protected]>2018-07-22 04:31:29 +0300
commit1f55c63f89a7e338d9df8a5a3c6cb3842429fec8 (patch)
tree9bc01c197ad9700f6eee735d001f8aa32f77cfc9 /kvmd/web/js/msd.js
parent32c40c3b3a141a98ee3ae70483ba7fe11f536126 (diff)
ui fixes
Diffstat (limited to 'kvmd/web/js/msd.js')
-rw-r--r--kvmd/web/js/msd.js17
1 files changed, 10 insertions, 7 deletions
diff --git a/kvmd/web/js/msd.js b/kvmd/web/js/msd.js
index 34ba72f7..23dcbf58 100644
--- a/kvmd/web/js/msd.js
+++ b/kvmd/web/js/msd.js
@@ -56,7 +56,8 @@ var msd = new function() {
}
};
- this.selectNewImageFile = function(el_input) {
+ this.selectNewImageFile = function() {
+ var el_input = $("msd-select-new-image-file");
var image_file = (el_input.files.length ? el_input.files[0] : null);
if (image_file && image_file.size > __state.info.size) {
alert("New image is too big for your Mass Storage Device; maximum: " + __formatSize(__state.info.size));
@@ -64,11 +65,6 @@ var msd = new function() {
image_file = null;
}
__image_file = image_file;
- $("msd-new-image").style.display = (__image_file ? "block" : "none");
- $("msd-progress").setAttribute("data-label", "Waiting for upload ...");
- $("msd-progress-value").style.width = "0%";
- $("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
- $("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : "");
__applyState();
};
@@ -109,6 +105,12 @@ var msd = new function() {
$("msd-select-new-image-button").disabled = (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || __upload_http);
$("msd-upload-new-image-button").disabled = (!__state.in_operate || __state.connected_to !== "kvm" || __state.busy || !__image_file);
$("msd-abort-uploading-button").disabled = (!__state.in_operate || !__upload_http);
+
+ $("msd-new-image").style.display = (__image_file ? "block" : "none");
+ $("msd-progress").setAttribute("data-label", "Waiting for upload ...");
+ $("msd-progress-value").style.width = "0%";
+ $("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
+ $("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : "");
};
var __formatSize = function(size) {
@@ -125,7 +127,8 @@ var msd = new function() {
if (__upload_http.status !== 200) {
alert("Can't upload image to the Mass Storage Device:", __upload_http.responseText);
}
- el_input.value = "";
+ $("msd-select-new-image-file").value = "";
+ __image_file = null;
__upload_http = null;
__applyState();
}