add well done message if no errors in the logs
This commit is contained in:
@@ -82,5 +82,6 @@ async def data_fetch():
|
|||||||
|
|
||||||
data["notes-list"] = await render_template(
|
data["notes-list"] = await render_template(
|
||||||
'templ_notes_list.html.j2',
|
'templ_notes_list.html.j2',
|
||||||
notes=LogHandler().get_buffer(3))
|
notes=LogHandler().get_buffer(3),
|
||||||
|
hide_if_empty=True)
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ async def mqtt_fetch():
|
|||||||
|
|
||||||
data["notes-list"] = await render_template(
|
data["notes-list"] = await render_template(
|
||||||
'templ_notes_list.html.j2',
|
'templ_notes_list.html.j2',
|
||||||
notes=LogHandler().get_buffer(3))
|
notes=LogHandler().get_buffer(3),
|
||||||
|
hide_if_empty=True)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
19
app/src/web/notes_list.py
Normal file
19
app/src/web/notes_list.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from quart import render_template
|
||||||
|
from quart_babel import format_datetime
|
||||||
|
|
||||||
|
from . import web
|
||||||
|
from .log_handler import LogHandler
|
||||||
|
|
||||||
|
|
||||||
|
@web.route('/notes-fetch')
|
||||||
|
async def notes_fetch():
|
||||||
|
data = {
|
||||||
|
"update-time": format_datetime(format="medium"),
|
||||||
|
}
|
||||||
|
|
||||||
|
data["notes-list"] = await render_template(
|
||||||
|
'templ_notes_list.html.j2',
|
||||||
|
notes=LogHandler().get_buffer(),
|
||||||
|
hide_if_empty=False)
|
||||||
|
|
||||||
|
return data
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
{% if notes|length > 0 %}
|
{% if notes|length > 0 %}
|
||||||
<div class="w3-container w3-margin-bottom">
|
<div class="w3-container w3-margin-bottom">
|
||||||
<h5>Notes</h5>
|
<h5>{{_("Warnings and error messages")}} </h5>
|
||||||
<ul class="w3-ul w3-card-4">
|
<ul class="w3-ul w3-card-4">
|
||||||
{% for note in notes %}
|
{% for note in notes %}
|
||||||
<li class="{% if note.level is le(30) %}w3-leftbar w3-rightbar w3-pale-blue w3-border-blue{% else %}w3-leftbar w3-rightbar w3-pale-red w3-border-red{% endif %}">
|
<li class="{% if note.level is le(30) %}w3-leftbar w3-rightbar w3-pale-blue w3-border-blue{% else %}w3-leftbar w3-rightbar w3-pale-red w3-border-red{% endif %}">
|
||||||
<span class="w3-col" style="width:160px">{{note.ctime|datetimeformat}}</span>
|
<span class="w3-col" style="width:150px">{{note.ctime|datetimeformat(format='short')}}</span>
|
||||||
<span class="w3-col w3-hide-small" style="width:100px">{{note.lname|e}}</span>
|
<span class="w3-col w3-hide-small" style="width:100px">{{note.lname|e}}</span>
|
||||||
<span class="w3-rest">{{note.msg|e}}</span>
|
<span class="w3-rest">{{note.msg|e}}</span>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{% elif not hide_if_empty %}
|
||||||
|
<div class="w3-container w3-margin-bottom">
|
||||||
|
<div class="w3-leftbar w3-rightbar w3-pale-green w3-border-green">
|
||||||
|
<div class="w3-container">
|
||||||
|
<h2>{{_("Well done!")}}</h2>
|
||||||
|
<p>{{_("No warnings or errors have been logged since the last proxy start.")}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
Reference in New Issue
Block a user