VolkovLabs / volkovlabs-dynamictext-panel

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

Questions about how to use Global Variable #146

Closed YoonSungHyun-Git closed 1 year ago

YoonSungHyun-Git commented 1 year ago

Hello,

I want to determine if grafana user is admin or not. However, the value is expressed only as 1. I wonder if the method of use is wrong.

{{variable "__user"}} -> value : 1

I wonder if admin can be determined.

mikhail-vl commented 1 year ago

@YoonSungHyun-inzent This is the correct syntax. I will update the documentation.

{{#if (contains (variable "{__user.login}") "admin")}}
  User is admin
{{else}}
  User is not admin
{{/if}}
mikhail-vl commented 1 year ago

Resolved in https://github.com/VolkovLabs/volkovlabs.io/pull/273 and added to the documentation.