VolkovLabs / volkovlabs-dynamictext-panel

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

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

Closed HoniWhy closed 12 months ago

HoniWhy commented 12 months 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 12 months 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 12 months 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 12 months ago

@HoniWhy Thank you for confirming.