Schema: Change how origin filters are added to AdHocVariable (#106086)

* refactor origin filters schema

* add canary version

* update schema

* fix failing tests

* refactor

* remove autogenerated import

* tests

* maintain only dashboard originated filters

* refactor

* refactor

* Schema: Persist defaultValue for groupBy in schema (#106542)

* persist defaultValue for groupBy in schema

* fix

* type

* refactor

* refactor

* bump scenes
This commit is contained in:
Victor Marin
2025-06-16 11:15:00 +03:00
committed by GitHub
parent f974cb12b5
commit ffc16ee072
14 changed files with 118 additions and 102 deletions
@@ -692,8 +692,7 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
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"
FilterOrigin: "dashboard"
// FIXME: should we introduce this? --- Variable value option
VariableValueOption: {
@@ -696,8 +696,7 @@ VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
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"
FilterOrigin: "dashboard"
// FIXME: should we introduce this? --- Variable value option
VariableValueOption: {
@@ -1673,14 +1673,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"`
Origin *DashboardFilterOrigin `json:"origin,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 string `json:"origin,omitempty"`
// @deprecated
Condition *string `json:"condition,omitempty"`
}
@@ -1691,14 +1691,8 @@ func NewDashboardAdHocFilterWithLabels() *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"
)
const DashboardFilterOrigin = "dashboard"
// Define the MetricFindValue type
// +k8s:openapi-gen=true
@@ -7,13 +7,17 @@ package apis
import (
"fmt"
"github.com/grafana/grafana-app-sdk/app"
"github.com/grafana/grafana-app-sdk/resource"
v0alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
v1beta1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
v2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1"
)
var ()
var appManifestData = app.ManifestData{
AppName: "dashboard",
Group: "dashboard.grafana.app",