Docs: Add variable topics - custom, constant, text box (#26471)
* moved some content into other topics * Update variable-value-tags.md * Update variable-selection-options.md * Update add-query-variable.md * Update templates-and-variables.md * Create add-custom-variable.md * Update menu.yaml * Update templates-and-variables.md * Update templates-and-variables.md * editing content * Create add-text-box-variable.md * added links * content updates * update-content * Update templates-and-variables.md * Update menu.yaml * Update add-constant-variable.md * Update add-constant-variable.md * Update docs/sources/variables/add-query-variable.md Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update docs/sources/variables/variable-value-tags.md Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update docs/sources/variables/variable-value-tags.md Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update docs/sources/variables/variable-value-tags.md Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -37,58 +37,9 @@ Query expressions are different for each data source. For more information, refe
|
||||
1. In the **Query** field, enter a query.
|
||||
- The query field varies according to your data source. Some data sources have custom query editors.
|
||||
- If you need more room in a single input field query editor, then hover your cursor over the lines in the lower right corner of the field and drag downward to expand.
|
||||
2. (optional) In the **Regex** field, type a regex expression to filter or capture specific parts of the names return by your data source query. To see examples, refer to [Filter variables with regex]({{< relref "filter-variables-with-regex.md" >}}).
|
||||
3. In the **Sort** list, select the sort order for values to be displayed in the dropdown list. The default option, **Disabled**, means that the order of options returned by your data source query will be used.
|
||||
|
||||
## Enter Selection Options
|
||||
|
||||
All selection options are optional, and they are off by default.
|
||||
|
||||
### Multi-value
|
||||
|
||||
If you turn this on, then the variable dropdown list allows users to select multiple options at the same time. For more information, refer to [Formatting multi-value variables]({{< relref "formatting-multi-value-variables.md" >}}).
|
||||
|
||||
### Include All option
|
||||
|
||||
Grafana adds an `All` option to the variable dropdown list. If a user selects this option, then all variable options are selected.
|
||||
|
||||
### Custom all value
|
||||
|
||||
This option is only visible if the **Include All option** is selected.
|
||||
|
||||
Enter regex, globs, or lucene syntax in the **Custom all value** field to define the value of the `All` option.
|
||||
|
||||
By default the `All` value includes all options in combined expression. This can become very long and can have performance problems. Sometimes it can be better to specify a custom all value, like a wildcard regex.
|
||||
|
||||
In order to have custom regex, globs, or lucene syntax in the **Custom all value** option, it is never escaped so you will have to think about what is a valid value for your data source.
|
||||
|
||||
## Enter Value groups/tags (experimental feature)
|
||||
|
||||
If you have many options in the dropdown for a multi-value variable, then you can use this feature to group the values into selectable tags.
|
||||
|
||||
{{< docs-imagebox img="/img/docs/v50/variable_dropdown_tags.png" max-width="300px" >}}
|
||||
|
||||
This feature is off by default. Click **Enabled** to turn on the feature.
|
||||
|
||||
### Tags query
|
||||
|
||||
Enter a data source query that should return a list of tags. The tags query returns a list of tags that each represent a group, and the tag values query returns a list of group members.
|
||||
|
||||
For example, the tags query could be a list of regions (Europe, Asia, Americas), and then if the user selects the Europe tag, then the tag values query would return a list of countries -- Sweden, Germany, France, and so on.
|
||||
|
||||
If you have a variable with a lot of values (say all the countries in the world), then this allows you to easily select a group of them. If the user selects the tag Europe, all the countries in Europe would be selected.
|
||||
|
||||
In this [example dashboard](https://play.grafana.org/d/ZUPhFVGGk/graphite-with-experimental-tags?orgId=1), the server variable has tags enabled.
|
||||
|
||||
### Tag values query
|
||||
|
||||
Enter a data source query that should return a list of values for a specified tag key. Use `$tag` in the query to refer the currently selected tag.
|
||||
|
||||
The `$tag` variable will have the value of the tag that the user chooses.
|
||||
|
||||
For example, if you have a Graphite query for tags, `regions.*`, that returns a list of regions. The the values query could be `regions.$tag.*`, which if the user chooses Europe would be interpolated to `regions.Europe.*`.
|
||||
|
||||
## Final steps
|
||||
|
||||
1. (optional) In the **Regex** field, type a regex expression to filter or capture specific parts of the names returned by your data source query. To see examples, refer to [Filter variables with regex]({{< relref "filter-variables-with-regex.md" >}}).
|
||||
1. In the **Sort** list, select the sort order for values to be displayed in the dropdown list. The default option, **Disabled**, means that the order of options returned by your data source query will be used.
|
||||
1. (optional) Enter [Selection Options]({{< relref "variable-selection-options.md" >}}).
|
||||
1. (optional) Enter [Value groups/tags]({{< relref "variable-value-tags.md" >}}).
|
||||
1. In **Preview of values**, Grafana displays a list of the current variable values. Review them to ensure they match what you expect.
|
||||
1. Click **Add** to add the variable to the dashboard.
|
||||
1. Click **Add** to add the variable to the dashboard.
|
||||
|
||||
Reference in New Issue
Block a user