insights: return pie chart insights with their own presentation options
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 toinsight_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 bechart_type
or justtype
. Any thoughts here? - I added this
PresentationType
field to theInsightView
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 thepresentation
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
.