fix(ui): display missing OpenAPI fields in ManageDataTables, RolesAndPermissions and Users pages#97
Conversation
…Permissions and Users pages
📝 WalkthroughWalkthroughThis PR updates three table columns across different pages to display actual data values instead of placeholder strings. The "Sub Type" column now shows entity subtype data, the "Status" column displays enabled/disabled state, and the "Is Self Service" column shows yes/no based on user properties. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment Tip CodeRabbit can approve the review once all CodeRabbit's comments are resolved.Enable the |
|
Please create a Jira ticket for this task, or link the existing one if it already exists. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/pages/system/roles-and-permissions/RolesAndPermissions.tsx`:
- Line 178: The current status rendering in RolesAndPermissions.tsx uses (role
as any).disabled ? 'Disabled' : 'Enabled', which treats undefined as "Enabled";
change the logic to explicitly check for true/false on role.disabled (e.g.,
role.disabled === true ? 'Disabled' : role.disabled === false ? 'Enabled' :
'Unknown') so missing/undefined values render 'Unknown' instead of defaulting to
Enabled; update the component where the status is computed/rendered (the
expression referencing (role as any).disabled) to use this explicit three-way
check.
In `@src/pages/users/Users.tsx`:
- Line 196: The current JSX always shows "No" when isSelfServiceUser is missing;
update the render for (user as any).isSelfServiceUser so it displays 'Yes' only
if the value is === true, 'No' only if === false, and 'Unknown' when the field
is null/undefined or not a boolean. Locate the expression "(user as
any).isSelfServiceUser" in Users.tsx and replace the single ternary with a
boolean-type check (e.g. typeof === 'boolean') to decide between 'Yes'/'No' and
fall back to 'Unknown'; also consider using the typed user property instead of
casting to any if available.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d455f8c0-89a8-489e-b2a5-2acfa4395d2d
📒 Files selected for processing (3)
src/pages/system/manage-data-tables/ManageDataTables.tsxsrc/pages/system/roles-and-permissions/RolesAndPermissions.tsxsrc/pages/users/Users.tsx
| </TableCell> | ||
| <TableCell className="px-6 py-4"> | ||
| {'missing in OpenApi'} | ||
| {(role as any).disabled ? 'Disabled' : 'Enabled'} |
There was a problem hiding this comment.
Do not map unknown disabled values to “Enabled” (Line 178).
If disabled is absent/undefined, the current ternary renders “Enabled”, which is a misleading status. Handle explicit true/false and fall back to unknown.
Suggested change
- {(role as any).disabled ? 'Disabled' : 'Enabled'}
+ {(role as any).disabled === true
+ ? 'Disabled'
+ : (role as any).disabled === false
+ ? 'Enabled'
+ : '—'}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {(role as any).disabled ? 'Disabled' : 'Enabled'} | |
| {(role as any).disabled === true | |
| ? 'Disabled' | |
| : (role as any).disabled === false | |
| ? 'Enabled' | |
| : '—'} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/pages/system/roles-and-permissions/RolesAndPermissions.tsx` at line 178,
The current status rendering in RolesAndPermissions.tsx uses (role as
any).disabled ? 'Disabled' : 'Enabled', which treats undefined as "Enabled";
change the logic to explicitly check for true/false on role.disabled (e.g.,
role.disabled === true ? 'Disabled' : role.disabled === false ? 'Enabled' :
'Unknown') so missing/undefined values render 'Unknown' instead of defaulting to
Enabled; update the component where the status is computed/rendered (the
expression referencing (role as any).disabled) to use this explicit three-way
check.
| </TableCell> | ||
| <TableCell className="px-6 py-4 text-zinc-700 dark:text-zinc-200"> | ||
| {'Missing in OpenApi'} | ||
| {(user as any).isSelfServiceUser ? 'Yes' : 'No'} |
There was a problem hiding this comment.
Avoid defaulting unknown isSelfServiceUser to “No” (Line 196).
When the field is missing/null, this currently renders “No”, which is inaccurate. Render Yes/No only for explicit booleans, otherwise show unknown.
Suggested change
- {(user as any).isSelfServiceUser ? 'Yes' : 'No'}
+ {(user as any).isSelfServiceUser === true
+ ? 'Yes'
+ : (user as any).isSelfServiceUser === false
+ ? 'No'
+ : '—'}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {(user as any).isSelfServiceUser ? 'Yes' : 'No'} | |
| {(user as any).isSelfServiceUser === true | |
| ? 'Yes' | |
| : (user as any).isSelfServiceUser === false | |
| ? 'No' | |
| : '—'} |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/pages/users/Users.tsx` at line 196, The current JSX always shows "No"
when isSelfServiceUser is missing; update the render for (user as
any).isSelfServiceUser so it displays 'Yes' only if the value is === true, 'No'
only if === false, and 'Unknown' when the field is null/undefined or not a
boolean. Locate the expression "(user as any).isSelfServiceUser" in Users.tsx
and replace the single ternary with a boolean-type check (e.g. typeof ===
'boolean') to decide between 'Yes'/'No' and fall back to 'Unknown'; also
consider using the typed user property instead of casting to any if available.
gkbishnoi07
left a comment
There was a problem hiding this comment.
your one workflow is failing please fix it
Summary
Fixed 3 pages that were showing hardcoded 'Missing in OpenApi'
text by replacing them with actual field values.
Problem
Several pages had placeholder text instead of real data because
fields were missing from the OpenAPI spec.
Changes
ManageDataTables.tsx→ displayentitySubTypefieldRolesAndPermissions.tsx→ displaydisabledstatus as 'Enabled'/'Disabled'Users.tsx→ displayisSelfServiceUseras 'Yes'/'No'Related
Summary by CodeRabbit