mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 22:24:31 +08:00
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:
@ -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"
|
||||
```
|
||||
|
Reference in New Issue
Block a user