Skip to content

fix: sdk service-account view#1574

Merged
rohanchkrabrty merged 5 commits intomainfrom
fix-service-account
Apr 28, 2026
Merged

fix: sdk service-account view#1574
rohanchkrabrty merged 5 commits intomainfrom
fix-service-account

Conversation

@rohanchkrabrty
Copy link
Copy Markdown
Contributor

@rohanchkrabrty rohanchkrabrty commented Apr 26, 2026

Summary

  • Update design bugs for service-accounts list, details, manage-access, delete and revoke dialogs (column widths, hover-only row actions, headerless dialog bodies, custom key/delete icons, projects cell skeleton + tooltip).
  • Make the manage-project-access dialog responsive: dialog content flexes within a 650px max-height, body inner Flex fills available space, table scrolls inside, and skeleton renders 9 rows; spinner is size={2} and the access dropdown disables while a row is loading.
  • Replace the manual copy icon + state with Apsara's CopyButton for the generated key, and reveal it on container hover only.
  • Fix the missing initial-key value after create: cache fresh tokens (with token value) in a side cache that survives the details-page refetch, merge into the displayed list, and clear on navigate-away or delete.
  • Make views-new/service-accounts self-contained by copying useServiceUserTokens into the feature folder and routing all its consumers there; legacy views/api-keys hook left untouched for old views.

@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 28, 2026 1:55pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 900125fe-e4e2-488b-968a-22a54b547925

📥 Commits

Reviewing files that changed from the base of the PR and between 79f063c and f8fb5b2.

📒 Files selected for processing (9)
  • web/sdk/react/views-new/service-accounts/components/add-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/add-token-form.tsx
  • web/sdk/react/views-new/service-accounts/components/delete-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/manage-project-access-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/revoke-token-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/service-account-columns.tsx
  • web/sdk/react/views-new/service-accounts/service-account-details-view.tsx
  • web/sdk/react/views-new/service-accounts/service-accounts-view.tsx
  • web/sdk/tsconfig.json
✅ Files skipped from review due to trivial changes (2)
  • web/sdk/tsconfig.json
  • web/sdk/react/views-new/service-accounts/components/add-token-form.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • web/sdk/react/views-new/service-accounts/components/add-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/delete-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/service-account-columns.tsx
  • web/sdk/react/views-new/service-accounts/components/manage-project-access-dialog.tsx
  • web/sdk/react/views-new/service-accounts/service-accounts-view.tsx
  • web/sdk/react/views-new/service-accounts/service-account-details-view.tsx

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added token caching for improved service account token management
    • Project lists now display in tooltips to prevent truncation
  • Improvements

    • Simplified delete and revoke dialogs with clearer actions
    • Table columns now have fixed widths for consistent layout
    • Loading states enhanced with skeleton placeholders
    • Token copy functionality redesigned for better usability
    • Action buttons now reveal on row hover for cleaner interface
    • Updated menu icons to key symbols for visual clarity

Walkthrough

Adds a React Query-backed token cache and hook, updates service-account dialogs and tables with CSS-module styling and fixed column widths, replaces inline truncation with tooltip-based project display, updates several import paths to ~ aliases, and adjusts UI icons and copy-to-clipboard behavior.

Changes

Cohort / File(s) Summary
Token Hook & Cache
web/sdk/react/views-new/service-accounts/hooks/useServiceUserTokens.ts
Adds useServiceUserTokens hook and cacheFreshServiceUserToken helper to list tokens and overlay/maintain "fresh" token values with imperative cache update methods.
Add Service Account / Token Creation
web/sdk/react/views-new/service-accounts/components/add-service-account-dialog.tsx, web/sdk/react/views-new/service-accounts/components/add-token-form.tsx
Caches newly created service-user token into fresh-token cache when present; switched imports to ~ alias in add-token-form.
Dialog Components & Styling
web/sdk/react/views-new/service-accounts/components/delete-service-account-dialog.tsx, .../revoke-token-dialog.tsx, .../delete-service-account-dialog.module.css, .../revoke-token-dialog.module.css
Removed AlertDialog.Header, hid dialog close button, applied .body CSS class to dialog bodies (removes bottom border), and adjusted primary button text/placement in delete dialog.
Manage Project Access Dialog
web/sdk/react/views-new/service-accounts/components/manage-project-access-dialog.tsx
Adds fixed column widths (40px checkbox, 180px role), per-row loading flag, smaller spinner size, disables role Select while loading/unchecked, sets loadingRowCount={9}, and adds inner body wrapper class.
Projects Cell + Styling
web/sdk/react/views-new/service-accounts/components/projects-cell.tsx, .../projects-cell.module.css
Renders Skeleton while loading, returns - for empty, replaces inline truncation with Tooltip wrapper and CSS-styled Text; adds .text and .tooltipContent classes.
Service Account Columns + Styling
web/sdk/react/views-new/service-accounts/components/service-account-columns.tsx, .../service-account-columns.module.css
Applies CSS-module classes to action cell and buttons, adds fixed width limits for projects, createdAt, and an exact 48px actions column; hides actions until row hover and disables transitions.
Service Accounts / Details Views & Styling
web/sdk/react/views-new/service-accounts/service-accounts-view.tsx, .../service-accounts-view.module.css, web/sdk/react/views-new/service-accounts/service-account-details-view.tsx, .../service-account-details-view.module.css
Treats missing organization?.id as loading, updates empty-state and menu icons to local SVGs, adds table class for fixed layout, replaces manual copy UI with CopyButton, calls clearFreshTokens() on navigation/delete-success, and restructures token list layout and manage-access container styling.
Revoke Token Dialog
web/sdk/react/views-new/service-accounts/components/revoke-token-dialog.tsx
Uses ~ import aliases, hides dialog close button, removes header wrapper, and applies .body CSS class.
TypeScript Paths
web/sdk/tsconfig.json
Adds ~/utils path mapping to ./utils/index.ts.

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

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

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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/sdk/react/views-new/service-accounts/components/service-account-columns.tsx (1)

77-77: ⚠️ Potential issue | 🟡 Minor

Empty column header lacks an accessible name.

header: '' produces a <th> with no accessible label for the actions column. Screen-reader users navigating column headers will hear an empty cell. Consider providing a visually-hidden label (e.g., header: () => <VisuallyHidden>Actions</VisuallyHidden>) or an aria-label on the cell, consistent with how the similar actions column is handled in manage-project-access-dialog.tsx (which uses header: 'Actions').

🧹 Nitpick comments (4)
web/sdk/react/views-new/service-accounts/components/projects-cell.tsx (1)

44-55: Tooltip fires even when no truncation occurs.

The tooltip is rendered unconditionally for any non-empty projectNames, so for service accounts with one or two short project names (no overflow) hovering the cell still pops a tooltip duplicating the visible text. Consider rendering the tooltip only when the trigger is actually truncated (e.g., compare scrollWidth > clientWidth on the text element, or skip the tooltip when there's only one project and it fits).

web/sdk/react/views-new/service-accounts/hooks/useServiceUserTokens.ts (2)

57-69: freshTokensMap is read imperatively and won't trigger re-renders on its own.

queryClient.getQueryData(...) doesn't subscribe the component to that cache key. If cacheFreshServiceUserToken (or removeQueries in clearFreshTokens) is called from a context that doesn't also mutate listServiceUserTokens, this hook's consumer won't re-render and the merged tokens will appear stale.

Today this happens to work because every caller in the PR also writes to the listServiceUserTokens cache (which is subscribed via useQuery), but it's a fragile coupling. Consider subscribing to the fresh-token cache too — e.g. via a dedicated useQuery keyed by getFreshTokensCacheKey(id), or useSyncExternalStore over the QueryCache — so the merge stays correct regardless of how/when the fresh cache mutates.


83-109: Add generic type parameter to getQueryData calls for type safety.

Lines 85 and 99 are missing generic type parameters. Without them, currentData is typed as unknown, making currentData?.tokens unsafe. This is inconsistent with the getQueryData<FreshTokensMap>(...) pattern already used elsewhere in this file (lines 34, 77, 112).

♻️ Proposed change
-    const currentData = queryClient.getQueryData(queryKey);
+    const currentData =
+      queryClient.getQueryData<MessageInitShape<typeof ListServiceUserTokensResponseSchema>>(
+        queryKey
+      );
web/sdk/react/views-new/service-accounts/service-accounts-view.tsx (1)

276-276: Prefer a CSS class for the danger color.

style={{ color: 'var(--rs-color-foreground-danger-primary)' }} (also repeated at line 252 in service-account-details-view.tsx) is fine functionally, but moving it into service-accounts-view.module.css (e.g. a .dangerMenuItem class) would keep theming consistent with the rest of this file and avoid duplicating the literal CSS var.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 463cd448-e890-417e-b359-f50fb9aa1c66

📥 Commits

Reviewing files that changed from the base of the PR and between d2f59d8 and 79f063c.

📒 Files selected for processing (15)
  • web/sdk/react/views-new/service-accounts/components/add-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/delete-service-account-dialog.module.css
  • web/sdk/react/views-new/service-accounts/components/delete-service-account-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/manage-project-access-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/projects-cell.module.css
  • web/sdk/react/views-new/service-accounts/components/projects-cell.tsx
  • web/sdk/react/views-new/service-accounts/components/revoke-token-dialog.module.css
  • web/sdk/react/views-new/service-accounts/components/revoke-token-dialog.tsx
  • web/sdk/react/views-new/service-accounts/components/service-account-columns.module.css
  • web/sdk/react/views-new/service-accounts/components/service-account-columns.tsx
  • web/sdk/react/views-new/service-accounts/hooks/useServiceUserTokens.ts
  • web/sdk/react/views-new/service-accounts/service-account-details-view.module.css
  • web/sdk/react/views-new/service-accounts/service-account-details-view.tsx
  • web/sdk/react/views-new/service-accounts/service-accounts-view.module.css
  • web/sdk/react/views-new/service-accounts/service-accounts-view.tsx

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 26, 2026

Coverage Report for CI Build 25057152887

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.353%

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: 37069
Covered Lines: 15700
Line Coverage: 42.35%
Coverage Strength: 11.76 hits per line

💛 - Coveralls

@rohanchkrabrty rohanchkrabrty changed the title fix(sdk): polish service accounts views-new UI and flows fix: sdk service-account view Apr 27, 2026
Comment thread web/sdk/react/views-new/service-accounts/service-accounts-view.tsx
Comment thread web/sdk/react/views-new/service-accounts/service-accounts-view.tsx
@rohanchkrabrty rohanchkrabrty enabled auto-merge (squash) April 28, 2026 13:55
@rohanchkrabrty rohanchkrabrty merged commit a6ca37b into main Apr 28, 2026
8 checks passed
@rohanchkrabrty rohanchkrabrty deleted the fix-service-account branch April 28, 2026 14:01
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.

3 participants