Skip to content

feat: move admin access group grid to mui#911

Open
priscila-moneo wants to merge 2 commits intomasterfrom
feature/move-admin-access-group-grid-mui
Open

feat: move admin access group grid to mui#911
priscila-moneo wants to merge 2 commits intomasterfrom
feature/move-admin-access-group-grid-mui

Conversation

@priscila-moneo
Copy link
Copy Markdown

@priscila-moneo priscila-moneo commented May 4, 2026

ref: https://app.clickup.com/t/86b9n7qe1

Summary by CodeRabbit

  • New Features

    • Admin access management now uses a modal dialog for creating and editing entries instead of separate pages.
  • Style

    • Updated admin access forms and tables to Material-UI (MUI) components for a modernized interface.
  • Bug Fixes

    • Improved pagination handling with proper page and row-per-page parameters.
    • Simplified deletion confirmation flow for admin access entries.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@priscila-moneo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 38 minutes and 3 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: da268913-fe14-4034-8da4-6c2cd68979d2

📥 Commits

Reviewing files that changed from the base of the PR and between 2c47f00 and e24b38c.

📒 Files selected for processing (8)
  • src/actions/admin-access-actions.js
  • src/components/forms/admin-access-form.js
  • src/layouts/admin-access-layout.js
  • src/pages/admin_access/__tests__/admin-access-list-page.test.js
  • src/pages/admin_access/admin-access-list-page.js
  • src/pages/admin_access/edit-admin-access-page.js
  • src/reducers/admin_access/__tests__/admin-access-list-reducer.test.js
  • src/reducers/admin_access/admin-access-list-reducer.js
📝 Walkthrough

Walkthrough

This PR refactors the admin access module from a multi-page CRUD flow to a dialog-based single-page pattern. The list page now handles both viewing and editing via a modal dialog, with supporting changes to action creators (pagination params, conditional redirect), form UI (Bootstrap to MUI), layout routing (simplified single route), and reducer state tracking (pagination totals, deletion count updates). The dedicated edit page is removed as its functionality is consolidated into the list page dialog.

Changes

Admin Access Module Dialog-Based Refactor

Layer / File(s) Summary
State Shape & Pagination
src/reducers/admin_access/admin-access-list-reducer.js
Reducer now tracks totalAdminAccesses, persists currentPage/perPage/order/orderDir/term on request, and decrements the total count when items are deleted.
Action Creators
src/actions/admin-access-actions.js
getAdminAccess includes page and perPage in request metadata. saveAdminAccess adds optional redirectOnCreate param (default true) to conditionally redirect vs. show inline success message on create.
Form UI Refactor
src/components/forms/admin-access-form.js
Bootstrap layout replaced with MUI components (Box, Button, Grid2, Typography); componentDidUpdate simplified; props use shorthand (e.g., multi instead of multi={true}).
List Page Core Logic
src/pages/admin_access/admin-access-list-page.js
Refactored from class to hooks-based functional component with useState/useEffect. Dialog state controls edit form visibility; route params (/new or :access_id) trigger form open/reset/load; table swapped from Bootstrap to MuiTable with built-in pagination and action handlers; deletion is direct (no confirmation).
Routing & Layout
src/layouts/admin-access-layout.js
Converted from Redux-connected class to stateless functional component; single catch-all route /:access_id? renders AdminAccessListPage; fallback Redirect points to match.url instead of hardcoded path.
Legacy Page Removal
src/pages/admin_access/edit-admin-access-page.js
Entire EditAdminAccessPage module deleted; edit logic now embedded in list page dialog.
Tests
src/pages/admin_access/__tests__/admin-access-list-page.test.js, src/reducers/admin_access/__tests__/admin-access-list-reducer.test.js
New test suites verify list page dialog open/close on route changes, create/edit button behavior, per-page pagination changes, and reducer deletion with count updates.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested reviewers

  • smarcet
  • romanetar

Poem

Behold! A dialog springs to life—
No more separate pages, no edit strife.
From Bootstrap's grid to Material's grace,
The list and form now share one place.
🐰✨

🚥 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 accurately summarizes the main change: migrating the admin access group grid/form components from Bootstrap to Material-UI (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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/move-admin-access-group-grid-mui

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 38 minutes and 3 seconds.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/layouts/admin-access-layout.js`:
- Around line 30-36: The current Route path (`path={`${match.url}/:access_id?`}`
in the Switch) is too permissive and treats any single-segment suffix as an edit
route; replace it with explicit routes: add a Route for the "new" page using
`${match.url}/new` (rendering AdminAccessListPage or AdminAccessForm as
appropriate) and add a separate Route for numeric IDs using a constrained param
like `${match.url}/:access_id(\\d+)` that renders AdminAccessListPage for
editing; keep the Redirect to `match.url` after those Routes and ensure the
order is: new route, numeric-id route, then Redirect so invalid segments still
fall through to the redirect.

In `@src/pages/admin_access/admin-access-list-page.js`:
- Around line 63-79: The getAdminAccess(accessId).then(() => setOpen(true)) call
can reopen the modal with stale data; modify the effect around
useEffect/getAdminAccess to guard against late responses by sequencing or
cancellation: capture the current accessId/isNew (from match.params.access_id
and a flag from /new) or create a request token/AbortController before calling
getAdminAccess, and when the promise resolves verify the token matches the
latest accessId (and still not isNew) before calling setOpen(true) and applying
fetched data (or abort the fetch). Also ensure resetAdminAccessForm is only
applied for the intended /new route by checking the same guard.
- Around line 106-112: handleDeleteAdminAccess currently performs an optimistic
delete via deleteAdminAccess but never refetches the paginated data, leaving
currentPage pointing at an empty page after deleting the last item; change the
flow so that after deleteAdminAccess resolves (or in its success
callback/promise then), call the pagination refetch function (e.g.,
fetchAdminAccessPage or refetchAdminAccess) for the currentPage, and if the
returned page is empty and currentPage > 1, decrement currentPage and refetch
the previous page; update the state that holds currentPage and the page data
accordingly instead of relying only on the reducer’s local filter.
🪄 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: f9c84e8b-8dbe-47a6-856f-4041b0d8ca43

📥 Commits

Reviewing files that changed from the base of the PR and between 08e2650 and 2c47f00.

📒 Files selected for processing (8)
  • src/actions/admin-access-actions.js
  • src/components/forms/admin-access-form.js
  • src/layouts/admin-access-layout.js
  • src/pages/admin_access/__tests__/admin-access-list-page.test.js
  • src/pages/admin_access/admin-access-list-page.js
  • src/pages/admin_access/edit-admin-access-page.js
  • src/reducers/admin_access/__tests__/admin-access-list-reducer.test.js
  • src/reducers/admin_access/admin-access-list-reducer.js
💤 Files with no reviewable changes (1)
  • src/pages/admin_access/edit-admin-access-page.js

Comment thread src/layouts/admin-access-layout.js
Comment on lines +63 to +79
useEffect(() => {
const { access_id: accessId } = match.params;
const isNew = /\/new$/.test(history.location.pathname);

this.state = {};
}
if (isNew) {
resetAdminAccessForm();
setOpen(true);
return;
}

componentDidMount() {
this.props.getAdminAccesses();
}
if (accessId) {
getAdminAccess(accessId).then(() => setOpen(true));
return;
}

handleEdit(admin_access_id) {
const { history } = this.props;
history.push(`/app/admin-access/${admin_access_id}`);
}
setOpen(false);
}, [match.params.access_id, history.location.pathname]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Guard against stale edit loads.

getAdminAccess(accessId).then(() => setOpen(true)) has no stale-request check. If the user closes the dialog or switches from /app/admin-access/1 to /app/admin-access/new before the fetch finishes, the late response can reopen the modal and repopulate the form with the old record. This needs request sequencing/cancellation, or at least a route/id guard before applying the result.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/admin_access/admin-access-list-page.js` around lines 63 - 79, The
getAdminAccess(accessId).then(() => setOpen(true)) call can reopen the modal
with stale data; modify the effect around useEffect/getAdminAccess to guard
against late responses by sequencing or cancellation: capture the current
accessId/isNew (from match.params.access_id and a flag from /new) or create a
request token/AbortController before calling getAdminAccess, and when the
promise resolves verify the token matches the latest accessId (and still not
isNew) before calling setOpen(true) and applying fetched data (or abort the
fetch). Also ensure resetAdminAccessForm is only applied for the intended /new
route by checking the same guard.

Comment thread src/pages/admin_access/admin-access-list-page.js
Comment thread src/actions/admin-access-actions.js Outdated

dispatch(
showMessage(successMessage, () => {
history.push(`/app/admin-access/${payload.response.id}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

redirectOnCreate if should go here, if not the noAlert flag is redundant

? `${member.first_name} ${member.last_name} (${member.email})`
: `${member.first_name} ${member.last_name} (${member.id})`;
}}
: `${member.first_name} ${member.last_name} (${member.id})`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if the only thing that changes is the parenthesis, then the ternary condition should go there

path={`${match.url}/:access_id?`}
component={AdminAccessListPage}
/>
<Redirect to={match.url} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

before the routes would only match on / or digit, or new. Now it matches everything , for example app/admin-access/santi. it is not equivalent to what we had

this.handleDeleteAdminAccess = this.handleDeleteAdminAccess.bind(this);
useEffect(() => {
const { access_id: accessId } = match.params;
const isNew = /\/new$/.test(history.location.pathname);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

so what if the url is app/admin-access/santi/new ?

const totalItems =
typeof totalAdminAccesses === "number"
? totalAdminAccesses
: admin_accesses.length;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

admin_accesses is paginated, the length of this will rarely be the total

@priscila-moneo priscila-moneo force-pushed the feature/move-admin-access-group-grid-mui branch from 2c47f00 to e24b38c Compare May 4, 2026 19:53
Copy link
Copy Markdown

@santipalenque santipalenque left a comment

Choose a reason for hiding this comment

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

LGTM

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