Show readable summaries instead of raw JSON in the audit log
Task #94: Each admin audit log row now renders a localized one-line summary derived from the entry's action + metadata, e.g. "Deleted group 'audit-test-group'" or "تم حذف المجموعة 'X'", instead of just showing the raw target type/id. Implementation - Added `formatAuditSummary(entry, t, lang)` in `artifacts/tx-os/src/pages/admin.tsx` covering all known audit actions emitted by the API (group/user/role/app/service/settings/ auth create/update/delete/permission/membership variants, including forced deletions). Returns null for unknown actions so the row gracefully falls back to the existing "Target: type #id" display. - The summary now occupies the prominent text slot in `AuditLogRow`. The raw action code stays in the small badge (it is also the value the action-filter dropdown uses), and the timestamp moved next to it. The expand toggle still reveals the full JSON metadata for power users (data-testid `audit-metadata-<id>` unchanged). - Added `admin.audit.summary.*` keys plus a pluralized `admin.audit.unit.*` helper map in en.json and ar.json. The Arabic unit keys provide all six CLDR plural forms (zero/one/two/few/ many/other) so counts read naturally; English uses one/other. Verification - `tsc --build` clean for the tx-os artifact. - e2e test (admin login → create + delete a uniquely named group → open Audit Log → confirm Arabic and English summaries render, raw JSON is still available behind the toggle, and the action pill still shows the raw action code) passed. Follow-up proposed - #117 "Show readable action names in the audit log filter dropdown" (the filter dropdown still lists raw action codes). Replit-Task-Id: b47aacde-087e-4a2b-8fb2-0e63cb1936e4
This commit is contained in:
@@ -490,6 +490,72 @@
|
||||
"invalidDate": "Dates must be in YYYY-MM-DD format.",
|
||||
"invertedDates": "\"From\" date must be on or before \"To\" date.",
|
||||
"fixFiltersFirst": "Adjust the filters to load entries."
|
||||
},
|
||||
"unit": {
|
||||
"member_one": "{{count}} member",
|
||||
"member_other": "{{count}} members",
|
||||
"app_one": "{{count}} app",
|
||||
"app_other": "{{count}} apps",
|
||||
"role_one": "{{count}} role",
|
||||
"role_other": "{{count}} roles",
|
||||
"group_one": "{{count}} group",
|
||||
"group_other": "{{count}} groups",
|
||||
"order_one": "{{count}} order",
|
||||
"order_other": "{{count}} orders",
|
||||
"change_one": "{{count}} change",
|
||||
"change_other": "{{count}} changes",
|
||||
"permission_one": "{{count}} permission",
|
||||
"permission_other": "{{count}} permissions",
|
||||
"restriction_one": "{{count}} restriction",
|
||||
"restriction_other": "{{count}} restrictions",
|
||||
"note_one": "{{count}} note",
|
||||
"note_other": "{{count}} notes",
|
||||
"conversation_one": "{{count}} conversation",
|
||||
"conversation_other": "{{count}} conversations",
|
||||
"message_one": "{{count}} message",
|
||||
"message_other": "{{count}} messages"
|
||||
},
|
||||
"summary": {
|
||||
"app": {
|
||||
"create": "Created app '{{name}}'",
|
||||
"update": "Updated app '{{name}}' ({{changes}})",
|
||||
"delete": "Deleted app '{{name}}'",
|
||||
"forceDelete": "Force-deleted app '{{name}}' (affected {{groups}})"
|
||||
},
|
||||
"auth": {
|
||||
"issueResetLink": "Issued password reset link for @{{username}}"
|
||||
},
|
||||
"group": {
|
||||
"create": "Created group '{{name}}' ({{members}}, {{apps}})",
|
||||
"update": "Updated group '{{name}}' ({{changes}})",
|
||||
"delete": "Deleted group '{{name}}'",
|
||||
"forceDelete": "Force-deleted group '{{name}}' ({{members}})",
|
||||
"userAdd": "Added user #{{userId}} to group '{{name}}'",
|
||||
"userRemove": "Removed user #{{userId}} from group '{{name}}'",
|
||||
"appAdd": "Added app #{{appId}} to group '{{name}}'",
|
||||
"appRemove": "Removed app #{{appId}} from group '{{name}}'",
|
||||
"roleAdd": "Added role #{{roleId}} to group '{{name}}'",
|
||||
"roleRemove": "Removed role #{{roleId}} from group '{{name}}'"
|
||||
},
|
||||
"role": {
|
||||
"create": "Created role '{{name}}'",
|
||||
"update": "Updated role '{{name}}' ({{changes}})",
|
||||
"rename": "Renamed role '{{previousName}}' to '{{name}}'",
|
||||
"delete": "Deleted role '{{name}}'",
|
||||
"permissionsReplace": "Updated permissions for role '{{name}}' (added {{added}}, removed {{removed}})",
|
||||
"permissionAdd": "Added permission '{{permission}}' to role '{{name}}'",
|
||||
"permissionRemove": "Removed permission '{{permission}}' from role '{{name}}'"
|
||||
},
|
||||
"service": {
|
||||
"forceDelete": "Force-deleted service '{{name}}' (affected {{orders}})"
|
||||
},
|
||||
"settings": {
|
||||
"update": "Updated system settings ({{changes}})"
|
||||
},
|
||||
"user": {
|
||||
"delete": "Deleted user @{{username}}",
|
||||
"forceDelete": "Force-deleted user @{{username}}"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboardSoon": "Dashboard widgets coming soon.",
|
||||
|
||||
Reference in New Issue
Block a user