mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
web: process default states
This commit is contained in:
parent
a57e5cdaa9
commit
4f901d2f78
@ -15,17 +15,12 @@ function Atx() {
|
|||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
self.setState = function(state) {
|
self.setState = function(state) {
|
||||||
$("atx-power-led").className = (state.leds.power ? "led-green" : "led-gray");
|
$("atx-power-led").className = ((state && state.leds.power) ? "led-green" : "led-gray");
|
||||||
$("atx-hdd-led").className = (state.leds.hdd ? "led-red" : "led-gray");
|
$("atx-hdd-led").className = ((state && state.leds.hdd) ? "led-red" : "led-gray");
|
||||||
|
|
||||||
wm.switchDisabled($("atx-power-button"), state.busy);
|
wm.switchDisabled($("atx-power-button"), (!state || state.busy));
|
||||||
wm.switchDisabled($("atx-power-button-long"), state.busy);
|
wm.switchDisabled($("atx-power-button-long"), (!state || state.busy));
|
||||||
wm.switchDisabled($("atx-reset-button"), state.busy);
|
wm.switchDisabled($("atx-reset-button"), (!state || state.busy));
|
||||||
};
|
|
||||||
|
|
||||||
self.clearState = function() {
|
|
||||||
$("atx-power-led").className = "led-gray";
|
|
||||||
$("atx-hdd-led").className = "led-gray";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var __clickButton = function(button, confirm_msg) {
|
var __clickButton = function(button, confirm_msg) {
|
||||||
|
|||||||
@ -89,11 +89,11 @@ function Msd() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var __applyState = function() {
|
var __applyState = function() {
|
||||||
|
if (__state) {
|
||||||
if (__state.connected_to === "server") {
|
if (__state.connected_to === "server") {
|
||||||
$("msd-another-another-user-uploads").style.display = "none";
|
$("msd-another-another-user-uploads").style.display = "none";
|
||||||
$("msd-led").className = "led-green";
|
$("msd-led").className = "led-green";
|
||||||
$("msd-status").innerHTML = $("msd-led").title = "Connected to Server";
|
$("msd-status").innerHTML = $("msd-led").title = "Connected to Server";
|
||||||
$("msd-another-another-user-uploads").style.display = "none";
|
|
||||||
} else if (__state.busy) {
|
} else if (__state.busy) {
|
||||||
if (!__upload_http) {
|
if (!__upload_http) {
|
||||||
$("msd-another-another-user-uploads").style.display = "block";
|
$("msd-another-another-user-uploads").style.display = "block";
|
||||||
@ -132,6 +132,32 @@ function Msd() {
|
|||||||
$("msd-progress-value").style.width = "0%";
|
$("msd-progress-value").style.width = "0%";
|
||||||
$("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
|
$("msd-new-image-name").innerHTML = (__image_file ? __image_file.name : "");
|
||||||
$("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : "");
|
$("msd-new-image-size").innerHTML = (__image_file ? __formatSize(__image_file.size) : "");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$("msd-another-another-user-uploads").style.display = "none";
|
||||||
|
$("msd-led").className = "led-gray";
|
||||||
|
$("msd-status").innerHTML = "";
|
||||||
|
$("msd-led").title = "";
|
||||||
|
$("msd-not-in-operate").style.display = "none";
|
||||||
|
$("msd-current-image-broken").style.display = "none";
|
||||||
|
$("msd-current-image-name").innerHTML = "";
|
||||||
|
$("msd-current-image-size").innerHTML = "";
|
||||||
|
$("msd-storage-size").innerHTML = "";
|
||||||
|
|
||||||
|
wm.switchDisabled($("msd-switch-to-kvm-button"), true);
|
||||||
|
wm.switchDisabled($("msd-switch-to-server-button"), true);
|
||||||
|
wm.switchDisabled($("msd-select-new-image-button"), true);
|
||||||
|
wm.switchDisabled($("msd-upload-new-image-button"), true);
|
||||||
|
wm.switchDisabled($("msd-abort-uploading-button"), true);
|
||||||
|
wm.switchDisabled($("msd-reset-button"), true);
|
||||||
|
|
||||||
|
$("msd-select-new-image-file").value = "";
|
||||||
|
$("msd-new-image").style.display = "none";
|
||||||
|
$("msd-progress").setAttribute("data-label", "");
|
||||||
|
$("msd-progress-value").style.width = "0%";
|
||||||
|
$("msd-new-image-name").innerHTML = "";
|
||||||
|
$("msd-new-image-size").innerHTML = "";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var __formatSize = function(size) {
|
var __formatSize = function(size) {
|
||||||
|
|||||||
@ -81,12 +81,12 @@ function Session() {
|
|||||||
} else if (event.msg_type === "event") {
|
} else if (event.msg_type === "event") {
|
||||||
if (event.msg.event === "info_state") {
|
if (event.msg.event === "info_state") {
|
||||||
__setKvmdInfo(event.msg.event_attrs);
|
__setKvmdInfo(event.msg.event_attrs);
|
||||||
} else if (event.msg.event === "streamer_state") {
|
|
||||||
__streamer.setState(event.msg.event_attrs);
|
|
||||||
} else if (event.msg.event === "atx_state") {
|
} else if (event.msg.event === "atx_state") {
|
||||||
__atx.setState(event.msg.event_attrs);
|
__atx.setState(event.msg.event_attrs);
|
||||||
} else if (event.msg.event === "msd_state") {
|
} else if (event.msg.event === "msd_state") {
|
||||||
__msd.setState(event.msg.event_attrs);
|
__msd.setState(event.msg.event_attrs);
|
||||||
|
} else if (event.msg.event === "streamer_state") {
|
||||||
|
__streamer.setState(event.msg.event_attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -110,9 +110,10 @@ function Session() {
|
|||||||
__ping_timer = null;
|
__ping_timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
__streamer.clearState();
|
|
||||||
__atx.clearState();
|
|
||||||
__hid.setSocket(null);
|
__hid.setSocket(null);
|
||||||
|
__atx.setState(null);
|
||||||
|
__msd.setState(null);
|
||||||
|
__streamer.setState(null);
|
||||||
__ws = null;
|
__ws = null;
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ function Streamer() {
|
|||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
|
||||||
self.setState = function(state) {
|
self.setState = function(state) {
|
||||||
if (state.state) {
|
if (state && state.state) {
|
||||||
var source = state.state.source;
|
var source = state.state.source;
|
||||||
var stream = state.state.stream;
|
var stream = state.state.stream;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ function Streamer() {
|
|||||||
if (stream.clients_stat.hasOwnProperty(__client_id)) {
|
if (stream.clients_stat.hasOwnProperty(__client_id)) {
|
||||||
__client_fps = stream.clients_stat[__client_id].fps;
|
__client_fps = stream.clients_stat[__client_id].fps;
|
||||||
} else {
|
} else {
|
||||||
self.clearState();
|
__clearState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__prev) {
|
if (!__prev) {
|
||||||
@ -110,11 +110,11 @@ function Streamer() {
|
|||||||
__updateStreamHeader(true);
|
__updateStreamHeader(true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
self.clearState();
|
__clearState();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
self.clearState = function() {
|
var __clearState = function() {
|
||||||
tools.info("Stream: refreshing ...");
|
tools.info("Stream: refreshing ...");
|
||||||
|
|
||||||
$("stream-image").className = "stream-image-inactive";
|
$("stream-image").className = "stream-image-inactive";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user