File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
public/app/features/panel Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
"github.com/grafana/grafana/pkg/util"
13
13
)
14
14
15
- func GetTestMetrics (c * middleware.Context ) {
15
+ func GetTestMetrics (c * middleware.Context ) Response {
16
16
from := c .QueryInt64 ("from" )
17
17
to := c .QueryInt64 ("to" )
18
18
maxDataPoints := c .QueryInt64 ("maxDataPoints" )
@@ -37,7 +37,7 @@ func GetTestMetrics(c *middleware.Context) {
37
37
result .Data [seriesIndex ].DataPoints = points
38
38
}
39
39
40
- c . JSON (200 , & result )
40
+ return Json (200 , & result )
41
41
}
42
42
43
43
func GetInternalMetrics (c * middleware.Context ) Response {
Original file line number Diff line number Diff line change @@ -200,6 +200,11 @@ class MetricsPanelCtrl extends PanelCtrl {
200
200
this . panel . snapshotData = result . data ;
201
201
}
202
202
203
+ if ( ! result || ! result . data ) {
204
+ console . log ( 'Data source query result invalid, missing data field:' , result ) ;
205
+ result = { data : [ ] } ;
206
+ }
207
+
203
208
return this . events . emit ( 'data-received' , result . data ) ;
204
209
}
205
210
You can’t perform that action at this time.
0 commit comments