-
Notifications
You must be signed in to change notification settings - Fork 20
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
setup master enhancement #1386
Conversation
WalkthroughWalkthroughThe 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
Possibly related PRs
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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:
Missing key property for iterable elements:
- The
children
prop of thePopUp
component is an iterable element and should have a uniquekey
prop.- The
footerChildren
prop of thePopUp
component is an iterable element and should have a uniquekey
prop.Using a prop for passing children:
- The
children
prop of thePopUp
component should be passed as JSX elements instead of using a prop.To address these issues, apply the following changes:
- Add a unique
key
prop to thediv
element in thechildren
prop of thePopUp
component:-<div> {t(showPopUp?.secondaryText)} </div> +<div key="secondary-text"> {t(showPopUp?.secondaryText)} </div>
- Add a unique
key
prop to theButton
element in thefooterChildren
prop of thePopUp
component:-<Button +<Button key="footer-button"
- Pass the
children
prop of thePopUp
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 useDigit.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 useDigit.Utils.workbench.getMDMSLabel
with the entirerow?.code
.The change to use the
Digit.Utils.workbench.getMDMSLabel
utility function with the entirerow?.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
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
: checkmicro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/pgr/src/components/PGRCard.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/ModuleMasterTable.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/index.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1)
Pattern
**/*.js
: checkmicro-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 newkey
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 themodule
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 settingshow
tofalse
.The change simplifies the logic by always setting
show
tofalse
, regardless of thepathVar
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 ofconfig
.- 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 withonError
andonSuccess
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 useDigit.Utils.locale.getTransformedLocale
for localizing master types.The change to use the
Digit.Utils.locale.getTransformedLocale
utility function with the new key formatSANDBOX_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"; |
There was a problem hiding this comment.
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.
import { Button, Toast } from "@egovernments/digit-ui-components"; | |
import { Toast } from "@egovernments/digit-ui-components"; |
No description provided.