-
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
User management screen #1496
User management screen #1496
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces significant updates across multiple files within the microplan module. Key changes include the addition of new CSS classes in Changes
Possibly related PRs
Suggested reviewers
Poem
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: 26
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)
Line range hint
1-170
: Summary: User management functionality added to microplan module.The changes in this file successfully introduce user management functionality to the microplan module. Key modifications include:
- Importing the UserManagement component.
- Adding a data request for "rolesForMicroplan" in the useCustomMDMS hook.
- Implementing a new PrivateRoute for the UserManagement component.
These changes are consistent with the PR objectives and enhance the module's capabilities. The implementation follows existing patterns in the codebase, maintaining consistency and readability.
As the application grows, consider implementing lazy loading for routes to improve initial load time and performance, especially for larger components like UserManagement.
🧰 Tools
🪛 Biome
[error] 62-62: Use Number.Infinity instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.Infinity instead.(lint/style/useNumberNamespace)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (8)
- 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/MicroplanCard.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (4 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserSearchConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserSearchConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)
Pattern
**/*.js
: check
📓 Learnings (1)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (3)
Learnt from: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#876 File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392 Timestamp: 2024-06-14T14:10:38.086Z Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Learnt from: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#876 File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392 Timestamp: 2024-10-08T20:11:07.772Z Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Learnt from: siddhant-nawale-egov PR: egovernments/DIGIT-Frontend#876 File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392 Timestamp: 2024-10-08T20:11:12.539Z Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
[error] 109-109: This is an unexpected use of the debugger statement.
Unsafe fix: Remove debugger statement
(lint/suspicious/noDebugger)
[error] 155-155: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 156-156: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 205-205: This is an unexpected use of the debugger statement.
Unsafe fix: Remove debugger statement
(lint/suspicious/noDebugger)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js
[error] 165-165: 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)
🔇 Additional comments (9)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserSearchConfig.js (3)
1-7
: LGTM: Default search values and function declaration look good.The default search values are appropriately defined, and the
searchconfig
function is correctly exported for use in other parts of the application.
71-97
: 🛠️ Refactor suggestionVerify the Address jsonPath and consider adding more user details.
The search result configuration looks good overall, but there are a couple of points to consider:
The Address jsonPath (
address.locality.code
) might not provide a meaningful address. Consider using a more descriptive path or concatenating multiple fields for a complete address.You might want to include additional useful information in the search results, such as the user's mobile number or email address.
Consider applying this diff to enhance the search results:
{ label: "Address", - jsonPath: "address.locality.code", + jsonPath: "address.fullAddress", }, +{ + label: "Mobile Number", + jsonPath: "mobileNumber", +}, +{ + label: "Email", + jsonPath: "emailId", +},Also, verify that the
address.fullAddress
(or an equivalent) field exists in the API response.To verify the correct address field in the API response, you can run the following command:
#!/bin/bash # Search for API response handling related to address fields rg --type js -i 'address.*response'
11-28
: Verify the serviceName for employee search.The API configuration looks good overall, with proper multi-tenancy support. However, there's a potential issue:
- The
serviceName
is set to "/egov-hrms/employees/", which suggests it's searching for employees. Is this intentional for individual user search, or should it be a different endpoint?Please verify if this is the correct endpoint for searching individual users.
To verify the correct endpoint, you can run the following command:
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss (1)
113-118
: LGTM! Consider verifying the max-width value.The
.microplan-container
class is well-implemented for managing long content within a constrained width. The use ofword-wrap
,white-space
, andoverflow-wrap
properties ensures proper text handling and overflow management.Please verify if the max-width of 15rem aligns with the design specifications for this component.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (2)
1-108
: Overall component reviewThe UserManagement component appears to be a functional implementation of a user management interface. It correctly uses React hooks, integrates with a translation system, and implements navigation and search functionality.
However, there are several areas for improvement:
- Clean up commented code to improve readability.
- Refine the
onClickRow
function for better logging and more flexible navigation.- Review the configuration passed to InboxSearchComposer for clarity and correctness.
- Standardize imports, particularly for react-router-dom.
Addressing these points will significantly improve the component's maintainability and robustness. Despite these suggestions, the overall structure and functionality of the component appear sound.
88-105
: Review InboxSearchComposer configurationIn the InboxSearchComposer component, you're spreading the
microplanData
into theconfigs
prop:configs={{...config, additionalDetails: { microplanData }}}This approach might be redundant if
microplanData
is already part of theconfig
object. Additionally, it's unclear whymicroplanData
is being added toadditionalDetails
.Consider the following:
- If
microplanData
is truly additional data not present inconfig
, consider passing it as a separate prop to InboxSearchComposer for clarity.- If
microplanData
is meant to override or extend existing config, make sure this is clearly documented.- Review if
additionalDetails
is the correct place for this data, or if InboxSearchComposer expects it in a different structure.Clarifying the purpose and structure of this data will improve the maintainability of the component.
To verify the structure and usage of
config
andmicroplanData
, you can run:health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)
10-10
: LGTM: New import for UserManagement component.The import statement for the UserManagement component is correctly placed and suggests the addition of a new feature for user management in the microplan module.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js (2)
33-34
: Ensure consistency between 'type' and 'typeMobile' propertiesIn the
search
section (lines 33-34), thetype
is set to"search"
, andtypeMobile
is set to"filter"
:"type": "search", "typeMobile": "filter",In the
filter
section (lines 156-157), thetype
is set to"filter"
, andtypeMobile
is set to"sort"
:"type": "filter", "typeMobile": "sort",Please verify that these settings are intentional and that they won't cause inconsistent behavior across different devices. Consistent use of these properties ensures the UI behaves as expected on both desktop and mobile platforms.
Also applies to: 156-157
1-298
: Well-structured configuration objectThe
tqmInboxConfigPlantOperator
object is comprehensive and appears to cover all necessary configurations for the TQM inbox functionality. The code adheres to naming conventions and is well-organized, which will aid in maintainability and scalability.
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserSearchConfig.js
Outdated
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss
Outdated
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss
Outdated
Show resolved
Hide resolved
...ro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlantOperator.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Outdated
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Outdated
Show resolved
Hide resolved
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: 12
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/example/public/index.html (1)
Line range hint
1-38
: Consider consolidating CSS imports for better maintainability.While not directly related to the current change, I noticed that this file includes multiple CSS imports from various versions and packages. Some are even commented out. To improve maintainability and reduce the risk of styling conflicts, consider:
- Consolidating these imports to use consistent versions where possible.
- Removing any unnecessary or outdated imports.
- Documenting the purpose of each import if they serve specific functions.
Would you like assistance in proposing a more streamlined set of CSS imports?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
⛔ 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/MicroplanCard.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (4 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (3 hunks)
- health/micro-ui/web/public/index.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
[error] 153-153: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 154-154: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js
[error] 163-163: 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)
🔇 Additional comments (8)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanCard.js (1)
21-21
: LGTM! The implementation looks good and addresses previous feedback.The addition of the "USER_MANAGEMENT" link is consistent with the existing pattern and aligns with the PR objective. The implementation is correct, using the appropriate
generateLink
function. The path suffix "user-management" is clear and descriptive, which improves code readability and maintainability.health/micro-ui/web/micro-ui-internals/example/public/index.html (1)
21-21
: CSS version update looks good, but verify compatibility.The update to the CSS version from
1.0.76-campaign
to1.0.77-campaign
seems appropriate. This change aligns with the AI-generated summary, which mentioned updates to external CSS stylesheets.To ensure this change doesn't introduce any unexpected styling issues, please run the following verification:
Additionally, it would be beneficial to:
- Test the application thoroughly to ensure no visual regressions.
- Confirm that this version update was intentional and required for the user management screen implementation.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js (2)
10-10
: LGTM: New import for UserManagement component.The import statement for the UserManagement component is correctly added, aligning with the introduction of user management functionalities mentioned in the PR summary.
Line range hint
1-168
: Overall assessment: Changes align with PR objectives.The modifications in this file, including the new import, data request, and PrivateRoute for the UserManagement component, are consistent with the PR objectives of implementing a user management screen. The changes are well-integrated into the existing structure of the file.
Minor suggestions for improvement:
- Add a comment explaining the purpose of the "rolesForMicroplan" data request.
- Use a self-closing element for the UserManagement component in the PrivateRoute.
These changes enhance the maintainability and readability of the code without affecting its functionality.
🧰 Tools
🪛 Biome
[error] 60-60: Use Number.Infinity instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.Infinity instead.(lint/style/useNumberNamespace)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (3)
6-6
: Standardize imports from 'react-router-dom'As previously noted, consider standardizing the imports from
react-router-dom
to avoid potential issues.
24-27
: Refine theonClickRow
function for better reusabilityAs previously mentioned, the hardcoded route in
history.push
makes the component less reusable. Consider parameterizing the path or moving it to a configuration object to enhance flexibility.
43-43
: Clean up commented-out codeAs previously noted, there are commented-out lines of code that should be reviewed. Consider removing them or uncommenting if they are necessary.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1)
116-128
: Verify the URLs for Link ActionsThe
url
properties for both "Bulk Upload Users" and "Download User Data" links are set to"/employee"
. Please verify if these URLs are correct and lead to the intended destinations. If they should point to different endpoints, consider updating them accordingly.
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js
Show resolved
Hide resolved
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js
Show resolved
Hide resolved
...ro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Show resolved
Hide resolved
...cro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js
Outdated
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
Show resolved
Hide resolved
...h/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserSearchConfig.js
Outdated
Show resolved
Hide resolved
...ro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js
Outdated
Show resolved
Hide resolved
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.
@abishekTa-egov check out the comments and fix
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: 5
🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Line range hint
66-66
: Removeconsole.log
statement used for debuggingThe
console.log
statement at line 66 is intended for debugging and should be removed to keep the console output clean in production.Apply this diff to remove the
console.log
statement:- select={(e) => { console.log(e, "event") }} + select={(e) => { /* Handle selection */ }}Alternatively, replace the
console.log
with appropriate event handling logic if needed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (3)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (4 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1 hunks)
- health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UserManagementConfig.js (1)
Pattern
**/*.js
: checkhealth/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1)
Pattern
**/*.js
: check
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js
[error] 153-153: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
[error] 154-154: Avoid the delete operator which can impact performance.
Unsafe fix: Use an undefined assignment instead.
(lint/performance/noDelete)
🔇 Additional comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/UserManagement.js (1)
18-18
: Verify the access path forconfig
In the line
const config = UserManagementConfig?.UserManagementConfig?.[0];
, it's important to ensure thatUserManagementConfig
actually contains a property namedUserManagementConfig
. If this is not the case,config
may beundefined
, leading to potential issues when accessingconfig?.label
later on.Please confirm the structure of
UserManagementConfig
. If it doesn't have a nestedUserManagementConfig
property, you might need to adjust the assignment:-const config = UserManagementConfig?.UserManagementConfig?.[0]; +const config = UserManagementConfig?.[0];
User-management screen
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Chores