Dashboards: Add join and customqueryparam template variable formatters (#107904)

* Update scenes lib

* update schema for customqueryparam formatter

* add docs for new formatters

* fix docs example

* sort alpha
This commit is contained in:
Josh Hunt
2025-07-14 17:08:06 +01:00
committed by GitHub
parent 403d6380fa
commit 12f05a8553
5 changed files with 49 additions and 18 deletions

View File

@ -94,6 +94,16 @@ String to interpolate: '${servers:glob}'
Interpolation result: '{test1,test2}'
```
### Join
Formats multi-valued variables with a custom delimiter. If no delimiter argument is supplied, they will be combined with `,`.
```bash
servers = ["test1", "test2"]
String to interpolate: '${servers:join:&}'
Interpolation result: "test1&test2"
```
### JSON
Formats variables with multiple values as a comma-separated string.
@ -134,6 +144,24 @@ String to interpolate: '${servers:pipe}'
Interpolation result: 'test1.|test2'
```
### Query parameters
Formats single- and multi-valued variables into their query parameter representation. Example: `var-foo=value1&var-foo=value2`
```bash
servers = ["test1", "test2"]
String to interpolate: '${servers:queryparam}'
Interpolation result: "var-servers=test1&var-servers=test2"
```
Use the `customqueryparam` formatter to customize how the query parameters are formatted. It accepts two optional arguments to specify the parameter name, and a value prefix.
```bash
servers = ["test1", "test2"]
String to interpolate: '${servers:customqueryparam:v-servers:x-}'
Interpolation result: "v-servers=x-test1&v-servers=x-test2"
```
### Raw
Doesn't apply any data source-specific formatting to the variable.
@ -194,13 +222,3 @@ servers = ["test1", "test2"]
String to interpolate: '${servers:text}'
Interpolation result: "test1 + test2"
```
### Query parameters
Formats single- and multi-valued variables into their query parameter representation. Example: `var-foo=value1&var-foo=value2`
```bash
servers = ["test1", "test2"]
String to interpolate: '${servers:queryparam}'
Interpolation result: "var-servers=test1&var-servers=test2"
```