mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-18 17:15:13 +01:00
Add Full support for backup status
This commit is contained in:
parent
33cad6afa8
commit
6e4435c86f
@ -435,7 +435,7 @@ class Helpers:
|
||||
source_size += os.stat(fp).st_size
|
||||
files_count += 1
|
||||
dest_size = os.path.getsize(str(dest_path))
|
||||
percent = round((dest_size/source_size) * 100)
|
||||
percent = round((dest_size/source_size) * 100, 1)
|
||||
if percent >= 0:
|
||||
results = {
|
||||
"percent": percent,
|
||||
|
@ -665,6 +665,20 @@ class Server:
|
||||
file_helper.del_dirs(tempDir)
|
||||
logger.info(f"Backup of server: {self.name} completed")
|
||||
self.server_scheduler.remove_job("backup_"+str(self.server_id))
|
||||
results = {
|
||||
"percent": 100,
|
||||
"total_files": 0,
|
||||
"current_file": 0
|
||||
}
|
||||
if len(websocket_helper.clients) > 0:
|
||||
websocket_helper.broadcast_page_params(
|
||||
'/panel/server_detail',
|
||||
{
|
||||
'id': str(self.server_id)
|
||||
},
|
||||
'backup_status',
|
||||
results
|
||||
)
|
||||
server_users = server_permissions.get_server_user_list(self.server_id)
|
||||
for user in server_users:
|
||||
websocket_helper.broadcast_user(user, 'notification', translation.translate('notify', 'backupComplete',
|
||||
@ -674,6 +688,20 @@ class Server:
|
||||
except:
|
||||
logger.exception(f"Failed to create backup of server {self.name} (ID {self.server_id})")
|
||||
self.server_scheduler.remove_job("backup_"+str(self.server_id))
|
||||
results = {
|
||||
"percent": 100,
|
||||
"total_files": 0,
|
||||
"current_file": 0
|
||||
}
|
||||
if len(websocket_helper.clients) > 0:
|
||||
websocket_helper.broadcast_page_params(
|
||||
'/panel/server_detail',
|
||||
{
|
||||
'id': str(self.server_id)
|
||||
},
|
||||
'backup_status',
|
||||
results
|
||||
)
|
||||
self.is_backingup = False
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user