Create a feature flag for dashboards v2#15601
Merged
bosiraphael merged 7 commits intomainfrom Nov 4, 2025
Merged
Conversation
...modules/page-layout/utils/__tests__/validate-and-transform-widget-configuration.util.spec.ts
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
Introduces a feature flag IS_DASHBOARD_V2_ENABLED to control access to new chart types (PIE, LINE, GAUGE) in the dashboard system.
Key changes:
- Added backend validation that prevents creating/updating widgets with v2 chart types when the feature flag is disabled
- Frontend disables v2 chart type selection when feature flag is not enabled
- Refactored
validateAndTransformWidgetConfigurationfunction signature to accept object parameter withisDashboardV2Enabledflag - Integrated
FeatureFlagServiceintoPageLayoutWidgetServiceto check feature flag during widget creation and updates - Comprehensive unit tests added for feature flag validation scenarios
- Removed unused
isWidgetConfigurationValidutility and its tests - Dev seeder sets the feature flag to
trueby default for development environments
Implementation quality:
- Clean separation of concerns with validation logic centralized
- Consistent v2 chart type definitions across frontend and backend (PIE, LINE, GAUGE)
- Backend properly validates against unauthorized API usage even if frontend is bypassed
- Good test coverage including edge cases for feature flag behavior
Confidence Score: 5/5
- This PR is safe to merge with no issues found
- The implementation is thorough and well-tested. The feature flag is properly integrated at both frontend and backend layers with appropriate validation. The refactoring from positional parameters to object parameters improves code clarity. All tests have been updated and new tests added for the feature flag scenarios. The changes follow the codebase patterns and maintain backward compatibility.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/twenty-server/src/engine/core-modules/page-layout/utils/validate-and-transform-widget-configuration.util.ts | 5/5 | Refactored to accept feature flag parameter, validates v2 chart types (PIE, LINE, GAUGE) require feature flag |
| packages/twenty-server/src/engine/core-modules/page-layout/services/page-layout-widget.service.ts | 5/5 | Integrated FeatureFlagService, checks feature flag before validating widget configurations in create and update methods |
| packages/twenty-front/src/modules/command-menu/pages/page-layout/components/ChartTypeSelectionSection.tsx | 5/5 | Uses feature flag hook to disable v2 chart types in UI when flag is disabled |
| packages/twenty-server/src/engine/core-modules/page-layout/utils/tests/validate-and-transform-widget-configuration.util.spec.ts | 5/5 | Updated all test cases to pass isDashboardV2Enabled parameter, added comprehensive feature flag tests |
Sequence Diagram
sequenceDiagram
participant User
participant Frontend
participant API
participant Service
participant FeatureFlag
participant Validation
User->>Frontend: Create/Update Widget with v2 chart type
Frontend->>Frontend: Check IS_DASHBOARD_V2_ENABLED
alt Feature disabled
Frontend->>User: Disable v2 chart options (PIE, LINE, GAUGE)
else Feature enabled
Frontend->>API: POST/PUT widget with v2 chart configuration
API->>Service: PageLayoutWidgetService.create/update()
Service->>FeatureFlag: isFeatureEnabled(IS_DASHBOARD_V2_ENABLED)
FeatureFlag-->>Service: boolean
Service->>Validation: validateAndTransformWidgetConfiguration({type, config, isDashboardV2Enabled})
alt V2 chart && feature disabled
Validation-->>Service: throw Error
Service-->>API: PageLayoutWidgetException
API-->>Frontend: 400 Error
else Valid configuration
Validation-->>Service: validatedConfig
Service->>Service: Insert/Update widget
Service-->>API: PageLayoutWidgetEntity
API-->>Frontend: Success
end
end
14 files reviewed, no comments
Contributor
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:1144 This environment will automatically shut down when the PR is closed or after 5 hours. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent users from creating v2 chart types via the api.
Only created unit tests and not integration tests (since it's not that important, and the v2 will be released soon), but tested via the api playground.