Add Config Based Control to Enable Feature Preview Menu item.#9759
Add Config Based Control to Enable Feature Preview Menu item.#9759ImalshaD wants to merge 2 commits intowso2:masterfrom
Conversation
📝 WalkthroughWalkthroughThis PR introduces a configuration-based feature flag for the Feature Preview menu item. A new Changes
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a deployment-config-controlled toggle to show/hide the “Feature Preview” entry in the header user dropdown.
Changes:
- Introduces
showFeaturePreviewMenuItemin 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.
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
.changeset/strong-fans-count.mdapps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2apps/console/src/public/deployment.config.jsonfeatures/admin.core.v1/components/header.tsxfeatures/admin.core.v1/configs/app.tsfeatures/admin.core.v1/models/config.tsfeatures/admin.core.v1/store/reducers/config.tsmodules/core/src/helpers/__mocks__/deployment.config.json
VivekVinushanth
left a comment
There was a problem hiding this comment.
Approving based on the logic to disable the component as a whole.
@brionmario @DonOmalVindula hope this is fine.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Closing this PR and Bringing the Changes with: #9767 |
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:
showFeaturePreviewMenuItemproperty 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]showFeaturePreviewMenuItemfrom deployment configuration (features/admin.core.v1/configs/app.ts).showFeaturePreviewMenuItemproperty (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:
showFeaturePreviewMenuItemstate 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: