From 99ccaa925fe339302dd4f41686b0c5fa689cfbec Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Fri, 8 Mar 2024 23:23:36 -0500 Subject: [PATCH] Add backups to page --- app/classes/web/panel_handler.py | 9 +- app/frontend/static/assets/css/crafty.css | 10 ++ .../templates/panel/server_backup.html | 108 +++++++++++++++++- app/translations/en_EN.json | 8 +- 4 files changed, 130 insertions(+), 5 deletions(-) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index d61e3c0e..5532fdf5 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -680,6 +680,11 @@ class PanelHandler(BaseHandler): page_data["backup_config"] = ( self.controller.management.get_backup_config(server_id) ) + page_data["backups"] = self.controller.management.get_backups_by_server( + server_id, model=True + ) + for backup in page_data["backups"]: + print(backup) exclusions = [] page_data["exclusions"] = ( self.controller.management.get_excluded_backup_dirs(server_id) @@ -706,7 +711,9 @@ class PanelHandler(BaseHandler): page_data["backup_list"] = server.list_backups() except: page_data["backup_list"] = [] - page_data["backup_path"] = Helpers.wtol_path(server_info["backup_path"]) + page_data["backup_path"] = Helpers.wtol_path( + page_data["backup_config"]["backup_path"] + ) if subpage == "metrics": try: diff --git a/app/frontend/static/assets/css/crafty.css b/app/frontend/static/assets/css/crafty.css index 43dd2e6a..8a80f6d8 100644 --- a/app/frontend/static/assets/css/crafty.css +++ b/app/frontend/static/assets/css/crafty.css @@ -12,6 +12,16 @@ nav.sidebar { position: fixed; } +td { + -ms-overflow-style: none; + /* IE and Edge */ + scrollbar-width: none; + /* Firefox */ +} + +td::-webkit-scrollbar { + display: none; +} @media (min-width: 992px) { nav.sidebar { diff --git a/app/frontend/templates/panel/server_backup.html b/app/frontend/templates/panel/server_backup.html index 2a9263ba..7d5216f2 100644 --- a/app/frontend/templates/panel/server_backup.html +++ b/app/frontend/templates/panel/server_backup.html @@ -39,7 +39,111 @@ {% include "parts/m_server_controls_list.html %} - +
+
+
+
+

{{ translate('backups', 'backups', data['lang']) }}

+ {% if data['user_data']['hints'] %} + + {% end %} + +
+
+ {% if len(data['backups']) == 0 %} +
+ {{ translate('backups', 'no-backup', data['lang']) }} {{ translate('backups', 'newbackup',data['lang']) }}. +
+ {% end %} + {% if len(data['backups']) > 0 %} +
+ + + + + + + + + + + + {% for backup in data['backups'] %} + + + + + + + + {% end %} + +
{{ translate('serverBackups', 'enabled', data['lang']) }}{{ translate('serverBackups', 'name', data['lang']) }} {{ translate('serverBackups', 'storageLocation', data['lang']) }}{{ translate('serverBackups', 'maxBackups', data['lang']) }}{{ translate('serverBackups', 'actions', data['lang']) }}
+ + +

{{backup.backup_name}}

+
+

{{backup.backup_location}}

+
+

{{backup.max_backups}}

+
+ + + +
+
+
+ + + + + + + + + + {% for backup in data['backups'] %} + + + + + + {% end %} + +
{{ translate('backups', 'enabled', + data['lang']) }}Name + {{ translate('backups', 'edit', data['lang']) + }}
+ + +

{{backup.backup_name}}

+
+ + + +
+
+ {% end %} +
+
+
+

@@ -69,7 +173,7 @@ class="text-muted ml-1"> - {{ translate('serverBackups', 'storageLocationDesc', data['lang']) }} {% end %}
diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index 5c48b873..b0edd92e 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -323,7 +323,11 @@ "shutdown": "Shutdown server for duration of backup", "size": "Size", "storageLocation": "Storage Location", - "storageLocationDesc": "Where do you want to store backups?" + "storageLocationDesc": "Where do you want to store backups?", + "enabled": "Enabled", + "name": "Name", + "storage": "Storage Location", + "action": "Actions" }, "serverConfig": { "bePatientDelete": "Please be patient while we remove your server from the Crafty panel. This screen will close in a few moments.", @@ -671,4 +675,4 @@ "webhook_body": "Webhook Body", "webhooks": "Webhooks" } -} +} \ No newline at end of file