Schema: Add origin property to AdHocFilterWithLabels (#104320)

* add origin to AdHocFilterWithLabels

* typo

* fix

* use singular for FilterOrigin

* run ./hack/update-codegen.sh

* add canary scenes to verify typechecks

* update dashboard schema json snapshot

* fix

* fix

* update canaries

* fix

* bump scenes version
This commit is contained in:
Victor Marin
2025-04-24 11:13:17 +03:00
committed by GitHub
parent e6414a6690
commit faa33e30a9
11 changed files with 64 additions and 21 deletions

View File

@ -704,6 +704,10 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// Determine the origin of the adhoc variable filter
// Accepted values are `dashboard` (filter originated from dashboard), or `scope` (filter originated from scope).
FilterOrigin: "dashboard" | "scope"
// FIXME: should we introduce this? --- Variable value option
VariableValueOption: {
label: string
@ -915,6 +919,7 @@ AdHocFilterWithLabels: {
keyLabel?: string
valueLabels?: [...string]
forceEdit?: bool
origin?: FilterOrigin
// @deprecated
condition?: string
}

View File

@ -294,6 +294,8 @@ var _ resource.ListObject = &DashboardList{}
// Copy methods for all subresource types
// DeepCopy creates a full deep copy of DashboardStatus
func (s *DashboardStatus) DeepCopy() *DashboardStatus {
cpy := &DashboardStatus{}

View File

@ -294,6 +294,8 @@ var _ resource.ListObject = &DashboardList{}
// Copy methods for all subresource types
// DeepCopy creates a full deep copy of DashboardStatus
func (s *DashboardStatus) DeepCopy() *DashboardStatus {
cpy := &DashboardStatus{}

View File

@ -708,6 +708,10 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// Determine the origin of the adhoc variable filter
// Accepted values are `dashboard` (filter originated from dashboard), or `scope` (filter originated from scope).
FilterOrigin: "dashboard" | "scope"
// FIXME: should we introduce this? --- Variable value option
VariableValueOption: {
label: string
@ -919,6 +923,7 @@ AdHocFilterWithLabels: {
keyLabel?: string
valueLabels?: [...string]
forceEdit?: bool
origin?: FilterOrigin
// @deprecated
condition?: string
}

View File

@ -1665,13 +1665,14 @@ func NewDashboardAdhocVariableSpec() *DashboardAdhocVariableSpec {
// Define the AdHocFilterWithLabels type
// +k8s:openapi-gen=true
type DashboardAdHocFilterWithLabels struct {
Key string `json:"key"`
Operator string `json:"operator"`
Value string `json:"value"`
Values []string `json:"values,omitempty"`
KeyLabel *string `json:"keyLabel,omitempty"`
ValueLabels []string `json:"valueLabels,omitempty"`
ForceEdit *bool `json:"forceEdit,omitempty"`
Key string `json:"key"`
Operator string `json:"operator"`
Value string `json:"value"`
Values []string `json:"values,omitempty"`
KeyLabel *string `json:"keyLabel,omitempty"`
ValueLabels []string `json:"valueLabels,omitempty"`
ForceEdit *bool `json:"forceEdit,omitempty"`
Origin *DashboardFilterOrigin `json:"origin,omitempty"`
// @deprecated
Condition *string `json:"condition,omitempty"`
}
@ -1681,6 +1682,16 @@ func NewDashboardAdHocFilterWithLabels() *DashboardAdHocFilterWithLabels {
return &DashboardAdHocFilterWithLabels{}
}
// Determine the origin of the adhoc variable filter
// Accepted values are `dashboard` (filter originated from dashboard), or `scope` (filter originated from scope).
// +k8s:openapi-gen=true
type DashboardFilterOrigin string
const (
DashboardFilterOriginDashboard DashboardFilterOrigin = "dashboard"
DashboardFilterOriginScope DashboardFilterOrigin = "scope"
)
// Define the MetricFindValue type
// +k8s:openapi-gen=true
type DashboardMetricFindValue struct {

View File

@ -380,6 +380,12 @@ func schema_pkg_apis_dashboard_v2alpha1_DashboardAdHocFilterWithLabels(ref commo
Format: "",
},
},
"origin": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"condition": {
SchemaProps: spec.SchemaProps{
Description: "@deprecated",

View File

@ -11,6 +11,8 @@ import (
"github.com/grafana/grafana-app-sdk/app"
)
var ()
var appManifestData = app.ManifestData{
AppName: "dashboard",
Group: "dashboard.grafana.app",