Skip to content

FEATURE/2327 app configuration screen development #2385

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

Merged

Conversation

nabeelmd-eGov
Copy link
Contributor

@nabeelmd-eGov nabeelmd-eGov commented Apr 28, 2025

  • Fix App config redirection, implemented localisation fetch from env
  • revert add translation for app configuration screen

Choose the appropriate template for your PR:

Feature PR

Feature Request

JIRA ID

Module

Description

Related Issues


Bugfix PR

Bugfix Request

JIRA ID

Module

Description

Root Cause

Related Issues


Release PR

Summary by CodeRabbit

  • New Features
    • Added support for dynamically configuring the MDMS service endpoint based on global settings.
    • Updated navigation to include a new query parameter when selecting campaign features.
  • Improvements
    • Enhanced locale handling by treating locales as objects with value and label properties for better consistency.
    • Localisation management now adapts to enabled languages and modules from user session data, supporting multiple locales.
  • Bug Fixes
    • Removed redundant localisation data fetching to streamline configuration loading.

@nabeelmd-eGov nabeelmd-eGov requested a review from a team as a code owner April 28, 2025 09:28
Copy link
Contributor

coderabbitai bot commented Apr 28, 2025

📝 Walkthrough

Walkthrough

This set of changes updates several components within the campaign-manager module of the micro-UI. The updates include modifying how locale objects are handled (from strings to objects with value/label), dynamically configuring the MDMS service endpoint, refining the fetching and usage of MDMS data (including adding schema code and removing some modules), and enhancing localization logic to support dynamic and multiple locales. Navigation URLs are also updated to include new query parameters. No changes are made to the signatures or exports of public entities.

Changes

File(s) Change Summary
.../AppFeatures.js Adds a schema code option to the useCustomMDMS hook and appends a formId=default query parameter to navigation URLs.
.../AppConfigurationParentLayer.js Introduces a configurable MDMS context path for service requests, replacing the hardcoded endpoint with a dynamic one based on global config.
.../AppConfigurationWrapper.js Removes fetching of the "AppScreenLocalisationConfig" module from the useCustomMDMS hook call.
.../AppLocalisationTable.js Refactors locale handling from strings to objects with value and label properties throughout the component and its subcomponents.
.../AppLocalisationWrapper.js Updates locale and module handling to be dynamic, retrieves configuration from session storage, updates localization fetching logic, and exposes enabled modules via context.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppLocalisationWrapper
    participant SessionStorage
    participant MDMS
    participant AppLocalisationTable

    User->>AppLocalisationWrapper: Loads component
    AppLocalisationWrapper->>SessionStorage: Reads enabledModules, currentLocale
    AppLocalisationWrapper->>MDMS: Fetches AppScreenLocalisationConfig (with caching)
    AppLocalisationWrapper->>MDMS: Fetches localisation data (dynamic locale array)
    MDMS-->>AppLocalisationWrapper: Returns localisation data
    AppLocalisationWrapper->>AppLocalisationTable: Provides context (enabledModules, locales)
    User->>AppLocalisationTable: Interacts with locale tabs (now objects)
    AppLocalisationTable->>AppLocalisationWrapper: Updates/reads localization state
Loading

Possibly related PRs

Suggested reviewers

  • jagankumar-egov

Poem

In fields of code where locales play,
Strings became objects, brightening the way.
With schema codes and context paths anew,
The rabbit hops, bringing features through.
Dynamic tongues and modules now align,
Campaigns and configs in perfect design.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17b606f and 5c3214d.

📒 Files selected for processing (5)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/AppFeatures.js (2 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationTable.js (4 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.js`: check

**/*.js: check

  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationTable.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js
  • health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/AppFeatures.js
🧬 Code Graph Analysis (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationScreenParent/AppConfigurationParentLayer.js (1)
  • reqCriteriaForm (76-95)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationTable.js (2)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationScreenParent/AppLocalisationTable.js (4)
  • activeLocale (28-28)
  • availableLocales (27-27)
  • currentLocale (26-26)
  • columns (30-50)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (3)
  • currentLocale (40-40)
  • updateLocalization (45-50)
  • locState (35-35)
🪛 Biome (1.9.4)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js

[error] 22-22: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)


[error] 57-57: Use Number.POSITIVE_INFINITY instead of the equivalent global.

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

(lint/style/useNumberNamespace)


[error] 58-58: Use Number.POSITIVE_INFINITY instead of the equivalent global.

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

(lint/style/useNumberNamespace)

⏰ Context from checks skipped due to timeout of 10000ms (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
🔇 Additional comments (10)
health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationParentLayer.js (1)

185-187: Good use of configurable MDMS context path

The implementation of a configurable MDMS context path is a good practice. By retrieving the path from global configs with a fallback value, you've made the code more maintainable and adaptable to different environments.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppConfigurationWrapper.js (1)

273-273:

✅ Verification successful

Improved separation of concerns in MDMS data fetching

Removing the "AppScreenLocalisationConfig" from this hook call is good for separation of concerns, as the localization data is now handled by the AppLocalisationWrapper component.

Please verify that the AppLocalisationWrapper component properly fetches this localization data to ensure no functionality is lost.


🏁 Script executed:

#!/bin/bash
# Verify that AppLocalisationWrapper is fetching the localization config
rg --type js "AppScreenLocalisationConfig" -A 5 -B 5 health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/

Length of output: 7032


Verified localization fetching in AppLocalisationWrapper

The AppLocalisationWrapper component correctly retrieves AppScreenLocalisationConfig via the useCustomMDMS hook:

  • File: health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js
    Hook call includes [{ name: "AppScreenLocalisationConfig" }].
  • The select option returns data?.[MODULE_CONSTANTS]?.["AppScreenLocalisationConfig"]?.[0].

No functionality is lost.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/NewCampaignCreate/AppFeatures.js (2)

32-33: Added schema code for enhanced MDMS integration

Adding the schema code parameter to the useCustomMDMS hook aligns with the broader pattern of MDMS refinements in this PR.


77-79: Updated navigation with formId parameter

The URL now includes a formId parameter which supports the app configuration redesign feature.

health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/appConfigurationRedesign/AppLocalisationWrapper.js (6)

1-1: Updated imports for enhanced functionality.

The additions of useState and the Loader component improve the component's capabilities for state management and loading state visualization.

Also applies to: 3-3


39-40: Dynamic locale configuration from session storage.

Good improvement to retrieve language settings from session storage instead of hardcoding values, making the component more flexible and adaptable to user preferences.


42-44: Updated addMissingKey to utilize dynamic modules.

The function now correctly passes the dynamic enabledModules to the reducer, aligning with the previous changes for flexible localization.


68-70: Dynamic locale handling based on available languages.

The changes properly determine whether to use a single locale or multiple locales based on the contents of enabledModules, improving the flexibility of the localization system.

🧰 Tools
🪛 Biome (1.9.4)

[error] 70-70: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


80-91: Enhanced useEffect for localization data handling.

The effect now includes additional context data (current locale and enabled modules) when dispatching localization data to the reducer, ensuring consumers have access to complete information.


94-96: Context provider now includes enabledModules.

Exposing enabledModules through the context is a good improvement, allowing child components to access available languages without additional prop drilling.

@jagankumar-egov jagankumar-egov merged commit b9cab90 into console Apr 28, 2025
6 of 8 checks passed
@jagankumar-egov jagankumar-egov deleted the FEATURE/2327-app-configuration-screen-development branch April 28, 2025 09:40
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.

3 participants