VolkovLabs / volkovlabs-dynamictext-panel

Business Text Panel for @grafana
https://docs.volkovlabs.io
Apache License 2.0
78 stars 14 forks source link

Display data.data as JSON #191

Closed samant-rags closed 1 year ago

samant-rags commented 1 year ago

not sure if i am doing something wrong or is it a issue.

Data returned by my datasource (postgres) was not converting into JSON object .. shows as object but was not able to parse as JSON. Finally had to do line #3 to make it work. Wondering why : basically had to do data.data to get the proper json object

image

mikhail-vl commented 1 year ago

@samant-rags When you are using a custom Helper, I would recommend using the context (obj) to process and return the result, instead of using global data variable:

Screenshot 2023-07-09 at 12 04 55

If you are accessing data directly, it's a global variable that is the same as @root: https://volkovlabs.io/plugins/volkovlabs-dynamictext-panel/data/

Let me know if it helps.

mikhail-vl commented 1 year ago

Actually, our implemented json handler is doing exactly the same as yours, you just need to use the proper context.

{{{json data}}}