Skip to content

feat: add PAT tab to admin organization details#1576

Merged
rohanchkrabrty merged 15 commits intomainfrom
admin-pat
Apr 30, 2026
Merged

feat: add PAT tab to admin organization details#1576
rohanchkrabrty merged 15 commits intomainfrom
admin-pat

Conversation

@rohanchkrabrty
Copy link
Copy Markdown
Contributor

Summary

  • Add a new PAT tab under the admin organization details page that lists the current admin user's personal access tokens for the org.
  • Implement OrganizationPatView in sdk/admin using FrontierService.searchCurrentUserPATs (read-only — no create/edit/revoke actions per the design).
  • Columns mirror the Figma spec: Title, Project (with overflow names in a 600px-wide tooltip), Created By (avatar + name from orgMembersMap), Created On / Expiry Date (DD MMM YYYY), Last used (relative time via dayjs).
  • Wire the tab into the org navbar chips and add the pat route in apps/admin.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Apr 30, 2026 7:27am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

Warning

Rate limit exceeded

@rohanchkrabrty has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 2 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d2c766b3-2e20-489c-81ea-a15d23bf0346

📥 Commits

Reviewing files that changed from the base of the PR and between 34bdeb8 and de86853.

📒 Files selected for processing (3)
  • web/sdk/admin/views/organizations/details/pat/columns.tsx
  • web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.tsx
  • web/sdk/admin/views/organizations/details/pat/index.tsx
📝 Walkthrough

Walkthrough

Adds an Organization Personal Access Tokens (PAT) management feature: new nested org route, exported view, navbar link, PAT list columns, styles, a details dialog component, and the OrganizationPatView with server-mode table and data fetching.

Changes

Cohort / File(s) Summary
Routing & Barrel Export
web/apps/admin/src/routes.tsx, web/sdk/admin/index.ts
Adds nested route /organizations/:organizationId/pat mounting OrganizationPatView and re-exports OrganizationPatView from the admin SDK barrel.
Organization Navbar
web/sdk/admin/views/organizations/details/layout/navbar.tsx
Inserts a new "PAT" navigation chip that links to the organization's /pat subroute.
PAT View & Data
web/sdk/admin/views/organizations/details/pat/index.tsx, web/sdk/admin/views/organizations/details/pat/columns.tsx
Adds OrganizationPatView component with server-mode DataTable, infinite query for PATs, project lookup, and getColumns returning column defs (Title, Project, Created By, Created On, Expiry Date, Last used).
PAT Details Dialog
web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.tsx, web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.module.css
New PatDetailsDialog component that displays scoped projects and resolved roles (with loading state) and associated CSS module for dialog layout and list styling.
PAT Styling
web/sdk/admin/views/organizations/details/pat/pat.module.css
New CSS module with layout, truncation, and table/empty-state styles for the PAT view.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • rohilsurana
  • rsbh
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.


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 41 minutes and 2 seconds.

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

Base automatically changed from worktree-feat-pat-tokens to main April 27, 2026 00:01
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 27, 2026

Coverage Report for CI Build 25153014672

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 42.342%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 37079
Covered Lines: 15700
Line Coverage: 42.34%
Coverage Strength: 11.74 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@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: 2

🧹 Nitpick comments (6)
web/sdk/admin/views/organizations/details/pat/pat.module.css (2)

19-23: Prefer overflow: auto over overflow: scroll.

overflow: scroll always renders scrollbars (both axes) even when content fits, which is visually noisy on macOS/Linux when the table is small. auto only shows them when needed.

♻️ Proposed fix
 .table-wrapper {
   /* Navbar Height + Toolbar height */
   max-height: calc(100vh - 90px);
-  overflow: scroll;
+  overflow: auto;
 }

20-21: Magic number for header/toolbar offset.

calc(100vh - 90px) hardcodes the combined navbar + toolbar height. If either control's size changes (zoom, density, theme), the table either over- or under-scrolls. Consider deriving the value via a CSS custom property or measuring with a ref/ResizeObserver.

web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.tsx (2)

33-33: Dialog open flips on every render after close.

const open = pat !== null; is fine, but combined with enabled: open on useQuery and defaultValue="projects" on <Tabs>, opening a different PAT after closing one preserves nothing — that's intentional. Just flagging that roleEntries (line 72) is recomputed on every render rather than memoized; not a correctness issue, but consider useMemo for symmetry with scopeProjects / rolesMap.


172-172: Nit: stray space in closing tag.

</Dialog > — minor, but inconsistent with the rest of the file.

♻️ Proposed fix
-    </Dialog >
+    </Dialog>
web/sdk/admin/views/organizations/details/pat/columns.tsx (1)

8-21: Module-level dayjs.extend(relativeTime) is fine but global.

Calling dayjs.extend(relativeTime) at module scope mutates the shared dayjs instance. If another part of the app already extends it (or expects vanilla dayjs), this is a no-op / harmless — just noting that side-effectful module init can surprise consumers of this barrel. No change required if dayjs is already centrally extended elsewhere.

web/sdk/admin/views/organizations/details/pat/index.tsx (1)

152-153: Memoize data to avoid prop-identity churn.

infiniteData?.pages?.flatMap(...) ?? [] produces a new array every render, which causes DataTable to re-receive a new data reference each render even when content is unchanged. Wrap in useMemo keyed on infiniteData?.pages.

♻️ Proposed fix
-  const data =
-    infiniteData?.pages?.flatMap((page) => page?.organizationPats ?? []) ?? [];
+  const data = useMemo(
+    () => infiniteData?.pages?.flatMap((page) => page?.organizationPats ?? []) ?? [],
+    [infiniteData?.pages],
+  );

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 99248006-e1cb-4420-9d55-384ca65d31b0

📥 Commits

Reviewing files that changed from the base of the PR and between d11eb4e and 30fa2d9.

📒 Files selected for processing (8)
  • web/apps/admin/src/routes.tsx
  • web/sdk/admin/index.ts
  • web/sdk/admin/views/organizations/details/layout/navbar.tsx
  • web/sdk/admin/views/organizations/details/pat/columns.tsx
  • web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.module.css
  • web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.tsx
  • web/sdk/admin/views/organizations/details/pat/index.tsx
  • web/sdk/admin/views/organizations/details/pat/pat.module.css

Comment thread web/sdk/admin/views/organizations/details/pat/columns.tsx
Comment thread web/sdk/admin/views/organizations/details/pat/columns.tsx Outdated
Comment thread web/sdk/admin/views/organizations/details/pat/index.tsx Outdated
Comment thread web/sdk/admin/views/organizations/details/pat/index.tsx
Comment thread web/sdk/admin/views/organizations/details/pat/components/pat-details-dialog.tsx Outdated
@rohanchkrabrty rohanchkrabrty enabled auto-merge (squash) April 30, 2026 07:27
@rohanchkrabrty rohanchkrabrty merged commit 310473f into main Apr 30, 2026
8 checks passed
@rohanchkrabrty rohanchkrabrty deleted the admin-pat branch April 30, 2026 07:32
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.

4 participants