Skip to content

Add Audit Logs page (Sprint 2) - #472

Open
navyamidha95339-arch wants to merge 9 commits into
mainfrom
navya/feature/audit-logs-page
Open

Add Audit Logs page (Sprint 2)#472
navyamidha95339-arch wants to merge 9 commits into
mainfrom
navya/feature/audit-logs-page

Conversation

@navyamidha95339-arch

Copy link
Copy Markdown
Collaborator

Summary
Implements the Audit Logs admin page - server-side paginated log table with filters, a details modal, and a purge action with confirmation.

Checklist

✅ Server-side pagination (page/limit sent to backend, no client-side slicing)
✅ Filters: userId, action, role, from/to date range
✅ Details modal showing full log entry including metadata
✅ Purge with confirmation dialog (destructive action requires explicit confirm)
✅ Loading, error (with retry), empty, and purging states handled

Note on role filter
While building this, found that the role filter on GET /admin/audit-logs was broken on the backend (queries a field that doesn't exist on the AuditLog schema). Reported it and it's being fixed separately in [BE-030 PR link] - this frontend PR depends on that fix for the role filter to return results,but works fully with the other filters in the meantime.
Screenshot 2026-08-06 151209

Testing
Manually tested pagination, all filters, details modal, and purge (against a local database, as per team lead's guidance - purge was never run against the shared cluster). Verified loading/error/empty states.

@navyamidha95339-arch
navyamidha95339-arch marked this pull request as draft August 6, 2026 05:13
@navyamidha95339-arch
navyamidha95339-arch marked this pull request as ready for review August 6, 2026 05:14
@Krisha190235

Copy link
Copy Markdown
Collaborator

Nice, comprehensive page — verified the logs read, filters (userId/action/from/to), pagination, details modal, and purge all match the backend contract, and the purge confirm modal is the right call for a destructive action.

One functional gap: the role filter always returns empty. The select sends role, but the AuditLog schema has no role field, so query.role = role matches nothing (this is the known backend issue). Since the fix belongs on the backend (add role, or filter via the populated user.role), let's keep it with the backend lead and either merge with that tracked, or temporarily hide the role dropdown until it's supported so it doesn't mislead.

Also this PR pulls in a large unrelated package-lock.json bump (axios 1.18→1.19, react-router 7.18.x, babel, etc.) — can you revert that to keep the diff focused, or confirm it's intentional and CI is green? Minor nit: handleApplyFilters double-fetches when page ≠ 1 (direct fetchLogs() + the [page] effect) — could rely on the effect alone.

Otherwise looks good.

@Krisha190235

Copy link
Copy Markdown
Collaborator

Went through the latest commits and checked 577789f directly. Everything mechanical looks great now — the unrelated package-lock.json bump is reverted (just the intentional yaml override left), the filter apply/clear double-fetch is fixed, and CI is green with no base conflicts.

One correction though: 577789f's message says "role filter now works with Backend," but the diff only changes the apply/clear handlers — it doesn't touch the role filter. The dropdown still sends role, and main's AuditLog model still has no role field (getAuditLogs does if (role) query.role = role), so that query still returns empty. So the role filter isn't actually functional yet. Could we either (a) get the backend to add a role field / filter via the populated user.role, or (b) hide the role dropdown until it's supported — and drop the "works with Backend" wording? Everything else is good to merge. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants