mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Cleanup update code
This commit is contained in:
parent
0643a68c74
commit
a8449cc6f2
@ -439,15 +439,13 @@ class Server:
|
|||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
db_helper.set_update(self.server_id, False)
|
db_helper.set_update(self.server_id, False)
|
||||||
dashOffHtmlString = '<a data-id="'+str(self.server_id)+'" class="play_button"><i class="fas fa-play"></i></a> <a data-id="'+str(self.server_id)+'" class="clone_button"> <i class="fas fa-clone"></i></a> '
|
|
||||||
if len(websocket_helper.clients) > 0:
|
if len(websocket_helper.clients) > 0:
|
||||||
# There are clients
|
# There are clients
|
||||||
self.check_update()
|
self.check_update()
|
||||||
websocket_helper.broadcast('update_button_status', {
|
websocket_helper.broadcast('update_button_status', {
|
||||||
'isUpdating': self.check_update(),
|
'isUpdating': self.check_update(),
|
||||||
'server_id': self.server_id,
|
'server_id': self.server_id,
|
||||||
'wasRunning': wasStarted,
|
'wasRunning': wasStarted
|
||||||
'dashOffGetString': dashOffHtmlString
|
|
||||||
})
|
})
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
websocket_helper.broadcast('notification', "Executable update finished for "+self.name)
|
websocket_helper.broadcast('notification', "Executable update finished for "+self.name)
|
||||||
|
@ -286,23 +286,13 @@ $( document ).ready(function() {
|
|||||||
webSocket.on('update_button_status', function (updateButton) {
|
webSocket.on('update_button_status', function (updateButton) {
|
||||||
var id = 'controls';
|
var id = 'controls';
|
||||||
var dataId = updateButton.server_id;
|
var dataId = updateButton.server_id;
|
||||||
console.log(dataId)
|
|
||||||
var id = id.concat(updateButton.server_id);
|
var id = id.concat(updateButton.server_id);
|
||||||
console.log("ID " + id);
|
|
||||||
if (updateButton.isUpdating){
|
if (updateButton.isUpdating){
|
||||||
console.log(updateButton.isUpdating)
|
console.log(updateButton.isUpdating)
|
||||||
document.getElementById(id).innerHTML = '<a data-id="dataId" class=""> UPDATING...</i></a>';
|
document.getElementById(id).innerHTML = '<a data-id="dataId" class=""> UPDATING...</i></a>';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
if (updateButton.wasStarted){
|
|
||||||
document.getElementById(id).innerHTML = '<a class="stop_button" data-id="dataId"> <i class="fas fa-stop"></i></a> <a class="restart_button" data-id="{{server["server_data"]["server_id"]}}"> <i class="fas fa-sync"></i></a> ';
|
|
||||||
|
|
||||||
}else{
|
|
||||||
document.getElementById(id).innerHTML = updateButton.dashOffGetString;
|
|
||||||
console.log(updateButton.dashOffGetString);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user