Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bebuch committed Mar 20, 2018
1 parent d114e18 commit 4ef8a68
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ <h1>live view</h1>
});
};

var last_chain = 'none';

var command_socket = new WebSocket('ws://' + window.location.host + '/');
command_socket.onmessage = function(evt){
console.log("control onmessage");
Expand All @@ -98,13 +100,19 @@ <h1>live view</h1>
disable_change_events();
if(typeof(data['running-chains']) === 'string' && data['running-chains'] === ''){
document.getElementById("none").checked = true;
last_chain = 'none';
}else if(Object.prototype.toString.call(data['running-chains']) === '[object Array]'){
if(data['running-chains'].includes("show_live")){
document.getElementById("show_live").checked = true;
last_chain = 'show_live';
live_connection = live_image('scheduler');
}else if(data['running-chains'].includes("save_live")){
document.getElementById("save_live").checked = true;
last_chain = 'save_live';
live_connection = live_image('scheduler');
}else{
document.getElementById("none").checked = true;
last_chain = 'none';
}
}
enable_change_events();
Expand All @@ -116,6 +124,7 @@ <h1>live view</h1>

disable_change_events();
document.getElementById(data['run-chain']).checked = true;
last_chain = data['run-chain'];
enable_change_events();

live_connection = live_image('scheduler');
Expand All @@ -127,6 +136,7 @@ <h1>live view</h1>

disable_change_events();
document.getElementById("none").checked = true;
last_chain = 'none';
enable_change_events();

live_connection = false;
Expand All @@ -146,7 +156,6 @@ <h1>live view</h1>
};


var last_chain = 'none';
function changeHandler(event){
if(last_chain != 'none'){
command_socket.send(JSON.stringify({chain: last_chain, live: false}));
Expand Down

0 comments on commit 4ef8a68

Please sign in to comment.