Fixing bugs with updates

This commit is contained in:
Andrew McManus 2021-07-26 21:39:22 -04:00
parent c8f25b0f9c
commit a661d33698
3 changed files with 6 additions and 3 deletions

View File

@ -407,10 +407,12 @@ class Server:
if len(websocket_helper.clients) > 0: if len(websocket_helper.clients) > 0:
# There are clients # There are clients
self.check_update() self.check_update()
message = '<a data-id="'+self.server_id+'" class=""> UPDATING...</i></a>'
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,
'string': message
}) })
backup_dir = os.path.join(self.settings['path'], 'crafty_executable_backups') backup_dir = os.path.join(self.settings['path'], 'crafty_executable_backups')
#checks if backup directory already exists #checks if backup directory already exists

View File

@ -286,10 +286,11 @@ $( 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;
var string = updateButton.string
var id = id.concat(updateButton.server_id); var id = id.concat(updateButton.server_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 = string;
} }
else{ else{
window.location.reload() window.location.reload()

View File

@ -136,7 +136,7 @@
webSocket.on('update_button_status', function (updateButton) { webSocket.on('update_button_status', function (updateButton) {
if (updateButton.isUpdating){ if (updateButton.isUpdating){
console.log(updateButton.isUpdating) console.log(updateButton.isUpdating)
document.getElementById('update_control_buttons').innerHTML = '<button onclick="" id="start-btn" style="max-width: 7rem;" class="btn btn-primary m-1 flex-grow-1">{{ translate("serverTerm", "updating") }}</button><button onclick="" id="restart-btn" style="max-width: 7rem;" class="btn btn-outline-primary m-1 flex-grow-1">{% raw translate("serverTerm", "restart") %}</button><button onclick="" id="stop-btn" style="max-width: 7rem;" class="btn btn-danger m-1 flex-grow-1 disabled">{{ translate("serverTerm", "stop") }}</button>'; document.getElementById('control_buttons').innerHTML = '<button onclick="" id="start-btn" style="max-width: 7rem;" class="btn btn-primary m-1 flex-grow-1">{{ translate("serverTerm", "updating") }}</button><button onclick="" id="restart-btn" style="max-width: 7rem;" class="btn btn-outline-primary m-1 flex-grow-1">{% raw translate("serverTerm", "restart") %}</button><button onclick="" id="stop-btn" style="max-width: 7rem;" class="btn btn-danger m-1 flex-grow-1 disabled">{{ translate("serverTerm", "stop") }}</button>';
} }
else{ else{
window.location.reload() window.location.reload()