mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add legend name to dataframes config (#32356)
This commit is contained in:
parent
9f2fa7c20c
commit
2a5279911f
@ -216,7 +216,7 @@ func parseResponse(value model.Value, query *PrometheusQuery) (plugins.DataQuery
|
||||
}
|
||||
frames = append(frames, data.NewFrame(name,
|
||||
data.NewField("time", nil, timeVector),
|
||||
data.NewField("value", tags, values)))
|
||||
data.NewField("value", tags, values).SetConfig(&data.FieldConfig{DisplayNameFromDS: name})))
|
||||
}
|
||||
queryRes.Dataframes = plugins.NewDecodedDataFrames(frames)
|
||||
|
||||
|
@ -182,6 +182,7 @@ func TestParseResponse(t *testing.T) {
|
||||
require.Len(t, decoded[0].Fields[1].Labels, 2)
|
||||
require.Equal(t, decoded[0].Fields[1].Labels.String(), "app=Application, tag2=tag2")
|
||||
require.Equal(t, decoded[0].Fields[1].Name, "value")
|
||||
require.Equal(t, decoded[0].Fields[1].Config.DisplayNameFromDS, "legend Application")
|
||||
|
||||
// Ensure the timestamps are UTC zoned
|
||||
testValue := decoded[0].Fields[0].At(0)
|
||||
|
Loading…
Reference in New Issue
Block a user