Add warning if SD card is getting full

This commit is contained in:
Taylor Helsper 2021-12-04 18:17:09 -06:00
parent 17e6c146db
commit 2b65ff420f
2 changed files with 29 additions and 15 deletions

View File

@ -494,12 +494,15 @@ def index():
lnd_status = get_lnd_status()
lnd_status_color = get_lnd_status_color()
# Find drive usage
# Find drive / SD card usage
os_drive_usage = get_os_drive_usage()
data_drive_usage = get_data_drive_usage()
low_drive_space_error = False
low_os_drive_space_error = False
if int(re.sub("[^0-9]", "", data_drive_usage)) >= 95:
low_drive_space_error = True
if int(re.sub("[^0-9]", "", os_drive_usage)) >= 95:
low_os_drive_space_error = True
# Check for new version of software
upgrade_available = False
@ -555,6 +558,7 @@ def index():
"data_drive_usage": data_drive_usage,
"os_drive_usage": os_drive_usage,
"low_drive_space_error": low_drive_space_error,
"low_os_drive_space_error": low_os_drive_space_error,
"is_quicksync_disabled": not is_quicksync_enabled(),
"cpu_usage": get_cpu_usage(),
"ram_usage": get_ram_usage(),

View File

@ -1,30 +1,38 @@
{% if fsck_error %}
<div class="main_page_error_block">
<center>
<p>There may be an error with the filesystem on your drive.</p>
<p>{{ fsck_results }}</p>
<p style="text-align: center;"><b>Warning!</b></p>
<p style="text-align: center;">There may be an error with the filesystem on your drive.</p>
<p style="text-align: center;">
{{ fsck_results }}
<br/><br/><br/>
<a href="/clear-fsck-error" class="ui-button ui-widget ui-corner-all settings_button_small">OK</a>
</center>
</p>
</div>
{% endif %}
{% if sd_rw_error %}
<div class="main_page_error_block">
<center>
<p>There may be an error with the filesystem on your SD card. It was mounted as read-only and has been updated to read/write.</p>
</center>
<p style="text-align: center;">There may be an error with the filesystem on your SD card. It was mounted as read-only and has been updated to read/write.</p>
</div>
{% endif %}
{% if low_drive_space_error %}
<div class="main_page_error_block">
<center>
<p>Your drive is {{data_drive_usage}} full and free space is running very low. You may need to upgrade to a larger drive.</p>
<p style="text-align: center;"><b>Warning!</b></p>
<p style="text-align: center;">Your drive is {{data_drive_usage}} full and free space is running very low. You may need to upgrade to a larger drive.</p>
{% if not is_quicksync_disabled %}
<p>QuickSync is enabled! Disable <a href="/settings#quicksync">QuickSync</a> to save significant disk space.</p>
<p style="text-align: center;">QuickSync is enabled! Disable <a href="/settings#quicksync">QuickSync</a> to save significant disk space.</p>
{% endif %}
<p>To migrate to a larger drive, try the <a href="/settings#clone_tool">Clone Tool</a>.</p>
</center>
<p style="text-align: center;">To migrate to a larger drive, try the <a href="/settings#clone_tool">Clone Tool</a>.</p>
</div>
{% endif %}
{% if low_os_drive_space_error %}
<div class="main_page_error_block">
<p style="text-align: center;"><b>Warning!</b></p>
<p style="text-align: center;">Your SD card is {{os_drive_usage}} full and free space is running low.</p>
<p style="text-align: center;">You can flash the latest image for your device onto a larger SD card. Instructions
and download links are available <a href="https://mynodebtc.com/download" target="_blank">here</a>.</p>
</div>
{% endif %}
@ -42,7 +50,9 @@
{% if not has_changed_password %}
<div class="main_page_warning_block">
<p style="text-align: center;"><b>Warning!</b><br/>You appear to be using the default password! You should change it to something else on the <a href="/settings">settings</a> page.</p>
<p style="text-align: center;"><b>Warning!</b></p>
<p style="text-align: center;">You appear to be using the default password! You should change it to
something else on the <a href="/settings">settings</a> page.</p>
</div>
{% endif %}