Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCM Admin Console v0.3 & Microplan v0.1 Release UI Code changes #1823

Merged
merged 519 commits into from
Dec 9, 2024

Conversation

jagankumar-egov
Copy link
Collaborator

@jagankumar-egov jagankumar-egov commented Nov 13, 2024

Choose the appropriate template for your PR:

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a comprehensive search functionality for checklists and campaigns.
    • Added new components for managing boundary relationships and microplan data.
    • Enhanced UI with new styles and improved user interactions across various components.
    • Implemented a new loading state management system for better user experience during data fetching.
    • Added a new configuration for microplan campaign search functionality.
    • Introduced a new React component for managing approved microplans.
    • Added functionality for creating and managing boundary relations.
    • Introduced new components for campaign data fetching and management, enhancing user experience.
  • Bug Fixes

    • Resolved issues with data handling and state management in several components.
    • Improved error handling and notifications for user actions.
  • Documentation

    • Updated changelogs for the campaign manager and web modules to reflect recent changes.
    • Added a new README and detailed comments in the code for better understanding.
  • Style

    • Refined CSS styles for improved layout and responsiveness across the application.
    • Introduced new SCSS files for specific components to maintain modularity.
  • Tests

    • Enhanced test coverage for new features and critical components to ensure reliability.

Swathi-eGov and others added 30 commits November 6, 2024 18:01
Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
* updated css for summary screen

* removed log

* added null check

---------

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
* Breadcrumb changes

* console.log removed

* indentations
* Feat : Added download button for finalised microplans

* Added Todo
* fixed HCMPRE-776 and removed updated old validation

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/MapView.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update MyCampaign.js

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignDates.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update CampaignDates.js

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update SetupCampaign.js

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Update MultiSelectDropdown.js
#1769)

Fixed loader,breadcrumb,table cells css and added placeholder text for assumption fields
* Added dynamic column inside pop inbox

* updated status to action in status logs

* updated status log

* added comment logs for edit population

* updated css version

* updated code rabbit comment and css version

---------

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
* z-index and camapaign-name in preview

* ui-ux-demo-review

* version updates

* ver

* Update ViewHierarchy.js

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
updated the search dropdown

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
* Added info icon on formula and assumptions

* Incremented CSS version
* updated react-components version to fix icon issues in inbox screen

* updated versions everywhere
* My microplan data fixes, localisation fixes

* setup response screen fixes, breadcrumb localisation code correctify

* search bar fix

* fixes

* ADD NEW LOCALE

* roletable fixes for mobile number search, qa issue fix

* FIXES

* quickfixes

* quick fixes/ Tagging UI UX fixes

* fix

* added locale

* census table assignee issue fixes

* role table pop up css fix and my microplan click fix

* fixes and stepper click enable for back

* added user tag fixes

* UserAccessfixes

* Custom Assumption - Custom Formula

* Update health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfiguration.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* updated date formate and css

* updated css

---------

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
* Changes to usermanagement redirext on row click

* changes to onRow click in userManagement

* console removed

* changes

* null check

* changes

* removing extra mdms call

* changing useState

* removed var

* changes

* changes
* removed popup for facilitya and population upload

* updated plan inbox

---------

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
* bug/boundary

* changed field name

* added something

* Update checklistSearchConfig.js

* Update ViewHierarchy.js

* fixes

* fixes1

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* pending changes

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/useBoundaryHome.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/GeoPode.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
#1790)

* reverted action in assign to all, updated the column heading with projecttype

* removed logs

---------

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
Changes to userManagement, css for boundary
* user tagging fixes

* Vehicle Assumptions and Vehicle Formula

* Update health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* yarn

---------

Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 40

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 618b9c4 and f4fe24e.

⛔ Files ignored due to path filters (4)
  • .github/workflows/buildWorkbenchUI.yml is excluded by !**/*.yml
  • health/micro-ui/web/core/inter-package.json is excluded by !**/*.json
  • health/micro-ui/web/core/package.json is excluded by !**/*.json
  • health/micro-ui/web/micro-ui-internals/example/package.json is excluded by !**/*.json
📒 Files selected for processing (13)
  • .github/pull_request_template.md (1 hunks)
  • health/micro-ui/web/core/App.js (1 hunks)
  • health/micro-ui/web/core/Dockerfile (1 hunks)
  • health/micro-ui/web/core/install-deps.sh (1 hunks)
  • health/micro-ui/web/core/nginx.conf (1 hunks)
  • health/micro-ui/web/core/webpack.config.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js (3 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UpdateBoundaryWrapper.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (18 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
health/micro-ui/web/core/webpack.config.js (1)

Pattern **/*.js: check

health/micro-ui/web/core/App.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UpdateBoundaryWrapper.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js (1)

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)

Pattern **/*.js: check

📓 Learnings (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#741
File: micro-ui/web/micro-ui-internals/packages/modules/hcm-microplanning/src/Module.js:15-15
Timestamp: 2024-11-10T20:01:49.000Z
Learning: When adding a new module code like "campaignmanager" to `moduleCode`, ensure that it is properly handled in all relevant conditional checks and function parameters across the codebase.
🪛 Shellcheck (0.10.0)
health/micro-ui/web/core/install-deps.sh

[style] 17-17: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)

🪛 Hadolint (2.12.0)
health/micro-ui/web/core/Dockerfile

[warning] 4-4: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>

(DL3018)


[warning] 13-13: Use WORKDIR to switch to a directory

(DL3003)

🪛 Biome (1.9.4)
health/micro-ui/web/core/webpack.config.js

[error] 1-1: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js

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


[error] 31-31: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)


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

health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js

[error] 802-802: 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] 803-803: 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] 804-804: 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] 812-825: 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] 827-838: 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] 891-891: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 902-902: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 913-913: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 924-924: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 991-1025: 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] 1002-1002: 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] 1014-1014: 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] 1094-1094: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 1115-1115: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 1136-1136: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 1148-1148: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 1210-1210: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1211-1211: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


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

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js

[error] 100-100: 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] 101-110: 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] 113-113: 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] 122-122: 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] 123-123: 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] 124-124: 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] 224-224: 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] 229-229: 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] 230-244: 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] 245-245: 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] 246-248: 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] 249-268: 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] 269-282: 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] 274-274: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 193-193: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)


[error] 197-222: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)


[error] 227-227: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)


[error] 313-313: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 314-314: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 345-345: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 224-224: This let declares a variable that is only assigned once.

'epoch' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 445-445: 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] 461-461: 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] 474-474: 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] 762-762: 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] 778-778: 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] 793-793: 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)

🔇 Additional comments (29)
.github/pull_request_template.md (1)

3-4: Verify referenced template files exist

Let's ensure the referenced template files are present in the repository.

✅ Verification successful

Referenced PR template files exist and are properly organized

The verification confirms that all three template files (feature_template.md, bugfix_template.md, and release_template.md) are present in the correct location under .github/PULL_REQUEST_TEMPLATE/ directory.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced template files exist
fd -t f ".*_template.md" .github/PULL_REQUEST_TEMPLATE/

Length of output: 206

health/micro-ui/web/core/install-deps.sh (2)

15-15: Verify UICustomizations.js compatibility

The script copies UICustomizations.js from the example directory. We should verify that this is the intended source and not a development template.

✅ Verification successful

Based on the inspection of the example UICustomizations.js file, I can now provide a final response:

UICustomizations.js is a valid source file, not a development template

The file contains production-ready code with well-structured customization configurations for various modules including:

  • Business service mappings
  • Workflow payload transformations
  • Search configurations
  • Campaign management
  • Microplan configurations
  • User management features

The code shows no signs of being a template as it:

  • Contains no TODO/FIXME markers
  • Has fully implemented business logic
  • Includes proper error handling
  • Uses production environment configurations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are other UICustomizations.js files that might be more appropriate
echo "Checking for other UICustomizations.js files..."
fd "UICustomizations.js"

# Check the content of the example file for template markers
rg -l "TODO|FIXME|template|example" micro-ui-internals/example/src/UICustomizations.js

Length of output: 1057


Script:

#!/bin/bash
# Let's check the content of the example UICustomizations.js file
cat health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js

# Also check the content of one of the module-specific UICustomizations.js for comparison
cat health/micro-ui/web/micro-ui-internals/packages/modules/workbench/src/configs/UICustomizations.js

Length of output: 50646


1-18: Verify the script's integration with the build process

The script copies several critical build configuration files. We should verify that these files are properly referenced in the build process and CI/CD pipeline.

✅ Verification successful

Let me gather more information about the webpack configuration and build process integration.


Let me check the Dockerfile references to understand how install-deps.sh is integrated into the build process.


The install-deps.sh script is properly integrated into the build process

Based on the verification results, the script is well-integrated into the build process:

  1. The script is used across multiple Dockerfiles as part of their build steps
  2. It's executed before yarn install and yarn build:webpack commands
  3. The webpack configuration files are consistent across different modules
  4. The build process follows a clear pattern:
    • Execute install-deps.sh to set up dependencies
    • Run yarn install
    • Build using webpack configuration

The script copies critical build files that are subsequently used by the webpack build process, and this pattern is consistently implemented across different modules (core, workbench, microplan).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the copied files are referenced in CI/CD configurations
echo "Checking CI/CD configurations for build file references..."

# Look for references to webpack.config.js
rg -l "webpack\.config\.js" .github/workflows/

# Check package.json scripts that might use these files
fd -t f "package.json" -x jq -r '.scripts | select(.build != null or .start != null)'

Length of output: 14968


Script:

#!/bin/bash
# Check for webpack.config.js references in build scripts and its content
echo "Checking webpack.config.js references and content..."

# Find and show content of webpack config files
fd -t f "webpack.config.js" -x cat {}

# Check for build.sh references since it's mentioned in package.json
fd -t f "build.sh" -x cat {}

# Look for install-deps.sh usage in other scripts
rg -l "install-deps.sh"

Length of output: 8867


Script:

#!/bin/bash
# Check the Dockerfiles that reference install-deps.sh
echo "Checking Dockerfiles that use install-deps.sh..."
fd -t f "Dockerfile" -x cat {} \; | grep -A 5 -B 5 "install-deps.sh"

# Check if there are any CI/CD pipeline configurations
echo "Checking CI/CD configurations..."
fd -t f -e yml -e yaml -p "workflow|jenkins|azure|gitlab" -x cat {}

Length of output: 2453

🧰 Tools
🪛 Shellcheck (0.10.0)

[style] 17-17: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)

health/micro-ui/web/core/webpack.config.js (1)

38-48: 🧹 Nitpick (assertive)

Review chunk splitting configuration

The current configuration has some potential issues:

  1. maxSize and enforceSizeThreshold are identical (244000), which negates the purpose of having a threshold
  2. The size limits might be too restrictive for modern web applications
  optimization: {
    splitChunks: {
      chunks: 'all',
      minSize: 50000,
-      maxSize: 244000,
-      enforceSizeThreshold: 244000,
+      maxSize: 500000,
+      enforceSizeThreshold: 1000000,
      minChunks: 1,
      maxAsyncRequests: 10,
      maxInitialRequests: 5
    },
  },
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)

87-89: 🧹 Nitpick (assertive)

Verify module codes are properly handled across the codebase

Ensure that the new moduleCode entries like "campaignmanager" are properly handled in all relevant conditional checks and function parameters across the codebase.

Run the following script to verify the usage of new module codes:

✅ Verification successful

Based on the search results, I can generate the final response as we have sufficient information to verify the module code usage:

Module codes are properly handled across the codebase

The new module codes are used consistently:

  • campaignmanager is used in both campaign-manager and microplan modules
  • schema and admin-schemas are used in multiple module configurations
  • checklist is properly scoped to campaign-manager module
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of module codes to ensure proper handling.

# Test: Find all occurrences of module codes in the codebase.

module_codes=("campaignmanager" "schema" "admin-schemas" "checklist")
for code in "${module_codes[@]}"; do
  echo "Searching for module code: $code"
  rg --fixed-strings "$code"
done

Length of output: 84391

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundariesDuplicate.js (5)

9-13: Avoid accessing 'props.props' by properly destructuring props

The usage of props?.props throughout the component indicates that props may not be properly destructured. This can lead to confusion and potential bugs. Consider destructuring the necessary properties directly from props.

You can destructure the needed properties at the component definition:

-const SelectingBoundariesDuplicate = ({ onSelect, formData, ...props }) => {
+const SelectingBoundariesDuplicate = ({ onSelect, formData, props: { dataParams, sessionData, hierarchyData, ...restProps } }) => {

Then, you can access dataParams, sessionData, and hierarchyData directly without the props.props syntax.


31-31: Use 'Number.parseInt' instead of global 'parseInt'

ES2015 recommends using Number.parseInt for consistency and to avoid unintended global namespace pollution.

Apply this diff to fix the issue:

-return keyParam ? parseInt(keyParam) : 1;
+return keyParam ? Number.parseInt(keyParam) : 1;
🧰 Tools
🪛 Biome (1.9.4)

[error] 31-31: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)


65-70: Prevent infinite re-renders by adding a dependency array to 'useEffect'

The useEffect without a dependency array runs after every render, causing executionCount to increment indefinitely. This can lead to an infinite loop and degrade performance.

Add a dependency array to control when the effect runs. If you intend for this effect to run only once on mount, use an empty array:

-useEffect(() => {
+useEffect(() => {
   if (executionCount < 5) {
     onSelect("boundaryType", { selectedData: selectedData, boundaryData: boundaryOptions , updateBoundary: !restrictSelection});
     setExecutionCount((prevCount) => prevCount + 1);
   }
-});
+}, []);

If it depends on certain variables, include them in the dependency array accordingly.


119-130: Use self-closing tag for 'Wrapper' component

Since the Wrapper component has no children, it can be self-closed to improve code readability and adhere to JSX best practices.

Apply this diff to fix the issue:

               }}
-            ></Wrapper>
+            />} />
🧰 Tools
🪛 Biome (1.9.4)

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


139-145: Add 'key' prop to elements in an array

When rendering an array of elements, each element should have a unique key prop to help React identify which items have changed. This prevents potential issues during re-renders.

Apply this diff to fix the issue:

 additionalElements={[
-  <span style={{ color: "#505A5F" }}>
+  <span key="boundary-info" style={{ color: "#505A5F" }}>
🧰 Tools
🪛 Biome (1.9.4)

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

health/micro-ui/web/core/App.js (1)

41-41: 🧹 Nitpick (assertive)

Fix the typo in the comment

There's a typo in the comment on line 41. "Overide" should be "Override."

Apply this diff to fix the typo:

-/* To Overide any existing config/middlewares  we need to use similar method */
+/* To Override any existing config/middlewares we need to use a similar method */

Likely invalid or redundant comment.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (9)

98-119: 🛠️ Refactor suggestion

Wrap Switch Case Content in a Block

Variables declared within this case (lines 98-119) can be accessed by other case clauses, potentially leading to unexpected behavior. Wrap the code inside this case with braces {} to limit the scope of the variables and prevent variable leakage.

Apply this diff to fix the issue:

97           switch (key) {       
98               case "HCM_CHECKLIST_STATUS":
+                 {
99                   
100                   const [localIsActive, setLocalIsActive] = useState(row?.ServiceRequest?.[0]?.isActive);
101                   const toggle = async () => {
102                     const prev = row?.ServiceRequest?.[0]?.isActive;
103                     const sdcode = row?.ServiceRequest?.[0]?.code;
104                     const res = await updateServiceDefinition(tenantId, !prev, sdcode);
105                     setLocalIsActive(!localIsActive);
106                     if(res)
107                     {
108                       
109                     }
110                   };
111
112                   const switchText = localIsActive ? "Active" : "Inactive";
113                   return (
114                     row?.ServiceRequest?.[0] ? (
115                       <Switch
116                         isCheckedInitially={row?.ServiceRequest?.[0]?.isActive}
117                         label={switchText}
118                         onToggle={toggle}
119                       />
120                     ) : (
121                       <>{t("CHECKLIST_TOBE_CONFIGURED")}</>
122                     )
123                   );
124                   break;
+                 }
🧰 Tools
🪛 Biome (1.9.4)

[error] 100-100: 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] 101-110: 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] 113-113: 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)


120-155: 🛠️ Refactor suggestion

Wrap Switch Case Content in a Block

Variables declared within this case (lines 120-155) can be accessed by other case clauses, potentially leading to unintended behavior. Wrap the code inside this case with braces {} to limit the scope of the variables.

Apply this diff to fix the issue:

119                   break;
120                   case "HCM_CHECKLIST_ACTION":
+                     {
121                       const role_code = row?.data?.role;
122                       const cl_code = row?.data?.checklistType;
123                       const sd = row?.ServiceRequest?.[0];
124                       if(sd)
125                       {
126                         return (
127                           <Button
128                             type="button"
129                             size="medium"
130                             style={{width: "8rem"}}
131                             variation="secondary"
132                             label={t("HCM_CHECKLIST_VIEW")}
133                             onClick={() => {
134                               history.push(`/${window.contextPath}/employee/campaign/checklist/view?campaignName=${campaignName}&role=${role_code}&checklistType=${cl_code}&projectType=${projectType}&campaignId=${campaignId}`)
135                             }}
136                           />
137                         )
138                       }
139                       else{
140                         return (
141                           <Button
142                             type="button"
143                             size="medium"
144                             style={{width: "8rem"}}
145                             variation="secondary"
146                             label={t("HCM_CHECKLIST_CREATE")}
147                             onClick={() => {
148                               history.push(`/${window.contextPath}/employee/campaign/checklist/create?campaignName=${campaignName}&role=${role_code}&checklistType=${cl_code}&projectType=${projectType}&campaignId=${campaignId}`)
149                             }}
150                           />
151                         );
152                       }
153                       break;
+                     }
🧰 Tools
🪛 Biome (1.9.4)

[error] 122-122: 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] 123-123: 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] 124-124: 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)


223-227: 🛠️ Refactor suggestion

Remove Unreachable Code After Return Statement

The break; statement on line 225 is unreachable because of the return statement on line 223. Remove the break; statement to clean up the code.

Apply this diff to fix the issue:

223             return Digit.DateUtils.ConvertEpochToDate(epoch);
-               break;
🧰 Tools
🪛 Biome (1.9.4)

[error] 224-224: 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] 227-227: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)


[error] 224-224: This let declares a variable that is only assigned once.

'epoch' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


195-222: 🛠️ Refactor suggestion

Remove Unreachable Code Block

The code block from lines 195-222 is unreachable due to the return statement on line 193. Remove the unreachable code to clean up the function.

Apply this diff to fix the issue:

193             return row?.boundaryHierarchy?.length;
-               // Unreachable code below
-               return (
-                 (
-                   <>
-                     <TooltipWrapper
-                       arrow={false}
-                       content={res}
-                       enterDelay={100}
-                       leaveDelay={0}
-                       placement="bottom"
-                       style={{}}
-                     >
-                       {row?.boundaryHierarchy?.length}
-                     </TooltipWrapper>
-                   </>
-                 )
-               )
-               break;
🧰 Tools
🪛 Biome (1.9.4)

[error] 197-222: This code is unreachable

... because this statement will return from the function beforehand

(lint/correctness/noUnreachable)


274-274: 🧹 Nitpick (assertive)

Use Optional Chaining to Simplify Code

On line 274, consider simplifying the condition by using optional chaining.

Apply this diff to enhance readability:

+    if (resFile?.GeneratedResource?.[0]?.fileStoreid) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 274-274: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


224-224: 🧹 Nitpick (assertive)

Use 'const' Instead of 'let' for Variables That Are Not Reassigned

The variable epoch on line 224 is not reassigned after its initial declaration. Consider using const instead of let for better code clarity.

Apply this diff:

+    const epoch = row?.auditDetails?.createdTime;
🧰 Tools
🪛 Biome (1.9.4)

[error] 224-224: 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] 224-224: This let declares a variable that is only assigned once.

'epoch' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


313-314: 🧹 Nitpick (assertive)

Avoid Assignments in Expressions

Assignments within expressions can reduce code readability and may lead to unintended side effects. Refactor the code to use explicit if statements.

Apply this diff:

+    if (userId) {
+      data.body.PlanConfigurationSearchCriteria.userUuid = userId;
+    }
+    if (status) {
+      data.body.PlanConfigurationSearchCriteria.status = [status];
+    }
🧰 Tools
🪛 Biome (1.9.4)

[error] 313-313: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


[error] 314-314: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)


445-476: 🛠️ Refactor suggestion

Wrap Switch Case Content in a Block

Variables declared within this case (lines 445-476) can be accessed by other cases, potentially causing unexpected behavior. Wrap the code inside this case with braces {} to limit the scope.

Apply this diff:

+          {
...
+          }
🧰 Tools
🪛 Biome (1.9.4)

[error] 445-445: 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] 461-461: 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] 474-474: 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)


1061-1063: ⚠️ Potential issue

Simplify Filter Condition in Options

The filter condition in lines 1061-1063 may not work as intended due to the use of || within the filter method. Adjust the condition to correctly filter based on roles.

Apply this diff to fix the issue:

+     ].filter((obj) => Digit.Utils.didEmployeeHasAtleastOneRole(["SYSTEM_ADMINISTRATOR"]) || obj?.key !== 2)
health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js (7)

802-825: 🛠️ Refactor suggestion

Wrap Switch Case Content in a Block

Variables declared within this case (lines 802-825) can be accessed by other case clauses, potentially leading to unexpected behavior. Wrap the code inside this case with braces {} to limit the scope.

Apply this diff:

+             {
...
+             }
🧰 Tools
🪛 Biome (1.9.4)

[error] 802-802: 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] 803-803: 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] 804-804: 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] 812-825: 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)


991-1025: 🛠️ Refactor suggestion

Wrap Switch Case Content in a Block

Variables declared within this case (lines 991-1025) can be accessed by other case clauses, potentially causing unexpected behavior. Wrap the code inside this case with braces {} to limit the scope.

Apply this diff:

+             {
...
+             }
🧰 Tools
🪛 Biome (1.9.4)

[error] 991-1025: 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] 1002-1002: 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] 1014-1014: 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)


1210-1211: 🧹 Nitpick (assertive)

Avoid Using the delete Operator for Better Performance

Using the delete operator can impact performance. Assign undefined to object properties instead.

Apply this diff:

+      data.params.roleschosen = undefined;
+      data.params.name = undefined;
🧰 Tools
🪛 Biome (1.9.4)

[error] 1210-1210: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1211-1211: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


1094-1094: 🧹 Nitpick (assertive)

Use Template Literals Instead of String Concatenation

Using template literals enhances readability. Replace the string concatenation with a template literal.

Apply this diff:

+      return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_DISEASE_${value}`))}</p>

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1094-1094: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


1136-1136: 🧹 Nitpick (assertive)

Use Template Literals Instead of String Concatenation

Consider using template literals to improve code readability.

Apply this diff:

+      <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_DISTRIBUTION_${value}`))}</p>

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1136-1136: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


1148-1148: 🧹 Nitpick (assertive)

Use Template Literals Instead of String Concatenation

Using template literals improves readability. Replace the string concatenation with a template literal.

Apply this diff:

+      return <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_STATUS_${value}`))}</p>;

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1148-1148: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


1115-1115: 🧹 Nitpick (assertive)

Use Template Literals Instead of String Concatenation

Replace string concatenation with template literals for better readability.

Apply this diff:

+      <p>{t(Digit.Utils.locale.getTransformedLocale(`MICROPLAN_TYPE_${value}`))}</p>

Likely invalid or redundant comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 1115-1115: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/SelectingBoundaries.js (2)

45-48: Correct the Parameters in useCustomMDMS Hook

The useCustomMDMS hook parameters may be incorrectly structured, which could lead to unexpected behavior. The options objects should be combined into a single object.

Apply this diff to correct the parameters:

 const { isLoading, data: HierarchySchema } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME,[ 
   { 
     name: "HierarchySchema",
     "filter": `[?(@.type=='${window.Digit.Utils.campaign.getModuleName()}')]`
- }], { select: (MdmsRes) => MdmsRes }, { schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema` });
+ }], { 
+   select: (MdmsRes) => MdmsRes,
+   schemaCode: `${CONSOLE_MDMS_MODULENAME}.HierarchySchema`
+ });

54-54: location is Not Defined

location is used without being defined or imported, which will result in a ReferenceError.

Import useLocation from react-router-dom and initialize location:

+ import { useLocation } from "react-router-dom";
...
+ const location = useLocation();
const searchParams = new URLSearchParams(location.search);

.github/pull_request_template.md Show resolved Hide resolved
.github/pull_request_template.md Show resolved Hide resolved
.github/pull_request_template.md Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/App.js Show resolved Hide resolved
health/micro-ui/web/core/App.js Show resolved Hide resolved
health/micro-ui/web/core/App.js Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between f4fe24e and 1589bf3.

📒 Files selected for processing (1)
  • health/micro-ui/web/core/install-deps.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
health/micro-ui/web/core/install-deps.sh

[style] 25-25: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)

🔇 Additional comments (2)
health/micro-ui/web/core/install-deps.sh (2)

10-17: LGTM! Well-structured function with proper error handling

The copy_file function is well implemented with appropriate error checking for both file existence and copy operations.


25-25: Improve command output efficiency

The echo commands can be simplified as suggested in the previous review.

🧰 Tools
🪛 Shellcheck (0.10.0)

[style] 25-25: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)

health/micro-ui/web/core/install-deps.sh Outdated Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 1589bf3 and e7b54f8.

📒 Files selected for processing (1)
  • health/micro-ui/web/core/install-deps.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
health/micro-ui/web/core/install-deps.sh

[style] 25-25: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)

🔇 Additional comments (3)
health/micro-ui/web/core/install-deps.sh (3)

25-25: 🛠️ Refactor suggestion

Improve status output formatting and reliability

The current command chain could fail silently and uses inefficient command substitution.

-echo "UI :: core " && echo "Branch: $(git branch --show-current)" && echo "$(git log -1 --pretty=%B)" && echo "installing packages" 
+# Print installation status
+{
+    echo "=== UI Core Setup ==="
+    echo "Branch: $BRANCH"
+    echo "Last commit:"
+    git log -1 --pretty=%B
+    echo "Status: Installing packages..."
+} || { echo "Error: Failed to print status"; exit 1; }

Likely invalid or redundant comment.

🧰 Tools
🪛 Shellcheck (0.10.0)

[style] 25-25: Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.

(SC2005)


3-5: 🛠️ Refactor suggestion

Improve script initialization and branch handling

Store the branch name in a variable to avoid multiple Git calls and ensure consistent message formatting.

-BRANCH="$(git branch --show-current)"
-
-echo "Main Branch: $BRANCH"
+# Store Git information
+BRANCH="$(git branch --show-current)"
+COMMIT_MSG="$(git log -1 --pretty=%B)"
+
+echo "Branch: $BRANCH"
+echo "Last commit: $COMMIT_MSG"

Likely invalid or redundant comment.


7-8: 🧹 Nitpick (assertive)

Improve directory setup structure

Consider adding environment variables for better configurability and maintainability.

-INTERNALS="micro-ui-internals"
-cd ..
+# Configuration
+ROOT_DIR="${ROOT_DIR:-..}"
+INTERNALS="${INTERNALS:-micro-ui-internals}"
+SRC_DIR="${SRC_DIR:-src}"
+
+cd "$ROOT_DIR" || { echo "Error: Failed to change to $ROOT_DIR directory"; exit 1; }

Likely invalid or redundant comment.

health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
health/micro-ui/web/core/install-deps.sh Show resolved Hide resolved
Swathi-eGov and others added 3 commits December 9, 2024 11:53
#1989)

* updated changeQueryName for planfacilityserach as residingBoundaries is changed to multiselect dropdown

* fixed length change issue
@jagankumar-egov jagankumar-egov changed the title Console v0.3 changes HCM Admin Console v0.3 & Microplan v0.1 Release UI Code changes Dec 9, 2024
nabeelmd-eGov and others added 2 commits December 9, 2024 14:06
Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (1)

Line range hint 861-884: Handle errors properly in the fetchData function

The catch block is empty, which can suppress errors and make debugging difficult.

Update the catch block to handle exceptions appropriately:

  } catch (error) {
- }
+   console.error(error);
+   setLoader(false);
+   setIsValidation(false);
+   setIsError(true);
+   setShowToast({ key: "error", label: t("HCM_VALIDATION_FAILED"), transitionTime: 5000 });
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between e7b54f8 and 81a3cec.

📒 Files selected for processing (1)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (16 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (1)

Pattern **/*.js: check

🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js

[error] 63-63: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)


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


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

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

(lint/correctness/noChildrenProp)


[error] 1218-1218: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)


[error] 1230-1238: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)


[error] 1239-1249: 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 (8)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (8)

63-63: 🛠️ Refactor suggestion

Use Number.parseInt instead of global parseInt for consistency

ES2015 moved some globals into the Number namespace. Using Number.parseInt improves clarity and consistency.

Apply this diff:

-    return keyParam ? parseInt(keyParam) : 1;
+    return keyParam ? Number.parseInt(keyParam) : 1;
🧰 Tools
🪛 Biome (1.9.4)

[error] 63-63: Use Number.parseInt instead of the equivalent global.

ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.parseInt instead.

(lint/style/useNumberNamespace)


69-69: 🛠️ Refactor suggestion

Rename setprojectType to setProjectType for naming consistency

The setter function setprojectType should follow camelCase convention. Rename it to setProjectType and update all its usages for consistency.

Apply this diff:

-const [projectType , setprojectType] = useState(props?.props?.projectType)
+const [projectType , setProjectType] = useState(props?.props?.projectType)

...

-useEffect(() =>{
-  setprojectType(props?.props?.projectType);
+useEffect(() =>{
+  setProjectType(props?.props?.projectType);
 }, [props?.props?.projectType])

Also applies to: 109-111


71-71: 🧹 Nitpick (assertive)

Remove commented-out code to enhance readability

The commented-out code is unnecessary and can be removed to keep the codebase clean.

Apply this diff:

-// const projectType = props?.props?.projectType;

231-238: ⚠️ Potential issue

Ensure the filtered array has elements before accessing index [0]

Accessing the first element without checking if the array is non-empty can lead to undefined errors.

Consider adding a check before accessing:

const facilityData = Schemas?.MdmsRes?.[CONSOLE_MDMS_MODULENAME]?.adminSchema?.filter(
  (item) => item.title === "facility" && item.campaignType === "all"
);
const facility = facilityData?.length ? await convertIntoSchema(facilityData[0]) : null;

Repeat similar checks for boundary and user to ensure robustness.


260-269: 🧹 Nitpick (assertive)

Remove commented-out code within filterByUpdateFlag function

Cleaning up commented-out code improves code clarity and maintainability.

Apply this diff:

    const filterByUpdateFlag = (schemaProperties) => {
      return Object.keys(schemaProperties).filter(
        (key) => {
-          // if (parentId) {
-          //   return schemaProperties[key].isUpdate === true;
-          // }
          return schemaProperties[key].isUpdate !== true;
        }
      );
    };

1217-1217: 🛠️ Refactor suggestion

Avoid passing children via props; nest them inside the component instead

Passing children as a prop is not recommended in React. Instead, nest the child elements within the component for better clarity.

Refactor the code as follows:

-  children={[
-    <div>
-      {type === "boundary"
-        ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_TEXT")
-        : type === "facilityWithBoundary"
-        ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_TEXT")
-        : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_TEXT")}
-    </div>,
-  ]}
+>
+  <div>
+    {type === "boundary"
+      ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_TEXT")
+      : type === "facilityWithBoundary"
+      ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_TEXT")
+      : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_TEXT")}
+  </div>
🧰 Tools
🪛 Biome (1.9.4)

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

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

(lint/correctness/noChildrenProp)


1218-1224: ⚠️ Potential issue

Add a unique key prop to elements in the children array

When rendering an array of elements, each should have a unique key prop to help React identify them.

Apply this diff:

  children={[
-    <div>
+    <div key="popup-content">
      {type === "boundary"
        ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_TEXT")
        : type === "facilityWithBoundary"
        ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_TEXT")
        : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_TEXT")}
    </div>,
  ]}
🧰 Tools
🪛 Biome (1.9.4)

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


1230-1250: ⚠️ Potential issue

Include key props for elements in footerChildren array

Each element in the footerChildren array should have a unique key prop to prevent rendering issues.

Apply this diff:

    footerChildren={[
+     <Button
+       key="cancel-button"
        type={"button"}
        size={"large"}
        variation={"secondary"}
        label={t("HCM_CAMPAIGN_UPLOAD_CANCEL")}
        onClick={() => {
          setShowPopUp(false);
        }}
      />,
+     <Button
+       key="download-button"
        type={"button"}
        size={"large"}
        variation={"primary"}
        icon={"FileDownload"}
        label={getDownloadLabel()}
        title={t("HCM_CAMPAIGN_DOWNLOAD_TEMPLATE")}
        onClick={() => {
          downloadTemplate(), setShowPopUp(false);
        }}
      />,
    ]}
🧰 Tools
🪛 Biome (1.9.4)

[error] 1230-1238: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)


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

Copy link
Contributor

@nipunarora-eGov nipunarora-eGov left a comment

Choose a reason for hiding this comment

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

Based on High level review, these are the points/ tech debts I can thought of:

  1. Consistency in localization module names → some having (prefix) → It should be configurable if required
  2. UI master for Pop and Plan Inboxes
  3. Using common components wherever customizations have been made
  4. Enhance the multiselect dropdown component → use the same from UI-components in boundary screens
  5. Re-design/Cleanup of assumption and formula flow as the current code has gotten very complex and unreadable for a new dev
  6. Using Redux for global states instead of context API
  7. In many screens duplicate API calls are made due to multiple unnecessary re-renders and state changes which trigger API calls. We need to fix this
  8. Writing a wrapper over react-data-table library's Table component and publishing as part of ui-components package
  9. Reworking plan and pop inboxes with help of UI masters(stuffs like button icons, order of action buttons, some validations logics are hard coded) we can extract those to in mdms masters
  10. We should to keep a CONSTANTS file in UI so we can import that and use instead of hardcoding actions, user role codes etc....

nipunarora-eGov
nipunarora-eGov previously approved these changes Dec 9, 2024
Copy link
Contributor

@nipunarora-eGov nipunarora-eGov left a comment

Choose a reason for hiding this comment

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

Added my observations/tech debts that I could think of at the moment.

@jagankumar-egov jagankumar-egov merged commit b3c48dc into master Dec 9, 2024
3 of 4 checks passed
@jagankumar-egov jagankumar-egov deleted the master-pull branch December 9, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.