Attach empty removable drives in the Web UI (#877)

* Read the drive properties file once and store it in the Flask app config. Spin out the drive properties formatting to a helper method.

* Add empty removable disk drives to the attach peripherals UI

* Refinement of UI labels and help text, moving some context to the wiki
This commit is contained in:
Daniel Markstedt
2022-10-01 16:51:30 -07:00
committed by GitHub
parent 255a6e139f
commit d969fbdcce
8 changed files with 187 additions and 84 deletions
+38 -4
View File
@@ -1,7 +1,6 @@
import pytest
from conftest import (
IMAGES_DIR,
SCSI_ID,
FILE_SIZE_1_MIB,
STATUS_SUCCESS,
@@ -27,7 +26,7 @@ def test_attach_image(http_client, create_test_image, detach_devices):
assert response.status_code == 200
assert response_data["status"] == STATUS_SUCCESS
assert response_data["messages"][0]["message"] == (
f"Attached {test_image} as Hard Disk to SCSI ID {SCSI_ID} LUN 0"
f"Attached {test_image} as Hard Disk Drive to SCSI ID {SCSI_ID} LUN 0"
)
# Cleanup
@@ -38,8 +37,43 @@ def test_attach_image(http_client, create_test_image, detach_devices):
@pytest.mark.parametrize(
"device_name,device_config",
[
# TODO: Fix networking in container, else SCBR attachment fails
# ("X68000 Host Bridge", {"type": "SCBR", "interface": "eth0", "inet": "10.10.20.1/24"}),
(
"Removable Disk Drive",
{
"type": "SCRM",
"drive_props": {
"vendor": "VENDOR",
"product": "PRODUCT",
"revision": "0123",
"block_size": "512",
},
},
),
(
"Magneto-Optical Drive",
{
"type": "SCMO",
"drive_props": {
"vendor": "VENDOR",
"product": "PRODUCT",
"revision": "0123",
"block_size": "512",
},
},
),
(
"CD/DVD Drive",
{
"type": "SCCD",
"drive_props": {
"vendor": "VENDOR",
"product": "PRODUCT",
"revision": "0123",
"block_size": "512",
},
},
),
("Host Bridge", {"type": "SCBR", "interface": "eth0", "inet": "10.10.20.1/24"}),
("DaynaPORT SCSI/Link", {"type": "SCDP", "interface": "eth0", "inet": "10.10.20.1/24"}),
("Host Services", {"type": "SCHS"}),
("Printer", {"type": "SCLP", "timeout": 30, "cmd": "lp -oraw %f"}),
+1 -5
View File
@@ -4,7 +4,6 @@ import os
from conftest import (
IMAGES_DIR,
AFP_DIR,
SCSI_ID,
FILE_SIZE_1_MIB,
STATUS_SUCCESS,
@@ -201,10 +200,7 @@ def test_upload_file(http_client, delete_file):
def test_download_file(http_client, create_test_image):
file_name = create_test_image()
response = http_client.post(
"/files/download",
data={"file": f"{IMAGES_DIR}/{file_name}"}
)
response = http_client.post("/files/download", data={"file": f"{IMAGES_DIR}/{file_name}"})
assert response.status_code == 200
assert response.headers["content-type"] == "application/octet-stream"
+1 -3
View File
@@ -42,9 +42,7 @@ def test_show_named_drive_presets(http_client):
assert response.status_code == 200
assert response_data["status"] == STATUS_SUCCESS
assert "cd_conf" in response_data["data"]
assert "hd_conf" in response_data["data"]
assert "rm_conf" in response_data["data"]
assert "drive_properties" in response_data["data"]
# route("/drive/cdrom", methods=["POST"])