Skip to content

Add schema name display in Settings Admin Workspace#15151

Merged
charlesBochet merged 1 commit intomainfrom
add-workspace-schema-name-admin
Oct 16, 2025
Merged

Add schema name display in Settings Admin Workspace#15151
charlesBochet merged 1 commit intomainfrom
add-workspace-schema-name-admin

Conversation

@neo773
Copy link
Copy Markdown
Member

@neo773 neo773 commented Oct 16, 2025

No description provided.

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR adds a schema name display feature to the Settings Admin Workspace panel. It introduces a new utility function getWorkspaceSchemaName that generates database schema names by prefixing "workspace_" to a base36-encoded workspace UUID. The main change adds this schema name as a new field in the workspace information display, providing administrators with visibility into the underlying database schema names associated with each workspace.

The implementation follows the existing pattern in the admin panel by adding a new entry to the workspaceInfoItems array, complete with an appropriate icon (IconId) and translatable label. This change integrates seamlessly with the existing workspace information display structure and maintains consistency with the current UI patterns.

Important Files Changed

Changed Files
Filename Score Overview
packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx 2/5 Added schema name field to workspace info display with unsafe non-null assertion
packages/twenty-front/src/modules/settings/admin-panel/utils/get-workspace-schema-name.util.ts 4/5 New utility function to generate workspace schema names using base36 UUID encoding

Confidence score: 2/5

  • This PR requires careful review due to a critical null safety issue that could cause runtime errors
  • Score lowered due to unsafe non-null assertion operator usage on activeWorkspace?.id! which could throw if the workspace ID is undefined, and potential dependency on unvalidated external utility function
  • Pay close attention to SettingsAdminWorkspaceContent.tsx for the null assertion issue that needs proper error handling

Sequence Diagram

sequenceDiagram
    participant User
    participant SettingsAdminWorkspaceContent
    participant getWorkspaceSchemaName
    participant uuidToBase36
    participant SettingsAdminTableCard

    User->>SettingsAdminWorkspaceContent: "Views workspace admin panel"
    SettingsAdminWorkspaceContent->>SettingsAdminWorkspaceContent: "Creates workspaceInfoItems array"
    SettingsAdminWorkspaceContent->>getWorkspaceSchemaName: "getWorkspaceSchemaName(activeWorkspace.id)"
    getWorkspaceSchemaName->>uuidToBase36: "uuidToBase36(workspaceId)"
    uuidToBase36-->>getWorkspaceSchemaName: "Returns base36 encoded UUID"
    getWorkspaceSchemaName-->>SettingsAdminWorkspaceContent: "Returns 'workspace_{base36_id}'"
    SettingsAdminWorkspaceContent->>SettingsAdminTableCard: "Renders workspace info including schema name"
    SettingsAdminTableCard-->>User: "Displays workspace information with schema name"
Loading

Context used:

  • Context from dashboard - Ensure that type assertions are safe and consider using type guards instead of direct assertions. (source)

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

{
Icon: IconId,
label: t`Schema name`,
value: getWorkspaceSchemaName(activeWorkspace?.id!),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

logic: Using non-null assertion (!) on activeWorkspace?.id could cause runtime error if workspace ID is undefined. Consider adding null check or default value.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
Line: 172:172

Comment:
**logic:** Using non-null assertion (!) on activeWorkspace?.id could cause runtime error if workspace ID is undefined. Consider adding null check or default value.

How can I resolve this? If you propose a fix, please make it concise.

value: activeWorkspace?.id,
},
{
Icon: IconId,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Same Icon (IconId) used for both ID and Schema name rows - consider using a different icon for schema name to improve visual distinction.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/twenty-front/src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
Line: 170:170

Comment:
**style:** Same Icon (IconId) used for both ID and Schema name rows - consider using a different icon for schema name to improve visual distinction.

How can I resolve this? If you propose a fix, please make it concise.

{
Icon: IconId,
label: t`Schema name`,
value: getWorkspaceSchemaName(activeWorkspace?.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.

Potential bug: The component crashes if activeWorkspace is undefined because getWorkspaceSchemaName(activeWorkspace?.id!) is called before the null check, causing a TypeError.
  • Description: When an admin searches for a user with no workspaces, the activeWorkspace variable is undefined. The SettingsAdminWorkspaceContent component proceeds to define workspaceInfoItems before its null check for activeWorkspace. The line value: getWorkspaceSchemaName(activeWorkspace?.id!) uses a non-null assertion ! on what becomes an undefined value. This undefined is passed to getWorkspaceSchemaName and then to uuidToBase36, which attempts to call .replace() on it. This results in a TypeError, causing a runtime crash in the admin panel.

  • Suggested fix: Move the null check if (!activeWorkspace) return null; to be before the workspaceInfoItems array is defined. This will ensure the component exits early when activeWorkspace is not available, preventing the crash.
    severity: 0.65, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:24488

This environment will automatically shut down when the PR is closed or after 5 hours.

@charlesBochet charlesBochet merged commit 4e3c378 into main Oct 16, 2025
57 checks passed
@charlesBochet charlesBochet deleted the add-workspace-schema-name-admin branch October 16, 2025 20:42
@github-actions
Copy link
Copy Markdown
Contributor

Thanks @neo773 for your contribution!
This marks your 41st PR on the repo. You're top 1% of all our contributors 🎉
See contributor page - Share on LinkedIn - Share on Twitter

Contributions

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