Skip to content

Commit

Permalink
feat(ssdeadashboard): optionally use HTML progress element instead of…
Browse files Browse the repository at this point in the history
… CSS
  • Loading branch information
zdzichu committed Nov 16, 2024
1 parent d301149 commit 3740c7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ssd-health-dashboard/visualizer/app/ssdead.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

from flask import Flask, render_template
from flask import Flask, render_template, request
import datetime
import json
import humanize
Expand Down Expand Up @@ -94,10 +94,10 @@ def main():
"dead_on": dead_time.strftime('%B %Y'),
"written": humanize.naturalsize(data_written, binary=False), # manufacturers use power-of-10 sizes
"temperature": temperature,
"key_ttl": cache.ttl(key)
"key_ttl": cache.ttl(key),
})

return render_template("main.html", hosts_drives=hosts_drives)
return render_template("main.html", hosts_drives=hosts_drives, progress=request.args.get("progress"))

if __name__ == "__main__":
# app.run(host='::', port=7770)
Expand Down
4 changes: 4 additions & 0 deletions ssd-health-dashboard/visualizer/app/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
<tr>
<td>{{ drive.model_name }}<br/>
<span class="minor">{{ drive.drive }} 🌡️{{ drive.temperature }}°C</span></td>
{% if progress %}
<td width="25%"><progress max="100" value="{{ drive.percentage_used }}" title="Written: {{ drive.written }}">{{ drive.percentage_used }}%</progress></td>
{% else %}
<td width="25%"><div class="progress" style="width: {{ drive.percentage_used }}%" title="Written: {{ drive.written }}"> {{ drive.percentage_used }}% </div></td>
{% endif %}
<td>will live until {{ drive.dead_on }}😵</td>
</tr>
{% endfor %}
Expand Down

0 comments on commit 3740c7e

Please sign in to comment.