Dashboard Controls: Allow displaying dashboard links (#110666)

* feat: add `placement` to dashboard links (v1)

* feat: add `placement` property for dashboard links (v2)

* refactor: rename the `DropdownVariableControls` to `DashboardControlsMenu`

* feat: make it possible to render links under the dashboard controls dropdown

* fix: update the v2beta1 (and remove changes from v2alpha1)

* fix: linting errors

* chore: update codegen

* fix: frontend unit tests

* tests(DashboardLinkRenderer): add tests

* fix: hide divider if not necessary

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

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update kinds/dashboard/dashboard_kind.cue

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update pkg/kinds/dashboard/dashboard_spec_gen.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update apps/dashboard/pkg/apis/dashboard/v2beta1/zz_generated.openapi.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update apps/dashboard/kinds/v2beta1/dashboard_spec.cue

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: remove "default" placement option for links (review note)

* feat: hide the <Stack> wrapper if there are no links or variables

---------

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Levente Balogh
2025-09-11 13:16:46 +02:00
committed by GitHub
co-authored by Dominik Prokop Copilot
parent 2e0fdb2a60
commit 273731ed8e
17 changed files with 478 additions and 61 deletions
@@ -272,6 +272,8 @@ type DashboardLink struct {
Tags []string `json:"tags"`
// If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards
AsDropdown bool `json:"asDropdown"`
// Placement can be used to display the link somewhere else on the dashboard other than above the visualisations.
Placement string `json:"placement,omitempty"`
// If true, the link will be opened in a new tab
TargetBlank bool `json:"targetBlank"`
// If true, includes current template variables values in the link as query params
@@ -285,6 +287,7 @@ func NewDashboardLink() *DashboardLink {
return &DashboardLink{
Tags: []string{},
AsDropdown: false,
Placement: DashboardLinkPlacement,
TargetBlank: false,
IncludeVars: false,
KeepTime: false,
@@ -299,6 +302,10 @@ const (
DashboardLinkTypeDashboards DashboardLinkType = "dashboards"
)
// Dashboard Link placement. Defines where the link should be displayed.
// - "inControlsMenu" renders the link in bottom part of the dashboard controls dropdown menu
const DashboardLinkPlacement = "inControlsMenu"
// Transformations allow to manipulate data returned by a query before the system applies a visualization.
// Using transformations you can: rename fields, join time series data, perform mathematical operations across queries,
// use the output of one transformation as the input to another transformation, etc.