-
Notifications
You must be signed in to change notification settings - Fork 21
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 6407 template #1154
base: test-campaign-changes
Are you sure you want to change the base?
Hlm 6407 template #1154
Conversation
…smc (#1137) * some changes related to generate boundary template * updated logic for making configurable target acc to delivery only for smc * refactored code for including dynamic target columns for specific types according to configs array
* Action column fixes, date editable logic change * added roles for dss --------- Co-authored-by: nabeelmd-eGov <[email protected]>
* Update constants.ts * Update processTrackUtils.ts
* Action column fixes, date editable logic change * added roles for dss * update dates fixes --------- Co-authored-by: nabeelmd-eGov <[email protected]>
Warning Rate limit exceeded@Priyanka-eGov has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 2 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughWalkthroughThe recent changes enhance the application's configuration and functionality by simplifying schema calls and adding robust checks for Kafka broker availability. New properties and functions were introduced to streamline data handling and improve error management, particularly for message processing in the Kafka messaging system. Additionally, numerous utility functions were refined, ensuring more accurate validation and processing. Overall, these modifications aim to bolster the reliability and efficiency of data operations within the project. Changes
Sequence Diagram(s)sequenceDiagram
participant Producer
participant Broker
Producer->>Broker: checkBrokerAvailability()
alt Broker is available
Broker-->>Producer: Confirm message received
Producer->>Producer: Proceed with sending messages
else Broker not available
Broker-->>Producer: Error: broker not available
Producer->>Producer: Handle error and shut down
end
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 as PR comments)
Additionally, you can add 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (7)
- utilities/project-factory/src/server/api/campaignApis.ts (1 hunks)
- utilities/project-factory/src/server/config/index.ts (2 hunks)
- utilities/project-factory/src/server/kafka/Listener.ts (1 hunks)
- utilities/project-factory/src/server/kafka/Producer.ts (1 hunks)
- utilities/project-factory/src/server/utils/generateUtils.ts (2 hunks)
- utilities/project-factory/src/server/utils/genericUtils.ts (1 hunks)
- utilities/project-factory/src/server/utils/targetUtils.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- utilities/project-factory/src/server/config/index.ts
Additional context used
Biome
utilities/project-factory/src/server/kafka/Producer.ts
[error] 26-26: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
Additional comments not posted (6)
utilities/project-factory/src/server/kafka/Producer.ts (1)
41-41
: LGTM!The integration of
checkBrokerAvailability
within theproducer.on('ready', ...)
event listener is appropriate.utilities/project-factory/src/server/kafka/Listener.ts (1)
21-21
: LGTM!The addition of
KAFKA_TEST_TOPIC
to thetopicNames
array is appropriate.utilities/project-factory/src/server/utils/generateUtils.ts (1)
17-17
: LGTM!The addition of the conditional check to validate the presence of
existingBoundaries
andcurrentBoundaries
enhances the robustness of the function.utilities/project-factory/src/server/utils/targetUtils.ts (1)
19-19
: Verify the impact of removing the first element fromheaderColumnsAfterHierarchy
.The line
headerColumnsAfterHierarchy.shift();
removes the first element from the array. Ensure this change does not unintentionally alter the expected headers, especially in downstream processing.utilities/project-factory/src/server/api/campaignApis.ts (1)
875-875
: Verify the impact of the modified parameters forcallMdmsTypeSchema
.The change simplifies the parameters passed to
callMdmsTypeSchema
. Ensure this does not unintentionally alter the schema retrieval logic, particularly for the "facilityMicroplan" type.utilities/project-factory/src/server/utils/genericUtils.ts (1)
471-471
: Verify the impact of the modified parameters forcallMdmsTypeSchema
.The change simplifies the parameters passed to
callMdmsTypeSchema
. Ensure this does not unintentionally alter the schema retrieval logic, particularly for the "microplan" source.
|
||
producer.send(payloads, (err, data) => { | ||
if (err) { | ||
if (err.message && err.message.toLowerCase().includes('broker not available')) { |
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 optional chaining for error message check.
To prevent potential undefined errors, use optional chaining when accessing the error message.
- if (err.message && err.message.toLowerCase().includes('broker not available')) {
+ if (err.message?.toLowerCase().includes('broker not available')) {
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.
if (err.message && err.message.toLowerCase().includes('broker not available')) { | |
if (err.message?.toLowerCase().includes('broker not available')) { |
Tools
Biome
[error] 26-26: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
* Update Listener.ts * added new branch * Update Listener.ts * fixed mapping kafka error * mapping kafka fixed * fix kafka * fix kafka * Update publishProjectFactory.yml
* Update Listener.ts * added new branch * Update Listener.ts * fixed mapping kafka error * mapping kafka fixed * fix kafka * fix kafka * Removing foreign key constraint * Update publishProjectFactory.yml
* Action column fixes, date editable logic change * added roles for dss * update dates fixes * HCMPRE-154 update dates bug fixes, Added toast for error * code clean * Update micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Adding date bug * date fix * Update micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: nabeelmd-eGov <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Jagankumar <[email protected]>
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, codebase verification and nitpick comments (2)
utilities/project-factory/src/server/utils/genericUtils.ts (1)
Verify the function usage in the codebase.
The function
processGenerate
has been updated to include a new parameterenableCaching
. Ensure that all calls to this function pass the correct number of arguments.
- In
utilities/project-factory/src/server/service/dataManageService.ts
, the calls toprocessGenerate
do not include the newenableCaching
parameter:
- Line 7:
await processGenerate(request);
Please update these calls to match the new function signature.
Analysis chain
Line range hint
830-840
:
Verify the function usage in the codebase.The function
processGenerate
has been updated to include a new parameterenableCaching
. Ensure that all calls to this function pass the correct number of arguments.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `processGenerate` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'processGenerate'Length of output: 78
Script:
#!/bin/bash # Description: Verify all function calls to `processGenerate` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type ts -A 5 $'processGenerate'Length of output: 6840
utilities/project-factory/src/server/utils/campaignUtils.ts (1)
592-592
: Ensure theexistingCampaignDetails
parameter is always passed.The function now relies on the
existingCampaignDetails
parameter. Ensure that all calls to this function provide this parameter to avoid runtime errors.
- File:
utilities/project-factory/src/server/utils/campaignUtils.ts
- Lines: 592, 595
Analysis chain
Ensure the
existingCampaignDetails
parameter is always passed.The function now relies on the
existingCampaignDetails
parameter. Ensure that all calls to this function provide this parameter to avoid runtime errors.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `enrichAndPersistCampaignForUpdate` provide the `existingCampaignDetails` parameter. # Test: Search for the function usage. Expect: Only occurrences with the new parameter. rg --type typescript -A 5 $'enrichAndPersistCampaignForUpdate'Length of output: 96
Script:
#!/bin/bash # Description: Verify all function calls to `enrichAndPersistCampaignForUpdate` provide the `existingCampaignDetails` parameter. # Test: Search for the function usage. Expect: Only occurrences with the new parameter. rg --type ts -A 5 $'enrichAndPersistCampaignForUpdate'Length of output: 2019
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (6)
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/css/package.json
is excluded by!**/*.json
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json
is excluded by!**/*.json
micro-ui/web/package.json
is excluded by!**/*.json
micro-ui/web/workbench/package.json
is excluded by!**/*.json
Files selected for processing (29)
- micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
- micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss (1 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js (7 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (2 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DSSCard.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js (8 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (5 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (3 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (2 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (4 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (7 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js (1 hunks)
- micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (1 hunks)
- micro-ui/web/public/index.html (1 hunks)
- utilities/project-factory/migration/main/V20240725155100__remove_constraint_process_details.sql (1 hunks)
- utilities/project-factory/src/server/api/genericApis.ts (2 hunks)
- utilities/project-factory/src/server/config/constants.ts (1 hunks)
- utilities/project-factory/src/server/config/index.ts (3 hunks)
- utilities/project-factory/src/server/kafka/Listener.ts (5 hunks)
- utilities/project-factory/src/server/service/dataManageService.ts (2 hunks)
- utilities/project-factory/src/server/utils/campaignMappingUtils.ts (1 hunks)
- utilities/project-factory/src/server/utils/campaignUtils.ts (3 hunks)
- utilities/project-factory/src/server/utils/excelUtils.ts (1 hunks)
- utilities/project-factory/src/server/utils/generateUtils.ts (3 hunks)
- utilities/project-factory/src/server/utils/genericUtils.ts (9 hunks)
- utilities/project-factory/src/server/utils/processTrackUtils.ts (2 hunks)
- utilities/project-factory/src/server/utils/targetUtils.ts (5 hunks)
- utilities/project-factory/src/server/validators/campaignValidators.ts (2 hunks)
Files skipped from review due to trivial changes (4)
- micro-ui/web/micro-ui-internals/example/public/index.html
- micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss
- micro-ui/web/public/index.html
- utilities/project-factory/migration/main/V20240725155100__remove_constraint_process_details.sql
Files skipped from review as they are similar to previous changes (3)
- utilities/project-factory/src/server/config/index.ts
- utilities/project-factory/src/server/kafka/Listener.ts
- utilities/project-factory/src/server/utils/targetUtils.ts
Additional context used
Path-based instructions (12)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DSSCard.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (1)
Pattern
**/*.js
: check
Biome
utilities/project-factory/src/server/service/dataManageService.ts
[error] 46-46: 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/campaign-manager/src/pages/employee/index.js
[error] 41-41: 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)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js
[error] 86-86: 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] 107-107: 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] 138-138: 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] 169-169: 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)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js
[error] 93-93: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
[error] 291-296: 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 (61)
utilities/project-factory/src/server/utils/generateUtils.ts (2)
17-17
: Improvement in robustness.The new conditional check ensures that both
existingBoundaries
andcurrentBoundaries
are present before proceeding with the comparison, preventing potential errors or unexpected behavior.
Line range hint
65-79
:
Conditional caching parameter added.The addition of the
enableCaching
parameter to thecallGenerate
function allows for conditional caching based on the input, enhancing flexibility.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (3)
67-67
: Ensure action bar visibility for ongoing campaigns.The URL construction for "CAMPAIGN_ONGOING" includes the
actionBar
parameter set totrue
, ensuring that the action bar is displayed when navigating to ongoing campaigns.
74-74
: Ensure action bar visibility for upcoming campaigns.The URL construction for "CAMPAIGN_UPCOMING" includes the
actionBar
parameter set totrue
, ensuring that the action bar is displayed when navigating to upcoming campaigns.
78-80
: Ensure draft and boundary information visibility for draft campaigns.The URL construction for "CAMPAIGN_DRAFTS" includes the
draftBoundary
andfetchBoundary
parameters set totrue
, ensuring that the draft and boundary information is fetched and displayed when navigating to draft campaigns.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js (1)
36-39
: Enhance user input validation.The validation check ensures that the
formData
object contains a non-emptydateWithBoundary
property before proceeding, improving the robustness of the form submission logic.utilities/project-factory/src/server/service/dataManageService.ts (5)
12-13
: Import statements look good.The new imports for Redis utilities and configuration are appropriate for the caching logic introduced later.
44-44
: Function signature change is appropriate.The addition of the
enableCaching
parameter allows for optional caching, enhancing the function's flexibility.
51-67
: Caching logic is well-implemented.The function appropriately checks for a cache key, retrieves cached data if available, and logs cache hits and misses.
80-82
: Return statement and caching of response data are appropriate.Caching the boundary file details in Redis when caching is enabled improves performance.
Line range hint
83-88
:
Error handling is appropriate.The error handling logs the error and rethrows it, ensuring that errors are logged for debugging purposes.
Tools
Biome
[error] 46-46: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
utilities/project-factory/src/server/config/constants.ts (1)
129-139
: New exported constant is appropriate.The new
processTrackForUi
constant provides a consolidated list of process tracks for the UI, enhancing functionality.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js (5)
5-5
: Import statement looks good.The import of
DustbinIcon
is necessary for the new delete functionality.
7-7
: New props added correctly.The new props
canDelete
andonDeleteCard
are added correctly to support the delete functionality.
13-14
: State initialization improvements are correct.The default values for
startDate
andendDate
now handle undefined values appropriately.
18-24
: useEffect hook updates are correct.The
useEffect
hook has been updated to handle undefined values forstartDate
andendDate
properly.
68-75
: JSX structure improvements are correct.The new JSX structure includes conditional rendering for the delete icon, enhancing the user interface.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (4)
Line range hint
1-11
: No changes to import statements.No action needed for import statements.
40-40
: New state variablebaseTimeOut
is correctly implemented.The use of a custom hook to fetch
baseTimeOut
is appropriate and enhances the flexibility of the component.
94-108
: Conditional refetching logic is correctly implemented.The new
useEffect
hook improves the efficiency of the component by avoiding unnecessary refetching.
214-223
: Button rendering improvements are correct.The changes ensure consistent rendering of the
Button
for downloading user credentials, enhancing the user interface.utilities/project-factory/src/server/utils/excelUtils.ts (2)
74-75
: Commenting out lines is acceptable.The commented-out lines alter the visual structure of the worksheet but do not affect the core logic of data processing.
Line range hint
76-101
: Core logic remains intact.The core logic of the
formatWorksheet
function remains unchanged and is intact.utilities/project-factory/src/server/utils/processTrackUtils.ts (7)
5-5
: Ensure the correct import ofprocessTrackForUi
.The import statement for
processTrackForUi
is correct and necessary for the new functionality.
35-35
: Efficiently create theuiSet
.The creation of
uiSet
usingprocessTrackForUi
is efficient and ensures quick membership checks.
41-41
: New propertyshowInUi
added to the return object.The
showInUi
property is correctly added to the return object and is determined by checking if thetype
exists in theuiSet
.
Line range hint
54-54
:
EnsurecampaignId
is provided.The check for
campaignId
ensures that the function does not proceed without a valid campaign ID.
Line range hint
61-61
:
Handle different track statuses.The function correctly differentiates between
error
and non-error types, calling appropriate handlers.
Line range hint
78-78
:
Filter process details based on status.The function correctly filters
inProgress
,toBeCompleted
, andfailed
statuses from the process details.
Line range hint
88-88
:
Update or create new process details.The function correctly updates or creates new process details based on the current status.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DSSCard.js (3)
62-66
: Additional role checks for supervisors.The additional role checks ensure that only authorized users can access the
DSSCard
component.
77-86
: Conditional rendering based on role checks.The conditional rendering ensures that the component is only rendered if the user has the necessary permissions.
221-221
: ExportDSSCard
andNDSSCard
.The export statement correctly exports the
DSSCard
andNDSSCard
components.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js (4)
112-115
: OptimizelowestHierarchy
computation.The use of
useMemo
to computelowestHierarchy
optimizes performance by memoizing the result.
156-159
: Auto-hide toast messages.The
useEffect
hook for auto-hiding toast messages enhances the user experience by providing timely feedback.
225-227
: Display feedback for boundary selection.The
showToast
state provides immediate feedback to the user when attempting to delete a boundary without selection.
236-241
: Handle boundary deletion.The
onDeleteBoundary
function correctly dispatches the "DELETE_BOUNDARY" action to the reducer.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1)
246-251
: Simplified conditional rendering logic.The changes simplify the conditional rendering logic for
cardSecondaryAction
. This improves readability and reduces complexity.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (2)
254-259
: Avoid potential duplication of configuration entries.The new configuration entries are identical and added at two different locations. Ensure that this duplication is intentional and does not lead to any unintended side effects.
659-664
: Avoid potential duplication of configuration entries.The new configuration entries are identical and added at two different locations. Ensure that this duplication is intentional and does not lead to any unintended side effects.
utilities/project-factory/src/server/utils/campaignMappingUtils.ts (2)
418-434
: Ensure consistent usage of the renamed parameter.The function parameter has been renamed from
messageObject
tomappingObject
. Ensure that all references to the old parameter name have been updated correctly.
429-434
: Ensure campaign status and message production logic is correct.The campaign status is set to
inprogress
and a message is produced. Verify that this logic aligns with the intended workflow.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (4)
253-253
: Initialize state variabletimeLine
correctly.The state variable
timeLine
is initialized correctly usingReact.useState(false)
.
254-263
: Ensure proper handling ofonActionSelect
function.The
onActionSelect
function handles different actions based on thevalue.code
. Ensure that thesetTimeline
function is correctly updating the state.
618-618
: Initialize state variabletimeLine
correctly.The state variable
timeLine
is initialized correctly usingReact.useState(false)
.
619-628
: Ensure proper handling ofonActionSelect
function.The
onActionSelect
function handles different actions based on thevalue.code
. Ensure that thesetTimeline
function is correctly updating the state.utilities/project-factory/src/server/api/genericApis.ts (1)
883-884
: Ensure proper handling of asynchronous processing withprocessMapping
.The
processMapping
function is now handling the processing asynchronously. Ensure that the function is correctly processing themappingObject
.micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (1)
540-541
: Add a check for emptyjsonData
.The new check for empty
jsonData
ensures that only non-empty data is processed further.utilities/project-factory/src/server/utils/genericUtils.ts (3)
Line range hint
810-821
:
Verify the function usage in the codebase.The function
updateAndPersistGenerateRequest
has been updated to include a new parameterenableCaching
. Ensure that all calls to this function pass the correct number of arguments.Verification successful
Verification successful: The function
updateAndPersistGenerateRequest
is correctly called with the updated signature, including the newenableCaching
parameter.
utilities/project-factory/src/server/utils/genericUtils.ts
: The function call matches the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `updateAndPersistGenerateRequest` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'updateAndPersistGenerateRequest'Length of output: 94
Script:
#!/bin/bash # Description: Verify all function calls to `updateAndPersistGenerateRequest` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg 'updateAndPersistGenerateRequest'Length of output: 462
Line range hint
364-377
:
Verify the function usage in the codebase.The function
fullProcessFlowForNewEntry
has been updated to include a new parameterenableCaching
. Ensure that all calls to this function pass the correct number of arguments.Verification successful
Verify the function usage in the codebase.
The function
fullProcessFlowForNewEntry
has been updated to include a new parameterenableCaching
. The search results confirm that all calls to this function within the same file pass the correct number of arguments.
utilities/project-factory/src/server/utils/genericUtils.ts
:
- Line:
await fullProcessFlowForNewEntry(newEntryResponse, generatedResource, request, enableCaching, filteredBoundary);
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `fullProcessFlowForNewEntry` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'fullProcessFlowForNewEntry'Length of output: 89
Script:
#!/bin/bash # Description: Verify all function calls to `fullProcessFlowForNewEntry` match the new signature. # Test: Search for the function usage in TypeScript files. Expect: Only occurrences of the new signature. rg 'fullProcessFlowForNewEntry' --glob '*.ts' -A 5Length of output: 1927
Tools
Biome
[error] 366-366: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
788-790
: Verify the function usage in the codebase.The function
processGenerateForNew
has been updated to include a new parameterenableCaching
. Ensure that all calls to this function pass the correct number of arguments.Verification successful
Let's correct the file type and re-run the script to verify all calls to
processGenerateForNew
.
To ensure comprehensive verification, let's search for
processGenerateForNew
usage across the entire codebase.
All calls to
processGenerateForNew
match the new signature.The function
processGenerateForNew
has been updated correctly, and all usages in the codebase reflect the new parameterenableCaching
.
utilities/project-factory/src/server/utils/genericUtils.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `processGenerateForNew` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'processGenerateForNew'Length of output: 84
Script:
#!/bin/bash # Description: Verify all function calls to `processGenerateForNew` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type ts -A 5 $'processGenerateForNew'Length of output: 1285
Script:
#!/bin/bash # Description: Verify all function calls to `processGenerateForNew` match the new signature across the entire codebase. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg 'processGenerateForNew'Length of output: 396
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js (7)
1-12
: LGTM!The new imports for
Menu
,ActionBar
, andSubmitBar
enhance the UI capabilities of the component.
260-260
: LGTM!The new state variable
actionBar
is correctly initialized based on URL search parameters.
269-269
: LGTM!The new state variable
displayMenu
is correctly initialized.
497-497
: LGTM!The logic for updating URL parameters has been refined for clarity.
1441-1442
: LGTM!The logic for handling campaign date validation has been improved for clarity.
1532-1546
: LGTM!The new function
onActionSelect
correctly handles actions selected from the new action bar.
1592-1597
: LGTM!The new action bar with
Menu
andSubmitBar
components enhances the user experience by providing additional options.utilities/project-factory/src/server/validators/campaignValidators.ts (2)
23-23
: Import statement added correctly.The import statement for
isDynamicTargetTemplateForProjectType
is correctly added and necessary for the new condition.
223-223
: Improved condition for validating delivery rules.The new condition using
isDynamicTargetTemplateForProjectType
improves clarity and maintainability by directly linking the validation to the project type.utilities/project-factory/src/server/utils/campaignUtils.ts (1)
Line range hint
1453-1457
:
Verify the correctness of the dynamic target template check.The function now uses
isDynamicTargetTemplateForProjectType
to check if dynamic target templates are enabled. Ensure that this function correctly identifies the project types that support dynamic templates.Verification successful
The dynamic target template check is correctly implemented.
The
isDynamicTargetTemplateForProjectType
function correctly identifies project types that support dynamic templates by checking against theenableDynamicTemplateFor
configuration.
utilities/project-factory/src/server/utils/targetUtils.ts
:function isDynamicTargetTemplateForProjectType(projectType: string) { const projectTypesFromConfig = config?.enableDynamicTemplateFor; return projectTypesFromConfig?.includes(projectType) ?? false; }Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of `isDynamicTargetTemplateForProjectType` function. # Test: Search for the function implementation. Expect: Correct logic to identify project types. rg --type typescript -A 5 $'isDynamicTargetTemplateForProjectType'Length of output: 100
Script:
#!/bin/bash # Description: Verify the correctness of `isDynamicTargetTemplateForProjectType` function. # Test: Search for the function implementation. Expect: Correct logic to identify project types. rg --type ts -A 5 $'isDynamicTargetTemplateForProjectType'Length of output: 5266
if (existingCampaignDetails) { | ||
if (areBoundariesSame(existingCampaignDetails?.boundaries, request?.body?.CampaignDetails?.boundaries)) { | ||
updateTargetColumnsIfDeliveryConditionsDifferForSMC(request); | ||
} | ||
} |
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.
Optimize boundary comparison and target column update logic.
The current logic checks if existingCampaignDetails
is present and then compares boundaries. If the boundaries are the same, it updates target columns if delivery conditions differ. This can be optimized by combining the checks to reduce nested conditions.
if (existingCampaignDetails && areBoundariesSame(existingCampaignDetails?.boundaries, request?.body?.CampaignDetails?.boundaries)) {
updateTargetColumnsIfDeliveryConditionsDifferForSMC(request);
}
case "DELETE_BOUNDARY": | ||
return state.filter((item) => item?.id !== action?.item?.id); | ||
break; |
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 unreachable code.
The break statement after the return statement is unreachable and should be removed.
- break;
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.
case "DELETE_BOUNDARY": | |
return state.filter((item) => item?.id !== action?.item?.id); | |
break; | |
case "DELETE_BOUNDARY": | |
return state.filter((item) => item?.id !== action?.item?.id); |
Tools
Biome
[error] 93-93: This code is unreachable
... because this statement will return from the function beforehand
(lint/correctness/noUnreachable)
@@ -76,7 +83,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) => | |||
withoutLabel={true} | |||
type="date" | |||
value={startDate} | |||
nonEditable={today >= startDate ? true : false} | |||
nonEditable={startDate?.length > 0 && today > startDate ? 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.
Simplify boolean literals in conditional expression.
Unnecessary use of boolean literals in the conditional expression.
- nonEditable={startDate?.length > 0 && today > startDate ? true : false}
+ nonEditable={startDate?.length > 0 && today > startDate}
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.
nonEditable={startDate?.length > 0 && today > startDate ? true : false} | |
nonEditable={startDate?.length > 0 && today > startDate} |
Tools
Biome
[error] 86-86: 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)
@@ -131,7 +135,7 @@ | |||
<FieldV1 | |||
withoutLabel={true} | |||
type="date" | |||
nonEditable={today >= item?.startDate ? true : false} | |||
nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? 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.
Simplify boolean literals in conditional expression.
Unnecessary use of boolean literals in the conditional expression.
- nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false}
+ nonEditable={item?.startDate?.length > 0 && today > item?.startDate}
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.
nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false} | |
nonEditable={item?.startDate?.length > 0 && today > item?.startDate} |
Tools
Biome
[error] 138-138: 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)
@@ -97,19 +104,16 @@ | |||
withoutLabel={true} | |||
type="date" | |||
value={endDate} | |||
nonEditable={today >= endDate ? true : false} | |||
nonEditable={endDate?.length > 0 && today > endDate ? 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.
Simplify boolean literals in conditional expression.
Unnecessary use of boolean literals in the conditional expression.
- nonEditable={endDate?.length > 0 && today > endDate ? true : false}
+ nonEditable={endDate?.length > 0 && today > endDate}
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.
nonEditable={endDate?.length > 0 && today > endDate ? true : false} | |
nonEditable={endDate?.length > 0 && today > endDate} |
Tools
Biome
[error] 107-107: 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)
try { | ||
const { hierarchyType, campaignId } = request?.query; |
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.
Fix unsafe usage of optional chaining.
The usage of optional chaining here can lead to a TypeError if request.query
is undefined
.
- const { hierarchyType, campaignId } = request?.query;
+ const { hierarchyType, campaignId } = request.query || {};
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.
const { hierarchyType, campaignId } = request?.query; | |
const { hierarchyType, campaignId } = request.query || {}; |
Tools
Biome
[error] 46-46: Unsafe usage of optional chaining.
If it short-circuits with 'undefined' the evaluation will throw TypeError here:
(lint/correctness/noUnsafeOptionalChaining)
name: "timeline", | ||
sections: [ | ||
{ | ||
? { |
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 unused isPreview
variable.
The isPreview
variable is defined but not used in the component.
- const isPreview = searchParams.get("preview");
Committable suggestion was skipped due to low confidence.
<BoundaryWithDate | ||
project={item} | ||
dateReducerDispatch={dateReducerDispatch} | ||
canDelete={dateReducer?.length > 1} | ||
onDeleteCard={() => onDeleteBoundary(item, index)} | ||
/> |
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 missing key property in iterable.
The BoundaryWithDate
component instances in the iterable should have a unique key property.
- dateReducer?.map((item, index) => (
+ dateReducer?.map((item, index) => (
+ <BoundaryWithDate
+ key={item.id}
+ project={item}
+ dateReducerDispatch={dateReducerDispatch}
+ canDelete={dateReducer?.length > 1}
+ onDeleteCard={() => onDeleteBoundary(item, index)}
+ />
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.
<BoundaryWithDate | |
project={item} | |
dateReducerDispatch={dateReducerDispatch} | |
canDelete={dateReducer?.length > 1} | |
onDeleteCard={() => onDeleteBoundary(item, index)} | |
/> | |
<BoundaryWithDate | |
key={item.id} | |
project={item} | |
dateReducerDispatch={dateReducerDispatch} | |
canDelete={dateReducer?.length > 1} | |
onDeleteCard={() => onDeleteBoundary(item, index)} | |
/> |
Tools
Biome
[error] 291-296: 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)
|
||
// for (const header of mdmsHeaders) { | ||
// if (!expectedHeaders.includes(t(header))) { | ||
// const errorMessage = t("HCM_BOUNDARY_INVALID_SHEET"); | ||
// setErrorsType((prevErrors) => ({ | ||
// ...prevErrors, | ||
// [type]: errorMessage, | ||
// })); | ||
// setIsError(true); | ||
// isValid = false; | ||
// break; | ||
// } | ||
// } |
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.
Re-enable header validation checks.
The validation checks for headers have been commented out, which may introduce risks related to data integrity. Consider re-enabling these checks to ensure the headers are valid.
- // for (const header of mdmsHeaders) {
- // if (!expectedHeaders.includes(t(header))) {
- // const errorMessage = t("HCM_BOUNDARY_INVALID_SHEET");
- // setErrorsType((prevErrors) => ({
- // ...prevErrors,
- // [type]: errorMessage,
- // }));
- // setIsError(true);
- // isValid = false;
- // break;
- // }
- // }
Committable suggestion was skipped due to low confidence.
{ | ||
path: pathVar === "update-dates-boundary" ? "" : `/${window?.contextPath}/employee/campaign/my-campaign`, | ||
content: t("UPDATE_DATE_CHANGE"), | ||
show: pathVar === "update-dates-boundary" ? 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.
New breadcrumb item is appropriate.
The new breadcrumb item for "UPDATE_DATE_CHANGE" enhances navigation by providing an additional context-specific link.
Simplify the ternary operator usage.
The ternary operator usage here is unnecessary and can be simplified.
- show: pathVar === "update-dates-boundary" ? true: false,
+ show: pathVar === "update-dates-boundary",
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.
{ | |
path: pathVar === "update-dates-boundary" ? "" : `/${window?.contextPath}/employee/campaign/my-campaign`, | |
content: t("UPDATE_DATE_CHANGE"), | |
show: pathVar === "update-dates-boundary" ? true: false, | |
}, | |
{ | |
path: pathVar === "update-dates-boundary" ? "" : `/${window?.contextPath}/employee/campaign/my-campaign`, | |
content: t("UPDATE_DATE_CHANGE"), | |
show: pathVar === "update-dates-boundary", | |
}, |
Tools
Biome
[error] 41-41: 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)
…-template # Conflicts: # utilities/project-factory/src/server/api/campaignApis.ts # utilities/project-factory/src/server/utils/campaignUtils.ts # utilities/project-factory/src/server/utils/genericUtils.ts
No description provided.