{% extends "base.html" %}
{% import '_ui.html' as ui %}
{% block title %}Audit log - PXE Manager{% endblock %}
{# Audit log, newest first. One line per entry: time, source, action chip and
the details truncated with a tip; the full details are in the row body.
Chips are coloured by action family; destructive actions use c-err. The
whole log is rendered; the script shows the first 300 matches and a
"Show more" control. #}
{% set families = [
('images', 'Images', 'w11'),
('drivers', 'Drivers and BIOS', 'off'),
('enrollment', 'Enrollment', 'ok'),
('blancco', 'Blancco', 'neutral'),
('imaging', 'Imaging', 'w10'),
('boot', 'Boot files', 'neutral'),
('backups', 'Backups', 'w10'),
('other', 'Other', 'neutral'),
] %}
{% set fam_kind = {} %}{% for k, l, c in families %}{% set _ = fam_kind.update({k: c}) %}{% endfor %}
{% macro family(a) -%}
{%- if a.startswith('IMAGING_') -%}imaging
{%- elif a.startswith(('IMAGE_', 'UNATTEND_', 'SHOPFLOOR_MENU', 'STARTNET', 'PACKAGE_')) -%}images
{%- elif a.startswith(('DRIVER_', 'DELL_', 'HARDWARE_', 'BIOS_')) -%}drivers
{%- elif a.startswith(('ENROLLMENT_', 'PPKG_', 'MCL_', 'BPRT_')) -%}enrollment
{%- elif a.startswith(('BLANCCO_', 'REPORT_')) -%}blancco
{%- elif a.startswith('IPXE_') -%}boot
{%- elif a.startswith('BACKUP_') -%}backups
{%- else -%}other{%- endif -%}
{%- endmacro %}
{% block extra_head %}
{% endblock %}
{% block content %}
{{ ui.head('Audit log', 'Tools', (entries | length) ~ ' entr' ~ ('ies' if entries | length != 1 else 'y') ~ ', newest first.') }}
Activity history
{% if entries %}
{# Parse once, so the filter pills can show counts. #}
{% set rows = [] %}
{% for entry in entries %}
{% set parts = entry.split(' ', 1) %}
{% set r = {'raw': entry, 'when': '', 'src': '', 'action': '', 'detail': entry} %}
{% if parts | length == 2 %}
{% set _ = r.update({'when': parts[0].split(',')[0], 'detail': parts[1]}) %}
{% set meta = parts[1].split('] ', 1) %}
{% if meta | length == 2 %}
{% set _ = r.update({'src': meta[0].lstrip('['), 'detail': meta[1]}) %}
{% set ad = meta[1].split(': ', 1) %}
{% if ad | length == 2 %}{% set _ = r.update({'action': ad[0], 'detail': ad[1]}) %}{% endif %}
{% endif %}
{% endif %}
{% set fam = family(r.action) if r.action else 'other' %}
{% set _ = r.update({'fam': fam, 'bad': r.action and ('DELETE' in r.action or 'ROLLBACK' in r.action or 'REMOVE' in r.action)}) %}
{% set _ = rows.append(r) %}
{% endfor %}
{% set bad_count = rows | selectattr('bad') | list | length %}
{% if bad_count %}{% endif %}
{% for k, label, c in families %}
{% set n = rows | selectattr('fam', 'equalto', k) | list | length %}
{% if n %}{% endif %}
{% endfor %}
TimeSourceActionDetails
{% for r in rows %}
{{ r.when or '-' }}{{ r.src or '-' }}{% if r.action %}{{ ui.chip(r.action, 'err' if r.bad else fam_kind[r.fam]) }}{% else %}-{% endif %}{{ r.detail or '-' }}▾