feat(audit-log): show resolved names instead of UUIDs in the table + detail #107

Merged
YousifShkara merged 1 commit from feat/audit-log-show-names into main 2026-06-10 05:52:24 +02:00
Owner

The audit log table rendered an 8-char UUID prefix in both the "Entity ID" and "User" columns, and the expanded detail row dumped the full UUIDs again. Every other user-visible reference to an actor or a record in mokosh already uses resolved names (assigned_to_name on tickets, display_name() on calendar, user_name() on projects); the audit log was the last surface where end users saw a raw UUID.

Pairs with the mokosh-server patch (feat/audit-log-resolve-names) that adds user_name: Option<String> and entity_name: Option<String> to AuditLogEntryResponse, computed server-side via a LEFT JOIN against users plus a CASE-per-entity-type subselect (companies/contacts/sites/contracts/contract_items/rate_cards/invoices/tickets/projects/assets/credential_vault/payment_gateway_configs/tax_rates, plus the auth synthetic type whose entity_id is itself a user_id).

SPA wiring:

  • AuditLogEntry gains the two new Option fields with #[serde(default)] so an older server build (pre-rename, before the JOIN ships) decodes cleanly and the UI falls back to the short-UUID rendering rather than failing to parse the response.
  • The table row reads entity_name and user_name. user_name falls back to "System" when null (catches system-issued rows + JIT-created users whose name hasn't been onboarded yet); entity_name falls back to the short-UUID prefix so a brand-new entity_type that doesn't have a server-side resolver row yet still gets SOMETHING the reader can correlate against.
  • The "Entity ID" column header is renamed "Record" - the column now shows a human label, not an identifier, and the "Entity" column to its left already carries the type label.
  • The expanded detail view renders the resolved name as the primary value, with the raw UUID demoted to a small muted sub-line for traceability when correlating across logs/DB. The sub-line is suppressed entirely when the underlying UUID is null (system-issued rows).

Net effect for the user: the audit log table now reads "yousif (Yousif Lastname) created ticket T000042 in tenant X" instead of "8abc12... created entity in tenant 4f3e2d...". The short UUID remains as a safety net for any entity_type the server doesn't yet resolve, and a small muted UUID sub-line in the detail view preserves the ability to chase a row through logs by id when debugging.

The audit log table rendered an 8-char UUID prefix in both the "Entity ID" and "User" columns, and the expanded detail row dumped the full UUIDs again. Every other user-visible reference to an actor or a record in mokosh already uses resolved names (assigned_to_name on tickets, display_name() on calendar, user_name() on projects); the audit log was the last surface where end users saw a raw UUID. Pairs with the mokosh-server patch (feat/audit-log-resolve-names) that adds `user_name: Option<String>` and `entity_name: Option<String>` to `AuditLogEntryResponse`, computed server-side via a LEFT JOIN against users plus a CASE-per-entity-type subselect (companies/contacts/sites/contracts/contract_items/rate_cards/invoices/tickets/projects/assets/credential_vault/payment_gateway_configs/tax_rates, plus the `auth` synthetic type whose entity_id is itself a user_id). SPA wiring: - `AuditLogEntry` gains the two new Option<String> fields with `#[serde(default)]` so an older server build (pre-rename, before the JOIN ships) decodes cleanly and the UI falls back to the short-UUID rendering rather than failing to parse the response. - The table row reads `entity_name` and `user_name`. `user_name` falls back to "System" when null (catches system-issued rows + JIT-created users whose name hasn't been onboarded yet); `entity_name` falls back to the short-UUID prefix so a brand-new entity_type that doesn't have a server-side resolver row yet still gets SOMETHING the reader can correlate against. - The "Entity ID" column header is renamed "Record" - the column now shows a human label, not an identifier, and the "Entity" column to its left already carries the type label. - The expanded detail view renders the resolved name as the primary value, with the raw UUID demoted to a small muted sub-line for traceability when correlating across logs/DB. The sub-line is suppressed entirely when the underlying UUID is null (system-issued rows). Net effect for the user: the audit log table now reads "yousif (Yousif Lastname) created ticket T000042 in tenant X" instead of "8abc12... created entity in tenant 4f3e2d...". The short UUID remains as a safety net for any entity_type the server doesn't yet resolve, and a small muted UUID sub-line in the detail view preserves the ability to chase a row through logs by id when debugging.
feat(audit-log): show resolved names instead of UUIDs in the table + detail
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 1m59s
841e47ad48
The audit log table rendered an 8-char UUID prefix in both the "Entity ID" and "User" columns, and the expanded detail row dumped the full UUIDs again. Every other user-visible reference to an actor or a record in mokosh already uses resolved names (assigned_to_name on tickets, display_name() on calendar, user_name() on projects); the audit log was the last surface where end users saw a raw UUID.

Pairs with the mokosh-server patch (feat/audit-log-resolve-names) that adds `user_name: Option<String>` and `entity_name: Option<String>` to `AuditLogEntryResponse`, computed server-side via a LEFT JOIN against users plus a CASE-per-entity-type subselect (companies/contacts/sites/contracts/contract_items/rate_cards/invoices/tickets/projects/assets/credential_vault/payment_gateway_configs/tax_rates, plus the `auth` synthetic type whose entity_id is itself a user_id).

SPA wiring:

- `AuditLogEntry` gains the two new Option<String> fields with `#[serde(default)]` so an older server build (pre-rename, before the JOIN ships) decodes cleanly and the UI falls back to the short-UUID rendering rather than failing to parse the response.
- The table row reads `entity_name` and `user_name`. `user_name` falls back to "System" when null (catches system-issued rows + JIT-created users whose name hasn't been onboarded yet); `entity_name` falls back to the short-UUID prefix so a brand-new entity_type that doesn't have a server-side resolver row yet still gets SOMETHING the reader can correlate against.
- The "Entity ID" column header is renamed "Record" - the column now shows a human label, not an identifier, and the "Entity" column to its left already carries the type label.
- The expanded detail view renders the resolved name as the primary value, with the raw UUID demoted to a small muted sub-line for traceability when correlating across logs/DB. The sub-line is suppressed entirely when the underlying UUID is null (system-issued rows).

Net effect for the user: the audit log table now reads "yousif (Yousif Lastname) created ticket T000042 in tenant X" instead of "8abc12... created entity in tenant 4f3e2d...". The short UUID remains as a safety net for any entity_type the server doesn't yet resolve, and a small muted UUID sub-line in the detail view preserves the ability to chase a row through logs by id when debugging.
YousifShkara deleted branch feat/audit-log-show-names 2026-06-10 05:52:24 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!107
No description provided.