Skip to content

feat: audit migration to mui - #1027

Open
santipalenque wants to merge 4 commits into
masterfrom
feature/migrate-audit-to-mui
Open

feat: audit migration to mui#1027
santipalenque wants to merge 4 commits into
masterfrom
feature/migrate-audit-to-mui

Conversation

@santipalenque

@santipalenque santipalenque commented Jul 28, 2026

Copy link
Copy Markdown

https://app.clickup.com/t/9014802374/86bb2ex8n

Summary by CodeRabbit

  • New Features

    • Introduced a unified, grid-based audit log filtering experience with member selection and created date-time range criteria, including a timezone info alert.
  • Bug Fixes

    • Improved persistence of audit log filters across searching, sorting, pagination, and rows-per-page changes.
    • Ensures audit log filters and parameters are cleared when leaving the audit log page.
    • Updated audit log timestamp formatting to display correct local dates.
  • Documentation

    • Refreshed audit-log timezone messaging and corrected the payment profile not found interpolation placeholder.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4f46509-657f-43e9-b92e-12b355a61b49

📥 Commits

Reviewing files that changed from the base of the PR and between c9c6134 and c0ef613.

📒 Files selected for processing (1)
  • src/components/audit-logs/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/audit-logs/index.js

📝 Walkthrough

Walkthrough

Audit log filtering now uses shared MUI grid criteria and array-based filter expressions. The table, search, pagination, sorting, timezone display, cleanup, and page composition were updated, with breadcrumb handling removed.

Changes

Audit log grid migration

Layer / File(s) Summary
Filter expression contract
src/actions/audit-log-actions.js
Audit log requests clone array-based filters, append term searches, and default filters to an empty array.
Grid filter data flow
src/components/audit-logs/index.js
Shared criteria support user and datetime filters, while parsed filters flow through fetching, table interactions, rendering, and cleanup.
Local timezone display
src/reducers/audit_log/audit-log-reducer.js, src/i18n/en.json
Audit-log timestamps use direct epoch conversion, and the UI adds a localized timezone notice.
Page composition cleanup
src/pages/audit-log/audit-log-page.js, src/i18n/en.json
The page removes breadcrumb and route-match handling while retaining the entry count and audit-log entity filter; a payment-profile interpolation placeholder is updated.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: smarcet

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: migrating the audit experience to MUI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/migrate-audit-to-mui

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/audit-logs/index.js (1)

95-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Collapse the five near-identical getAuditLog calls into one helper.

The four handlers and the effect differ only in page/perPage/order/term. A single fetchLogs({ ... }) wrapper keeps the positional-argument contract in one place, which matters since the action takes seven positional params.

♻️ Suggested shape
+  const fetchLogs = ({
+    newTerm = searchTerm,
+    page = DEFAULT_CURRENT_PAGE,
+    newPerPage = perPage,
+    sortKey = order,
+    sortDir = orderDir
+  } = {}) =>
+    getAuditLog(
+      entityFilter,
+      newTerm,
+      page,
+      newPerPage,
+      sortKey,
+      sortDir,
+      parsedFilter
+    );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/audit-logs/index.js` around lines 95 - 142, Introduce a single
fetchLogs helper near handleSort that accepts page, perPage, order, orderDir,
and term overrides, applies the current entityFilter and parsedFilter, and calls
getAuditLog with the existing seven-argument order. Update handleSort,
handlePageChange, handlePerPageChange, handleSearch, and the related effect to
use this helper while preserving each handler’s current defaults and state
updates.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/audit-logs/index.js`:
- Line 37: Update the customParser callback to validate that f.value is a
non-empty array before mapping it; return an empty filter result for missing,
non-array, or empty values, while preserving the existing user_id expression for
valid selections.
- Around line 68-89: Update the action column in auditLogColumns to use the
normalized action field exposed by logEntries, replacing action_description with
action; alternatively, rename the reducer output to action_description and keep
all consumers consistent.

---

Nitpick comments:
In `@src/components/audit-logs/index.js`:
- Around line 95-142: Introduce a single fetchLogs helper near handleSort that
accepts page, perPage, order, orderDir, and term overrides, applies the current
entityFilter and parsedFilter, and calls getAuditLog with the existing
seven-argument order. Update handleSort, handlePageChange, handlePerPageChange,
handleSearch, and the related effect to use this helper while preserving each
handler’s current defaults and state updates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09f09dcb-ed56-479a-88e2-5b7ccc069a32

📥 Commits

Reviewing files that changed from the base of the PR and between 52e285c and a5abcc6.

📒 Files selected for processing (3)
  • src/actions/audit-log-actions.js
  • src/components/audit-logs/index.js
  • src/pages/audit-log/audit-log-page.js

multiple: true
}
},
customParser: (f) => [`user_id==${f.value.map((s) => s.value).join("||")}`]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Guard customParser against empty/non-array values.

If f.value is an empty array the parser emits a dangling user_id== expression that the API will reject; if the widget ever yields a single object (non-multiple), .map throws.

🛡️ Proposed guard
-    customParser: (f) => [`user_id==${f.value.map((s) => s.value).join("||")}`]
+    customParser: (f) => {
+      const values = (Array.isArray(f.value) ? f.value : [f.value])
+        .map((s) => s?.value)
+        .filter((v) => v != null);
+      return values.length ? [`user_id==${values.join("||")}`] : [];
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
customParser: (f) => [`user_id==${f.value.map((s) => s.value).join("||")}`]
customParser: (f) => {
const values = (Array.isArray(f.value) ? f.value : [f.value])
.map((s) => s?.value)
.filter((v) => v != null);
return values.length ? [`user_id==${values.join("||")}`] : [];
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/audit-logs/index.js` at line 37, Update the customParser
callback to validate that f.value is a non-empty array before mapping it; return
an empty filter result for missing, non-array, or empty values, while preserving
the existing user_id expression for valid selections.

Comment thread src/components/audit-logs/index.js
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.

1 participant