EntityAPI: Save nested summary info in the SQL database (#61732)

This commit is contained in:
Ryan McKinley
2023-01-20 16:00:17 -08:00
committed by GitHub
parent c4090c579d
commit 624e5dbed2
14 changed files with 486 additions and 168 deletions
@@ -4,10 +4,8 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"strconv"
"github.com/grafana/grafana/pkg/infra/slugify"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/plugins"
)
@@ -58,10 +56,8 @@ func NewStaticDashboardSummaryBuilder(lookup DatasourceLookup, sanitize bool) mo
}
dashboardRefs := NewReferenceAccumulator()
url := fmt.Sprintf("/d/%s/%s", uid, slugify.Slugify(dash.Title))
summary.Name = dash.Title
summary.Description = dash.Description
summary.URL = url
for _, v := range dash.Tags {
summary.Labels[v] = ""
}
@@ -78,7 +74,6 @@ func NewStaticDashboardSummaryBuilder(lookup DatasourceLookup, sanitize bool) mo
}
p.Name = panel.Title
p.Description = panel.Description
p.URL = fmt.Sprintf("%s?viewPanel=%d", url, panel.ID)
p.Fields = make(map[string]interface{}, 0)
p.Fields["type"] = panel.Type
@@ -5,7 +5,6 @@
"graph": "",
"panel-tests": ""
},
"URL": "/d/graph-gradient-area-fills.json/panel-tests-graph-gradient-area-fills",
"fields": {
"schemaVersion": 18
},
@@ -14,7 +13,6 @@
"uid": "graph-gradient-area-fills.json#2",
"kind": "panel",
"name": "Req/s",
"URL": "/d/graph-gradient-area-fills.json/panel-tests-graph-gradient-area-fills?viewPanel=2",
"fields": {
"type": "graph"
},
@@ -33,7 +31,6 @@
"uid": "graph-gradient-area-fills.json#11",
"kind": "panel",
"name": "Req/s",
"URL": "/d/graph-gradient-area-fills.json/panel-tests-graph-gradient-area-fills?viewPanel=11",
"fields": {
"type": "graph"
},
@@ -52,7 +49,6 @@
"uid": "graph-gradient-area-fills.json#7",
"kind": "panel",
"name": "Memory",
"URL": "/d/graph-gradient-area-fills.json/panel-tests-graph-gradient-area-fills?viewPanel=7",
"fields": {
"type": "graph"
},
@@ -71,7 +67,6 @@
"uid": "graph-gradient-area-fills.json#10",
"kind": "panel",
"name": "Req/s",
"URL": "/d/graph-gradient-area-fills.json/panel-tests-graph-gradient-area-fills?viewPanel=10",
"fields": {
"type": "graph"
},
@@ -5,7 +5,6 @@
"graph-ng": "",
"panel-tests": ""
},
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips",
"fields": {
"schemaVersion": 28
},
@@ -14,7 +13,6 @@
"uid": "graph-shared-tooltips.json#4",
"kind": "panel",
"name": "two units",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=4",
"fields": {
"type": "timeseries"
},
@@ -33,7 +31,6 @@
"uid": "graph-shared-tooltips.json#13",
"kind": "panel",
"name": "Speed vs Temperature (XY)",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=13",
"fields": {
"type": "xychart"
},
@@ -62,7 +59,6 @@
"uid": "graph-shared-tooltips.json#2",
"kind": "panel",
"name": "Cursor info",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=2",
"fields": {
"type": "debug"
},
@@ -81,7 +77,6 @@
"uid": "graph-shared-tooltips.json#5",
"kind": "panel",
"name": "Only temperature",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=5",
"fields": {
"type": "timeseries"
},
@@ -100,7 +95,6 @@
"uid": "graph-shared-tooltips.json#9",
"kind": "panel",
"name": "Only Speed",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=9",
"fields": {
"type": "timeseries"
},
@@ -119,7 +113,6 @@
"uid": "graph-shared-tooltips.json#11",
"kind": "panel",
"name": "Panel Title",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=11",
"fields": {
"type": "timeseries"
},
@@ -138,7 +131,6 @@
"uid": "graph-shared-tooltips.json#8",
"kind": "panel",
"name": "flot panel (temperature)",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=8",
"fields": {
"type": "graph"
},
@@ -157,7 +149,6 @@
"uid": "graph-shared-tooltips.json#10",
"kind": "panel",
"name": "flot panel (no units)",
"URL": "/d/graph-shared-tooltips.json/panel-tests-shared-tooltips?viewPanel=10",
"fields": {
"type": "graph"
},
@@ -5,7 +5,6 @@
"graph": "",
"panel-tests": ""
},
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions",
"fields": {
"schemaVersion": 18
},
@@ -14,7 +13,6 @@
"uid": "graph-time-regions.json#2",
"kind": "panel",
"name": "Business Hours",
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions?viewPanel=2",
"fields": {
"type": "graph"
},
@@ -34,7 +32,6 @@
"uid": "graph-time-regions.json#4",
"kind": "panel",
"name": "Sunday's 20-23",
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions?viewPanel=4",
"fields": {
"type": "graph"
},
@@ -54,7 +51,6 @@
"uid": "graph-time-regions.json#3",
"kind": "panel",
"name": "Each day of week",
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions?viewPanel=3",
"fields": {
"type": "graph"
},
@@ -74,7 +70,6 @@
"uid": "graph-time-regions.json#5",
"kind": "panel",
"name": "05:00",
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions?viewPanel=5",
"fields": {
"type": "graph"
},
@@ -94,7 +89,6 @@
"uid": "graph-time-regions.json#7",
"kind": "panel",
"name": "From 22:00 to 00:30 (crossing midnight)",
"URL": "/d/graph-time-regions.json/panel-tests-graph-time-regions?viewPanel=7",
"fields": {
"type": "graph"
},
@@ -5,7 +5,6 @@
"graph": "",
"panel-tests": ""
},
"URL": "/d/graph_tests.json/panel-tests-graph",
"fields": {
"schemaVersion": 16
},
@@ -14,7 +13,6 @@
"uid": "graph_tests.json#1",
"kind": "panel",
"name": "No Data Points Warning",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=1",
"fields": {
"type": "graph"
},
@@ -34,7 +32,6 @@
"uid": "graph_tests.json#2",
"kind": "panel",
"name": "Datapoints Outside Range Warning",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=2",
"fields": {
"type": "graph"
},
@@ -54,7 +51,6 @@
"uid": "graph_tests.json#3",
"kind": "panel",
"name": "Random walk series",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=3",
"fields": {
"type": "graph"
},
@@ -74,7 +70,6 @@
"uid": "graph_tests.json#4",
"kind": "panel",
"name": "Millisecond res x-axis and tooltip",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=4",
"fields": {
"type": "graph"
},
@@ -93,7 +88,6 @@
{
"uid": "graph_tests.json#6",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=6",
"fields": {
"type": "text"
},
@@ -112,7 +106,6 @@
"uid": "graph_tests.json#5",
"kind": "panel",
"name": "2 yaxis and axis labels",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=5",
"fields": {
"type": "graph"
},
@@ -131,7 +124,6 @@
{
"uid": "graph_tests.json#7",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=7",
"fields": {
"type": "text"
},
@@ -150,7 +142,6 @@
"uid": "graph_tests.json#8",
"kind": "panel",
"name": "null value connected",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=8",
"fields": {
"type": "graph"
},
@@ -170,7 +161,6 @@
"uid": "graph_tests.json#10",
"kind": "panel",
"name": "null value null as zero",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=10",
"fields": {
"type": "graph"
},
@@ -189,7 +179,6 @@
{
"uid": "graph_tests.json#13",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=13",
"fields": {
"type": "text"
},
@@ -208,7 +197,6 @@
"uid": "graph_tests.json#9",
"kind": "panel",
"name": "Stacking value ontop of nulls",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=9",
"fields": {
"type": "graph"
},
@@ -227,7 +215,6 @@
{
"uid": "graph_tests.json#14",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=14",
"fields": {
"type": "text"
},
@@ -246,7 +233,6 @@
"uid": "graph_tests.json#12",
"kind": "panel",
"name": "Stacking all series null segment",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=12",
"fields": {
"type": "graph"
},
@@ -265,7 +251,6 @@
{
"uid": "graph_tests.json#15",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=15",
"fields": {
"type": "text"
},
@@ -284,7 +269,6 @@
"uid": "graph_tests.json#21",
"kind": "panel",
"name": "Null between points",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=21",
"fields": {
"type": "graph"
},
@@ -303,7 +287,6 @@
{
"uid": "graph_tests.json#22",
"kind": "panel",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=22",
"fields": {
"type": "text"
},
@@ -322,7 +305,6 @@
"uid": "graph_tests.json#20",
"kind": "panel",
"name": "Legend Table Single Series Should Take Minimum Height",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=20",
"fields": {
"type": "graph"
},
@@ -342,7 +324,6 @@
"uid": "graph_tests.json#16",
"kind": "panel",
"name": "Legend Table No Scroll Visible",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=16",
"fields": {
"type": "graph"
},
@@ -362,7 +343,6 @@
"uid": "graph_tests.json#17",
"kind": "panel",
"name": "Legend Table Should Scroll",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=17",
"fields": {
"type": "graph"
},
@@ -382,7 +362,6 @@
"uid": "graph_tests.json#18",
"kind": "panel",
"name": "Legend Table No Scroll Visible",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=18",
"fields": {
"type": "graph"
},
@@ -402,7 +381,6 @@
"uid": "graph_tests.json#19",
"kind": "panel",
"name": "Legend Table No Scroll Visible",
"URL": "/d/graph_tests.json/panel-tests-graph?viewPanel=19",
"fields": {
"type": "graph"
},
@@ -4,7 +4,6 @@
"gdev": "",
"panel-tests": ""
},
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks",
"fields": {
"schemaVersion": 19
},
@@ -13,7 +12,6 @@
"uid": "graph_y_axis.json#7",
"kind": "panel",
"name": "Data from 0 - 10K (unit short)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=7",
"fields": {
"type": "graph"
},
@@ -32,7 +30,6 @@
"uid": "graph_y_axis.json#5",
"kind": "panel",
"name": "Data from 0 - 10K (unit bytes metric)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=5",
"fields": {
"type": "graph"
},
@@ -51,7 +48,6 @@
"uid": "graph_y_axis.json#4",
"kind": "panel",
"name": "Data from 0 - 10K (unit bytes IEC)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=4",
"fields": {
"type": "graph"
},
@@ -70,7 +66,6 @@
"uid": "graph_y_axis.json#2",
"kind": "panel",
"name": "Data from 0 - 10K (unit short)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=2",
"fields": {
"type": "graph"
},
@@ -89,7 +84,6 @@
"uid": "graph_y_axis.json#3",
"kind": "panel",
"name": "Data from 0.0002 - 0.001 (unit short)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=3",
"fields": {
"type": "graph"
},
@@ -108,7 +102,6 @@
"uid": "graph_y_axis.json#6",
"kind": "panel",
"name": "Data from 12000 - 30000 (unit ms)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=6",
"fields": {
"type": "graph"
},
@@ -127,7 +120,6 @@
"uid": "graph_y_axis.json#9",
"kind": "panel",
"name": "Data from 0 - 1B (unit short)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=9",
"fields": {
"type": "graph"
},
@@ -146,7 +138,6 @@
"uid": "graph_y_axis.json#10",
"kind": "panel",
"name": "Data from 0 - 1B (unit bytes)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=10",
"fields": {
"type": "graph"
},
@@ -165,7 +156,6 @@
"uid": "graph_y_axis.json#8",
"kind": "panel",
"name": "Data from 12000 - 30000 (unit ms)",
"URL": "/d/graph_y_axis.json/panel-tests-graph-y-axis-ticks?viewPanel=8",
"fields": {
"type": "graph"
},