Skip to content

fix(groups): display user full name in role edit user dropdown#39942

Open
Abdulrehman-PIAIC80387 wants to merge 3 commits into
apache:masterfrom
Abdulrehman-PIAIC80387:fix/role-edit-show-user-fullname-39907
Open

fix(groups): display user full name in role edit user dropdown#39942
Abdulrehman-PIAIC80387 wants to merge 3 commits into
apache:masterfrom
Abdulrehman-PIAIC80387:fix/role-edit-show-user-fullname-39907

Conversation

@Abdulrehman-PIAIC80387
Copy link
Copy Markdown
Contributor

@Abdulrehman-PIAIC80387 Abdulrehman-PIAIC80387 commented May 7, 2026

SUMMARY

User dropdowns under role/group editing showed raw user.username as the label. For OAuth-authenticated users (Google, etc.), username is the provider's GUID, which makes the role/group user pickers unusable when looking up users by name.

Fix: introduced a shared getUserDisplayLabel(user) helper that prefers first_name + last_name and falls back to username for backward compatibility. Applied it across all 4 spots that were rendering user options:

  • superset-frontend/src/features/groups/utils.tsfetchUserOptions (search results)
  • superset-frontend/src/features/groups/GroupListModal.tsx — already-selected users when editing a group
  • superset-frontend/src/features/roles/RoleListEditModal.tsx — initial user options on the Users tab
  • superset-frontend/src/features/roles/RoleListEditModal.tsx — role users in the form's initial values

This avoids the inconsistency where the search dropdown could show a friendly name while the existing selection chip still showed the raw GUID.

Fixes #39907

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

image

After:

image

TESTING INSTRUCTIONS

  1. Settings → List Users → create a user with First Name "John", Last Name "Doe", Username "108234567890123456789" (mimicking an OAuth GUID).
  2. Settings → List Roles → edit any role.
  3. Click in the Users dropdown.
  4. Before the fix: entry shows as the OAuth GUID/username, both in the search dropdown and as a selected chip.
  5. With the fix: entry shows as John Doe everywhere. Users without first_name/last_name still fall back to their username.
  6. Repeat in Settings → List Groups → Edit Group → Users to verify the same fix applies there.

ADDITIONAL INFORMATION

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 7, 2026

Code Review Agent Run #5452b2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: d406040..d406040
    • superset-frontend/src/features/groups/utils.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the change:frontend Requires changing the frontend label May 7, 2026
Comment thread superset-frontend/src/features/groups/utils.ts Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

The flagged issue is correct: fetchUserOptions now uses full names for options, but existing selected users in RoleListEditModal still display usernames, causing inconsistency. To resolve, I've implemented the suggested shared helper in utils.ts.

superset-frontend/src/features/groups/utils.ts

export const getUserDisplayLabel = (user: any) =>
  [user.first_name, user.last_name].filter(Boolean).join(' ') || user.username;

export const fetchUserOptions = async (
  // ... other code ...
      return {
        data: results.map((user: any) => ({
          value: user.id,
          label: getUserDisplayLabel(user),
        })),
        totalCount: response.json?.count ?? 0,
      };

@pull-request-size pull-request-size Bot added size/S and removed size/XS labels May 7, 2026
@Abdulrehman-PIAIC80387
Copy link
Copy Markdown
Contributor Author

Good catch — extracted a shared getUserDisplayLabel helper and applied it to the other 3 places that were still showing the raw username (GroupListModal.tsx and the two spots in RoleListEditModal.tsx).

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 7, 2026

Code Review Agent Run #3a0490

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: d406040..6650389
    • superset-frontend/src/features/groups/GroupListModal.tsx
    • superset-frontend/src/features/groups/utils.ts
    • superset-frontend/src/features/roles/RoleListEditModal.tsx
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes user dropdowns in role/group edit modals to display full names instead of raw usernames (which are GUIDs for OAuth users).

Changes:

  • Adds shared getUserDisplayLabel helper in groups/utils.ts that prefers first_name + last_name, falling back to username.
  • Uses the helper in GroupListModal for already-selected users.
  • Uses the helper in RoleListEditModal for both initial user options and form initial values.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
superset-frontend/src/features/groups/utils.ts Adds getUserDisplayLabel helper and uses it in fetchUserOptions.
superset-frontend/src/features/groups/GroupListModal.tsx Uses helper to label existing group users.
superset-frontend/src/features/roles/RoleListEditModal.tsx Uses helper for role user labels in both effect and initial form values.

Comment thread superset-frontend/src/features/roles/RoleListEditModal.tsx Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 15, 2026

Code Review Agent Run #6030d5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 9e316b4..d96dbae
    • superset-frontend/src/features/groups/GroupListModal.tsx
    • superset-frontend/src/features/groups/utils.ts
    • superset-frontend/src/features/roles/RoleListEditModal.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4422e55
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a06ba59f2250000083557e9
😎 Deploy Preview https://deploy-preview-39942--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@Abdulrehman-PIAIC80387 Abdulrehman-PIAIC80387 force-pushed the fix/role-edit-show-user-fullname-39907 branch from 85186d6 to 4422e55 Compare May 15, 2026 06:16
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.16%. Comparing base (2b71d96) to head (4422e55).

Files with missing lines Patch % Lines
superset-frontend/src/features/users/utils.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39942      +/-   ##
==========================================
- Coverage   64.17%   64.16%   -0.01%     
==========================================
  Files        2590     2590              
  Lines      138087   138091       +4     
  Branches    32039    32042       +3     
==========================================
- Hits        88615    88611       -4     
- Misses      47947    47955       +8     
  Partials     1525     1525              
Flag Coverage Δ
javascript 67.00% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 15, 2026

Code Review Agent Run #e52af9

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/features/users/utils.ts - 1
    • Trim user names in display label · Line 47-54
      The getUserDisplayLabel function may produce display labels with extra spaces if user names contain leading or trailing whitespace. Trimming the values ensures clean output.
      Code suggestion
       @@ -47,6 +47,6 @@ export const getUserDisplayLabel = (user: {
          last_name?: string;
          username?: string;
        }): string =>
      -  [user.first_name, user.last_name].filter(Boolean).join(' ') ||
      -  user.username ||
      +  [user.first_name?.trim(), user.last_name?.trim()].filter(Boolean).join(' ') ||
      +  user.username?.trim() ||
          '';
Review Details
  • Files reviewed - 5 · Commit Range: b607151..4422e55
    • superset-frontend/src/features/groups/GroupListModal.tsx
    • superset-frontend/src/features/groups/utils.ts
    • superset-frontend/src/features/roles/RoleListEditModal.test.tsx
    • superset-frontend/src/features/roles/RoleListEditModal.tsx
    • superset-frontend/src/features/users/utils.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing role incorrectly displays oauth user

2 participants