feat: audit migration to mui - #1027
Conversation
|
Caution Review failedFailed to post review comments. We encountered an issue with GitHub. Use ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
⏰ Context from checks skipped due to timeout. (4)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2026-05-06T22:24:01.344ZApplied to files:
📚 Learning: 2026-07-13T15:30:50.911ZApplied to files:
📚 Learning: 2026-07-06T21:57:59.168ZApplied to files:
🪛 ast-grep (0.45.0)src/components/audit-logs/index.js[warning] 131-131: Avoid using the initial state variable in setState (setstate-same-var) 📝 WalkthroughWalkthroughAudit log filtering now uses shared MUI grid criteria and array-based filter expressions. The audit log table, search, pagination, sorting, cleanup, and page composition were updated accordingly, with breadcrumb handling removed. ChangesAudit log grid migration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GridFilter
participant AuditLogs
participant getAuditLog
GridFilter->>AuditLogs: Provide parsedFilter
AuditLogs->>getAuditLog: Request filtered audit logs
getAuditLog->>AuditLogs: Return audit log data
AuditLogs->>GridFilter: Reset filters on unmount
🚥 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.
| const auditLogColumns = [ | ||
| { | ||
| columnKey: "created", | ||
| value: T.translate("audit_log.date"), | ||
| header: T.translate("audit_log.date"), | ||
| sortable: true | ||
| }, | ||
| { | ||
| columnKey: "action_description", | ||
| value: T.translate("audit_log.action"), | ||
| header: T.translate("audit_log.action"), | ||
| sortable: false | ||
| }, | ||
| { | ||
| columnKey: "event_id", | ||
| value: T.translate("audit_log.event"), | ||
| header: T.translate("audit_log.event"), | ||
| sortable: true | ||
| }, | ||
| { columnKey: "user", value: T.translate("audit_log.user"), sortable: false } | ||
| { | ||
| columnKey: "user", | ||
| header: T.translate("audit_log.user"), | ||
| sortable: false | ||
| } | ||
| ]; |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the relevant file and nearby symbols
ast-grep outline src/components/audit-logs/index.js --view expanded
# Read the relevant section with line numbers
sed -n '1,220p' src/components/audit-logs/index.js
# Find table usages and any render/value accessor patterns in the repo
rg -n --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' 'columnKey|render:|value:' src components .Repository: fntechgit/summit-admin
Length of output: 50379
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- src/components/audit-logs/index.js ---'
sed -n '1,220p' src/components/audit-logs/index.js
echo
echo '--- imports/usages around audit-log table ---'
rg -n --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' 'MuiTable|Table' src/components/audit-logs src/pages | head -n 80
echo
echo '--- package version hints ---'
rg -n --glob 'package.json' '"openstack-uicore-foundation"|uicore-foundation' .Repository: fntechgit/summit-admin
Length of output: 13843
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- git diff for src/components/audit-logs/index.js ---'
git diff --unified=80 -- src/components/audit-logs/index.js
echo
echo '--- nearby audit-log action payload shape ---'
sed -n '1,260p' src/actions/audit-log-actions.js
echo
echo '--- any audit-log formatters/helpers ---'
rg -n --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' 'format.*audit|audit.*format|created.*format|user.*format|first_name|last_name|expand: "user"' srcRepository: fntechgit/summit-admin
Length of output: 50378
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- src/reducers/audit_log/audit-log-reducer.js ---'
sed -n '1,220p' src/reducers/audit_log/audit-log-reducer.js
echo
echo '--- current audit-log component columns plus data usage ---'
sed -n '1,240p' src/components/audit-logs/index.jsRepository: fntechgit/summit-admin
Length of output: 8149
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' 'action_description|audit_log\.action|columnKey: "action"|columnKey: "action_description"' srcRepository: fntechgit/summit-admin
Length of output: 322
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**' 'formatAuditLog|parseSpeakerAuditLog|action_description' src/utils src/reducers src/actions src/componentsRepository: fntechgit/summit-admin
Length of output: 696
Use the normalized action field here
logEntries exposes the formatted text as action, not action_description, so this column will render empty. Point columnKey at the reducer output field or rename the reducer key to match.
🤖 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 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.
https://app.clickup.com/t/9014802374/86bb2ex8n
Summary by CodeRabbit
New Features
Bug Fixes