Skip to content

Add Config Based Control to Enable Feature Preview Menu item.#9759

Closed
ImalshaD wants to merge 2 commits intowso2:masterfrom
ImalshaD:ImalshaD/conditional-feature-preview-modal
Closed

Add Config Based Control to Enable Feature Preview Menu item.#9759
ImalshaD wants to merge 2 commits intowso2:masterfrom
ImalshaD:ImalshaD/conditional-feature-preview-modal

Conversation

@ImalshaD
Copy link
Contributor

This pull request introduces a config-based "Feature Preview" menu item to the header user dropdown, allowing its visibility to be controlled via deployment configuration. The changes are focused on making the feature toggleable and integrating it into the UI configuration, state management, and rendering logic.

Feature Preview menu item integration:

  • Added showFeaturePreviewMenuItem property to the UI config interface (features/admin.core.v1/models/config.ts) and initial state (features/admin.core.v1/store/reducers/config.ts) to support toggling the Feature Preview menu item. [1] [2]
  • Updated config loading logic to read showFeaturePreviewMenuItem from deployment configuration (features/admin.core.v1/configs/app.ts).
  • Modified deployment config templates and mock files to include the new showFeaturePreviewMenuItem property (apps/console/src/public/deployment.config.json, apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2, modules/core/src/helpers/__mocks__/deployment.config.json). [1] [2] [3]

UI and rendering logic updates:

  • Integrated the showFeaturePreviewMenuItem state into the header component to conditionally render the Feature Preview menu item in the user dropdown (features/admin.core.v1/components/header.tsx). [1] [2] [3]

Documentation and release notes:

  • Added a changeset documenting the addition of config-based Feature Preview.

Copilot AI review requested due to automatic review settings March 13, 2026 03:09
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This PR introduces a configuration-based feature flag for the Feature Preview menu item. A new showFeaturePreviewMenuItem property is added across the deployment configuration, TypeScript interfaces, Redux store, and component layers to conditionally render the Feature Preview option in the header.

Changes

Cohort / File(s) Summary
Changeset & Configuration
.changeset/strong-fans-count.md, apps/console/java/.../deployment.config.json.j2, apps/console/src/public/deployment.config.json
Introduces patch version bumps and adds a new optional UI flag showFeaturePreviewMenuItem to deployment configurations, enabling conditional rendering of the Feature Preview menu item.
Configuration Model & State
features/admin.core.v1/models/config.ts, features/admin.core.v1/store/reducers/config.ts
Extends UIConfigInterface with optional showFeaturePreviewMenuItem property and initializes it in the common config reducer initial state.
Application Config Integration
features/admin.core.v1/configs/app.ts
Integrates the new showFeaturePreviewMenuItem field into the UI configuration object returned by Config.getUIConfig().
UI Component & Mocks
features/admin.core.v1/components/header.tsx, modules/core/src/helpers/__mocks__/deployment.config.json
Uses a Redux selector to conditionally render the Feature Preview menu item in the header; adds the flag to mock deployment configuration.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers the main implementation details with relevant file references and explains the feature, but does not follow the required template structure (missing Purpose, Related Issues/PRs sections, and Checklists). Use the repository's PR template structure with Purpose, Related Issues, Related PRs, and Checklist sections to ensure consistency and completeness.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding config-based control for the Feature Preview menu item, which aligns with all file modifications throughout the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Changeset Required ✅ Passed Changeset file .changeset/strong-fans-count.md exists with proper version bumps for required packages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a deployment-config-controlled toggle to show/hide the “Feature Preview” entry in the header user dropdown.

Changes:

  • Introduces showFeaturePreviewMenuItem in UI config model and reducer initial state.
  • Loads the new flag from deployment configuration and updates config templates/mocks.
  • Conditionally renders the “Feature Preview” menu item based on the new flag.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
modules/core/src/helpers/mocks/deployment.config.json Adds the new UI flag to mocked deployment config.
features/admin.core.v1/store/reducers/config.ts Extends initial UI reducer state with showFeaturePreviewMenuItem.
features/admin.core.v1/models/config.ts Extends UI config interface with the new optional flag.
features/admin.core.v1/configs/app.ts Reads showFeaturePreviewMenuItem from runtime deployment config.
features/admin.core.v1/components/header.tsx Uses the flag to conditionally render “Feature Preview” in the dropdown.
apps/console/src/public/deployment.config.json Adds the new UI flag to the public deployment config.
apps/console/java/.../deployment.config.json.j2 Adds templating support for the new flag in server-side generated config.
.changeset/strong-fans-count.md Documents the change for release/versioning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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: 1

🧹 Nitpick comments (1)
features/admin.core.v1/components/header.tsx (1)

701-701: Use a namespaced i18n key instead of a literal translation string.

"Feature Preview" should be mapped to a translation key in <namespace>:<key.path> format for consistency and localization coverage.

As per coding guidelines use i18next keys in the format <namespace>:<key.path>.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@features/admin.core.v1/components/header.tsx` at line 701, Replace the
literal translation string used in the ListItemText call — change t("Feature
Preview") in the header.tsx ListItemText usage to a namespaced i18next key like
t("admin.header.featurePreview"); update the corresponding i18n resource (e.g.,
JSON/YAML) to add the admin.header.featurePreview entry and ensure other usages
follow the <namespace>:<key.path> convention so the t(...) call uses the new
key.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@features/admin.core.v1/components/header.tsx`:
- Around line 104-106: The selector for showFeaturePreviewMenuItem should always
return a strict boolean and the i18n key for the label should use the file's
namespace format; update the useSelector call that produces
showFeaturePreviewMenuItem to coalesce the possibly-undefined config value into
a boolean (e.g., use `!!` or `?? false`) so the variable truly matches the
boolean type, and replace the plain t("Feature Preview") call with a
namespace-prefixed key consistent with this file (for example,
t("console:common.featurePreview") or the appropriate console:* path used
elsewhere) so translations follow the established pattern.

---

Nitpick comments:
In `@features/admin.core.v1/components/header.tsx`:
- Line 701: Replace the literal translation string used in the ListItemText call
— change t("Feature Preview") in the header.tsx ListItemText usage to a
namespaced i18next key like t("admin.header.featurePreview"); update the
corresponding i18n resource (e.g., JSON/YAML) to add the
admin.header.featurePreview entry and ensure other usages follow the
<namespace>:<key.path> convention so the t(...) call uses the new key.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 64f1ea1c-6a48-4075-bfbc-d985354e1351

📥 Commits

Reviewing files that changed from the base of the PR and between 26cf374 and d2c662b.

📒 Files selected for processing (8)
  • .changeset/strong-fans-count.md
  • apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2
  • apps/console/src/public/deployment.config.json
  • features/admin.core.v1/components/header.tsx
  • features/admin.core.v1/configs/app.ts
  • features/admin.core.v1/models/config.ts
  • features/admin.core.v1/store/reducers/config.ts
  • modules/core/src/helpers/__mocks__/deployment.config.json

Copy link
Contributor

@VivekVinushanth VivekVinushanth left a comment

Choose a reason for hiding this comment

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

Approving based on the logic to disable the component as a whole.
@brionmario @DonOmalVindula hope this is fine.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.01%. Comparing base (c8422c3) to head (d2c662b).
⚠️ Report is 25 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9759   +/-   ##
=======================================
  Coverage   56.01%   56.01%           
=======================================
  Files          42       42           
  Lines        1023     1023           
  Branches      247      231   -16     
=======================================
  Hits          573      573           
- Misses        416      450   +34     
+ Partials       34        0   -34     
Flag Coverage Δ
@wso2is/core 56.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ImalshaD
Copy link
Contributor Author

Closing this PR and Bringing the Changes with: #9767

@ImalshaD ImalshaD closed this Mar 13, 2026
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