mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-04 01:30:40 +00:00
Hide controls when appropriate (#327)
* Hide image file controls when it is attached * Hide device actions when no device is attached
This commit is contained in:
parent
8e0e0c89ac
commit
8fb8a42825
@ -60,6 +60,7 @@
|
||||
<td style="text-align:center">{{device.vendor}} {{device.product}}</td>
|
||||
{% endif %}
|
||||
<td style="text-align:left">
|
||||
{% if device.device_type != "-" %}
|
||||
{% if device.device_type in removable_device_types and "No Media" not in device.status %}
|
||||
<form action="/scsi/eject" method="post" onsubmit="return confirm('Eject Disk?')">
|
||||
<input type="hidden" name="scsi_id" value="{{device.id}}">
|
||||
@ -83,6 +84,7 @@
|
||||
<input type="submit" value="Info" />
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="inactive">{{device.id}}</td>
|
||||
@ -129,6 +131,9 @@
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
{% if file["name"] in attached_images %}
|
||||
<center>Attached!</center>
|
||||
{% else %}
|
||||
<form action="/scsi/attach" method="post">
|
||||
<input type="hidden" name="file_name" value="{{file["name"]}}">
|
||||
<input type="hidden" name="file_size" value="{{file["size"]}}">
|
||||
@ -163,6 +168,7 @@
|
||||
<input type="submit" value="Properties">
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -63,8 +63,11 @@ def index():
|
||||
sorted_image_files = sorted(files["files"], key = lambda x: x["name"].lower())
|
||||
sorted_config_files = sorted(config_files, key = lambda x: x.lower())
|
||||
|
||||
from pathlib import Path
|
||||
attached_images = []
|
||||
luns = 0
|
||||
for d in devices["device_list"]:
|
||||
attached_images.append(Path(d["image"]).name)
|
||||
luns += int(d["un"])
|
||||
|
||||
reserved_scsi_ids = server_info["reserved_ids"]
|
||||
@ -80,7 +83,6 @@ def index():
|
||||
list(ARCHIVE_FILE_SUFFIX)
|
||||
)
|
||||
|
||||
|
||||
return render_template(
|
||||
"index.html",
|
||||
bridge_configured=is_bridge_setup(),
|
||||
@ -91,6 +93,7 @@ def index():
|
||||
cfg_dir=cfg_dir,
|
||||
scsi_ids=scsi_ids,
|
||||
recommended_id=recommended_id,
|
||||
attached_images=attached_images,
|
||||
luns=luns,
|
||||
reserved_scsi_ids=reserved_scsi_ids,
|
||||
max_file_size=int(MAX_FILE_SIZE / 1024 / 1024),
|
||||
|
Loading…
x
Reference in New Issue
Block a user