mirror of
https://github.com/akuker/RASCSI.git
synced 2024-09-12 09:55:00 +00:00
Display available disk space on the Pi
This commit is contained in:
parent
479df419d2
commit
82c039171f
@ -39,3 +39,9 @@ def is_bridge_setup():
|
|||||||
if "rascsi_bridge" in output:
|
if "rascsi_bridge" in output:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def disk_space():
|
||||||
|
from shutil import disk_usage
|
||||||
|
total, used, free = disk_usage(__file__)
|
||||||
|
return {"total": total, "used": used, "free": free}
|
||||||
|
@ -135,5 +135,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p><small>Available disk space on the Pi: {{free_disk}} MB</small></p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p><small>Available disk space on the Pi: {{free_disk}} MB</small></p>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
<h2>Attach Ethernet Adapter</h2>
|
<h2>Attach Ethernet Adapter</h2>
|
||||||
|
@ -28,6 +28,7 @@ from pi_cmds import (
|
|||||||
running_env,
|
running_env,
|
||||||
rascsi_service,
|
rascsi_service,
|
||||||
is_bridge_setup,
|
is_bridge_setup,
|
||||||
|
disk_space,
|
||||||
)
|
)
|
||||||
from ractl_cmds import (
|
from ractl_cmds import (
|
||||||
attach_image,
|
attach_image,
|
||||||
@ -50,6 +51,7 @@ app = Flask(__name__)
|
|||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
server_info = get_server_info()
|
server_info = get_server_info()
|
||||||
|
disk = disk_space()
|
||||||
devices = list_devices()
|
devices = list_devices()
|
||||||
files=list_files()
|
files=list_files()
|
||||||
config_files=list_config_files()
|
config_files=list_config_files()
|
||||||
@ -60,6 +62,7 @@ def index():
|
|||||||
reserved_scsi_ids = server_info["reserved_ids"]
|
reserved_scsi_ids = server_info["reserved_ids"]
|
||||||
formatted_devices = sort_and_format_devices(devices["device_list"])
|
formatted_devices = sort_and_format_devices(devices["device_list"])
|
||||||
scsi_ids = get_valid_scsi_ids(devices["device_list"], reserved_scsi_ids)
|
scsi_ids = get_valid_scsi_ids(devices["device_list"], reserved_scsi_ids)
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
bridge_configured=is_bridge_setup(),
|
bridge_configured=is_bridge_setup(),
|
||||||
@ -73,6 +76,7 @@ def index():
|
|||||||
running_env=running_env(),
|
running_env=running_env(),
|
||||||
server_info=server_info,
|
server_info=server_info,
|
||||||
netinfo=get_network_info(),
|
netinfo=get_network_info(),
|
||||||
|
free_disk=int(disk["free"] / 1024 / 1024),
|
||||||
valid_file_suffix="."+", .".join(VALID_FILE_SUFFIX),
|
valid_file_suffix="."+", .".join(VALID_FILE_SUFFIX),
|
||||||
removable_device_types=REMOVABLE_DEVICE_TYPES,
|
removable_device_types=REMOVABLE_DEVICE_TYPES,
|
||||||
harddrive_file_suffix=HARDDRIVE_FILE_SUFFIX,
|
harddrive_file_suffix=HARDDRIVE_FILE_SUFFIX,
|
||||||
@ -88,6 +92,7 @@ def drive_list():
|
|||||||
Sets up the data structures and kicks off the rendering of the drive list page
|
Sets up the data structures and kicks off the rendering of the drive list page
|
||||||
"""
|
"""
|
||||||
server_info = get_server_info()
|
server_info = get_server_info()
|
||||||
|
disk = disk_space()
|
||||||
|
|
||||||
# Reads the canonical drive properties into a dict
|
# Reads the canonical drive properties into a dict
|
||||||
# The file resides in the current dir of the web ui process
|
# The file resides in the current dir of the web ui process
|
||||||
@ -136,6 +141,7 @@ def drive_list():
|
|||||||
rm_conf=rm_conf,
|
rm_conf=rm_conf,
|
||||||
running_env=running_env(),
|
running_env=running_env(),
|
||||||
server_info=server_info,
|
server_info=server_info,
|
||||||
|
free_disk=int(disk["free"] / 1024 / 1024),
|
||||||
cdrom_file_suffix=CDROM_FILE_SUFFIX,
|
cdrom_file_suffix=CDROM_FILE_SUFFIX,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user