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

setup master enhancement #1386

Closed
wants to merge 3 commits into from
Closed

setup master enhancement #1386

wants to merge 3 commits into from

Conversation

nabeelmd-eGov
Copy link
Contributor

No description provided.

@nabeelmd-eGov nabeelmd-eGov requested a review from a team as a code owner September 12, 2024 10:21
Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Walkthrough

Walkthrough

The changes involve updates to CSS styles, modifications to navigation links in multiple components, and enhancements in localization logic within the application. Notably, new query parameters have been added to links for improved routing. Additionally, there have been significant updates to components to streamline user interaction, including the removal of unnecessary pop-ups and the restructuring of state management for better performance.

Changes

File Path Change Summary
.../packages/css/src/pages/employee/sandbox.scss Added new styles for .digit-popup-wrapper.setupMasterPopUp.alert and modified .action-bar-wrap.
.../packages/modules/hrms/src/components/hrmscard.js Modified link property in propsForSandbox to include &key=about in the URL.
.../packages/modules/pgr/src/components/PGRCard.js Modified link property in propsForSandbox to include &key=about in the URL.
.../packages/modules/sandbox/src/configs/UICustomizations.js Updated localization logic to use Digit.Utils.workbench.getMDMSLabel for label retrieval.
.../packages/modules/sandbox/src/pages/employee/applicationMgmt/ApplicationHome.js Modified button click URL to include key=about.
.../packages/modules/sandbox/src/pages/employee/applicationMgmt/ModuleMasterTable.js Removed PopUp component for master data loading.
.../packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js Removed renderHierarchy function and added handleSetupMaster for setup process handling.
.../packages/modules/sandbox/src/pages/employee/index.js Simplified extraction of module from URL and altered breadcrumb visibility logic.

Possibly related PRs

Poem

🐇 In the garden of code, changes bloom bright,
With links that now guide us, day turns to night.
Styles dance and twirl, a CSS delight,
Simplifying paths, making navigation light.
Hooray for the updates, let’s hop with glee,
For a smoother experience, just wait and see! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5adc4bc and f747f58.

Files selected for processing (1)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js

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

Outside diff range and nitpick comments (4)
micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ApplicationHome.js (1)

37-39: LGTM! Please remove the commented out code.

The change in the URL looks good and potentially allows for more specific routing or state management within the application.

However, please remove the commented out code to keep the codebase clean.

Apply this diff to remove the commented out code:

-            // onButtonClick={() => history.push(`/${window?.contextPath}/employee/sandbox/application-management/module?module=${item?.module}`)}
Tools
Biome

[error] 33-39: 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)

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1)

Line range hint 118-188: Address the issues identified by the static analysis hints.

The code changes in the "masterDetail" section are correct and enhance the user experience by providing immediate feedback through pop-up alerts. However, there are a few issues identified by the static analysis hints that should be addressed:

  1. Missing key property for iterable elements:

    • The children prop of the PopUp component is an iterable element and should have a unique key prop.
    • The footerChildren prop of the PopUp component is an iterable element and should have a unique key prop.
  2. Using a prop for passing children:

    • The children prop of the PopUp component should be passed as JSX elements instead of using a prop.

To address these issues, apply the following changes:

  1. Add a unique key prop to the div element in the children prop of the PopUp component:
-<div> {t(showPopUp?.secondaryText)} </div>
+<div key="secondary-text"> {t(showPopUp?.secondaryText)} </div>
  1. Add a unique key prop to the Button element in the footerChildren prop of the PopUp component:
-<Button
+<Button key="footer-button"
  1. Pass the children prop of the PopUp component as JSX elements instead of using a prop:
-children={[<div key="secondary-text"> {t(showPopUp?.secondaryText)} </div>]}
+>
+  <div key="secondary-text"> {t(showPopUp?.secondaryText)} </div>
+</PopUp>
Tools
Biome

[error] 172-172: Avoid passing children using a prop

The canonical way to pass children in React is to use JSX elements

(lint/correctness/noChildrenProp)


[error] 172-172: 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)


[error] 178-184: 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)

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js (2)

227-228: Approve the change to use Digit.Utils.workbench.getMDMSLabel for label retrieval.

The change to use the Digit.Utils.workbench.getMDMSLabel utility function for retrieving labels based on a schema prefix is a good improvement. It enhances consistency and maintainability by centralizing the label retrieval logic.

Consider removing the commented out code that uses the old translation key SANDBOX_${value?.split(".")?.[0]} as it's no longer needed.


233-234: Approve the change to use Digit.Utils.workbench.getMDMSLabel with the entire row?.code.

The change to use the Digit.Utils.workbench.getMDMSLabel utility function with the entire row?.code for label retrieval is a good improvement. It simplifies the logic and aligns with the schema-based label retrieval approach.

Consider removing the commented out code that splits row?.code and uses the old translation key as it's no longer needed.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 082e71c and 5adc4bc.

Files selected for processing (8)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ApplicationHome.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ModuleMasterTable.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (6 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/index.js (2 hunks)
Additional context used
Path-based instructions (7)
micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ApplicationHome.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ModuleMasterTable.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js (1)

Pattern **/*.js: check

Biome
micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js

[error] 172-172: Avoid passing children using a prop

The canonical way to pass children in React is to use JSX elements

(lint/correctness/noChildrenProp)


[error] 172-172: 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)


[error] 178-184: 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)

Additional comments not posted (15)
micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1)

19-19: LGTM! Please verify the intended behavior.

The change looks good and aligns with the PR objective of enhancing the setup master functionality. However, please ensure that the additional query parameter &key=about is being handled correctly on the target page and leads to the intended behavior or context.

micro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js (1)

42-42: Verify the handling of the new key parameter.

The change looks good and does not introduce any syntax errors or breaking changes. However, please ensure that the key parameter is being handled correctly in the target URL (/employee/sandbox/application-management/setup-master) to provide the intended functionality or access the specific section within the setup master module.

Run the following script to verify the handling of the key parameter:

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/index.js (2)

19-20: LGTM!

The change to use URLSearchParams for retrieving the module parameter is a cleaner and more maintainable approach compared to the previous implementation. It simplifies the code and improves readability.


32-32: Verify the intended behavior and impact of always setting show to false.

The change simplifies the logic by always setting show to false, regardless of the pathVar content. This alteration in the control flow affects the visibility of the breadcrumb. Please ensure that this change aligns with the desired behavior and doesn't have any unintended consequences.

If this change doesn't meet the requirements or has unintended effects, I can assist in making the necessary adjustments. Please let me know if you need any help.

micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (2)

333-339: LGTM!

The changes to remove the default margin from p elements within .menu-wrap are safe and follow best practices for consistent spacing.


340-346: Looks good!

The new styles for the setup master popup alert are properly scoped and the green color for the heading conveys a positive state. The changes are safe to merge.

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (8)

1-3: LGTM!

The imports are correct and necessary for the component.


4-4: LGTM!

The imports are correct and necessary for the component.


15-19: LGTM!

  • The usage of useMemo is correct and will optimize performance by reducing unnecessary recalculations of config.
  • The key extraction from URL search params is correct.

38-39: LGTM!

The code change is correct and necessary.


42-43: LGTM!

The usage of the hook is correct and necessary for the component.


44-79: LGTM!

  • The implementation of handleSetupMaster is correct and enhances the user experience by providing immediate feedback through pop-up alerts.
  • The usage of useDefaultMasterHandler hook with onError and onSuccess callbacks is correct.
  • The setting of showPopUp state based on the outcome of the setup operation is correct.

Line range hint 88-117: LGTM!

  • The conditional rendering based on the key parameter is correct and simplifies the rendering logic.
  • The rendering of the "about" section with header, description, features, and action button is correct.

198-199: LGTM!

  • The calling of handleSetupMaster function on button click is correct and necessary for the setup process.
  • The commenting out of the history push to the module page is correct as it is no longer needed.
micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/configs/UICustomizations.js (1)

237-237: Approve the change to use Digit.Utils.locale.getTransformedLocale for localizing master types.

The change to use the Digit.Utils.locale.getTransformedLocale utility function with the new key format SANDBOX_MASTERTYPE_${value} for localizing master types is a good update. It aligns with the localization approach used in the codebase and improves consistency.

@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components";
import { Button, PopUp, Toast } from "@egovernments/digit-ui-components";
import { Button, Toast } from "@egovernments/digit-ui-components";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the unused import.

The Button component is imported but not being used in the provided code. It might have been used in the removed PopUp component. Please remove the unused import to keep the code clean.

-import { Button, Toast } from "@egovernments/digit-ui-components";
+import { Toast } from "@egovernments/digit-ui-components";

The import and usage of the Toast component looks good.

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
import { Button, Toast } from "@egovernments/digit-ui-components";
import { Toast } from "@egovernments/digit-ui-components";

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