insights: add support for language stats insights to graphql
Created by: chwarwick
Currently graphql only provides metadata about the language stats (pie chart) insight, which the webapp then uses to form a search query and tabulate the results in client.
Add the capability for an insightView
to run the search query and return a series for each language returned with a single "current" datapoint.
Out of scope: Tracking multiple datapoints over time addressed in this issue
Example:
query GetInsightView($id: ID){
insightViews(id: $id) {
nodes {
...InsightDataNode
__typename
}
__typename
}
}
fragment InsightDataNode on InsightView {
id
dataSeries {
...InsightDataSeries
__typename
}
__typename
}
fragment InsightDataSeries on InsightsSeries {
seriesId
label
points {
dateTime
value
__typename
}
__typename
}
Response:
{
"data": {
"insightViews": {
"nodes": [
{
"id": "{VIEW_ID}",
"dataSeries": [
{
"seriesId": "Go",
"label": "Go",
"points": [
{
"dateTime": "2021-11-22T00:00:00Z",
"value": 6000,
"__typename": "InsightDataPoint"
}
],
"__typename": "InsightsSeries"
},
{
"seriesId": "TypeScript",
"label": "TypeScript",
"points": [
{
"dateTime": "2021-11-22T00:00:00Z",
"value": 2500,
"__typename": "InsightDataPoint"
}
],
"__typename": "InsightsSeries"
},
{
"seriesId": "Java",
"label": "Java",
"points": [
{
"dateTime": "2021-11-22T00:00:00Z",
"value": 3000,
"__typename": "InsightDataPoint"
}
],
"__typename": "InsightsSeries"
}
],
"__typename": "InsightView"
}
],
"__typename": "InsightViewConnection"
}
}
}