Dashboard Schema V2: Support panel actions (#110842)

* support panel actions

* refactor

* add test; move action transformer to utils

* refactor so v2 headers and queryParams are just a simple record

* update open api

* update actions to be same shape accross all dashboard schemas and add validation on the backend

* cleanup

* update snapshot

* add tests to validation
This commit is contained in:
Haris Rozajac
2025-09-12 11:31:05 -06:00
committed by GitHub
parent ccc87a03f0
commit de01b3e209
24 changed files with 2808 additions and 25 deletions
@@ -1060,6 +1060,71 @@
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardAction": {
"type": "object",
"required": [
"type",
"title"
],
"properties": {
"confirmation": {
"type": "string"
},
"fetch": {
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardFetchOptions"
},
"infinity": {
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardInfinityOptions"
},
"oneClick": {
"type": "boolean"
},
"style": {
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardV2alpha1ActionStyle"
},
"title": {
"type": "string",
"default": ""
},
"type": {
"type": "string",
"default": ""
},
"variables": {
"type": "array",
"items": {
"default": {},
"allOf": [
{
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardActionVariable"
}
]
}
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardActionVariable": {
"type": "object",
"required": [
"key",
"name",
"type"
],
"properties": {
"key": {
"type": "string",
"default": ""
},
"name": {
"type": "string",
"default": ""
},
"type": {
"type": "string",
"default": ""
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardAdHocFilterWithLabels": {
"description": "Define the AdHocFilterWithLabels type",
"type": "object",
@@ -2062,6 +2127,47 @@
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardFetchOptions": {
"type": "object",
"required": [
"method",
"url"
],
"properties": {
"body": {
"type": "string"
},
"headers": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
},
"method": {
"type": "string",
"default": ""
},
"queryParams": {
"description": "These are 2D arrays of strings, each representing a key-value pair We are defining them this way because we can't generate a go struct that that would have exactly two strings in each sub-array",
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
},
"url": {
"type": "string",
"default": ""
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardFieldColor": {
"description": "Map a field to a color.",
"type": "object",
@@ -2088,6 +2194,18 @@
"description": "The data model used in Grafana, namely the data frame, is a columnar-oriented table structure that unifies both time series and table query results. Each column within this structure is called a field. A field can represent a single time series or table column. Field options allow you to change how the data is displayed in your visualizations.",
"type": "object",
"properties": {
"actions": {
"description": "Define interactive HTTP requests that can be triggered from data visualizations.",
"type": "array",
"items": {
"default": {},
"allOf": [
{
"$ref": "#/components/schemas/com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardAction"
}
]
}
},
"color": {
"description": "Panel color configuration",
"allOf": [
@@ -2427,6 +2545,52 @@
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardInfinityOptions": {
"type": "object",
"required": [
"method",
"url",
"datasourceUid"
],
"properties": {
"body": {
"type": "string"
},
"datasourceUid": {
"type": "string",
"default": ""
},
"headers": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
},
"method": {
"type": "string",
"default": ""
},
"queryParams": {
"description": "These are 2D arrays of strings, each representing a key-value pair We are defining them this way because we can't generate a go struct that that would have exactly two strings in each sub-array",
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string",
"default": ""
}
}
},
"url": {
"type": "string",
"default": ""
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardIntervalVariableKind": {
"description": "Interval variable kind",
"type": "object",
@@ -3735,6 +3899,14 @@
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardV2alpha1ActionStyle": {
"type": "object",
"properties": {
"backgroundColor": {
"type": "string"
}
}
},
"com.github.grafana.grafana.apps.dashboard.pkg.apis.dashboard.v2alpha1.DashboardV2alpha1FieldConfigSourceOverrides": {
"type": "object",
"required": [