mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-29 01:41:27 +00:00
Streamline the create iso workflow, removing the attach step (#1069)
This commit is contained in:
parent
649655ba40
commit
6ca140d842
|
@ -741,8 +741,7 @@ section#files p {
|
||||||
}
|
}
|
||||||
|
|
||||||
section#files table#images form.file-attach input[type="submit"],
|
section#files table#images form.file-attach input[type="submit"],
|
||||||
section#attach-devices form.device-attach input[type="submit"],
|
section#attach-devices form.device-attach input[type="submit"] {
|
||||||
section#create-iso form.iso-attach input[type="submit"] {
|
|
||||||
background: #efefef url("icons/file-device-attach.svg") no-repeat 0.5rem center;
|
background: #efefef url("icons/file-device-attach.svg") no-repeat 0.5rem center;
|
||||||
background-size: 1rem;
|
background-size: 1rem;
|
||||||
padding-left: 2rem;
|
padding-left: 2rem;
|
||||||
|
|
|
@ -385,7 +385,7 @@
|
||||||
<section id="create-iso">
|
<section id="create-iso">
|
||||||
<details>
|
<details>
|
||||||
<summary class="heading">
|
<summary class="heading">
|
||||||
{{ _("Create CD-ROM Image With File") }}
|
{{ _("Create CD-ROM Image") }}
|
||||||
</summary>
|
</summary>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{ _("HFS is for Mac OS, Joliet for Windows, and Rock Ridge for POSIX.") }}</li>
|
<li>{{ _("HFS is for Mac OS, Joliet for Windows, and Rock Ridge for POSIX.") }}</li>
|
||||||
|
@ -394,8 +394,8 @@
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<form action="/files/create_iso" method="post" class="iso-attach">
|
<form action="/files/create_iso" method="post">
|
||||||
<label for="iso_url">{{ _("Create ISO from URL:") }}</label>
|
<label for="iso_url">{{ _("Download file from URL:") }}</label>
|
||||||
<input name="url" id="iso_url" required="" type="url">
|
<input name="url" id="iso_url" required="" type="url">
|
||||||
<label for="iso_url_type">{{ _("Type:") }}</label>
|
<label for="iso_url_type">{{ _("Type:") }}</label>
|
||||||
<select name="type" id="iso_url_type">
|
<select name="type" id="iso_url_type">
|
||||||
|
@ -418,20 +418,12 @@
|
||||||
Rock Ridge
|
Rock Ridge
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="iso_url_scsi_id">{{ _("ID") }}</label>
|
<input type="submit" value="{{ _("Create") }}" onclick="processNotify('{{ _("Downloading file and generating CD-ROM image...") }}')">
|
||||||
<select name="scsi_id" id="iso_url_scsi_id">
|
|
||||||
{% for id in scsi_ids["valid_ids"] %}
|
|
||||||
<option value="{{ id }}"{% if id == scsi_ids["recommended_id"] %} selected{% endif %}>
|
|
||||||
{{ id }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type="submit" value="{{ _("Create and Attach") }}" onclick="processNotify('{{ _("Downloading file and generating CD-ROM image...") }}')">
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<form action="/files/create_iso" method="post" class="iso-attach">
|
<form action="/files/create_iso" method="post">
|
||||||
<label for="iso_file">{{ _("Create ISO from local file:") }}</label>
|
<label for="iso_file">{{ _("Use local file:") }}</label>
|
||||||
<select name="file" id="iso_file">
|
<select name="file" id="iso_file">
|
||||||
{% for f in files|sort(attribute='name') %}
|
{% for f in files|sort(attribute='name') %}
|
||||||
<option value="{{ f["name"] }}">{{ f["name"].replace(env["image_dir"], '') }}</option>
|
<option value="{{ f["name"] }}">{{ f["name"].replace(env["image_dir"], '') }}</option>
|
||||||
|
@ -458,15 +450,7 @@
|
||||||
Rock Ridge
|
Rock Ridge
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="iso_file_scsi_id">{{ _("ID") }}</label>
|
<input type="submit" value="{{ _("Create") }}" onclick="processNotify('{{ _("Generating CD-ROM image...") }}')">
|
||||||
<select name="scsi_id" id="iso_file_scsi_id">
|
|
||||||
{% for id in scsi_ids["valid_ids"] %}
|
|
||||||
<option value="{{ id }}"{% if id == scsi_ids["recommended_id"] %} selected{% endif %}>
|
|
||||||
{{ id }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
<input type="submit" value="{{ _("Create and Attach") }}" onclick="processNotify('{{ _("Generating CD-ROM image...") }}')">
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -476,7 +460,7 @@
|
||||||
<section id="create-image">
|
<section id="create-image">
|
||||||
<details>
|
<details>
|
||||||
<summary class="heading">
|
<summary class="heading">
|
||||||
{{ _("Create Empty Disk Image File") }}
|
{{ _("Create Empty Disk Image") }}
|
||||||
</summary>
|
</summary>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{ _("Please refer to <a href=\"%(url)s\" target=\"_blank\">wiki documentation</a> to learn more about the supported image file types.", url="https://github.com/PiSCSI/piscsi/wiki/Supported-Device-Types#image-types") }}</li>
|
<li>{{ _("Please refer to <a href=\"%(url)s\" target=\"_blank\">wiki documentation</a> to learn more about the supported image file types.", url="https://github.com/PiSCSI/piscsi/wiki/Supported-Device-Types#image-types") }}</li>
|
||||||
|
|
|
@ -892,7 +892,6 @@ def download_to_iso():
|
||||||
"""
|
"""
|
||||||
Downloads a file and creates a CD-ROM image with the specified file system and the file
|
Downloads a file and creates a CD-ROM image with the specified file system and the file
|
||||||
"""
|
"""
|
||||||
scsi_id = request.form.get("scsi_id")
|
|
||||||
url = request.form.get("url")
|
url = request.form.get("url")
|
||||||
iso_type = request.form.get("type")
|
iso_type = request.form.get("type")
|
||||||
local_file = request.form.get("file")
|
local_file = request.form.get("file")
|
||||||
|
@ -933,31 +932,11 @@ def download_to_iso():
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
process_attach = piscsi_cmd.attach_device(
|
|
||||||
scsi_id,
|
|
||||||
device_type="SCCD",
|
|
||||||
params={"file": process["file_name"]},
|
|
||||||
)
|
|
||||||
process_attach = ReturnCodeMapper.add_msg(process_attach)
|
|
||||||
if process_attach["status"]:
|
|
||||||
return response(
|
|
||||||
message=_(
|
|
||||||
"CD-ROM image %(file_name)s with type %(iso_type)s was created "
|
|
||||||
"and attached to SCSI ID %(id_number)s",
|
|
||||||
file_name=process["file_name"],
|
|
||||||
iso_type=iso_type,
|
|
||||||
id_number=scsi_id,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
return response(
|
return response(
|
||||||
error=True,
|
|
||||||
message=_(
|
message=_(
|
||||||
"CD-ROM image %(file_name)s with type %(iso_type)s was created "
|
"CD-ROM image %(file_name)s with type %(iso_type)s was created.",
|
||||||
"but could not be attached: %(error)s",
|
|
||||||
file_name=process["file_name"],
|
file_name=process["file_name"],
|
||||||
iso_type=iso_type,
|
iso_type=iso_type,
|
||||||
error=process_attach["msg"],
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ import uuid
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from conftest import (
|
from conftest import (
|
||||||
SCSI_ID,
|
|
||||||
FILE_SIZE_1_MIB,
|
FILE_SIZE_1_MIB,
|
||||||
STATUS_SUCCESS,
|
STATUS_SUCCESS,
|
||||||
)
|
)
|
||||||
|
@ -333,8 +332,6 @@ def test_create_iso_from_url(
|
||||||
httpserver,
|
httpserver,
|
||||||
http_client,
|
http_client,
|
||||||
list_files,
|
list_files,
|
||||||
list_attached_images,
|
|
||||||
detach_devices,
|
|
||||||
delete_file,
|
delete_file,
|
||||||
):
|
):
|
||||||
test_file_name = str(uuid.uuid4())
|
test_file_name = str(uuid.uuid4())
|
||||||
|
@ -355,7 +352,6 @@ def test_create_iso_from_url(
|
||||||
response = http_client.post(
|
response = http_client.post(
|
||||||
"/files/create_iso",
|
"/files/create_iso",
|
||||||
data={
|
data={
|
||||||
"scsi_id": SCSI_ID,
|
|
||||||
"type": ISO_TYPE,
|
"type": ISO_TYPE,
|
||||||
"url": url,
|
"url": url,
|
||||||
},
|
},
|
||||||
|
@ -366,16 +362,13 @@ def test_create_iso_from_url(
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_data["status"] == STATUS_SUCCESS
|
assert response_data["status"] == STATUS_SUCCESS
|
||||||
assert iso_file_name in list_files()
|
assert iso_file_name in list_files()
|
||||||
assert iso_file_name in list_attached_images()
|
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
response_data["messages"][0]["message"]
|
response_data["messages"][0]["message"]
|
||||||
== f"CD-ROM image {iso_file_name} with type {ISO_TYPE} was created "
|
== f"CD-ROM image {iso_file_name} with type {ISO_TYPE} was created."
|
||||||
f"and attached to SCSI ID {SCSI_ID}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
detach_devices()
|
|
||||||
delete_file(iso_file_name)
|
delete_file(iso_file_name)
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,8 +377,6 @@ def test_create_iso_from_local_file(
|
||||||
http_client,
|
http_client,
|
||||||
create_test_image,
|
create_test_image,
|
||||||
list_files,
|
list_files,
|
||||||
list_attached_images,
|
|
||||||
detach_devices,
|
|
||||||
delete_file,
|
delete_file,
|
||||||
):
|
):
|
||||||
test_file_name = create_test_image()
|
test_file_name = create_test_image()
|
||||||
|
@ -396,7 +387,6 @@ def test_create_iso_from_local_file(
|
||||||
response = http_client.post(
|
response = http_client.post(
|
||||||
"/files/create_iso",
|
"/files/create_iso",
|
||||||
data={
|
data={
|
||||||
"scsi_id": SCSI_ID,
|
|
||||||
"type": ISO_TYPE,
|
"type": ISO_TYPE,
|
||||||
"file": test_file_name,
|
"file": test_file_name,
|
||||||
},
|
},
|
||||||
|
@ -407,16 +397,13 @@ def test_create_iso_from_local_file(
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response_data["status"] == STATUS_SUCCESS
|
assert response_data["status"] == STATUS_SUCCESS
|
||||||
assert iso_file_name in list_files()
|
assert iso_file_name in list_files()
|
||||||
assert iso_file_name in list_attached_images()
|
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
response_data["messages"][0]["message"]
|
response_data["messages"][0]["message"]
|
||||||
== f"CD-ROM image {iso_file_name} with type {ISO_TYPE} was created "
|
== f"CD-ROM image {iso_file_name} with type {ISO_TYPE} was created."
|
||||||
f"and attached to SCSI ID {SCSI_ID}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
detach_devices()
|
|
||||||
delete_file(iso_file_name)
|
delete_file(iso_file_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user