Dashboards: Make it possible to render variables under a drop-down (#109225)
* feat: extend the variable models * test(DropDownVariableControls): add tests * refactor(VariableControls): filter in the render method
This commit is contained in:
@@ -723,6 +723,7 @@ QueryVariableSpec: {
|
||||
refresh: VariableRefresh
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
showInControlsMenu?: bool
|
||||
query: DataQueryKind
|
||||
regex: string | *""
|
||||
sort: VariableSort
|
||||
@@ -735,6 +736,7 @@ QueryVariableSpec: {
|
||||
allowCustomValue: bool | *true
|
||||
staticOptions?: [...VariableOption]
|
||||
staticOptionsOrder?: "before" | "after" | "sorted"
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Query variable kind
|
||||
@@ -755,6 +757,7 @@ TextVariableSpec: {
|
||||
hide: VariableHide
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Text variable kind
|
||||
@@ -775,6 +778,7 @@ ConstantVariableSpec: {
|
||||
hide: VariableHide
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Constant variable kind
|
||||
@@ -802,6 +806,7 @@ DatasourceVariableSpec: {
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
allowCustomValue: bool | *true
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Datasource variable kind
|
||||
@@ -827,6 +832,7 @@ IntervalVariableSpec: {
|
||||
hide: VariableHide
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Interval variable kind
|
||||
@@ -849,6 +855,7 @@ CustomVariableSpec: {
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
allowCustomValue: bool | *true
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Custom variable kind
|
||||
@@ -871,6 +878,7 @@ GroupByVariableSpec: {
|
||||
hide: VariableHide
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Group variable kind
|
||||
@@ -894,6 +902,7 @@ AdhocVariableSpec: {
|
||||
skipUrlSync: bool | *false
|
||||
description?: string
|
||||
allowCustomValue: bool | *true
|
||||
showInControlsMenu?: bool
|
||||
}
|
||||
|
||||
// Define the MetricFindValue type
|
||||
|
||||
@@ -1223,6 +1223,7 @@ type DashboardQueryVariableSpec struct {
|
||||
Refresh DashboardVariableRefresh `json:"refresh"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
Query DashboardDataQueryKind `json:"query"`
|
||||
Regex string `json:"regex"`
|
||||
Sort DashboardVariableSort `json:"sort"`
|
||||
@@ -1349,13 +1350,14 @@ func NewDashboardTextVariableKind() *DashboardTextVariableKind {
|
||||
// Text variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardTextVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Query string `json:"query"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Query string `json:"query"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardTextVariableSpec creates a new DashboardTextVariableSpec object.
|
||||
@@ -1394,13 +1396,14 @@ func NewDashboardConstantVariableKind() *DashboardConstantVariableKind {
|
||||
// Constant variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardConstantVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardConstantVariableSpec creates a new DashboardConstantVariableSpec object.
|
||||
@@ -1439,20 +1442,21 @@ func NewDashboardDatasourceVariableKind() *DashboardDatasourceVariableKind {
|
||||
// Datasource variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardDatasourceVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
PluginId string `json:"pluginId"`
|
||||
Refresh DashboardVariableRefresh `json:"refresh"`
|
||||
Regex string `json:"regex"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
IncludeAll bool `json:"includeAll"`
|
||||
AllValue *string `json:"allValue,omitempty"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
Name string `json:"name"`
|
||||
PluginId string `json:"pluginId"`
|
||||
Refresh DashboardVariableRefresh `json:"refresh"`
|
||||
Regex string `json:"regex"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
IncludeAll bool `json:"includeAll"`
|
||||
AllValue *string `json:"allValue,omitempty"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardDatasourceVariableSpec creates a new DashboardDatasourceVariableSpec object.
|
||||
@@ -1497,18 +1501,19 @@ func NewDashboardIntervalVariableKind() *DashboardIntervalVariableKind {
|
||||
// Interval variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardIntervalVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Auto bool `json:"auto"`
|
||||
AutoMin string `json:"auto_min"`
|
||||
AutoCount int64 `json:"auto_count"`
|
||||
Refresh DashboardVariableRefresh `json:"refresh"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Auto bool `json:"auto"`
|
||||
AutoMin string `json:"auto_min"`
|
||||
AutoCount int64 `json:"auto_count"`
|
||||
Refresh DashboardVariableRefresh `json:"refresh"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardIntervalVariableSpec creates a new DashboardIntervalVariableSpec object.
|
||||
@@ -1552,18 +1557,19 @@ func NewDashboardCustomVariableKind() *DashboardCustomVariableKind {
|
||||
// Custom variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardCustomVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
IncludeAll bool `json:"includeAll"`
|
||||
AllValue *string `json:"allValue,omitempty"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
Name string `json:"name"`
|
||||
Query string `json:"query"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
IncludeAll bool `json:"includeAll"`
|
||||
AllValue *string `json:"allValue,omitempty"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardCustomVariableSpec creates a new DashboardCustomVariableSpec object.
|
||||
@@ -1601,15 +1607,16 @@ func NewDashboardGroupByVariableKind() *DashboardGroupByVariableKind {
|
||||
// GroupBy variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardGroupByVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
DefaultValue *DashboardVariableOption `json:"defaultValue,omitempty"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Name string `json:"name"`
|
||||
DefaultValue *DashboardVariableOption `json:"defaultValue,omitempty"`
|
||||
Current DashboardVariableOption `json:"current"`
|
||||
Options []DashboardVariableOption `json:"options"`
|
||||
Multi bool `json:"multi"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardGroupByVariableSpec creates a new DashboardGroupByVariableSpec object.
|
||||
@@ -1651,15 +1658,16 @@ func NewDashboardAdhocVariableKind() *DashboardAdhocVariableKind {
|
||||
// Adhoc variable specification
|
||||
// +k8s:openapi-gen=true
|
||||
type DashboardAdhocVariableSpec struct {
|
||||
Name string `json:"name"`
|
||||
BaseFilters []DashboardAdHocFilterWithLabels `json:"baseFilters"`
|
||||
Filters []DashboardAdHocFilterWithLabels `json:"filters"`
|
||||
DefaultKeys []DashboardMetricFindValue `json:"defaultKeys"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
Name string `json:"name"`
|
||||
BaseFilters []DashboardAdHocFilterWithLabels `json:"baseFilters"`
|
||||
Filters []DashboardAdHocFilterWithLabels `json:"filters"`
|
||||
DefaultKeys []DashboardMetricFindValue `json:"defaultKeys"`
|
||||
Label *string `json:"label,omitempty"`
|
||||
Hide DashboardVariableHide `json:"hide"`
|
||||
SkipUrlSync bool `json:"skipUrlSync"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
AllowCustomValue bool `json:"allowCustomValue"`
|
||||
ShowInControlsMenu *bool `json:"showInControlsMenu,omitempty"`
|
||||
}
|
||||
|
||||
// NewDashboardAdhocVariableSpec creates a new DashboardAdhocVariableSpec object.
|
||||
|
||||
@@ -526,6 +526,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardAdhocVariableSpec(ref common.Ref
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "baseFilters", "filters", "defaultKeys", "hide", "skipUrlSync", "allowCustomValue"},
|
||||
},
|
||||
@@ -1191,6 +1197,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardConstantVariableSpec(ref common.
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "query", "current", "hide", "skipUrlSync"},
|
||||
},
|
||||
@@ -1358,6 +1370,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardCustomVariableSpec(ref common.Re
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "query", "current", "options", "multi", "includeAll", "hide", "skipUrlSync", "allowCustomValue"},
|
||||
},
|
||||
@@ -1743,6 +1761,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardDatasourceVariableSpec(ref commo
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "pluginId", "refresh", "regex", "current", "options", "multi", "includeAll", "hide", "skipUrlSync", "allowCustomValue"},
|
||||
},
|
||||
@@ -2343,6 +2367,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardGroupByVariableSpec(ref common.R
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "current", "options", "multi", "hide", "skipUrlSync"},
|
||||
},
|
||||
@@ -2475,6 +2505,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardIntervalVariableSpec(ref common.
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "query", "current", "options", "auto", "auto_min", "auto_count", "refresh", "hide", "skipUrlSync"},
|
||||
},
|
||||
@@ -3250,6 +3286,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardQueryVariableSpec(ref common.Ref
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"query": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
@@ -4094,6 +4136,12 @@ func schema_pkg_apis_dashboard_v2beta1_DashboardTextVariableSpec(ref common.Refe
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"showInControlsMenu": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Type: []string{"boolean"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"name", "current", "query", "hide", "skipUrlSync"},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user