Skip to content

Conversation

abishekTa-egov
Copy link
Contributor

@abishekTa-egov abishekTa-egov commented Aug 21, 2025

BUGFIX/HCMPRE-11112: Context path change for health-project in demo env

Summary by CodeRabbit

  • New Features
    • Campaign and project/staff search now use environment-driven endpoints, adapting automatically across deployments.
  • Refactor
    • Replaced hardcoded service URLs with dynamic configuration that trims trailing slashes and falls back to safe defaults.
  • Chores
    • Adjusted local proxy registration order to improve routing reliability during development.

@abishekTa-egov abishekTa-egov requested a review from a team as a code owner August 21, 2025 08:59
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

📝 Walkthrough

Walkthrough

Proxy registration for /project/staff/v1/_search was moved to a later batch in setupProxy.js. InboxConfig and ProjectService replaced hard-coded /health-project/.../_search paths with dynamic constructions using window.globalConfigs.getConfig("PROJECT_SERVICE_PATH"), trimming trailing slashes and falling back to /project/... equivalents. No payload/method/signature changes.

Changes

Cohort / File(s) Summary
Proxy config order update
health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js
Removed /project/staff/v1/_search from the first proxy batch and re-registered it in a later proxy batch; proxy target unchanged.
Config-driven API paths (InboxConfig)
health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js
Replaced fixed /health-project/staff/v1/_search with a dynamic expression: window?.globalConfigs?.getConfig("PROJECT_SERVICE_PATH") ? \${String(...).replace(//+$/,"")}/staff/v1/_search` : "/project/staff/v1/_search"` for ALL_CAMPAIGNS, PAST_CAMPAIGNS, and LIVE_CAMPAIGNS.
Config-driven API paths (ProjectService)
health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js
Replaced hard-coded /health-project/staff/v1/_search and /health-project/v1/_search with dynamic constructions based on PROJECT_SERVICE_PATH (trim trailing slashes) and fallbacks to /project/staff/v1/_search and /project/v1/_search; request methods and payloads unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as UI (Inbox)
  participant Cfg as window.globalConfigs
  participant Svc as ProjectService
  participant Proxy as Dev Proxy
  participant API as Project Service API

  UI->>Cfg: getConfig("PROJECT_SERVICE_PATH")
  Note right of Cfg: returns base path or undefined
  UI->>Svc: call staffSearch / projectSearch (body, params)
  alt PROJECT_SERVICE_PATH present
    Svc->>Proxy: POST ${basePath}/staff|v1/_search
  else fallback
    Svc->>Proxy: POST /project/staff|v1/_search
  end
  Proxy->>API: forward request
  API-->>Proxy: response
  Proxy-->>Svc: response
  Svc-->>UI: results
  Note over Proxy: `/project/staff/v1/_search` proxy entry moved later in setupProxy.js
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my nose where routes once lay,
From fixed snug burrows to paths that sway.
I hop the proxy to a newer spot,
Trim trailing slashes, tidy the lot.
Carrot-coded joy — shy hops, not haste. 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bd1558d and a1b0b67.

📒 Files selected for processing (2)
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js (3 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

check

Files:

  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js
🔇 Additional comments (6)
health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js (3)

5-8: LGTM: Correct conditional fallback and trailing-slash normalization for staffSearch

The ternary + replace(//+$/, "") fixes the earlier “undefined/…” URL issue and correctly falls back to “/project”. Nice.


26-29: LGTM: projectSearch URL construction matches the staffSearch fix

The dynamic base + fallback is consistent and correct.


15-16: No mismatches between ProjectStaff and Project shapes

All of the UI configurations and renderers consistently use the Project array returned by ProjectService.projectSearch—none rely on a top-level ProjectStaff property for rendering tables:

  • In health-dss’s InboxConfig.js, each resultsJsonPath: "Project" aligns with the hook’s returned data (data.Project) from the two-phase staff→project search flow.
  • The various assignCampaignConfig.js and other inbox/table configs across health-hrms, health-payments, etc., similarly reference only "Project" in their resultsJsonPath, matching their use of search_project rather than staffSearch.
  • No downstream consumer is wired to use ProjectStaff in resultsJsonPathstaffSearch is only leveraged internally to obtain project IDs, not to drive table rendering.

Since all renderers expect the Project property (as intended) and no config expects ProjectStaff in the response, there’s nothing to change here.

health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js (3)

11-14: LGTM: Proper conditional fallback and trailing-slash trim (ALL_CAMPAIGNS)

This fixes the “undefined/staff/…” problem and handles extra slashes correctly.


110-114: LGTM: Same fix applied consistently (PAST_CAMPAIGNS)

Consistent with ALL_CAMPAIGNS change.


209-213: LGTM: Same fix applied consistently (LIVE_CAMPAIGNS)

Consistent implementation across all three sections.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BUGFIX/HCMPRE-11112

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b2d2b4c and bd1558d.

📒 Files selected for processing (3)
  • health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js (3 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js

⚙️ CodeRabbit configuration file

check

Files:

  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/services/ProjectService.js
  • health/micro-ui/web/micro-ui-internals/example/src/setupProxy.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/health-dss/src/configs/InboxConfig.js
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)

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.

2 participants