feat: audit migration to mui - #1027
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAudit 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. ChangesAudit log grid migration
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/audit-logs/index.js (1)
95-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCollapse the five near-identical
getAuditLogcalls 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
📒 Files selected for processing (3)
src/actions/audit-log-actions.jssrc/components/audit-logs/index.jssrc/pages/audit-log/audit-log-page.js
| multiple: true | ||
| } | ||
| }, | ||
| customParser: (f) => [`user_id==${f.value.map((s) => s.value).join("||")}`] |
There was a problem hiding this comment.
🎯 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.
| 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.
https://app.clickup.com/t/9014802374/86bb2ex8n
Summary by CodeRabbit
New Features
Bug Fixes
Documentation