mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Move backups to ajax request
This commit is contained in:
parent
319e06cd10
commit
8858780d41
@ -309,6 +309,19 @@ class AjaxHandler(BaseHandler):
|
|||||||
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
self.controller.users.update_server_order(exec_user['user_id'], bleach.clean(self.get_argument('order')))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif page == "backup_now":
|
||||||
|
server_id = self.get_argument('id', None)
|
||||||
|
if server_id is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
server = self.controller.get_server_obj(server_id)
|
||||||
|
self.controller.management.add_to_audit_log_raw(
|
||||||
|
self.controller.users.get_user_by_id(exec_user['user_id'])['username'], exec_user['user_id'], server_id,
|
||||||
|
f"Backup now executed for server {server_id} ",
|
||||||
|
source_ip=self.get_remote_ip())
|
||||||
|
|
||||||
|
server.backup_server()
|
||||||
|
|
||||||
elif page == "clear_comms":
|
elif page == "clear_comms":
|
||||||
if exec_user['superuser']:
|
if exec_user['superuser']:
|
||||||
self.controller.clear_unexecuted_commands()
|
self.controller.clear_unexecuted_commands()
|
||||||
|
@ -466,6 +466,8 @@ class PanelHandler(BaseHandler):
|
|||||||
page_data['backup_config'] = self.controller.management.get_backup_config(server_id)
|
page_data['backup_config'] = self.controller.management.get_backup_config(server_id)
|
||||||
exclusions = []
|
exclusions = []
|
||||||
page_data['exclusions'] = self.controller.management.get_excluded_backup_dirs(server_id)
|
page_data['exclusions'] = self.controller.management.get_excluded_backup_dirs(server_id)
|
||||||
|
page_data['backing_up'] = self.controller.get_server_obj(server_id).is_backingup
|
||||||
|
page_data['backup_stats'] = self.controller.get_server_obj(server_id).send_backup_status()
|
||||||
#makes it so relative path is the only thing shown
|
#makes it so relative path is the only thing shown
|
||||||
for file in page_data['exclusions']:
|
for file in page_data['exclusions']:
|
||||||
if helper.is_os_windows():
|
if helper.is_os_windows():
|
||||||
@ -526,20 +528,6 @@ class PanelHandler(BaseHandler):
|
|||||||
|
|
||||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=backup")
|
self.redirect(f"/panel/server_detail?id={server_id}&subpage=backup")
|
||||||
|
|
||||||
elif page == 'backup_now':
|
|
||||||
server_id = self.check_server_id()
|
|
||||||
if server_id is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
server = self.controller.get_server_obj(server_id)
|
|
||||||
management_helper.add_to_audit_log_raw(
|
|
||||||
self.controller.users.get_user_by_id(exec_user['user_id'])['username'], exec_user['user_id'], server_id,
|
|
||||||
f"Backup now executed for server {server_id} ",
|
|
||||||
source_ip=self.get_remote_ip())
|
|
||||||
|
|
||||||
server.backup_server()
|
|
||||||
self.redirect(f"/panel/server_detail?id={server_id}&subpage=backup")
|
|
||||||
|
|
||||||
elif page == 'panel_config':
|
elif page == 'panel_config':
|
||||||
auth_servers = {}
|
auth_servers = {}
|
||||||
auth_role_servers = {}
|
auth_role_servers = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user