Introduce info.html template and use it to render detailed info (#863)

new:
- new templates to render structured info contents in
- get_diskinfo() class method that calls disktype and returns the results
- /diskinfo endpoint in the Flask app that renders the results from get_diskinfo()

changed:
- /logs/show and /scsi/info endpoints in the Flask app render in templates
- Now using the "RaSCSI Reloaded Control Page" header to function as the link back to the homepage (instead of the github project) which is in line with how most webapps work
- Removed the center style for "Attached!" to allow the ? button to be placed on the same line
- Remove individual device info, and introduced show all device info in a template
This commit is contained in:
Daniel Markstedt
2022-09-26 17:44:41 -07:00
committed by GitHub
parent edbaaf645d
commit 5da3d6c24b
11 changed files with 188 additions and 86 deletions
+2 -5
View File
@@ -176,17 +176,14 @@ def test_show_device_info(http_client, create_test_image, detach_devices):
response = http_client.post(
"/scsi/info",
data={
"scsi_id": SCSI_ID,
},
)
response_data = response.json()
assert response.status_code == 200
assert response_data["status"] == STATUS_SUCCESS
assert "device_info" in response_data["data"]
assert response_data["data"]["device_info"]["file"] == f"{IMAGES_DIR}/{test_image}"
assert "devices" in response_data["data"]
assert response_data["data"]["devices"][0]["file"] == test_image
# Cleanup
detach_devices()
+17
View File
@@ -315,3 +315,20 @@ def test_download_url_to_iso(
# Cleanup
detach_devices()
delete_file(iso_file_name)
# route("/files/diskinfo", methods=["POST"])
def test_show_diskinfo(http_client, create_test_image):
test_image = create_test_image()
response = http_client.post(
"/files/diskinfo",
data={
"file_name": test_image,
},
)
response_data = response.json()
assert response.status_code == 200
assert "Regular file" in response_data["data"]["diskinfo"]
+5 -2
View File
@@ -61,12 +61,15 @@ def test_show_logs(http_client):
"/logs/show",
data={
"lines": 100,
"scope": "",
"scope": "rascsi",
},
)
response_data = response.json()
assert response.status_code == 200
assert response.headers["content-type"] == "text/plain"
assert response_data["data"]["lines"] == "100"
assert response_data["data"]["scope"] == "rascsi"
# route("/config/save", methods=["POST"])