DashboardSchemaV2: add missing allowCustomValue property in variables (#105416)

* add missing allowCustomValue property to variables in schema V2

* fix K8s Codegen Check

* updade snapshots for backend tests
This commit is contained in:
Sergej-Vlasov
2025-05-20 11:50:46 +01:00
committed by GitHub
parent a7922912fe
commit 03f1bb950b
14 changed files with 180 additions and 82 deletions
@@ -751,6 +751,7 @@ QueryVariableSpec: {
includeAll: bool | *false
allValue?: string
placeholder?: string
allowCustomValue: bool | *true
}
// Query variable kind
@@ -817,6 +818,7 @@ DatasourceVariableSpec: {
hide: VariableHide
skipUrlSync: bool | *false
description?: string
allowCustomValue: bool | *true
}
// Datasource variable kind
@@ -863,6 +865,7 @@ CustomVariableSpec: {
hide: VariableHide
skipUrlSync: bool | *false
description?: string
allowCustomValue: bool | *true
}
// Custom variable kind
@@ -904,6 +907,7 @@ AdhocVariableSpec: {
hide: VariableHide
skipUrlSync: bool | *false
description?: string
allowCustomValue: bool | *true
}
// Define the MetricFindValue type
@@ -1223,23 +1223,24 @@ func NewDashboardQueryVariableKind() *DashboardQueryVariableKind {
// Query variable specification
// +k8s:openapi-gen=true
type DashboardQueryVariableSpec struct {
Name string `json:"name"`
Current DashboardVariableOption `json:"current"`
Label *string `json:"label,omitempty"`
Hide DashboardVariableHide `json:"hide"`
Refresh DashboardVariableRefresh `json:"refresh"`
SkipUrlSync bool `json:"skipUrlSync"`
Description *string `json:"description,omitempty"`
Datasource *DashboardDataSourceRef `json:"datasource,omitempty"`
Query DashboardDataQueryKind `json:"query"`
Regex string `json:"regex"`
Sort DashboardVariableSort `json:"sort"`
Definition *string `json:"definition,omitempty"`
Options []DashboardVariableOption `json:"options"`
Multi bool `json:"multi"`
IncludeAll bool `json:"includeAll"`
AllValue *string `json:"allValue,omitempty"`
Placeholder *string `json:"placeholder,omitempty"`
Name string `json:"name"`
Current DashboardVariableOption `json:"current"`
Label *string `json:"label,omitempty"`
Hide DashboardVariableHide `json:"hide"`
Refresh DashboardVariableRefresh `json:"refresh"`
SkipUrlSync bool `json:"skipUrlSync"`
Description *string `json:"description,omitempty"`
Datasource *DashboardDataSourceRef `json:"datasource,omitempty"`
Query DashboardDataQueryKind `json:"query"`
Regex string `json:"regex"`
Sort DashboardVariableSort `json:"sort"`
Definition *string `json:"definition,omitempty"`
Options []DashboardVariableOption `json:"options"`
Multi bool `json:"multi"`
IncludeAll bool `json:"includeAll"`
AllValue *string `json:"allValue,omitempty"`
Placeholder *string `json:"placeholder,omitempty"`
AllowCustomValue bool `json:"allowCustomValue"`
}
// NewDashboardQueryVariableSpec creates a new DashboardQueryVariableSpec object.
@@ -1254,13 +1255,14 @@ func NewDashboardQueryVariableSpec() *DashboardQueryVariableSpec {
String: (func(input string) *string { return &input })(""),
},
},
Hide: DashboardVariableHideDontHide,
Refresh: DashboardVariableRefreshNever,
SkipUrlSync: false,
Query: *NewDashboardDataQueryKind(),
Regex: "",
Multi: false,
IncludeAll: false,
Hide: DashboardVariableHideDontHide,
Refresh: DashboardVariableRefreshNever,
SkipUrlSync: false,
Query: *NewDashboardDataQueryKind(),
Regex: "",
Multi: false,
IncludeAll: false,
AllowCustomValue: true,
}
}
@@ -1442,19 +1444,20 @@ 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"`
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"`
}
// NewDashboardDatasourceVariableSpec creates a new DashboardDatasourceVariableSpec object.
@@ -1472,10 +1475,11 @@ func NewDashboardDatasourceVariableSpec() *DashboardDatasourceVariableSpec {
String: (func(input string) *string { return &input })(""),
},
},
Multi: false,
IncludeAll: false,
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
Multi: false,
IncludeAll: false,
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
AllowCustomValue: true,
}
}
@@ -1551,29 +1555,31 @@ 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"`
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"`
}
// NewDashboardCustomVariableSpec creates a new DashboardCustomVariableSpec object.
func NewDashboardCustomVariableSpec() *DashboardCustomVariableSpec {
return &DashboardCustomVariableSpec{
Name: "",
Query: "",
Current: *NewDashboardVariableOption(),
Multi: false,
IncludeAll: false,
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
Name: "",
Query: "",
Current: *NewDashboardVariableOption(),
Multi: false,
IncludeAll: false,
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
AllowCustomValue: true,
}
}
@@ -1642,23 +1648,25 @@ func NewDashboardAdhocVariableKind() *DashboardAdhocVariableKind {
// Adhoc variable specification
// +k8s:openapi-gen=true
type DashboardAdhocVariableSpec struct {
Name string `json:"name"`
Datasource *DashboardDataSourceRef `json:"datasource,omitempty"`
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"`
Name string `json:"name"`
Datasource *DashboardDataSourceRef `json:"datasource,omitempty"`
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"`
}
// NewDashboardAdhocVariableSpec creates a new DashboardAdhocVariableSpec object.
func NewDashboardAdhocVariableSpec() *DashboardAdhocVariableSpec {
return &DashboardAdhocVariableSpec{
Name: "",
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
Name: "",
Hide: DashboardVariableHideDontHide,
SkipUrlSync: false,
AllowCustomValue: true,
}
}
@@ -513,8 +513,15 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardAdhocVariableSpec(ref common.Re
Format: "",
},
},
"allowCustomValue": {
SchemaProps: spec.SchemaProps{
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"name", "baseFilters", "filters", "defaultKeys", "hide", "skipUrlSync"},
Required: []string{"name", "baseFilters", "filters", "defaultKeys", "hide", "skipUrlSync", "allowCustomValue"},
},
},
Dependencies: []string{
@@ -1344,8 +1351,15 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardCustomVariableSpec(ref common.R
Format: "",
},
},
"allowCustomValue": {
SchemaProps: spec.SchemaProps{
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"name", "query", "current", "options", "multi", "includeAll", "hide", "skipUrlSync"},
Required: []string{"name", "query", "current", "options", "multi", "includeAll", "hide", "skipUrlSync", "allowCustomValue"},
},
},
Dependencies: []string{
@@ -1727,8 +1741,15 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardDatasourceVariableSpec(ref comm
Format: "",
},
},
"allowCustomValue": {
SchemaProps: spec.SchemaProps{
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"name", "pluginId", "refresh", "regex", "current", "options", "multi", "includeAll", "hide", "skipUrlSync"},
Required: []string{"name", "pluginId", "refresh", "regex", "current", "options", "multi", "includeAll", "hide", "skipUrlSync", "allowCustomValue"},
},
},
Dependencies: []string{
@@ -3403,8 +3424,15 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardQueryVariableSpec(ref common.Re
Format: "",
},
},
"allowCustomValue": {
SchemaProps: spec.SchemaProps{
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"name", "current", "hide", "refresh", "skipUrlSync", "query", "regex", "sort", "options", "multi", "includeAll"},
Required: []string{"name", "current", "hide", "refresh", "skipUrlSync", "query", "regex", "sort", "options", "multi", "includeAll", "allowCustomValue"},
},
},
Dependencies: []string{