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

BUGFIX/HCMPRE-2243 : Showing only supported campaign types and minor fixes #2187

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

nipunarora-eGov
Copy link
Contributor

@nipunarora-eGov nipunarora-eGov commented Feb 3, 2025

Summary by CodeRabbit

  • New Features

    • Improved the campaign details view by enhancing the campaign type selection dropdown. The available options are now dynamically generated based on current data.
    • Expanded the data retrieved for campaign types to support a more robust filtering process, ensuring users see the most relevant campaign options.
    • Introduced loading feedback in the KPI display for better user experience during data retrieval.
    • Enhanced the layout and styling of filter components for improved responsiveness and alignment.
    • Added role-based logic to manage user actions and visibility in the Plan Inbox.
  • Bug Fixes

    • Corrected the handling of default selected options in the filter component to ensure accurate state updates.
  • Chores

    • Updated the CSS stylesheet to version 0.2.45 for the health UI component.

…lan ui (#2185)

* BUGFIX/HCMPRE-2243 : Showing only supported campaign types for microplan

* Added review changes

* Updated to hcm-microplanning module

* Fixed typo
@nipunarora-eGov nipunarora-eGov requested a review from a team as a code owner February 3, 2025 12:38
Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

📝 Walkthrough

Walkthrough

This pull request updates the campaign filtering logic in the CampaignDetails component and enhances data retrieval in the employee page. In CampaignDetails.js, the new variable campaignTypeOptions is created by mapping state?.MicroplanCampaignTypes to extract campaign codes, replacing the previous hard-coded exclusion. The employee index page now includes a request for "MicroplanCampaignTypes" data in the useCustomMDMS hook, expanding the dataset available for further processing in the application. Additional changes include updates to styles, conditional rendering, and state management across various components.

Changes

File Path Change Summary
health/micro-ui/web/.../CampaignDetails.js Added campaignTypeOptions variable using `state?.MicroplanCampaignTypes?.map(...)
health/micro-ui/web/.../employee/index.js Added new data retrieval { name: "MicroplanCampaignTypes" } in the useCustomMDMS hook for "hcm-microplanning".
health/micro-ui/web/.../example/public/index.html Updated stylesheet link version from 0.2.44 to 0.2.45.
health/micro-ui/web/.../css/src/components/microplan.scss Added new CSS classes for filter components to enhance layout and styling.
health/micro-ui/web/.../components/BoundaryKpi.js Introduced conditional rendering with a Loader component for data loading state.
health/micro-ui/web/.../components/BoundarySelection.js Removed isStatusMapLoading state and adjusted popup rendering logic.
health/micro-ui/web/.../components/InboxFilterWrapper.js Added conditional class name to FilterCard and modified default selected options logic.
health/micro-ui/web/.../pages/employee/PlanInbox.js Introduced isRootApprover variable affecting logic in fetchStatusCount and updated several hooks and functions.
health/micro-ui/web/.../utils/utilities.js Refactored createStatusMap function to use reduce for building the status map.
health/micro-ui/web/.../public/index.html Updated stylesheet link version from 0.2.44 to 0.2.45.

Possibly related PRs

Poem

I hopped through fields of code with glee,
Found new options in a data spree,
Mapping campaigns with a gentle touch,
Filtering changes that mean so much,
This rabbit celebrates each line—oh, what a spree! 🐰✨

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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 bcb3a79 and c65b8b8.

📒 Files selected for processing (2)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/CampaignDetails.js (2 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/CampaignDetails.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)

Pattern **/*.js: check

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

60-60: LGTM! Safely extracts campaign type codes.

The implementation correctly uses optional chaining and provides a fallback empty array, ensuring type safety.

health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)

142-142: LGTM! Added MDMS data retrieval for campaign types.

The implementation correctly integrates with the existing MDMS data fetching pattern and state management.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 3, 2025
nabeelmd-eGov
nabeelmd-eGov previously approved these changes Feb 3, 2025
Swathi-eGov
Swathi-eGov previously approved these changes Feb 3, 2025
Copy link
Collaborator

@jagankumar-egov jagankumar-egov left a comment

Choose a reason for hiding this comment

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

Consolidate the patch fixes and push to master,

BUGFIX/HCMPRE-2250 : Added loader while data is loading for the Boundary KPI
@Swathi-eGov Swathi-eGov dismissed stale reviews from nabeelmd-eGov, coderabbitai[bot], and themself via 168c43f February 5, 2025 10:29
@nipunarora-eGov nipunarora-eGov changed the title BUGFIX/HCMPRE-2243 : Showing only supported campaign types for microplan UI BUGFIX/HCMPRE-2243 : Showing only supported campaign types and minor fixes Feb 6, 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: 7

🔭 Outside diff range comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js (4)

250-256: Remove commented-out code.

Remove the commented-out version of updateUrlParams as it's no longer needed and the new implementation is already in place.


293-300: Complete the implementation of mergeAssumptions.

The function contains only comments describing what needs to be done but lacks implementation.

Would you like me to help implement this function based on the provided comments?


392-394: Complete the implementation of fetchBoundaryOptions.

The function is declared but not implemented.

Would you like me to help implement this function based on its parameters and usage context?


513-527: Add JSDoc documentation for exported functions.

The exported utility functions lack documentation describing their purpose, parameters, and return values. This documentation would improve maintainability and help other developers understand how to use these functions correctly.

Example for one function:

/**
 * Creates a status map counting occurrences of each type in the data array.
 * @param {Array} data - Array of objects containing type information
 * @param {Array} boundaryHierarchy - Array of boundary objects with boundaryType
 * @returns {Object} Map of types to their counts
 */
function createStatusMap(data, boundaryHierarchy) {
  // ... implementation
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c65b8b8 and af0c2e9.

⛔ Files ignored due to path filters (1)
  • health/micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
📒 Files selected for processing (8)
  • health/micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundaryKpi.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js (2 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js (3 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js (1 hunks)
  • health/micro-ui/web/public/index.html (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/BoundaryKpi.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js
📓 Learnings (2)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js (1)
Learnt from: Ramkrishna-egov
PR: egovernments/DIGIT-Frontend#1562
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js:57-57
Timestamp: 2024-11-12T10:40:17.779Z
Learning: In the `InboxFilterWrapper` component, `optionsKey` should always be set to `"name"` because options are transformed and created within the component.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js (1)
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1847
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js:308-314
Timestamp: 2024-11-18T04:35:51.535Z
Learning: In `PlanInbox.js`, the variable `planWithCensus?.StatusCount[selectedFilter]` is always defined in the given context, so null checks are unnecessary.
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/BoundarySelection.js

[error] 117-149: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing.

Unsafe fix: Use a SelfClosingElement instead

(lint/style/useSelfClosingElements)


[error] 135-146: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

⏰ Context from checks skipped due to timeout of 10000ms (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
🔇 Additional comments (11)
health/micro-ui/web/micro-ui-internals/example/public/index.html (1)

15-15: CSS Stylesheet Version Update Confirmed

The link for the Digit UI Health CSS has been successfully updated from an older version (likely 0.2.44) to version 0.2.45. This change ensures that any fixes or improvements in the new CSS release are applied across the UI. Please verify in a staging environment that the new stylesheet does not inadvertently override any custom styling.

health/micro-ui/web/public/index.html (1)

13-13: Consistent CSS Version Update

The updated stylesheet link now points to Digit UI Health CSS version 0.2.45, mirroring the change made in the internals example. This consistency across files is crucial for uniform styling and behavior. Ensure the new version is compatible with all dependent components and that any custom modifications (if any) are still applied correctly.

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

3-3: LGTM!

The Loader import is correctly added from the shared component library.

health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js (3)

67-70: LGTM! Good practice using a descriptive variable name and clear role check.

The isRootApprover check is well-implemented using the optional chaining operator and includes() method.


882-884: LGTM! CSS class name matches the new styles.

The class name planInbox-filtercard-table-wrapper aligns with the new styles in microplan.scss.


98-103: Verify the workflow behavior for non-root approvers.

The conditional spread operator usage for the assignee field could affect workflow routing. Please ensure this change doesn't bypass any required approvals.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check workflow configuration and role assignments

# Search for workflow configuration
rg -A 10 "PLAN_ESTIMATION" 

# Search for role assignments in the workflow
ast-grep --pattern 'roles: [$_]'

Length of output: 16514


Workflow Routing for Non-root Approvers is Working as Intended

The investigation confirms that non-root approvers correctly receive the assignee field (set to user.info.uuid). This aligns with the configured workflow logic that uses distinct roles ("PLAN_ESTIMATION_APPROVER" vs. "ROOT_PLAN_ESTIMATION_APPROVER") to control task routing. In contrast, users with the root role bypass this criteria, as intended.

  • Non-root users: The conditional spread operator adds { assignee: user.info.uuid }, effectively filtering tasks.
  • Root approvers: The check (isRootApprover) prevents the filter, ensuring they can access broader tasks.

Reviewing the workflow configuration and role checks in the code confirms that this change does not bypass any required approvals.

health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (1)

552-562: LGTM! Well-structured CSS using BEM methodology.

The new classes follow good CSS practices:

  • Uses BEM naming convention for better maintainability
  • Properly handles flex layout with align-items: stretch
  • Ensures content container grows with flex: 1
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/InboxFilterWrapper.js (3)

172-172: LGTM! Correct usage of optionsKey="name".

The code correctly follows the established pattern of using optionsKey="name" for both RadioButtons and MultiSelectDropdown components.

Also applies to: 217-217


164-164: Verify the CSS class definition for "plan-inbox-filtercard".

The addition of class-based styling is good for maintainability. However, ensure that the "plan-inbox-filtercard" class is properly defined in your CSS files.

Run this script to locate the CSS definition:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Search for the CSS class definition
rg -g '*.css' -g '*.scss' 'plan-inbox-filtercard'

Length of output: 158


CSS class definition is correctly implemented.
The class "plan-inbox-filtercard" is defined in the file health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss, confirming that the styling change in InboxFilterWrapper.js is supported as intended.


166-166: Good improvement moving from inline styles to class-based styling.

The change from inline styles to class-based styling improves maintainability.

Run this script to locate the CSS definition:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Search for the CSS class definition
rg -g '*.css' -g '*.scss' 'gap-between-dropdowns'

Length of output: 155


Change Verified: CSS class is defined as expected

The inline style was replaced correctly with the class "gap-between-dropdowns." I verified that the CSS definition exists in the file health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss. The update improves maintainability, and no issues were found.

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

21-21: LGTM!

The addition of showPopup state is appropriate for managing the popup's visibility.

@jagankumar-egov jagankumar-egov enabled auto-merge (squash) February 6, 2025 06:05
@jagankumar-egov jagankumar-egov merged commit 71f636a into master Feb 6, 2025
8 checks passed
@jagankumar-egov jagankumar-egov deleted the BUGFIX/HCMPRE-2243 branch February 6, 2025 06:09
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.

5 participants