-
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
FEATURE/HCMPRE-1425 : Added the Workbench module patches into develop branch #2089
base: develop
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis pull request introduces several enhancements across multiple components in the micro-ui workbench module. The changes focus on improving form handling, data fetching, validation, and user interface interactions. Key modifications include dynamic form disabling, advanced option selection in multi-select components, new utility functions for date conversions, enhanced configuration management, and improved action item fetching based on user roles. Changes
Suggested Reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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: 23
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (9)
micro-ui/web/core/package.json
is excluded by!**/*.json
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/core/package.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/workbench/package.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/react-components/package.json
is excluded by!**/*.json
micro-ui/web/package.json
is excluded by!**/*.json
micro-ui/web/sandbox/package.json
is excluded by!**/*.json
micro-ui/web/workbench/package.json
is excluded by!**/*.json
📒 Files selected for processing (12)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/UICustomizations.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/searchMDMSConfigPopup.js
(1 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/inbox.js
(1 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/index.js
(2 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js
(2 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSEdit.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSSearchv2.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSView.js
(3 hunks)micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js
(4 hunks)micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/BreadCrumb.js
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (12)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/index.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/searchMDMSConfigPopup.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/BreadCrumb.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSSearchv2.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/inbox.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSView.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSEdit.js (1)
Pattern **/*.js
: check
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/UICustomizations.js (1)
Pattern **/*.js
: check
🪛 Biome (1.9.4)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSSearchv2.js
[error] 161-161: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 191-191: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
[error] 197-197: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js
[error] 200-200: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 201-201: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 206-206: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 196-196: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/inbox.js
[error] 5-5: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
[error] 83-83: This let declares a variable that is only assigned once.
'updatedPath' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
[error] 156-156: This let declares a variable that is only assigned once.
'newFormattedOptions2' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSView.js
[error] 70-70: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
[error] 79-79: This let declares a variable that is only assigned once.
'propsToSendButtons' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 139-139: This let declares a variable that is only assigned once.
'propsToSend' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/UICustomizations.js
[error] 843-843: This let declares a variable that is only assigned once.
'hostname' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
[error] 845-845: This let declares a variable that is only assigned once.
'roleActions' is never reassigned.
Safe fix: Use const instead.
(lint/style/useConst)
🔇 Additional comments (24)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js (1)
62-62
: Usage of newly introduced limit looks correct.
This integrates well with the MdmsCriteria
body, ensuring the dynamic limit is applied during data fetch.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSEdit.js (5)
35-35
: Dynamic URL usage
Good use of Digit.Utils.workbench.getMDMSActionURL()
to generate dynamic endpoints.
85-96
: Ensure error messages are contextual
You’re showing a generic error toast “RA_DATE_RANGE_ERROR” for date validation. Confirm that this is indeed the correct localized message for the validation scenario.
124-124
: Enhance partial updates
You assign transformedData
directly to the request. Ensure your upstream code only expects changed fields or merges them correctly if partial updates are possible.
147-153
: Conditional date conversion
Good approach for only converting dates when available. Verify that “NA” is the desired fallback for relevant use cases.
159-159
: Conditional form data
Nicely implemented logic to switch between formattedData
and data?.data
based on the schema. Ensures a specialized approach without duplicating fields.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/UICustomizations.js (3)
5-5
: Check library usage
Axios is imported. Confirm if all calls in this file use the same library (axios or Digit’s HTTP layers) for consistency.
20-29
: Focus on date parsing reliability
convertDateToEpoch
returns "NA"
if !dateString
. This might be loosely typed in downstream usage. Ensure no type mismatch occurs if you later treat "NA"
as a numeric epoch.
531-535
: Ensure numeric conversion
At lines 531-535, Number(value)
is used for epoch conversion. Verify that all values will be valid integers or handle parsing errors.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/index.js (2)
7-7
: Hook import
useMDMSPopupSearch
is introduced. Verify this hook is already tested or has coverage to ensure stability.
31-33
: Added inbox property
Excellent approach to grouping hooks under modules. This keeps the code structure consistent.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/hooks/inbox.js (1)
5-5
: Check for undefined schemaCode before splitting.
If schemaCode
becomes undefined
, the chained .split()
will throw an error. A quick safeguard would be to default to an empty string or check for its presence beforehand.
- const [moduleName, masterName] = criteria?.body?.MdmsCriteria?.schemaCode?.split(".");
+ const schemaVal = criteria?.body?.MdmsCriteria?.schemaCode;
+ const [moduleName, masterName] = schemaVal ? schemaVal.split(".") : [null, null];
🧰 Tools
🪛 Biome (1.9.4)
[error] 5-5: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/searchMDMSConfigPopup.js (1)
21-21
: Addition of customHook property looks good.
The customHook
inclusion is straightforward and aligns with the new hook usage.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSSearchv2.js (2)
112-114
: Check fallback for empty properties array before iteration.
Ensure that properties
is always an object with valid keys. If properties
is undefined or null, this loop will throw an error.
188-191
: 🧹 Nitpick (assertive)
Use template literals.
String concatenation can be replaced with templated strings for clarity.
- window.location.href = "/works-ui/employee/rateanalysis/view-rate-analysis?sorId="+row?.data?.sorId+"&fromeffective="+row?.data?.effectiveFrom
+ window.location.href = `/works-ui/employee/rateanalysis/view-rate-analysis?sorId=${row?.data?.sorId}&fromeffective=${row?.data?.effectiveFrom}`
Likely invalid or redundant comment.
🧰 Tools
🪛 Biome (1.9.4)
[error] 191-191: Template literals are preferred over string concatenation.
Unsafe fix: Use a template literal.
(lint/style/useTemplate)
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/DigitJSONForm.js (3)
221-221
: Tooltip styling update is valid.
Applying a maxWidth
helps improve readability for lengthy tooltip text.
282-283
: Extract formDisabled logic into a single conditional.
Nice approach to clearly separate the disabled logic based on screenType
. This keeps form usage straightforward.
336-336
: Validate 'viewActions' usage.
You're conditionally rendering the ActionBar if viewActions
exists and has length. This is a good approach to avoid empty UI elements. Ensure no leftover references exist to the older logic.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js (3)
233-236
: Propagate the new parameter consistently.
The additional key
parameter is correctly passed to formatDates
. Confirm that callers of formatData
properly supply key
when needed.
257-257
: Validate that the formatType
matches known types.
Before calling formatData
with schema?.[key]?.formatType
, ensure it adheres to expected values (EPOC
, date
, datetime
, etc.) to avoid unexpected behaviors.
279-279
: Use consistent naming for reverse EPOC conversions.
Here, REVERT-EPOC
is appended to the format type, but ensure that all calling sites handle this naming pattern correctly.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js (3)
96-96
: Great clarity through explicit schema code pointer.
Defining schemaCodeToValidate
makes the code more maintainable and readable.
97-104
: Async form submission plus validation—good approach.
Ensure that any form validations or side effects do not block the UI thread. Consider providing user feedback (e.g., a spinner) while validating.
120-120
: Enhanced error messaging.
Appending an exclamation mark is helpful for visibility. Confirm the potential presence or length of resp?.response?.data?.Errors
.
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/components/MultiSelect.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSSearchv2.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/utils/index.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/workbench/src/pages/employee/MDMSAddV2.js
Show resolved
Hide resolved
if(isLoading || isLoadingSchema || renderLoader ) return <Loader /> | ||
|
||
return ( | ||
<React.Fragment> | ||
<MDMSAdd defaultFormData = {data?.data} screenType={"edit"} onSubmitEditAction={handleUpdate} updatesToUISchema ={schemaData?.updatesToUiSchema} /> | ||
<MDMSAdd defaultFormData = {(`${moduleName}.${masterName}` === "WORKS-SOR.Rates" || `${moduleName}.${masterName}` === "WORKS-SOR.Composition") ? formattedData : data?.data} screenType={"edit"} onSubmitEditAction={handleUpdate} updatesToUISchema ={schemaData?.updatesToUiSchema} /> |
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 rates related checks
@@ -153,7 +157,8 @@ const MDMSSearchv2 = () => { | |||
label:option.i18nKey, | |||
i18nKey:option.i18nKey, | |||
jsonPath:`data.${option.code}`, | |||
dontShowNA:true | |||
dontShowNA:true, | |||
additionalCustomization: currentSchema?.definition?.["x-ui-schema"]?.[option?.name]?.formatType === "EPOC" ? true : false |
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.
add comments what and why this is needed
params: {}, | ||
body: { | ||
MdmsCriteria: { | ||
tenantId: tenantId?.split(".")[0], |
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.
why tenant id .spit ?
MdmsCriteria: { | ||
tenantId: tenantId?.split(".")[0], | ||
uniqueIdentifiers: [uniqueIdentifier?.split(".")[0]], | ||
schemaCode: `${moduleName}.${"SOR"}`, |
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.
sor cant be there here also add comments
}, | ||
validateForm: async (data, props) => { | ||
try { | ||
const response = await axios.post("/mdms-v2/v2/_search", { |
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.
use generic service instead of axios
Choose the appropriate template for your PR:
Feature PR
Feature Request
JIRA ID
Module
Description
Related Issues
Bugfix PR
Bugfix Request
JIRA ID
Module
Description
Root Cause
Related Issues
Release PR
Summary by CodeRabbit
New Features
Bug Fixes
Refactor