Skip to content

Commit

Permalink
implement the send_logs toggle properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanSara authored May 4, 2022
1 parent 9e2ddca commit 1feeef8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions zanzocam/web_ui/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def logs_page():
percentage_occupancy = (total_logs_size / (total_logs_size + free_disk_space)) * 100

no_logs_dir = False
send_logs = read_flag_file(path=SEND_LOGS_FLAG, default=YES, catch_errors=True)
logs_count=len(logs.keys())
logs_size=f"{(total_logs_size / 1024):.2f} KB"
log_disk_occupancy=f"{percentage_occupancy:.4f}%"
Expand All @@ -79,6 +80,7 @@ def logs_page():
logs=[]
logs_count=0
logs_size="0 KB"
send_logs=True
log_disk_occupancy="0.0000%"

return render_template("logs.html",
Expand All @@ -87,5 +89,6 @@ def logs_page():
no_logs_dir=no_logs_dir,
logs=logs,
logs_count=logs_count,
send_logs=send_logs,
logs_size=logs_size,
log_disk_occupancy=log_disk_occupancy)
4 changes: 2 additions & 2 deletions zanzocam/web_ui/templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<div class="row">
<h3>Invio dei log al server:</h3>
<label class="toggle">
<input type="radio" value="YES" name="hotspot_value" {% if not hotspot_value or hotspot_value=="YES" %}checked{%endif%} onchange="javascript:logs('yes');">
<input type="radio" value="YES" name="send_logs" {% if not send_logs or send_logs=="YES" %}checked{%endif%} onchange="javascript:logs('yes');">
<span class="label">SI</span>
</label>
<label class="toggle">
<input type="radio" value="NO" name="hotspot_value" {% if hotspot_value=="NO" %}checked{%endif%} onchange="javascript:logs('no');">
<input type="radio" value="NO" name="send_logs" {% if send_logs=="NO" %}checked{%endif%} onchange="javascript:logs('no');">
<span class="label">NO</span>
</label>
</div>
Expand Down

0 comments on commit 1feeef8

Please sign in to comment.