[v10.1.x] DashboardSchema: Add options to VariableModel (#81112)

DashboardSchema: Add options to VariableModel (#79236)

* Add includeAll and regex fields to VariableModel  #67639

* Add allValue option to VariableModel

(cherry picked from commit f7fd8e6cd1)

Co-authored-by: Denis <7009699+someden@users.noreply.github.com>
This commit is contained in:
Selene
2024-01-23 11:54:09 -05:00
committed by GitHub
co-authored by Denis
parent 6582de0628
commit 42dad26bef
4 changed files with 78 additions and 0 deletions
+43
View File
@@ -149,6 +149,17 @@ const (
VariableRefreshN2 VariableRefresh = 2
)
// Defines values for VariableSort.
const (
VariableSortN0 VariableSort = 0
VariableSortN1 VariableSort = 1
VariableSortN2 VariableSort = 2
VariableSortN3 VariableSort = 3
VariableSortN4 VariableSort = 4
VariableSortN5 VariableSort = 5
VariableSortN6 VariableSort = 6
)
// Defines values for VariableType.
const (
VariableTypeAdhoc VariableType = "adhoc"
@@ -916,6 +927,9 @@ type VariableModel struct {
// Format to use while fetching all values from data source, eg: wildcard, glob, regex, pipe, etc.
AllFormat *string `json:"allFormat,omitempty"`
// Custom all value
AllValue *string `json:"allValue,omitempty"`
// Option to be selected in a variable.
Current *VariableOption `json:"current,omitempty"`
@@ -932,6 +946,9 @@ type VariableModel struct {
// Unique numeric identifier for the variable.
Id string `json:"id"`
// Whether all value option is available or not
IncludeAll *bool `json:"includeAll,omitempty"`
// Optional display name
Label *string `json:"label,omitempty"`
@@ -953,9 +970,24 @@ type VariableModel struct {
// `2`: Queries the data source when the dashboard time range changes.
Refresh *VariableRefresh `json:"refresh,omitempty"`
// Optional field, if you want to extract part of a series name or metric node segment.
// Named capture groups can be used to separate the display text and value.
Regex *string `json:"regex,omitempty"`
// Whether the variable value should be managed by URL query params or not
SkipUrlSync bool `json:"skipUrlSync"`
// Sort variable options
// Accepted values are:
// `0`: No sorting
// `1`: Alphabetical ASC
// `2`: Alphabetical DESC
// `3`: Numerical ASC
// `4`: Numerical DESC
// `5`: Alphabetical Case Insensitive ASC
// `6`: Alphabetical Case Insensitive DESC
Sort *VariableSort `json:"sort,omitempty"`
// Dashboard variable type
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).
@@ -986,6 +1018,17 @@ type VariableOption struct {
// `2`: Queries the data source when the dashboard time range changes.
type VariableRefresh int
// Sort variable options
// Accepted values are:
// `0`: No sorting
// `1`: Alphabetical ASC
// `2`: Alphabetical DESC
// `3`: Numerical ASC
// `4`: Numerical DESC
// `5`: Alphabetical Case Insensitive ASC
// `6`: Alphabetical Case Insensitive DESC
type VariableSort int
// Dashboard variable type
// `query`: Query-generated list of values such as metric names, server names, sensor IDs, data centers, and so on.
// `adhoc`: Key/value filters that are automatically added to all metric queries for a data source (Prometheus, Loki, InfluxDB, and Elasticsearch only).