Skip to content

insights: Add dashboardReferenceCount to InsightViews returned via the API

Administrator requested to merge insights/api/reference-count into main

Created by: CristinaBirkel

Closes https://github.com/sourcegraph/sourcegraph/issues/30031

Description

We want to be able to display the total number of dashboards an insight is on, (regardless of permissions.) This PR adds a dashboardReferenceCount to the InsightView object in GraphQL.

Testing Steps

Query for insight views and check that the dashboardReferenceCount value is what you expect. You can add/remove insights from dashboards to test that it goes up and down as well!

query { insightViews {
  nodes {
	id,
        dashboardReferenceCount,
        presentation {
        ... on LineChartInsightViewPresentation {
            title,
        },
        ... on PieChartInsightViewPresentation {
            title,
        }
     }
  }
}
}

Merge request reports

Loading