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-5195 adding rule engine with mdms data configured #247

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

siddhant-nawale-egov
Copy link
Contributor

@siddhant-nawale-egov siddhant-nawale-egov commented Apr 2, 2024

Adding rule engine with MDMS data configured

Summary by CodeRabbit

  • New Features
    • Introduced a new "Rule Engine Page" for better management of rules and assumptions.
    • Enhanced pagination in the SpatialDataPropertyMapping component with SVG components.
    • Added a "RuleEngine" component in the employee section for managing rules.
  • Style
    • Updated styling across various components for improved user interface.
  • Refactor
    • Simplified modal components by standardizing buttons and removing unused components.
    • Enhanced data fetching and initialization in employee pages for better performance.
    • Improved layout and functionality in Hypothesis and Upload pages.
  • Bug Fixes
    • Fixed file parsing error handling by returning a generic error message.
    • Removed unnecessary logging in validation functions for cleaner code.

Copy link
Contributor

coderabbitai bot commented Apr 2, 2024

Walkthrough

Walkthrough

The recent updates encompass refining user interface components and functionality within a microplanning context. Styling enhancements have been made across various elements, with unnecessary components removed to streamline the user experience. The rule engine's interface has notably improved, making rule and assumption management easier. Additionally, improvements in pagination and file handling ensure smoother interaction with the system's resources.

Changes

Files Summary
.../micro-ui-internals/packages/css/src/components/microplanning.scss Updated styles for various elements like buttons, upload section, icons, etc. Removed .loader-container styling.
.../hcm-microplanning/src/components/ComonComponents.js
.../hcm-microplanning/src/components/Modal.js
Updated component imports and usage, including refactoring CloseBtn to CloseButton.
.../hcm-microplanning/src/pages/employee/Upload.js Improved data fetching, UI components usage, and file handling.
.../micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/RuleEngine.js Added and integrated RuleEngine component for better rule management.
.../micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js Integrated RuleEngine component for improved rule management.

🐰✨

In the realm of code, where the rabbits hop,
We've trimmed the hedges, and at the top,
The Rule Engine shines, a beacon so bright,
Guiding the digits through the night.
With each click and scroll, the users delight,
For in this update, we've made it just right.
🌟🐇

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 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 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 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.

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.
  • 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/coderabbit-overrides.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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ef6beac and 196cc2c.
Files ignored due to path filters (5)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/UIConfiguration.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/UploadConfiguration.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/hypothesisAssumptions.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/configs/schemas.json is excluded by !**/*.json
Files selected for processing (11)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (20 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/ComonComponents.js (3 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningCard.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Modal.js (5 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Hypothesis.js (10 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/RuleEngine.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js (8 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/index.js (3 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js (1 hunks)
Files skipped from review due to trivial changes (2)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/excelValidations.js
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/utils/geojsonValidations.js
Additional Context Used
Path-based Instructions (8)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/ComonComponents.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningCard.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Modal.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Hypothesis.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/RuleEngine.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js (1)

Pattern **/*.js: check

Learnings (1)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js (3)
User: siddhant-nawale-egov"
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:0-0
Timestamp: 2024-03-13T05:11:36.400Z
Learning: A more detailed message for file parsing errors in the `Upload.js` file is displayed elsewhere in the code, as clarified by the user.
User: siddhant-nawale-egov"
PR: egovernments/DIGIT-Frontend#204
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:468-481
Timestamp: 2024-03-13T07:33:45.211Z
Learning: The error message in the `checkForErrorInUploadedFile` function within `Upload.js` is being localized and improved for better user experience, as clarified by the user.
User: siddhant-nawale-egov"
PR: egovernments/DIGIT-Frontend#214
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js:14-17
Timestamp: 2024-03-15T12:20:50.090Z
Learning: The `geojsonValidations` is a utility developed within the DIGIT-Frontend project, not an external dependency.
Additional comments not posted (28)
micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/ComonComponents.js (2)

1-1: The import changes align well with the described objectives and the removal of unused components. Good job on keeping the imports clean and relevant.


18-18: The update to ButtonType2 for direct use of FileDownload SVG is a clean and efficient integration. This enhances clarity and maintainability.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/MicroplanningCard.js (1)

31-35: The addition of the "Rule Engine Page" item is well-implemented, using the translation function for the label. Consider defining roles for access control in future updates if necessary.

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

8-8: The integration of the RuleEngine component, along with the breadcrumb navigation and routing updates, is well-executed. The use of PrivateRoute and the translation function for internationalization are good practices.

Also applies to: 32-36, 70-70

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Modal.js (3)

2-2: The addition of CloseButton and ButtonSelector imports aligns with the refactoring efforts described. Simplifying the component by replacing ButtonSelector with standard button elements is a positive change.


8-8: Modifications to default values and style handling adjustments are well-thought-out, contributing to the component's flexibility and maintainability.

Also applies to: 45-45, 75-75


102-102: The refactoring of the ModalWrapper component, including the replacement of CloseBtn with CloseButton, enhances clarity and consistency. Good job on this improvement.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/resourceMapping.js (1)

1-1: The addition of Pagination component imports and their usage to replace text-based pagination controls with SVG components is a positive enhancement to the UI's interactivity and visual appeal.

Also applies to: 116-125

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Hypothesis.js (5)

3-3: The removal of hypothesisAssumptions import and related usage appears to be part of the refactoring effort. Ensure this aligns with the PR objectives and does not impact functionality.


5-5: The update from ButtonType1 to ButtonType2 and other component updates are positive changes that likely improve the UI and functionality. Good job on enhancing the user experience and maintainability.

Also applies to: 84-84


30-33: Refactoring to use a custom MDMS hook for data fetching is a significant improvement, making the process more efficient and maintainable.


37-46: Adjustments to data initialization and retrieval logic are well-implemented, ensuring accurate and responsive state updates based on fetched data.


74-74: Enhancements to button components and other UI elements, including the replacement of CustomIcon with a custom <div> for the add button, contribute to a more cohesive and user-friendly interface.

Also applies to: 84-84

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/RuleEngine.js (3)

24-84: The implementation of the RuleEngine component, including state management, data fetching with custom MDMS hooks, and UI elements for rule management, aligns well with the PR objectives. This addition enhances the system's functionality as intended.


86-126: The UI elements and data handling within the RuleEngine component are efficiently implemented, enhancing the user experience and system functionality. Good use of React hooks for efficient state management.


372-423: The Select component and its usage within the RuleEngine component for dynamic rule configuration are well-implemented. The use of memoization with React.memo is a good practice for performance optimization.

micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (7)

11-14: The styling for p elements within .modal-header has been updated to reset padding and margin. This is a common practice to normalize styles across browsers.


26-33: > 📝 NOTE

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

The .button-type-1 class has been updated with !important flags on several properties. While this ensures the styles are applied, overuse of !important can make future CSS maintenance challenging. Consider if there's a way to achieve the desired styling without !important, possibly through more specific selectors or by reordering CSS rules.


64-69: > 📝 NOTE

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

Similar to .button-type-1, .button-type-2 and its child .icon and p elements also use !important extensively. Review the necessity of !important here as well, for the same reasons mentioned previously.


103-117: The .upload-section-options-active, .upload-section-options-inactive classes have been updated with new styling for p and .icon. The changes seem to improve the visual hierarchy and consistency of these elements. Ensure that these changes align with the overall design system and do not introduce inconsistencies elsewhere.


721-721: The .guidelines class has been added, providing styling for a new section. It's important to ensure that the padding and font styles here are consistent with similar sections throughout the application to maintain a cohesive user experience.


760-781: The .hypothesis-section .add-icon class introduces a new icon style. The use of !important for color in the nested p tag should be reviewed for necessity. Additionally, ensure the icon's size and color align with the design guidelines for icons throughout the application.


1020-1285: The .rule-engine-section introduces significant new styling for the rule engine feature. Given the complexity and importance of this feature, it's crucial to ensure that all new styles are thoroughly tested across different browsers and devices to ensure a consistent and accessible user experience. Additionally, review the use of !important within this section for the reasons mentioned earlier.

micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js (5)

3-3: The import of LoaderWithGap replaces the previous Loader component, aligning with the PR's objective to enhance UI components.


21-25: The structure of the useCustomMDMS call has been updated to include multiple objects as arguments, which is a good practice for clarity and maintainability.


49-52: The variable assignments and object property access within the useEffect hook have been modified to utilize the new structure of the useCustomMDMS call. This change ensures that the component state is updated based on the fetched MDMS data.


426-426: The modification in the handleValidationErrorResponse function to set uploadedFileError based on the error condition improves error handling by providing more specific feedback to the user.


1027-1030: The update to the CustomIcon component to handle cases where props.Icon is not defined is a good practice for robustness. It prevents runtime errors when the Icon prop is missing.

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

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 196cc2c and 1d5a371.
Files ignored due to path filters (1)
  • micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
Files selected for processing (5)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (22 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/ComonComponents.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Modal.js (5 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js (10 hunks)
  • micro-ui/web/public/index.html (1 hunks)
Files skipped from review as they are similar to previous changes (4)
  • micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/ComonComponents.js
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/components/Modal.js
  • micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/pages/employee/Upload.js
Additional comments not posted (1)
micro-ui/web/public/index.html (1)

17-17: The update of the CSS stylesheet version to @egovernments/[email protected] is noted. Ensure that the UI has been thoroughly tested with this new version to verify compatibility and that no styling issues have arisen as a result of the update.

@nipunarora-eGov nipunarora-eGov merged commit 0d6be82 into microplan Apr 2, 2024
2 checks passed
@nipunarora-eGov nipunarora-eGov deleted the HLM-5195-rule-engine branch April 2, 2024 10:44
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