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

  1. Create a project.
  2. Open the Analytics dashboards view.
  3. Follow the prompt to enable custom dashboards.
  4. Go back to the Analytics dashboards view.
  5. Create a new dashboard and select from the available visualziations.

Screenshots

image

Proposed solutions

Implementation plan

backend 2️⃣

  • 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 in VisualizationsResolver and conditionally appending the built-in visualizations eg.
-      visualizations << builtin_visualizations
+
+      if container.product_analytics_enabled? && container.product_analytics_onboarded?(user)
+        visualizations << builtin_visualizations
+      end
  • Update applicable specs.
Edited by Halil Coban