Skip to content

Commit 2f558e8

Browse files
Grafana Schema: Extend the VariableHide enum (#110579)
* feat: extend the `VariableHide` enum with a new option * feat: extend the `VariableHide` for v1
1 parent 1fd4611 commit 2f558e8

File tree

11 files changed

+26
-21
lines changed

11 files changed

+26
-21
lines changed

apps/dashboard/kinds/v2beta1/dashboard_spec.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ VariableSort: "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAs
684684
VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
685685

686686
// Determine if the variable shows on dashboard
687-
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
688-
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
687+
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
688+
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
689689

690690
// Determine the origin of the adhoc variable filter
691691
FilterOrigin: "dashboard"

apps/dashboard/pkg/apis/dashboard/v0alpha1/dashboard_kind.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ lineage: schemas: [{
243243
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
244244

245245
// Determine if the variable shows on dashboard
246-
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
247-
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
246+
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
247+
#VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
248248

249249
// Sort variable options
250250
// Accepted values are:

apps/dashboard/pkg/apis/dashboard/v1beta1/dashboard_kind.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ lineage: schemas: [{
243243
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
244244

245245
// Determine if the variable shows on dashboard
246-
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
247-
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
246+
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
247+
#VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
248248

249249
// Sort variable options
250250
// Accepted values are:

apps/dashboard/pkg/apis/dashboard/v2beta1/dashboard_spec.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ VariableSort: "disabled" | "alphabeticalAsc" | "alphabeticalDesc" | "numericalAs
688688
VariableRefresh: *"never" | "onDashboardLoad" | "onTimeRangeChanged"
689689

690690
// Determine if the variable shows on dashboard
691-
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
692-
VariableHide: *"dontHide" | "hideLabel" | "hideVariable"
691+
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
692+
VariableHide: *"dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu"
693693

694694
// Determine the origin of the adhoc variable filter
695695
FilterOrigin: "dashboard"

apps/dashboard/pkg/apis/dashboard/v2beta1/dashboard_spec_gen.go

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kinds/dashboard/dashboard_kind.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ lineage: schemas: [{
239239
#VariableRefresh: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="never|onDashboardLoad|onTimeRangeChanged")
240240

241241
// Determine if the variable shows on dashboard
242-
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
243-
#VariableHide: 0 | 1 | 2 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable") @grafana(TSVeneer="type")
242+
// Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
243+
#VariableHide: 0 | 1 | 2 | 3 @cuetsy(kind="enum",memberNames="dontHide|hideLabel|hideVariable|inControlsMenu") @grafana(TSVeneer="type")
244244

245245
// Sort variable options
246246
// Accepted values are:

packages/grafana-data/src/types/templateVars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export enum VariableHide {
4747
dontHide,
4848
hideLabel,
4949
hideVariable,
50+
inControlsMenu,
5051
}
5152

5253
export interface AdHocVariableFilter {

packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,13 @@ export enum VariableRefresh {
246246

247247
/**
248248
* Determine if the variable shows on dashboard
249-
* Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing).
249+
* Accepted values are 0 (show label and value), 1 (show value only), 2 (show nothing), 3 (show under the controls dropdown menu).
250250
*/
251251
export enum VariableHide {
252252
dontHide = 0,
253253
hideLabel = 1,
254254
hideVariable = 2,
255+
inControlsMenu = 3,
255256
}
256257

257258
/**

packages/grafana-schema/src/schema/dashboard/v2beta1/types.spec.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,8 @@ export const defaultVariableOption = (): VariableOption => ({
10391039
});
10401040

10411041
// Determine if the variable shows on dashboard
1042-
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing).
1043-
export type VariableHide = "dontHide" | "hideLabel" | "hideVariable";
1042+
// Accepted values are `dontHide` (show label and value), `hideLabel` (show value only), `hideVariable` (show nothing), `inControlsMenu` (show in a drop-down menu).
1043+
export type VariableHide = "dontHide" | "hideLabel" | "hideVariable" | "inControlsMenu";
10441044

10451045
export const defaultVariableHide = (): VariableHide => ("dontHide");
10461046

packages/grafana-schema/src/veneer/dashboard.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export enum VariableHide {
1818
dontHide,
1919
hideLabel,
2020
hideVariable,
21+
inControlsMenu,
2122
}
2223

2324
export interface VariableModel extends Omit<raw.VariableModel, 'datasource'> {

0 commit comments

Comments
 (0)