Skip to content

Conversation

@faisalsiddique4400
Copy link
Contributor

@faisalsiddique4400 faisalsiddique4400 commented Dec 1, 2025

feat(admin): add KeyCloak status check for SAML visibility in Admin UI (#2489)

Summary

The Admin UI should only display the SAML module in the sidebar if the required KeyCloak server is installed and operational. This feature introduces a server health check for KeyCloak to determine SAML availability.

Fix Summary

  • Added server health check for KeyCloak to detect installation status.
  • Conditionally render the SAML menu item in the Admin UI sidebar based on server availability.
  • Ensures that SAML is hidden when the required server is not installed.
  • Verified proper sidebar rendering under both installed and non-installed scenarios.

Closes

Closes: #2489

Summary by CodeRabbit

  • Refactor
    • Improved type safety and consistency for health/status data across the admin UI and Redux state.
    • Centralized health-state typing for selectors to reduce runtime type errors.
  • New Features
    • Added SAML service to the health-based visibility configuration so related menu items respect service health.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

📝 Walkthrough

Walkthrough

Adds explicit TypeScript types for health state and visibility, maps specific sidebar routes to health service keys (including SAML → keycloak), and updates selectors to use the new health typings; no reducer logic changes.

Changes

Cohort / File(s) Summary
Health types & state
admin-ui/app/redux/features/healthSlice.ts
Adds HealthStatus, exported HealthServiceKey, KnownHealthServices, exported HealthStatusResponse, exported HealthState, and types initialState as HealthState.
Sidebar visibility types
admin-ui/app/components/Sidebar/types.ts
Adds HealthVisibilityPath union (`'/jans-lock'
Sidebar usage & mapping
admin-ui/app/routes/Apps/Gluu/GluuAppSidebar.tsx
Adds /samlkeycloak mapping in visibility conditions, relaxes selectHealth typing to infer from state, and updates menu filtering to safely resolve health keys using the new VisibilityConditions keys.
Dashboard selectors typing
admin-ui/app/routes/Dashboards/DashboardPage.tsx
Introduces local DashboardHealthRootState (uses HealthState) and replaces untyped useSelector usages with typed selectors for serverStatus, serverHealth, and dbStatus.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify HealthVisibilityPath covers all routes that should be gated by health.
  • Confirm HealthServiceKey values match actual service identifiers (e.g., keycloak) used elsewhere.
  • Ensure consumers of HealthStatusResponse (selectors/components) handle the index-signature and optional keys.
  • Check there are no runtime assumptions about health remaining a plain Record<string,string> in other files.

🐰 In the meadow of code I hop and sing,
Mapped paths and health keys — what joy they bring!
SAML now checks Keycloak’s steady beat,
Types snug and tidy, all routes complete.
A carrot for safety, a ribbon of spring!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 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: adding KeyCloak status check for SAML visibility in the Admin UI sidebar.
Linked Issues check ✅ Passed The pull request implements both objectives from issue #2489: adding server health check for KeyCloak and conditionally rendering SAML based on availability.
Out of Scope Changes check ✅ Passed All changes are scoped to health type system improvements and SAML visibility logic, directly supporting the KeyCloak health check objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch admin-ui-issue-2489

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6d25a6 and d6d7a2d.

📒 Files selected for processing (2)
  • admin-ui/app/redux/features/healthSlice.ts (1 hunks)
  • admin-ui/app/routes/Dashboards/DashboardPage.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
admin-ui/app/routes/Dashboards/DashboardPage.tsx (1)
admin-ui/app/redux/features/healthSlice.ts (1)
  • HealthState (22-27)
🔇 Additional comments (3)
admin-ui/app/routes/Dashboards/DashboardPage.tsx (1)

62-66: LGTM! Improved type safety for health state selectors.

Replacing any with DashboardHealthRootState provides better type checking and autocomplete support for health state access.

admin-ui/app/redux/features/healthSlice.ts (2)

6-14: LGTM! KeyCloak service key added as per PR objectives.

The HealthServiceKey union properly includes 'keycloak' (line 14), enabling type-safe health checks for the SAML/KeyCloak integration.


22-27: LGTM! Well-structured health state interface.

The HealthState interface cleanly separates concerns with nullable status fields and a dedicated health services map, enabling proper type safety across the application.


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.

@mo-auto mo-auto added comp-admin-ui Component affected by issue or PR kind-feature Issue or PR is a new feature request labels Dec 1, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e664cbb and a6d25a6.

📒 Files selected for processing (4)
  • admin-ui/app/components/Sidebar/types.ts (3 hunks)
  • admin-ui/app/redux/features/healthSlice.ts (1 hunks)
  • admin-ui/app/routes/Apps/Gluu/GluuAppSidebar.tsx (3 hunks)
  • admin-ui/app/routes/Dashboards/DashboardPage.tsx (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
admin-ui/app/components/Sidebar/types.ts (1)
admin-ui/app/redux/features/healthSlice.ts (2)
  • HealthServiceKey (6-14)
  • HealthStatusResponse (18-20)
admin-ui/app/routes/Apps/Gluu/GluuAppSidebar.tsx (2)
admin-ui/app/cedarling/types/index.ts (1)
  • RootState (128-135)
admin-ui/app/components/Sidebar/types.ts (1)
  • VisibilityConditions (33-35)
admin-ui/app/routes/Dashboards/DashboardPage.tsx (1)
admin-ui/app/redux/features/healthSlice.ts (1)
  • HealthState (22-27)
🔇 Additional comments (8)
admin-ui/app/redux/features/healthSlice.ts (2)

6-27: Well-structured type definitions for health status management.

The HealthServiceKey union includes 'keycloak' which properly supports the PR objective of conditionally rendering the SAML menu based on KeyCloak availability. The HealthStatusResponse intersection type correctly allows both known service keys with type hints and arbitrary service names for extensibility.


29-34: LGTM!

The initialState is properly typed with HealthState, and the initial values align with the interface definition.

admin-ui/app/routes/Apps/Gluu/GluuAppSidebar.tsx (3)

45-50: SAML visibility correctly tied to KeyCloak health status.

The addition of '/saml': 'keycloak' fulfills the PR objective of hiding the SAML menu item when the KeyCloak server is not running.


78-78: LGTM!

The selector correctly accesses the typed health property from healthReducer. Type inference works properly here since SidebarRootState defines the correct shape.


159-164: Visibility filtering logic is correct.

The updated lookup safely handles menus with or without paths. Menus without a matching visibility condition are shown by default, while menus with conditions (like /saml) are shown only when the corresponding service (keycloak) reports 'Running'.

admin-ui/app/components/Sidebar/types.ts (2)

31-35: Type definitions correctly align with visibility conditions.

The HealthVisibilityPath union ('/jans-lock' | '/fido/fidomanagement' | '/scim' | '/saml') matches the keys in VISIBILITY_CONDITIONS from GluuAppSidebar.tsx, ensuring type safety between the two files.


53-55: LGTM!

The health property correctly uses HealthStatusResponse, ensuring consistency with the Redux slice definition.

admin-ui/app/routes/Dashboards/DashboardPage.tsx (1)

62-66: LGTM!

The health-related selectors are now properly typed with DashboardHealthRootState, providing type safety when accessing serverStatus, health, and dbStatus from the Redux store.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

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

Labels

comp-admin-ui Component affected by issue or PR kind-feature Issue or PR is a new feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(admin): adding KeyClock status for SAML

4 participants