Skip to content

Conversation

@celdrake
Copy link
Collaborator

@celdrake celdrake commented Dec 18, 2025

The button for reloading the organization will not succeed while the user stays logged in, so it's best to remove it.

We only keep it for the case where there's an unknown error which may be transient.

Summary by CodeRabbit

  • New Features

    • Added a user notification message informing users to log out and log in again to regain access to the application in certain scenarios.
  • Bug Fixes

    • Enhanced Reload button visibility to display conditionally based on available organizations, providing clearer guidance on available user actions.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

A new English translation message and UI updates to the OrganizationSelector component. The translation captures a user-facing message about logging out and back in to access the application. The component conditionally displays this message when users lack organization access and restricts the Reload button visibility to only show when organizations exist.

Changes

Cohort / File(s) Summary
Translation Addition
libs/i18n/locales/en/translation.json
Added new translation key "You will need to log out and log in again to access the application." with corresponding value.
UI Component Update
libs/ui-components/src/components/common/OrganizationSelector.tsx
Added informational text message in the no-access branch using the new translation key. Made Reload button rendering conditional—only visible when organizations are available, applied to both error and empty organization states.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Minor additions: one translation entry and straightforward conditional rendering logic
  • Changes confined to a single component with no cross-file dependencies
  • Low complexity with clear, localized modifications

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: conditionally showing the reload organizations button only when it can succeed, which is the core modification in OrganizationSelector.tsx.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08029e1 and d782277.

📒 Files selected for processing (2)
  • libs/i18n/locales/en/translation.json (1 hunks)
  • libs/ui-components/src/components/common/OrganizationSelector.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: celdrake
Repo: flightctl/flightctl-ui PR: 346
File: libs/ui-components/src/components/common/OrganizationGuard.tsx:54-62
Timestamp: 2025-09-17T12:24:09.201Z
Learning: In the Flight Control UI proxy, organization feature detection uses a 501 (Not Implemented) status code to explicitly signal when organizations are disabled via the ORGANIZATIONS_ENABLED setting. Any other status code (including errors like 404, 500) should be treated as organizations being enabled. The logic `organizationsEnabled = response.status !== 501` is correct and more resilient than checking `response.ok`.
Learnt from: celdrake
Repo: flightctl/flightctl-ui PR: 363
File: libs/ui-components/src/hooks/useWebSocket.ts:54-58
Timestamp: 2025-10-08T11:21:15.680Z
Learning: In flightctl-ui, when organizations are enabled, all API requests require the org_id parameter and fail with 403 if it's missing. This means users can only reach the Device details page (and its Terminal tab) if they have a valid organization selected, so organizationId will always be defined in that context.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: integration-tests
  • GitHub Check: Lint
  • GitHub Check: Build
  • GitHub Check: Build ocp plugin
🔇 Additional comments (3)
libs/i18n/locales/en/translation.json (1)

231-231: LGTM! Clear user guidance added.

The new translation key provides clear instructions to users who lack organization access. The message appropriately directs them to log out and back in after obtaining access.

libs/ui-components/src/components/common/OrganizationSelector.tsx (2)

197-197: LGTM! Helpful user guidance added.

The informational message logically follows the instruction to contact an administrator and clearly explains that the user must log out and back in after gaining access. This improves the user experience by setting clear expectations.


216-226: LGTM! Conditional rendering logic is correct.

The reload button is now appropriately shown only when organizations exist but there's an error (likely transient). When the user has no access to organizations, the button is correctly hidden since reloading won't succeed while they remain logged in. This aligns perfectly with the PR objective and improves UX by preventing futile actions.


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.

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.

1 participant