Commit Graph

5 Commits

Author SHA1 Message Date
Dominik Prokop 825f8fc7ff
Dashboard migrations: Fix `span: 0` bug and panel ordering in v16 dashboard migration (#112051)
Fix span: 0 bug and panel ordering in v16 dashboard migration

Fix span: 0 handling to match frontend behavior by defaulting to DEFAULT_PANEL_SPAN.
Fix panel ordering issue by using stable sort instead of unstable sort.
Fix collapsed property handling to only set when input row has collapse property.
Add comprehensive test cases for span: 0 bug and collapsed property behavior.
Add sanitized test input file for span: 0 demo dashboard with generic values instead of internal Grafana infrastructure references.

All backend migration tests and frontend comparison tests pass.
2025-10-06 13:29:33 +02:00
Ivan Ortega Alba a72e02f88a
Fix dashboard migration discrepancies between backend and frontend implementations (use `toEqual`) (#110268)
**Highlights**

* **Single-version migrations**: add `targetVersion` to migrator & model, separate outputs, enforce exact version.
* **Datasource fixes**: include `apiVersion` in tests, empty-string → `{}`, preserve `{}` refs, drop unwanted defaults.
* **Panel defaults & nesting**: only top-level panels get defaults; preserve empty `transformations` context-aware; filter repeated panels.

* **Migration parity**

  * V16: collapsed rows, grid height parsing (`px`).
  * V17: omit `maxPerRow` when `minSpan=1`.
  * V19–V20: cleanup defaults (`targetBlank`, style).
  * V23–V24: template vars + table panel consistency.
  * V28: full singlestat/stat parity, mappings & color.
  * V30–V36: threshold logic, empty refs, nested targets.
* **Save-model cleanup**: replicate frontend defaults/filtering, drop null IDs, metadata, unused props.
* **Testing**: unified suites, dev dashboards (v42), full unit coverage for major migrations.

Co-authored-by: Ivan Ortega [ivanortegaalba@gmail.com](mailto:ivanortegaalba@gmail.com)
Co-authored-by: Dominik Prokop [dominik.prokop@grafana.com](mailto:dominik.prokop@grafana.com)
2025-09-24 12:20:25 +02:00
Dominik Prokop 7324087273
Dashboard migration: v14 Broken dash repro (#110405)
* Broken dash repro

* Fix V16 migration to preserve panels when rows array is empty

- Fixed bug where panels were deleted when migrating dashboards with empty rows array
- Updated v16.go to match frontend implementation behavior
- Added test case for empty rows scenario in v16_test.go
- Renamed test files to v16.empty-rows-and-panels-array.json for clarity
- All migration tests passing (419 test cases)
2025-09-01 13:02:59 +00:00
Ivan Ortega Alba a7e4447d0e
DashboardMigration: V16 was removing panels when repeatInteration is null (#110151) 2025-08-26 14:20:22 +02:00
Dominik Prokop 49739618fa
Dashboard Migrations v16: Grid layout migration (#109603)
* Migration to be verified: v17 Convert minSpan to maxPerRow in panels

* Address review comments: use Go idiom for variable naming and sort.Ints for sorting

* Migration to be verified: 16 Grid layout migration

* Refactor v17 and v19 migrations to use shared helper functions

* Address reviews comments

---------

Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-08-20 17:31:32 +00:00