mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-27 04:49:18 +00:00
Merge pull request #373 from akuker/rdmark_inline_prop
Display image properties inline in the image list
This commit is contained in:
commit
7772b92503
@ -67,9 +67,10 @@ def list_images():
|
||||
|
||||
files = []
|
||||
for f in result.image_files_info.image_files:
|
||||
# Add flag for whether an image file has an associated *.properties file
|
||||
# Add properties meta data for the image, if applicable
|
||||
if f.name in prop_files:
|
||||
prop = True
|
||||
process = read_drive_properties(f"{cfg_dir}/{f.name}.{PROPERTIES_SUFFIX}")
|
||||
prop = process["conf"]
|
||||
else:
|
||||
prop = False
|
||||
size_mb = "{:,.1f}".format(f.size / 1024 / 1024)
|
||||
@ -309,10 +310,9 @@ def write_drive_properties(file_name, conf):
|
||||
|
||||
def read_drive_properties(path_name):
|
||||
"""
|
||||
Reads drive properties to any dir.
|
||||
Either ones deployed to the images dir, or the canonical database.
|
||||
Takes file path and bas (str) as argument
|
||||
Returns dict with boolean status and str msg
|
||||
Reads drive properties from json formatted file.
|
||||
Takes (str) path_name as argument.
|
||||
Returns dict with boolean status, str msg, dict conf
|
||||
"""
|
||||
from json import load
|
||||
try:
|
||||
|
@ -48,7 +48,7 @@ td.inactive {
|
||||
background-color:tan;
|
||||
}
|
||||
|
||||
summary {
|
||||
summary.heading {
|
||||
color: black;
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{% block content %}
|
||||
<details>
|
||||
<summary>Current RaSCSI Configuration</summary>
|
||||
<summary class="heading">Current RaSCSI Configuration</summary>
|
||||
<ul>
|
||||
<li>Displays the currently attached devices for each available SCSI ID.</li>
|
||||
<li>Save and load device configurations into <tt>{{cfg_dir}}</tt></li>
|
||||
@ -105,7 +105,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Image File Management</summary>
|
||||
<summary class="heading">Image File Management</summary>
|
||||
<ul>
|
||||
<li>Manage image files in the active RaSCSI image directory: <tt>{{base_dir}}</tt></li>
|
||||
<li>Select a valid SCSI ID and <a href="https://en.wikipedia.org/wiki/Logical_unit_number">LUN</a> to attach to. Unless you know what you're doing, always use LUN 0.</li>
|
||||
@ -123,7 +123,20 @@
|
||||
</tr>
|
||||
{% for file in files %}
|
||||
<tr>
|
||||
{% if file["prop"] %}
|
||||
<td>
|
||||
<details>
|
||||
<summary>{{file["name"]}}</summary>
|
||||
<ul>
|
||||
{% for key in file["prop"] %}
|
||||
<li>{{key}}: {{file['prop'][key]}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</details>
|
||||
</td>
|
||||
{% else %}
|
||||
<td>{{file["name"]}}</td>
|
||||
{% endif %}
|
||||
<td style="text-align:center">
|
||||
<form action="/files/download" method="post">
|
||||
<input type="hidden" name="image" value="{{file["name"]}}">
|
||||
@ -172,13 +185,6 @@
|
||||
<input type="hidden" name="image" value="{{file["name"]}}">
|
||||
<input type="submit" value="Delete" />
|
||||
</form>
|
||||
{% if file["prop"] %}
|
||||
<form action="/files/prop" method="post">
|
||||
<input type="hidden" name="image" value="{{file["name"]}}">
|
||||
<input type="submit" value="Properties">
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@ -190,7 +196,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Attach Ethernet Adapter</summary>
|
||||
<summary class="heading">Attach Ethernet Adapter</summary>
|
||||
<ul>
|
||||
<li>Emulates a SCSI DaynaPORT Ethernet Adapter. <a href="https://github.com/akuker/RASCSI/wiki/Dayna-Port-SCSI-Link#-macintosh-setup-instructions">Host drivers and configuration required</a>.</li>
|
||||
<li>If you have a DHCP setup, choose only the interface, and ignore the Static IP fields when attaching.</li>
|
||||
@ -228,7 +234,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Upload File</summary>
|
||||
<summary class="heading">Upload File</summary>
|
||||
<ul>
|
||||
<li>Uploads file to <tt>{{base_dir}}</tt>. The largest file size accepted is {{max_file_size}} MB.</li>
|
||||
<li>For unrecognized file types, try renaming hard drive images to '.hds' and CD-ROM images to '.iso' before uploading.</li>
|
||||
@ -259,7 +265,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Download File to Images</summary>
|
||||
<summary class="heading">Download File to Images</summary>
|
||||
<ul>
|
||||
<li>Given a URL, download that file to the <tt>{{base_dir}}</tt> directory.</li>
|
||||
</ul>
|
||||
@ -280,7 +286,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Download File to AppleShare</summary>
|
||||
<summary class="heading">Download File to AppleShare</summary>
|
||||
<ul>
|
||||
<li>Given a URL, download that file to the <tt>{{afp_dir}}</tt> directory and share it over AFP.</li>
|
||||
<li>Manage the files you download here through AppleShare on your vintage Mac.</li>
|
||||
@ -307,7 +313,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Download File from Web and Create HFS CD (Macintosh)</summary>
|
||||
<summary class="heading">Download File from Web and Create HFS CD (Macintosh)</summary>
|
||||
<ul>
|
||||
<li>Given a URL this will download a file, create a HFS iso, and mount it on the SCSI ID given.</li>
|
||||
<li>Requires a <a href="https://github.com/akuker/RASCSI/wiki/Drive-Setup#Mounting_CD_ISO_or_MO_images">compatible CD-ROM driver</a> installed on the target system.</li>
|
||||
@ -335,7 +341,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Create Empty Disk Image File</summary>
|
||||
<summary class="heading">Create Empty Disk Image File</summary>
|
||||
<ul>
|
||||
<li>The Generic image type is recommended for most systems</li>
|
||||
<li>APPLE GENUINE and NEC GENUINE image types will make RaSCSI masquerade as a particular drive type that are recognized by Mac and PC98 systems, respectively.</li>
|
||||
@ -367,7 +373,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Create Named Drive</summary>
|
||||
<summary class="heading">Create Named Drive</summary>
|
||||
<ul>
|
||||
<li>Here you can create pairs of images and properties files from a list of real-life drives.</li>
|
||||
<li>This will make RaSCSI use certain vendor strings and block sizes that may improve compatibility with certain systems</li>
|
||||
@ -379,7 +385,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Logging</summary>
|
||||
<summary class="heading">Logging</summary>
|
||||
<ul>
|
||||
<li>Get a certain number of lines of service logs with the given scope.</li>
|
||||
</ul>
|
||||
@ -406,7 +412,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Server Log Level</summary>
|
||||
<summary class="heading">Server Log Level</summary>
|
||||
<ul>
|
||||
<li>Change the log level of the RaSCSI backend service.</li>
|
||||
<li>The dropdown will indicate the current log level.</li>
|
||||
@ -432,7 +438,7 @@
|
||||
<hr/>
|
||||
|
||||
<details>
|
||||
<summary>Raspberry Pi Operations</summary>
|
||||
<summary class="heading">Raspberry Pi Operations</summary>
|
||||
<ul>
|
||||
<li>Issue reboot or shutdown commands to the Raspberr Pi.</li>
|
||||
<li>You can also restart the RaSCSI backend service here.</li>
|
||||
|
@ -646,27 +646,6 @@ def unzip():
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
@app.route("/files/prop", methods=["POST"])
|
||||
def show_properties():
|
||||
file_name = request.form.get("image")
|
||||
file_path = f"{cfg_dir}{file_name}.{PROPERTIES_SUFFIX}"
|
||||
|
||||
process = read_drive_properties(file_path)
|
||||
prop = process["conf"]
|
||||
|
||||
if process["status"]:
|
||||
flash("=== DRIVE PROPERTIES ===")
|
||||
flash(f"File Name: {cfg_dir}{file_name}")
|
||||
flash(f"Vendor: {prop['vendor']}")
|
||||
flash(f"Product: {prop['product']}")
|
||||
flash(f"Revision: {prop['revision']}")
|
||||
flash(f"Block Size: {prop['block_size']}")
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
flash(f"Failed to get drive properties for {file_name}", "error")
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.secret_key = "rascsi_is_awesome_insecure_secret_key"
|
||||
app.config["SESSION_TYPE"] = "filesystem"
|
||||
|
Loading…
Reference in New Issue
Block a user