Skip to content

Insights/contexts edit mutations

Administrator requested to merge insights/contexts-edit-mutations into main

Created by: coury-clark

Closes https://github.com/sourcegraph/sourcegraph/issues/33381 Stacked on https://github.com/sourcegraph/sourcegraph/pull/33818

Adds search context filters to the insights line chart mutations. This doesn't perform any validations that the contexts exist or are otherwise valid.

Test plan

Create mutation

mutation create ($input:LineChartSearchInsightInput!) {
  createLineChartSearchInsight(input:$input){
    view {
      id
      defaultFilters {
        searchContexts
        includeRepoRegex
        excludeRepoRegex
      }
    }
  }
}
{
  "input":{
    "options": {
      "title": "abc"
    },
    "viewControls": {
      "filters": {
        "searchContexts": ["@dev/srcall"]
      }
    },
    "dataSeries": {
      "generatedFromCaptureGroups": true,
      "query": "file:go\\.mod$ go\\s*(\\d\\.\\d+) patterntype:regexp",
      "timeScope": {
        "stepInterval": {
          "unit": "MONTH",
          "value": 3
        }
      },
      "repositoryScope": {
        "repositories": ["github.com/sourcegraph/sourcegraph"]
      },
      "options": {
        "label": "mylabel",
        "color": "blue"
      }
    }
  }
}

Update mutation

mutation edit ($input:UpdateLineChartSearchInsightInput!) {
  updateLineChartSearchInsight(input:$input, id:"aW5zaWdodF92aWV3OiIyN2tnSDlObWRFaE00WkNsUlVYNzhac2tSUnci"){
    view {
      id
      defaultFilters {
        searchContexts
        includeRepoRegex
        excludeRepoRegex
      }
    }
  }
}
{
  "data": {
    "updateLineChartSearchInsight": {
      "view": {
        "id": "aW5zaWdodF92aWV3OiIyN2tnSDlObWRFaE00WkNsUlVYNzhac2tSUnci",
        "defaultFilters": {
          "searchContexts": [
            "@dev/srcall",
            "@dev/abc"
          ],
          "includeRepoRegex": null,
          "excludeRepoRegex": null
        }
      }
    }
  }
}

Merge request reports

Loading