Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE/HCMPRE-0112: Mandatory Sign for assumptions and Formula Screen #2281

Open
wants to merge 5 commits into
base: console
Choose a base branch
from

Conversation

abishekTa-egov
Copy link
Contributor

@abishekTa-egov abishekTa-egov commented Mar 18, 2025

FEATURE/HCMPRE-0112: Mandatory Sign for assumptions and Formula Screen

Summary by CodeRabbit

  • New Features

    • Enhanced forms with a visible mandatory indicator to clearly denote required fields.
  • Style

    • Applied minor formatting adjustments for a cleaner, more consistent interface layout, without affecting functionality.
  • Chores

    • Removed unused functions and imports to streamline code structure while maintaining core functionality.

@abishekTa-egov abishekTa-egov requested a review from a team as a code owner March 18, 2025 12:22
Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

📝 Walkthrough

Walkthrough

The changes involve minor formatting adjustments and UI enhancements across several components. In the DataMgmtComponent and FileComponent files, whitespace adjustments have been made without affecting functionality. The FormulaConfiguration component introduces a mandatory indicator (a span with an asterisk), while the Hypothesis component activates conditional rendering for this element. No logic, functionality, or exported entity declarations are modified.

Changes

File(s) Change Summary
health/.../components/DataMgmtComponent.js, health/.../components/FileComponent.js Whitespace/formatting adjustments: added three blank lines in DataMgmtComponent and removed one blank line in FileComponent.
health/.../components/FormulaConfiguration.js, health/.../components/Hypothesis.js UI updates: inserted a mandatory indicator span in FormulaConfiguration and activated its conditional rendering in Hypothesis, along with a minor formatting fix.
health/.../example/src/UICustomizations.js Significant restructuring: removed functions (filterUniqueByKey, epochTimeForTomorrow12, cleanObject), simplified imports, and streamlined updatePayload method while maintaining core functionality.

Poem

I'm a rabbit, hopping through the code so bright,
Whitespace and symbols dancing in the light.
A tiny star (*) now marks a field so true,
Conditional hops show what's needed for you.
With code so neat, I nibble carrots in delight!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9dfd31e and 37b8308.

📒 Files selected for processing (4)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/DataMgmtComponent.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FileComponent.js (0 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js (2 hunks)
💤 Files with no reviewable changes (1)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FileComponent.js
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: check

**/*.js: check

  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/DataMgmtComponent.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js
🔇 Additional comments (3)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js (1)

321-321: Good UI enhancement for required field indication.

Adding the mandatory asterisk indicator helps users understand which fields are required, improving form usability.

health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js (2)

165-165: Good implementation of conditional mandatory indicator.

The conditional rendering of the mandatory asterisk based on category and source type is well-implemented and aligns with the PR objectives.


175-175: Clean code improvement.

Removing the extra whitespace improves code cleanliness.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 19, 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: 4

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37b8308 and 4950cee.

📒 Files selected for processing (2)
  • health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (14 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: check

**/*.js: check

  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js
  • health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
🧬 Code Definitions (1)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/UICustomizations.js (5) (5)
  • businessServiceMap (8-10)
  • inboxModuleNameMap (12-14)
  • UICustomizations (66-324)
  • UICustomizations (66-324)
  • additionalFieldsToSet (164-170)
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js

[error] 5-6: Use let or const instead of var.

A variable declared with var is accessible in the whole module. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.

(lint/style/noVar)


[error] 186-186: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 194-194: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 206-206: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 207-207: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 224-224: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 193-193: This let declares a variable that is only assigned once.

'selectedOrg' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 329-329: This let declares a variable that is only assigned once.

'Individual' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

⏰ Context from checks skipped due to timeout of 10000ms (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
🔇 Additional comments (10)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js (1)

321-321: Good implementation of the mandatory field indicator!

The conditional rendering for the mandatory asterisk follows React best practices. The indicator is only shown for non-CUSTOM formula sources, which aligns with the PR objective to add mandatory signs to the Formula Screen.

health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (9)

110-115: Consistent spacing in object properties improves readability.

The spacing in this object is now more consistent. The code is functionally identical, but the improved formatting enhances readability.


117-117: Proper spacing around spread operator enhances readability.

The addition of spaces around the spread operator improves code readability while maintaining the same functionality.


122-125: Formatting improvement in the enableModalSubmit function.

The improved formatting makes the code more readable while maintaining the same functionality.


149-159: Consistent formatting in conditional blocks.

The consistent formatting of the else if conditions improves readability. Each condition is now properly spaced with a consistent pattern.


243-243: LGTM: Path construction for link.

The path construction for the link is correct and uses template literals appropriately.


271-271: Improved return statement for workflow states.

The code now correctly returns the workflow state with proper translation key formatting.


274-274: Good error handling with default case.

Adding a default case with a clear "case not handled" message improves error handling and debugging.


292-295: Improved formatting for the functions object.

The consistent indentation and formatting of the functions object improves readability.


336-336: String trimming logic is correctly implemented.

The string trimming logic for the specified fields is correct and helps prevent issues with extra whitespace.

@@ -392,15 +325,15 @@ export const UICustomizations = {
wardCode: "wardCode[0].code",
socialCategory: "socialCategory.code",
};
const textConfig = ["name", "individualId"];
const textConfig = ["name", "individualId"]
let Individual = Object.keys(requestBody)
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use const instead of let for the Individual variable.

Since Individual is only assigned once and never reassigned, it should use const instead of let.

-let Individual = Object.keys(requestBody)
+const Individual = Object.keys(requestBody)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let Individual = Object.keys(requestBody)
const Individual = Object.keys(requestBody)
🧰 Tools
🪛 Biome (1.9.4)

[error] 329-329: This let declares a variable that is only assigned once.

'Individual' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

Comment on lines +221 to 225
//setting limit and offset becoz somehow they are not getting set in muster inbox
data.body.inbox .limit = data.state.tableForm.limit
data.body.inbox.offset = data.state.tableForm.offset
delete data.state
return data;
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider alternatives to using the delete operator.

Using the delete operator can impact performance. Consider setting properties to undefined instead of deleting them.

//setting limit and offset becoz somehow they are not getting set in muster inbox 
data.body.inbox .limit = data.state.tableForm.limit
data.body.inbox.offset = data.state.tableForm.offset
-delete data.state
+data.state = undefined
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
//setting limit and offset becoz somehow they are not getting set in muster inbox
data.body.inbox .limit = data.state.tableForm.limit
data.body.inbox.offset = data.state.tableForm.offset
delete data.state
return data;
//setting limit and offset becoz somehow they are not getting set in muster inbox
data.body.inbox .limit = data.state.tableForm.limit
data.body.inbox.offset = data.state.tableForm.offset
data.state = undefined
return data;
🧰 Tools
🪛 Biome (1.9.4)

[error] 224-224: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)

// var Digit = window.Digit || {};


var Digit = window.Digit || {};
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace var with const for better variable scoping.

Using var for variable declarations is not recommended in modern JavaScript as it has function scope rather than block scope, which can lead to unexpected behavior. Consider using const instead since this variable is not reassigned.

-var Digit = window.Digit || {};
+const Digit = window.Digit || {};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var Digit = window.Digit || {};
const Digit = window.Digit || {};
🧰 Tools
🪛 Biome (1.9.4)

[error] 5-6: Use let or const instead of var.

A variable declared with var is accessible in the whole module. Thus, the variable can be accessed before its initialization and outside the block where it is declared.
See MDN web docs for more details.
Unsafe fix: Use 'const' instead.

(lint/style/noVar)


let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use const instead of let for variables that aren't reassigned.

The selectedOrg variable is only assigned once and never reassigned, so it should use const instead of let for better code quality and to prevent accidental reassignment.

-let selectedOrg =  _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
+const selectedOrg =  _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
const selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null);
🧰 Tools
🪛 Biome (1.9.4)

[error] 193-193: This let declares a variable that is only assigned once.

'selectedOrg' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

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