portal/automation: better logs display

This commit is contained in:
Iain Learmonth 2022-09-26 15:02:18 +01:00
parent 50bc79d1e7
commit 082eff218a
3 changed files with 6 additions and 4 deletions

View file

@ -8,7 +8,7 @@ from sqlalchemy import exc
from wtforms import SubmitField, BooleanField
from app.extensions import db
from app.models.automation import Automation
from app.models.automation import Automation, AutomationLogs
from app.portal.util import view_lifecycle, response_404
bp = Blueprint("automation", __name__)
@ -58,8 +58,10 @@ def automation_edit(automation_id: int) -> ResponseReturnValue:
flash("Saved changes to bridge configuration.", "success")
except exc.SQLAlchemyError:
flash("An error occurred saving the changes to the bridge configuration.", "danger")
logs = AutomationLogs.query.filter(AutomationLogs.automation_id == automation.id).order_by(AutomationLogs.added).all()
return render_template("automation.html.j2",
automation=automation,
logs=logs,
form=form,
**_SECTION_TEMPLATE_VARS)

View file

@ -11,6 +11,6 @@
</div>
<h3>Logs</h3>
{{ automation_logs_table(automation.logs) }}
{{ automation_logs_table(logs) }}
{% endblock %}

View file

@ -167,7 +167,7 @@
{% for log in logs %}
<tr>
<td>{{ log.added | format_datetime }}</td>
<td>{{ log.logs }}</td>
<td><pre style="overflow: scroll; height: 200px;">{{ log.logs | e }}</pre></td>
</tr>
{% endfor %}
</tbody>
@ -596,4 +596,4 @@
</tbody>
</table>
</div>
{% endmacro %}
{% endmacro %}