Dashboard Controls: Fix schema transformation for link placement (#114630)
* fix: add missing transformation for scenes -> save model v2 * fix: link placement transformation on the backend between schemas * fix: update the openapi spec in the tests * tes: add tests for `transformSceneToSaveModelSchemaV2` * tests: extend conversion_test.go to cover link placements
This commit is contained in:
+1
@@ -70,6 +70,7 @@
|
||||
"title": "Documentation",
|
||||
"tooltip": "View documentation",
|
||||
"type": "link",
|
||||
"placement": "inControlsMenu",
|
||||
"url": "https://docs.example.com/dashboard-guide"
|
||||
},
|
||||
{
|
||||
|
||||
Vendored
+1
@@ -69,6 +69,7 @@
|
||||
"title": "Documentation",
|
||||
"tooltip": "View documentation",
|
||||
"type": "link",
|
||||
"placement": "inControlsMenu",
|
||||
"url": "https://docs.example.com/dashboard-guide"
|
||||
},
|
||||
{
|
||||
|
||||
Vendored
+2
-1
@@ -132,7 +132,8 @@
|
||||
"asDropdown": false,
|
||||
"targetBlank": true,
|
||||
"includeVars": false,
|
||||
"keepTime": false
|
||||
"keepTime": false,
|
||||
"placement": "inControlsMenu"
|
||||
},
|
||||
{
|
||||
"title": "Tag-based Link",
|
||||
|
||||
Vendored
+2
-1
@@ -137,7 +137,8 @@
|
||||
"asDropdown": false,
|
||||
"targetBlank": true,
|
||||
"includeVars": false,
|
||||
"keepTime": false
|
||||
"keepTime": false,
|
||||
"placement": "inControlsMenu"
|
||||
},
|
||||
{
|
||||
"title": "Tag-based Link",
|
||||
|
||||
@@ -376,6 +376,13 @@ func transformLinks(dashboard map[string]interface{}) []dashv2alpha1.DashboardDa
|
||||
}
|
||||
}
|
||||
|
||||
// Optional placement field - only set if present
|
||||
if placement, exists := linkMap["placement"]; exists {
|
||||
if placementStr, ok := placement.(string); ok {
|
||||
dashLink.Placement = &placementStr
|
||||
}
|
||||
}
|
||||
|
||||
result = append(result, dashLink)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,6 +548,7 @@ func convertDashboardLink_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardDashboar
|
||||
out.TargetBlank = in.TargetBlank
|
||||
out.IncludeVars = in.IncludeVars
|
||||
out.KeepTime = in.KeepTime
|
||||
out.Placement = in.Placement
|
||||
}
|
||||
|
||||
func convertDataLink_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardDataLink, out *dashv2beta1.DashboardDataLink) {
|
||||
|
||||
@@ -565,6 +565,7 @@ func convertDashboardLink_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardDashboard
|
||||
out.TargetBlank = in.TargetBlank
|
||||
out.IncludeVars = in.IncludeVars
|
||||
out.KeepTime = in.KeepTime
|
||||
out.Placement = in.Placement
|
||||
}
|
||||
|
||||
func convertDataLink_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardDataLink, out *dashv2alpha1.DashboardDataLink) {
|
||||
|
||||
Reference in New Issue
Block a user