From 956195d67eb8c91ad702518a3806450e5d2d8f4a Mon Sep 17 00:00:00 2001
From: Daniel Markstedt
Date: Sat, 28 Jan 2023 14:34:34 -0800
Subject: [PATCH] Ability to download and upload config files (#1083)
- Rename `/config/load` endpoint to `/config/action` since it has multiple functions
- Add a `send` function to above endpoint, which triggers a download of the config file, and use it with a new Download button on the index page
- Add an option to upload to the CFG_DIR
- Improve layout of the file transfer destination web form: radio buttons before labels, and better padding between options
- Add a test for config downloading
---
python/web/src/static/themes/modern/style.css | 8 +--
python/web/src/templates/index.html | 7 +--
python/web/src/templates/upload.html | 7 ++-
python/web/src/web.py | 25 +++++++---
python/web/tests/api/test_settings.py | 49 +++++++++++++++++--
5 files changed, 77 insertions(+), 19 deletions(-)
diff --git a/python/web/src/static/themes/modern/style.css b/python/web/src/static/themes/modern/style.css
index 35632141..978d9c6a 100644
--- a/python/web/src/static/themes/modern/style.css
+++ b/python/web/src/static/themes/modern/style.css
@@ -49,6 +49,10 @@ a:hover {
text-decoration: none;
}
+input[type="radio"] {
+ margin: 0 0.1rem 0 0.75rem;
+}
+
/*
------------------------------------------------------------------------------
Tables
@@ -145,10 +149,6 @@ select {
align-items: center;
}
-.dropzone label {
- padding: 0 0.5rem;
-}
-
.dropzone p,
.dropzone .dz-default {
flex: 0 0 100%;
diff --git a/python/web/src/templates/index.html b/python/web/src/templates/index.html
index be98df14..06adc9b5 100644
--- a/python/web/src/templates/index.html
+++ b/python/web/src/templates/index.html
@@ -13,7 +13,7 @@
-
@@ -368,10 +369,10 @@
diff --git a/python/web/src/templates/upload.html b/python/web/src/templates/upload.html
index a67941d5..c76aecb0 100644
--- a/python/web/src/templates/upload.html
+++ b/python/web/src/templates/upload.html
@@ -7,14 +7,17 @@
{{ _("You have to manually clean up partially uploaded files, as a result of cancelling the upload or closing this page.") }}
{{ _("Disk Images") }} = {{ env["image_dir"] }}
{{ _("Shared Files") }} = {{ FILE_SERVER_DIR }}
+ {{ _("PiSCSI Config") }} = {{ CFG_DIR }}
{{ _("Destination") }}