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"
// Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// 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" | "inControlsMenu"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -243,8 +243,8 @@ lineage: schemas: [{
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
// Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
// 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 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options
// Accepted values are:
@@ -243,8 +243,8 @@ lineage: schemas: [{
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
// Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
// 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 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options
// Accepted values are:
@@ -688,8 +688,8 @@ VariableSort: "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAs
VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
// Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
// 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" | "inControlsMenu"
// Determine the origin of the adhoc variable filter
FilterOrigin: "dashboard"
@@ -1282,14 +1282,15 @@ func NewDashboardVariableOption() *DashboardVariableOption {
}
// 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
type DashboardVariableHide string
const (
DashboardVariableHideDontHide DashboardVariableHide = "dontHide"
DashboardVariableHideHideLabel DashboardVariableHide = "hideLabel"
DashboardVariableHideHideVariable DashboardVariableHide = "hideVariable"
DashboardVariableHideDontHide DashboardVariableHide = "dontHide"
DashboardVariableHideHideLabel DashboardVariableHide = "hideLabel"
DashboardVariableHideHideVariable DashboardVariableHide = "hideVariable"
DashboardVariableHideInControlsMenu DashboardVariableHide = "inControlsMenu"
)
// 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")
// Determine if the variable shows on dashboard
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
// 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 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
// Sort variable options
// Accepted values are:
@@ -47,6 +47,7 @@ export enum VariableHide {
dontHide,
hideLabel,
hideVariable,
inControlsMenu,
}
export interface AdHocVariableFilter {
@@ -246,12 +246,13 @@ export enum VariableRefresh {
/**
* 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 {
dontHide = 0,
hideLabel = 1,
hideVariable = 2,
inControlsMenu = 3,
}
/**
@@ -1039,8 +1039,8 @@ export const defaultVariableOption = (): VariableOption => ({
});
// Determine if the variable shows on dashboard
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
export type VariableHide = "dontHide" | "hideLabel" | "hideVariable";
// 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" | "inControlsMenu";
export const defaultVariableHide = (): VariableHide => ("dontHide");
@@ -18,6 +18,7 @@ export enum VariableHide {
dontHide,
hideLabel,
hideVariable,
inControlsMenu,
}
export interface VariableModel extends Omit<raw.VariableModel, 'datasource'> {
+5 -4
View File
@@ -766,13 +766,14 @@ const (
)
// 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
const (
VariableHideDontHide VariableHide = 0
VariableHideHideLabel VariableHide = 1
VariableHideHideVariable VariableHide = 2
VariableHideDontHide VariableHide = 0
VariableHideHideLabel VariableHide = 1
VariableHideHideVariable VariableHide = 2
VariableHideInControlsMenu VariableHide = 3
)
// Option to be selected in a variable.