insights: Add sorting metadata for insights
Created by: CristinaBirkel
Closes https://github.com/sourcegraph/sourcegraph/issues/34612 Closes https://github.com/sourcegraph/sourcegraph/issues/34653
Description
This PR adds in functionality for series options, namely sortMode
, sortDirection
and limit
. The implementation mirrors the way we're doing repo/context filtering.
- Adds
SeriesDisplayOptions
to the graphql schema, which containsSortOptions
andLimit
. This can be passed into theinsightViews
query as an additional argument, and is also required for updates. - Adds 3 new fields to the
insight_view
database schema forseries_sort_mode
,series_sort_direction
, andseries_limit
. These are all nullable, which I think makes sense. - Similar to default filters, insights will use overridden values if passed into
insightViews
, and will fall back on persisted data otherwise. As a fallback, defaults are usedRESULT_COUNT, DESC, 20
.
Test plan
This PR contains both FE/BE changes so the best way to test it out is via the UI! Use the new Sort and Limit filters on capture group insights (both recorded and JIT) and make sure the options are reflected in the chart.