Update messages are working, but it's not clean and we should find a better way at some point.

This commit is contained in:
Andrew 2021-08-07 15:23:22 -04:00
parent f50e80749c
commit 160e374c7a
4 changed files with 18 additions and 2 deletions

View File

@ -146,6 +146,8 @@ class Server:
'error': msg 'error': msg
}) })
return False return False
websocket_helper.broadcast('send_start_reload', {
})
self.is_crashed = False self.is_crashed = False
self.start_time = str(datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')) self.start_time = str(datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'))

View File

@ -221,6 +221,7 @@
if (webSocket) { if (webSocket) {
webSocket.on('send_start_error', function (start_error) { webSocket.on('send_start_error', function (start_error) {
var closeEl = document.createElement('span'); var closeEl = document.createElement('span');
var strongEL = document.createElement('strong'); var strongEL = document.createElement('strong');
var msgEl = document.createElement('div'); var msgEl = document.createElement('div');
@ -248,7 +249,12 @@ if (webSocket) {
parentEl.appendChild(msgEl); parentEl.appendChild(msgEl);
document.querySelector('.warnings').appendChild(parentEl); document.querySelector('.warnings').appendChild(parentEl);
});
}
if (webSocket) {
webSocket.on('send_start_reload', function (start_error) {
location.reload()
}); });
} }

View File

@ -229,7 +229,11 @@ function send_command (server_id, command){
success: function(data){ success: function(data){
console.log("got response:"); console.log("got response:");
console.log(data); console.log(data);
setTimeout(function(){ location.reload() }, 10000); setTimeout(function(){
if (command != 'start_server'){
location.reload();
}
}, 10000);
} }
}); });

View File

@ -127,7 +127,11 @@
success: function(data){ success: function(data){
console.log("got response:"); console.log("got response:");
console.log(data); console.log(data);
setTimeout(function(){ location.reload(); }, 10000); setTimeout(function(){
if (command != 'start_server'){
location.reload();
}
}, 10000);
} }
}); });