apim-apps icon indicating copy to clipboard operation
apim-apps copied to clipboard

Fix disabled endpoints for vhosts not being reflected correctly

Open DDH13 opened this issue 3 months ago • 1 comments

DDH13 avatar Oct 15 '25 05:10 DDH13

Walkthrough

The changes introduce helper functions for intelligent endpoint and host selection across the DevPortal and Publisher applications. The DevPortal refactors AsyncApiConsole to prefer WebSocket or HTTP endpoints based on API type, while the Publisher's environment and deployment configuration pages add comprehensive WebSocket/host validation to prevent invalid selections and guide user interactions.

Changes

Cohort / File(s) Summary
Endpoint Selection Helpers
portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/AsyncApiConsole/AsyncApiUI.jsx, portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/Environments.jsx
Introduces helper functions (getPreferredEndpoint, pickFirstEnabledUrl) to centralize endpoint/URL selection logic. Updates initial endpoint computation and useEffect dependencies. Adds UI state for disabled Servers Select when unavailable and updates prop types to detail URL structures.
VHost Validation Refactoring (Publisher)
portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Environments/DeploymentOnbording.jsx, portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Environments/Environments.jsx
Introduces validation helpers (wsDisabled, wssDisabled, hasValidWebSocketPorts, hasValidHosts, getHostValue) for WebSocket and host availability. Replaces direct VHost usage throughout UI rendering and selection logic. Adds dynamic disabling of environment and external gateway controls based on host validity. Guards gateway URL computation and dropdown filtering with host validity checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas requiring attention:

  • DeploymentOnbording.jsx & Environments.jsx (publisher): Multiple refactored locations using new validation helpers; verify correctness of getHostValue() logic across WebSocket and HTTP paths
  • Environments.jsx (devportal): Confirm prop type additions align with actual data structure passed from parent components; check that pickFirstEnabledUrl() correctly handles all URL combinations
  • AsyncApiUI.jsx: Review getPreferredEndpoint() endpoint preference order (ws→wss for WebSocket, http→https otherwise) matches product requirements; validate disabled state placeholder behavior

Poem

🐰 Endpoints dance with purpose true,
WebSockets prefer their shaded blue,
While hosts stand guard at every gate,
No invalid picks shall seal your fate!
Selection helpers keep all neat,
Making refactored code quite sweet! 🎯

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 reflects the main changes across multiple files: fixing disabled endpoints for vhosts and their proper reflection in UI state management.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

coderabbitai[bot] avatar Nov 30 '25 12:11 coderabbitai[bot]

Quality Gate Failed Quality Gate failed

Failed conditions
28.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

sonarqubecloud[bot] avatar Nov 30 '25 12:11 sonarqubecloud[bot]