Add audit history
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-08-06 15:43:48 +03:00
parent aa76374f1f
commit 495ddd3e21
2 changed files with 38 additions and 7 deletions

View File

@@ -65,13 +65,29 @@
<td>{{ item.inventory.get("user").username | display_name }}</td>
</tr>
{% macro auditLine(timestamp, user) -%}
{{ timestamp | timeago }}
by
{{ user | display_name }}
{%- endmacro %}
<tr>
<td>Last audited</td>
<td>
{% if item.inventory.get("audit") %}
{{ item.inventory.audit.timestamp | timeago }}
by
{{ item.inventory.audit.username | display_name }}
{% if item.inventory.get("audit", {}).get("log") %}
<details>
<summary>
{{ auditLine(item.inventory.audit.timestamp, item.inventory.audit.username) }}
</summary>
<ul class="browser-default">
{% for audit in item.inventory.audit.log | reverse %}
<li>{{ auditLine(audit.timestamp, audit.username) }}</li>
{% endfor %}
</ul>
</details>
{% else %}
{{ auditLine(item.inventory.audit.timestamp, item.inventory.audit.username) }}
{% endif %}
{% else %}
Never
{% endif %}