Show organization unit details in application overview - #4845
Conversation
📝 WalkthroughWalkthrough
ChangesOrganization Unit Details
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
frontend/apps/console/src/features/applications/components/edit-application/integration-guides/__tests__/IntegrationGuides.test.tsx (1)
140-145: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the disabled hook call for the unassigned case.
The DOM assertions verify hidden rows, but they do not verify that
useGetOrganizationUnitis disabled whenapplication.ouIdis missing. Add an assertion for the same enabled-flag contract used by the sibling component.Suggested test assertion
renderWithProviders(<IntegrationGuides application={reactApplication} />); + expect(mockUseGetOrganizationUnit).toHaveBeenCalledWith(undefined, false);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/apps/console/src/features/applications/components/edit-application/integration-guides/__tests__/IntegrationGuides.test.tsx` around lines 140 - 145, Update the unassigned-application test around IntegrationGuides to mock or inspect useGetOrganizationUnit and assert it is called with the disabled enabled-flag when application.ouId is missing. Keep the existing assertions verifying that both organization unit rows are hidden, and match the enabled-option contract used by the sibling component.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@frontend/apps/console/src/features/applications/components/edit-application/integration-guides/__tests__/IntegrationGuides.test.tsx`:
- Around line 140-145: Update the unassigned-application test around
IntegrationGuides to mock or inspect useGetOrganizationUnit and assert it is
called with the disabled enabled-flag when application.ouId is missing. Keep the
existing assertions verifying that both organization unit rows are hidden, and
match the enabled-option contract used by the sibling component.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c4cba702-d84c-4b4e-b3a2-fc2406d8d913
📒 Files selected for processing (2)
frontend/apps/console/src/features/applications/components/edit-application/integration-guides/IntegrationGuides.tsxfrontend/apps/console/src/features/applications/components/edit-application/integration-guides/__tests__/IntegrationGuides.test.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Purpose
The Application details card on the application edit page's Overview tab showed only the Application ID and Client ID. The equivalent Agent details card on the agent edit page's Overview tab additionally shows the Organization Unit ID and Organization Unit Handle.
This left users with no way to see which OU an application belongs to. The OU is chosen during application creation and
GET /applications/{id}already returnsouId, but no application edit tab surfaced it anywhere.This PR adds Organization Unit ID and Organization Unit Handle rows to the Application details card, bringing it to parity with the Agent details card.
Approach
Frontend-only change, scoped to
IntegrationGuides.tsx(the component rendering the Overview tab) and its tests.Rendering. Two
CopyableFieldrows were added to the details card, reusing the label wording and field treatment ofAgentOverview.tsxso the two cards read identically.Resolving the handle. The one place this could not mirror the agent implementation is where the handle comes from. The agent GET response carries
ouHandledirectly (the service populates it viapopulateOUHandleForGetwhen?include=displayis set), butApplicationGetResponsehas noouHandlefield. Rather than extend the application API, the handle is resolved client-side with the existinguseGetOrganizationUnit(application.ouId)hook from@thunderid/configure-organization-units. This follows the pattern already used inAgentOverview, which resolves its owner label client-side fromuseGetUsers, and keeps the change to a single file.Conditional rendering. Both rows are conditional, where the agent card renders its OU ID unconditionally.
Agent.ouIdis a requiredstring, butApplication.ouIdis optional, and the handle arrives asynchronously, so an application with no OU, or one whose OU lookup has not yet resolved, shows only the rows it has values for.Related Issues
Summary by CodeRabbit