Skip to content

Insights/context filter prototype

Administrator requested to merge insights/context-filter-prototype into main

Created by: coury-clark

Adds query filter arguments for search contexts to the InsightView resolver. Future PRs will add this to the edit schema, and add it to the just-in-time path, and the applied / default schema.

Test plan

query insightview{
  insightViews (filters:{searchContexts:["@dev/srcall"]}) {
    nodes {
      id
      appliedFilters {
        excludeRepoRegex
        includeRepoRegex
      }
      defaultFilters {
        excludeRepoRegex
        includeRepoRegex
      }
      dataSeriesDefinitions {
        ... on SearchInsightDataSeriesDefinition {
          query
        }
      }
      dataSeries {
        points {
          value
          dateTime
        }
      }
    }
  }
}

Capture group series

query insightview{
  insightViews (id:"aW5zaWdodF92aWV3OiIyN2hpcU51em9QVHVzZGxPWE9HRG9xS2xxUlgi", filters:{searchContexts:["@dev/hashicorp"]}) {
    nodes {
      id
      appliedFilters {
        excludeRepoRegex
        includeRepoRegex
      }
      defaultFilters {
        excludeRepoRegex
        includeRepoRegex
      }
      dataSeriesDefinitions {
        ... on SearchInsightDataSeriesDefinition {
          query
        }
      }
      dataSeries {
        label
        points {
          value
          dateTime
        }
      }
    }
  }
}
{
  "data": {
    "insightViews": {
      "nodes": [
        {
          "id": "aW5zaWdodF92aWV3OiIyN2hpcU51em9QVHVzZGxPWE9HRG9xS2xxUlgi",
          "appliedFilters": {
            "excludeRepoRegex": null,
            "includeRepoRegex": null
          },
          "defaultFilters": {
            "excludeRepoRegex": "",
            "includeRepoRegex": ""
          },
          "dataSeriesDefinitions": [
            {
              "query": "file:go\\.mod$ go\\s*(\\d\\.\\d+) patterntype:regexp"
            }
          ],
          "dataSeries": [
            {
              "label": "1.13",
              "points": [
                {
                  "value": 1,
                  "dateTime": "2021-05-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-06-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-07-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-08-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-09-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-10-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-11-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2021-12-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2022-01-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2022-02-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2022-03-12T00:00:00Z"
                },
                {
                  "value": 1,
                  "dateTime": "2022-04-12T00:00:00Z"
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

Merge request reports

Loading