Users can add product analytics visualizations to custom dashboards before the feature is onboarded
Problem to solve
On projects that don't have Product Analytics enabled / onboarded users can still create custom dashboards.
The problem is that in the dashboard editor they can pick from Product Analytics visualizations even thought the feature is not ready.
Steps to reproduce
- Create a project.
- Open the Analytics dashboards view.
- Follow the prompt to enable custom dashboards.
- Go back to the Analytics dashboards view.
- Create a new dashboard and select from the available visualziations.
Screenshots
Proposed solutions
- Only list the built-in PA visualizations if the feature has been at least enabled and perhaps onboarded.
-
Improve the error messaging to let the user know why they are seeing this.- Can be implemented as part of Display a helpful error when the instance fails... (#430067).
Implementation plan
backend
- Update the available visualizations GraphQL endpoint to only return builtin Product Analytics visualizations if the feature is enabled and has been onboarded.
- This can be done by passing
current_user
to::ProductAnalytics::Visualization.for
call inVisualizationsResolver
and conditionally appending the built-in visualizations eg.
- This can be done by passing
- visualizations << builtin_visualizations
+
+ if container.product_analytics_enabled? && container.product_analytics_onboarded?(user)
+ visualizations << builtin_visualizations
+ end
- Update applicable specs.
Edited by Halil Coban