86aa5dca11
* migrate to v19 * migrate to v18 * Migration to be verified: v17 Convert minSpan to maxPerRow in panels * Migration to be verified: 16 Grid layout migration * Refactor v17 and v19 migrations to use shared helper functions * Migration to be verified: 15 No-op migration for schema consistency * Migration to be verified: 14 Shared crosshair to graph tooltip migration * cleanup --------- Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com> Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
39 lines
978 B
Go
39 lines
978 B
Go
package schemaversion
|
|
|
|
// V14 migrates the sharedCrosshair boolean property to graphTooltip integer property.
|
|
// This migration converts the old boolean shared crosshair setting to the new integer-based
|
|
// graph tooltip setting for consistency with updated dashboard tooltip behavior.
|
|
|
|
// Example before migration:
|
|
// {
|
|
// "schemaVersion": 13,
|
|
// "title": "My Dashboard",
|
|
// "sharedCrosshair": true,
|
|
// "panels": [...]
|
|
// }
|
|
|
|
// Example after migration:
|
|
// {
|
|
// "schemaVersion": 14,
|
|
// "title": "My Dashboard",
|
|
// "graphTooltip": 1,
|
|
// "panels": [...]
|
|
// }
|
|
|
|
func V14(dashboard map[string]interface{}) error {
|
|
// Convert sharedCrosshair boolean to graphTooltip integer
|
|
sharedCrosshair := GetBoolValue(dashboard, "sharedCrosshair")
|
|
|
|
if sharedCrosshair {
|
|
dashboard["graphTooltip"] = 1
|
|
} else {
|
|
dashboard["graphTooltip"] = 0
|
|
}
|
|
|
|
// Remove the old sharedCrosshair property
|
|
delete(dashboard, "sharedCrosshair")
|
|
|
|
dashboard["schemaVersion"] = 14
|
|
return nil
|
|
}
|