VolkovLabs / business-text

The Business Text panel plugin allows you to construct a text visualization template from the values of a dataset returned by a data source query.
https://volkovlabs.io
Apache License 2.0
83 stars 13 forks source link

Iterate through json with {{#each}} #198

Closed HoniWhy closed 1 year ago

HoniWhy commented 1 year ago

Hello! I'm having a hard time handling this kind of json:

{
  "data": [
    {
      "celery": true,
      "celerybeat": true,
      "daphne": true,
      "django": true,
      "mesh": true,
      "mongo": true,
      "nats": true,
      "nats-api": true,
      "nginx": true,
      "postgres": true,
      "redis": true
    }
  ]
}

Basically each column has a single value and i'd like to go through them with {{#each}} handlebar with no luck. Is there any easy way of doing this? Referencing each field like this feels wrong:

Label1: {{data.[0].smthg}}
Label2: {{data.[0].smthg}}
Label3: {{data.[0].smthg}}
Label4: {{data.[0].smthg}}

Surely there is a better way to handle this. I did some tinkering, and i'm pretty sure there is no direct way (plain grafana) of turning Labels into Rows with their Values being in the separate row. Perhaps there is some helper i'm not aware of?

mikhail-vl commented 1 year ago

@HoniWhy We have multiple examples in the documentation like https://volkovlabs.io/plugins/volkovlabs-dynamictext-panel/recipes/#iterate-through-all-fields-in-each-record

Let me know if it helps.

HoniWhy commented 1 year ago

Thanks for your help and continuous development of Dynamic Text plugin. I somehow misunderstood the example and missed "All Rows should be selected in the Panel options." part 🤦 This one is resolved

mikhail-vl commented 1 year ago

@HoniWhy Thank you for confirming.