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

HLM-5333: Form composer api integration for draft #233

Merged
merged 5 commits into from
Mar 22, 2024
Merged

Conversation

nabeelmd-eGov
Copy link
Contributor

@nabeelmd-eGov nabeelmd-eGov commented Mar 22, 2024

Summary by CodeRabbit

  • New Features

    • Introduced the MyCampaign component for managing campaigns.
    • Added new proxy route for enhanced backend connectivity.
    • Enhanced search functionalities within the campaign manager.
    • Implemented a custom hook useCreateCampaign for creating campaigns.
  • Enhancements

    • Updated CSS library version for improved styling.
    • Expanded UICustomizations with specific configurations for better UI control.
    • Improved data handling and UI interactions in campaign management modules.
  • Bug Fixes

    • Corrected spacing issues in the CampaignCard component.
    • Fixed return statement logic in campaign management components.
  • Refactor

    • Refactored data restructuring and submission logic in SetupCampaign.
    • Enhanced state management and side effects handling in CycleConfiguration and DeliverySetup.

Copy link
Contributor

coderabbitai bot commented Mar 22, 2024

Walkthrough

Walkthrough

The updates revolve around enriching the campaign manager module in a micro-UI setup. Significant enhancements include the addition of a new proxy route, component imports, configurations, and hooks for streamlined campaign creation and management. Noteworthy refinements in UI customization and service functionalities are spread across various components and pages, along with version updates and data structuring improvements.

Changes

Files Change Summary
.../example/public/index.html, .../web/public/index.html Updated @egovernments/digit-ui-css version from 1.8.1-beta.3 to 1.8.1-beta.5.
.../example/src/setupProxy.js Added a new proxy route for "/project-factory/v1/project-type".
.../campaign-manager/src/Module.js,
.../components/CampaignCard.js
Added MyCampaign component import,
updated role arrays spacing, and added a new link.
.../campaign-manager/src/configs/,
.../configs/UICustomizations.js
Expanded configurations with new properties and functions.
.../campaign-manager/src/hooks/,
.../hooks/services/createCampaignService.js
Introduced useCreateCampaign hook and createCampaignService function.
.../campaign-manager/src/pages/employee/ Enhanced campaign management components with new hooks and data restructuring.

"In the realm of code, where logic intertwines,
A rabbit hopped in, leaving bugs behind. 🐇💻
With each leap and bound, updates unfurled,
A digital garden, in a virtual world.
Campaigns flourish, with features anew,
In this tale of bytes, where dreams come true."
🌟🌱🚀

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6fbe36d and dd64589.
Files ignored due to path filters (5)
  • micro-ui/web/micro-ui-internals/example/package.json is excluded by: !**/*.json
  • micro-ui/web/micro-ui-internals/package.json is excluded by: !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json is excluded by: !**/*.json
  • micro-ui/web/package.json is excluded by: !**/*.json
  • micro-ui/web/workbench/package.json is excluded by: !**/*.json
Files selected for processing (16)
  • micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • micro-ui/web/micro-ui-internals/example/src/setupProxy.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.js (5 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/createCampaignService.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useCreateCampaign.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CycleConfiguration.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (4 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js (3 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (2 hunks)
  • micro-ui/web/public/index.html (1 hunks)
Files skipped from review due to trivial changes (2)
  • micro-ui/web/micro-ui-internals/example/public/index.html
  • micro-ui/web/public/index.html
Additional comments: 15
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useCreateCampaign.js (1)
  • 4-8: The useCreateCampaign hook is well-implemented, leveraging react-query for managing mutations. Consider adding JSDoc comments to document the hook's purpose, parameters, and expected return values for better maintainability and clarity for other developers.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js (1)
  • 13-13: The addition of useCreateCampaign to the campaign object is correctly implemented. Ensure that all import paths and usages of this hook across the application are updated accordingly.
Verification successful

The usage of useCreateCampaign across the application has been verified. It is correctly implemented and utilized within the SetupCampaign.js file, and the import/export paths are properly set up. This confirms the correctness of the addition of useCreateCampaign to the campaign object and its usage within the application.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the usage of useCreateCampaign across the application
rg --type js "useCreateCampaign"

Length of output: 719

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/createCampaignService.js (1)
  • 12-12: Improve error handling by checking for the existence of error?.response?.data?.Errors before attempting to access the message. This prevents potential undefined access errors.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (2)
  • 23-23: Avoid using inline styles for the Header component. Consider defining styles in a CSS file or using a CSS-in-JS solution for better maintainability and separation of concerns.
  • 28-28: Ensure the tabbed interface is accessible by adding appropriate ARIA roles, labels, and keyboard navigation support. This enhances usability for all users, including those using assistive technologies.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (2)
  • 13-13: The commented-out return statement seems to be temporarily disabled. Ensure it's either removed or reinstated based on the intended functionality to avoid leaving unused code.
  • 40-44: The new link for "My Campaign" is added without specifying roles. Ensure that appropriate roles are assigned to this link to control access based on user permissions.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (1)
  • 26-32: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [29-44]

The integration of the MyCampaign component and its corresponding route is correctly implemented. Verify that the route configuration and component integration work as expected across different user roles and permissions.

Verification successful

The shell script output confirms the integration of the MyCampaign component and its corresponding route in the specified file. This matches the expectations set in the review comment, indicating that the route configuration for MyCampaign is correctly implemented.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the route configuration for MyCampaign
rg --type js "path=.*/my-campaign"

Length of output: 219

micro-ui/web/micro-ui-internals/example/src/setupProxy.js (1)
  • 94-94: The addition of the new proxy route for project-type data retrieval is correctly implemented. Ensure that the proxy configuration works as expected and does not impact other backend communications negatively.
Verification successful

The new proxy route for project-type data retrieval is correctly implemented in setupProxy.js and is already being utilized within the application, specifically in the campaign-manager module for creating campaigns. This indicates a deliberate effort to integrate this new route into the application's functionality. It's recommended to manually verify that this integration works as expected and does not negatively impact other backend communications or application functionality.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the new proxy route configuration
rg --type js "/project-factory/v1/project-type"

Length of output: 309

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)
  • 46-53: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [15-50]

The import and registration of the MyCampaign component within the componentsToRegister object are correctly implemented. Verify that the component is available and functions as expected within the campaign manager module.

Verification successful

The script output confirms that the MyCampaign component is correctly imported, registered, and utilized within the campaign manager module. It is used in a route within pages/employee/index.js and is defined in pages/employee/MyCampaign.js. Additional references in configuration files indicate that MyCampaign is also configured for specific settings, further integrating it within the module. This supports the initial review comment's approval of these changes.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the registration and usage of MyCampaign component
rg --type js "MyCampaign"

Length of output: 1580

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CycleConfiguration.js (1)
  • 54-56: The addition of the useEffect hook to trigger onSelect with the updated state when state changes is correctly implemented. Ensure that the onSelect function is properly handling the received data.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.js (1)
  • 79-85: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [82-97]

The addition of name, isLast properties, and sessionData property assignments are correctly implemented to enhance the configuration's capabilities. Ensure that the components consuming this configuration are correctly utilizing the sessionData.

Also applies to: 108-120, 180-180

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/deliveryRule/index.js (1)
  • 174-195: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [13-192]

The changes introduced in the DeliverySetup function, including the addition of parameters, modification of default values, and enhancements in state management and reducer logic, are correctly implemented. Ensure that the new state management and reducer logic are correctly integrated and do not introduce unintended side effects.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (1)
  • 54-85: The introduction of the restructureData function, adjustments in the onSubmit function, the refactored filterCampaignConfig function, and the conditional label change in SetupCampaign are correctly implemented. Ensure that the data restructuring and submission logic are correctly integrated and do not introduce errors.

Also applies to: 87-119, 179-186, 217-217

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
  • 14-269: The configurations introduced in UICustomizations for MyCampaignConfigAdmin and TabVehicleConfigAdmin are correctly implemented, aiming to enhance module customizations. Ensure that the custom functionalities are correctly integrated and do not introduce unintended behaviors.

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.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between dd64589 and 7bbdd5c.
Files selected for processing (3)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/createCampaignService.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/createCampaignService.js
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js
Additional comments: 1
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
  • 14-125: The MyCampaignConfigAdmin configuration introduces several customizations, including data preprocessing, status criteria population, custom action labels, additional customizations, plant users criteria, and card interactions. Here are some observations and suggestions:
  1. Data Preprocessing and Cleanup: The preProcess function (lines 16-23) effectively cleans up the request data by focusing on the RequestInfo and tenantId. However, ensure that removing custom and inbox properties from data.body does not inadvertently affect other functionalities that might rely on these properties.

  2. Status Request Criteria: The populateStatusReqCriteria function (lines 25-47) constructs a request for workflow status search. It's crucial to verify that businessServiceMap?.tqm correctly maps to the intended business service. Additionally, consider handling cases where BusinessServices might be undefined or empty to prevent runtime errors.

  3. Custom Action Labels and Additional Customizations: The functions getCustomActionLabel (lines 49-51) and additionalCustomizations (lines 52-91) provide placeholders and case-specific logic. For additionalCustomizations, ensure that all cases are adequately covered and that the default case (case_not_found) is handled appropriately in the UI.

  4. Plant Users Request Criteria: The populatePlantUsersReqCriteria function (lines 92-114) fetches plant user information. It's important to confirm that the userInfo?.info?.uuid is always available and correctly identifies the user. Also, verify that Digit.SessionStorage.get("user_plants") returns the expected data format.

  5. Card Interactions: The onCardClick and onCardActionClick functions (lines 116-121) define URL patterns for navigating to test results. Ensure that these URLs are correctly formed and that all required query parameters are included.

Overall, the configurations introduced are comprehensive. However, it's essential to conduct thorough testing, especially for the custom logic in additionalCustomizations and the external dependencies like Digit.ULBService.getCurrentTenantId() and Digit.UserService.getUser().

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7bbdd5c and 8dfc2e1.
Files selected for processing (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js

@jagankumar-egov jagankumar-egov merged commit 5ef9398 into campaign Mar 22, 2024
1 check passed
@jagankumar-egov jagankumar-egov deleted the HLM-5333 branch March 22, 2024 11:34
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