Skip to content

insights: add `relatedInsightsForFile` query

Administrator requested to merge insights/prototype-file-insights into main

Created by: leonore

closes #39122 (closed) stacked on top of #39190

a prototype as part of the core workflow work

Test plan

query relatedForFile {
  relatedInsightsForFile (input: { 
      repo: "github.com/sourcegraph/sourcegraph", 
      file:  "enterprise/internal/insights/query/streaming/decoder.go",
      revision: ""
  })
  {
    viewId 
    title 
  }
}

mutation massCreate {
    createLineChartSearchInsight (input: {
        options: {
            title: "insights select:file"
        },
        dataSeries: [{
            query: "insights select:file",
            options: {
                label: "query",
                lineColor: "var(--oc-red-7)"
        },
        repositoryScope: {
          repositories: [],
        },
        timeScope: {
           stepInterval: {
                  unit: MONTH,
                  value: 1
            }
        }
        }]
    })
    {
      view {
          id,
          dataSeriesDefinitions {
              ... on SearchInsightDataSeriesDefinition {
                  seriesId,
                  query
              }
          }
    }
}
}

result:

{
  "data": {
    "relatedInsightsForFile": [
      {
        "viewId": "2CGA15xQoDQE24wDmcu6RhIPwLC",
        "title": "insights select:file"
      }
    ]
  }
}

Merge request reports

Loading