Skip to content

insights: return pie chart insights with their own presentation options

Administrator requested to merge insights/api/include-langstats into main

Created by: CristinaBirkel

PR 1/2 for https://github.com/sourcegraph/sourcegraph/issues/26675

Description

This PR returns pie charts (langstats) insights as a part of the GraphQL response for the InsightView type. Specifically, it returns them with their own presentation, distinct from the LineChartInsightViewPresentation. I'll follow up with another PR to do the create/update mutations.

  • Added a presentation_type field to insight_view. Not sure if this is the best name, but it seemed to align with what we're calling it in the API. Other options might be chart_type or just type. Any thoughts here?
  • I added this PresentationType field to the InsightView response so that the frontend will be able to easily distinguish between these types without having to rely on inferring it from what's in the presentation object.
  • I also added an enum for the PresentationType which I figure we can add to as more types become available.

Testing Steps

If you've got langstats insights in your db, you should just be able to observe them through querying the API for insights and verifying that the presentationType is PIE and that the right fields are returned in presentation.

Merge request reports

Loading