Grafana Schema: Extend the VariableHide enum (#110579)

* feat: extend the `VariableHide` enum with a new option

* feat: extend the `VariableHide` for v1
This commit is contained in:
Levente Balogh
2025-09-08 09:08:09 +02:00
committed by GitHub
parent 1fd4611487
commit 2f558e8cb7
11 changed files with 26 additions and 21 deletions
@@ -684,8 +684,8 @@ VariableSort: "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAs
VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged" VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing). // Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
// Determine the origin of the adhoc variable filter // Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard" FilterOrigin: "dashboard"
@@ -243,8 +243,8 @@ lineage: schemas: [{
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged") #VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing). // Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type") #VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options // Sort variable options
// Accepted values are: // Accepted values are:
@@ -243,8 +243,8 @@ lineage: schemas: [{
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged") #VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing). // Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type") #VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options // Sort variable options
// Accepted values are: // Accepted values are:
@@ -688,8 +688,8 @@ VariableSort: "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAs
VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged" VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing). // Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
// Determine the origin of the adhoc variable filter // Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard" FilterOrigin: "dashboard"
@@ -1282,14 +1282,15 @@ func NewDashboardVariableOption() *DashboardVariableOption {
} }
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing). // Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
// +k8s:openapi-gen=true // +k8s:openapi-gen=true
type DashboardVariableHide string type DashboardVariableHide string
const ( const (
DashboardVariableHideDontHide DashboardVariableHide = "dontHide" DashboardVariableHideDontHide DashboardVariableHide = "dontHide"
DashboardVariableHideHideLabel DashboardVariableHide = "hideLabel" DashboardVariableHideHideLabel DashboardVariableHide = "hideLabel"
DashboardVariableHideHideVariable DashboardVariableHide = "hideVariable" DashboardVariableHideHideVariable DashboardVariableHide = "hideVariable"
DashboardVariableHideInControlsMenu DashboardVariableHide = "inControlsMenu"
) )
// Options to config when to refresh a variable // Options to config when to refresh a variable
+2 -2
View File
@@ -239,8 +239,8 @@ lineage: schemas: [{
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged") #VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing). // Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type") #VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options // Sort variable options
// Accepted values are: // Accepted values are:
@@ -47,6 +47,7 @@ export enum VariableHide {
dontHide, dontHide,
hideLabel, hideLabel,
hideVariable, hideVariable,
inControlsMenu,
} }
export interface AdHocVariableFilter { export interface AdHocVariableFilter {
@@ -246,12 +246,13 @@ export enum VariableRefresh {
/** /**
* Determine if the variable shows on dashboard * Determine if the variable shows on dashboard
* Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing). * Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
*/ */
export enum VariableHide { export enum VariableHide {
dontHide = 0, dontHide = 0,
hideLabel = 1, hideLabel = 1,
hideVariable = 2, hideVariable = 2,
inControlsMenu = 3,
} }
/** /**
@@ -1039,8 +1039,8 @@ export const defaultVariableOption = (): VariableOption => ({
}); });
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing). // Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
export type VariableHide = "dontHide" | "hideLabel" | "hideVariable"; export type VariableHide = "dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu";
export const defaultVariableHide = (): VariableHide => ("dontHide"); export const defaultVariableHide = (): VariableHide => ("dontHide");
@@ -18,6 +18,7 @@ export enum VariableHide {
dontHide, dontHide,
hideLabel, hideLabel,
hideVariable, hideVariable,
inControlsMenu,
} }
export interface VariableModel extends Omit<raw.VariableModel, 'datasource'> { export interface VariableModel extends Omit<raw.VariableModel, 'datasource'> {
+5 -4
View File
@@ -766,13 +766,14 @@ const (
) )
// Determine if the variable shows on dashboard // Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing). // Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
type VariableHide int64 type VariableHide int64
const ( const (
VariableHideDontHide VariableHide = 0 VariableHideDontHide VariableHide = 0
VariableHideHideLabel VariableHide = 1 VariableHideHideLabel VariableHide = 1
VariableHideHideVariable VariableHide = 2 VariableHideHideVariable VariableHide = 2
VariableHideInControlsMenu VariableHide = 3
) )
// Option to be selected in a variable. // Option to be selected in a variable.