Commit Graph

18 Commits

Author SHA1 Message Date
Alexa V 80e58efd46
Dashboard - Schema V2 Stateless variables (ds ref independent) (#102571)
* Create basic logic for stateless variables

* Refactor function to get DS from queries and variables

* Simplify code, remove unnecessary wrappers

* Fix typo

* improve naming

* Add unit test for variables

* Fix tests

* Add extra logic to keep backwards compatibility, variables can be used without dashboard scene

* Adjust logic for variables ds

* Refactor code, pass dsReferenceMap
2025-03-26 09:59:34 -06:00
Haris Rozajac 26acc66ea3
Dashboard - Schema V2 Stateless (ds ref independent) queries (#101661)
- Rename `initializeMapping` into `initializeElementMapping`
- Create new  `initializeDSReferencesMapping` to track queries without explicit datasources
- Fix panel datasource detection to use default datasource when none is specified
- Improve datasource resolution by searching for best match by query kind
- Add unit test

---------

Co-authored-by: alexandra vargas <alexa1866@gmail.com>
Co-authored-by: Alexa V <239999+axelavargas@users.noreply.github.com>
Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
2025-03-20 12:45:25 -06:00
Ivan Ortega Alba bfedf0b512
Dashboard: Redirect between `v1alpha1` and `v2alpha1` depending on stored version (#101292)
* wip: Create a proxy state manager to avoid complexity

* Read path redirecting

* add tests for unified dashboard API

* add tests

* Contemplate both formats in DashboardProxy

* Fix force old

* Fix tests for proxy

* catch errors

* Save as V2 when dynamic dashboard is enabled

* Improve tests

* Remove feature toggle

* Use kubernetesDashboards for e2e suite

* Fix issue when loading snapshots

* Fix typescript errors

* Integrate with backend conversion error

* Remove legacy annotation

* fix snapshot loading; lint

* Add missing hideTimeControls

* fix test

* make setupDashboardAPI to all suites

* refactor getDashboardAPI

* Add tests

* fix DashboardScenePage tests

* fix tests

* fix go tests

* Refactor to understand better the need of transforming to v2 to compare

* Fix detect changes logic

* yes status from schema gen

---------

Co-authored-by: alexandra vargas <alexa1866@gmail.com>
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-03-12 11:43:32 -06:00
Alexa V 53de9ea795
Dashboard: SchemaV2 - arbitrary strings - dual key (#100379)
* Create element panel lookup table

* When transforming to schema v2 get the element_identifier

* Add element identifier logic to layouts

* Retrieve element id in the serialization of each layout

* Keep ElementMapping updated when adding, removing panels

* Add basic unit test

* Wip: implement element mapping in serializer

* Remove Singleton

* Apply suggestions from code review

Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>

* bring back missing functions - poc works at this point

* Move getElementIdentifierForVizPanel to dashboardSceneGraph

* poc - don't keep elementMapping updated

* Move logic to layout type serializer

* Remove unused code and remove layout tests

* clean up code, remove unnecessary functions

* Fix issue with initializeMapping

* remove console errors

* Remove testing code from response transformers

* Add unit test for DashboardSceneSerializer

* reset file, change not needed

* Improve comments on getElementIDForPanel

---------

Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
2025-03-06 19:59:27 +02:00
Sergej-Vlasov d1dee968c3
Schema V2: Adjust quick_ranges in time settings and remove time_options (#100135)
* adjut quickRanges type in v2

* clean up unused time_options property

* remove deprecated time_options property on time picker

* add schema migration for time_options

* adjust test
2025-02-12 19:23:09 +00:00
Haris Rozajac f5d8f42635
Dashboard Scene: Fix unnecessary diffing (#100158)
* Fix unnecessary diffing

* use a diferent approach; update legacyId type

* fix test
2025-02-07 10:47:07 -07:00
Alexa V 30c8ac7108
Dashboard: Schema V2 - Remove Dashboard id from spec (#99590)
* Dashboard: Schema V2 - Remove Dashboard id from spec

* Fix issue with dashboard id used in examples and serializers for schema v2

* Fix snapshot test
2025-01-29 10:13:56 +01:00
Alexa V 8f3fd8f91d
Schema v2: Write Path Implement saveDashboard in v2 client API (#98263)
Create new function for save dashboards written in schema v2 and using the v2 api from k8s
2025-01-27 14:14:19 +01:00
Dominik Prokop 8e078315f0
Schema v2: Reason about new dashboard based on UID (#98879)
* Schema v2: Reason about new dashboard based on UID

* Fix test

* Alerting: respect isNew dashboard for legacy and new arch

* Translate untranslated strings

* Unify is new checks

* PanelInspectDrawer update

* typo fix

* on close test for panel inspect drawer

* Update public/app/features/alerting/unified/PanelAlertTabContent.tsx
2025-01-27 11:18:06 +01:00
Dominik Prokop daced46d27
Schema v2: Remove schemaVersion property (#99375)
* Schema v2: Remove schemaVersion property

* ah snap
2025-01-22 16:52:34 +01:00
Kévin Gomez 77f7ab27be
Use cog as a cli tool to generate code for kinds v2 schemas (#99044)
* Use cog as a cli tool to generate code for kinds v2 schemas

* Update imports to dashboard v2 package in frontend

* Ensure cog is installed before using it
2025-01-16 13:18:47 +01:00
Dominik Prokop 99e1780527
Revert "Schema v2: Reason about new dashboard based on UID (#98800)" (#98877)
This reverts commit 72846e3431.
2025-01-13 13:07:45 +01:00
Dominik Prokop 72846e3431
Schema v2: Reason about new dashboard based on UID (#98800)
* Schema v2: Reason about new dashboard based on UID

* Fix test
2025-01-13 12:16:35 +01:00
Haris Rozajac 6b03adbbb0
Dashboard V2: Snapshot variables and read snapshot (#98463)
* Introduce DashboardScenePageStateManagerLike interface

* Implement dash loader for handling v2 api

* Transformation improvements

* Update response transformer test

* v2 schema: Remove defaultOptionEnabled from ds variable schema

* v2 schema: Make annotations filter optional

* WIP render dashboard from v2 schema

* Force dashbaord scene for v2 api

* V2 schema -> scene meta transformation

* v2 api: Handle home dashboard

* Use correct api client in DashboardScenePage

* Correctly use v2 dashboard scene serializer

* Remove unnecesary type assertions

* Handle v2 dashboard not found

* Fix type

* Fix test

* Some more tests fix

* snapshot

* Add dashboard id annotation

* Nits

* Nits

* Rename v2 api

* Enable snapshot variables

* Support getSnapshotUrl() for v2 serializer

* fix

* Make metadata available in the serializer

* Test

* Decouple meta info

* State Manager: Extract snapshot loading into loadSnapshot

* Fix tests

* Add test for snapshot url

* Don't expose dashboardLoaderSrvV2

* Remove TODO

* Bubble up loading snapshot error to error boundary

* Fix test

---------

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
2025-01-09 08:14:41 -07:00
Ivan Ortega Alba 1a6312296e
Dashboard: Compute tracking info for schema V2 (#98271) 2025-01-02 18:33:16 +02:00
Dominik Prokop 746bde0fac
DashboardSceneSerializerLike: Update interface to support initial version and snapshot url (#98206)
* Make dashboard prompt ignoreChanges schema version independent

* Serializer: add interface for snapshot url retrieval

* Revert "Make dashboard prompt ignoreChanges schema version independent"

This reverts commit 65466c2ef1.

* Add dashbaord version to scene metadata

* Add tracking info

* Revert "Add tracking info"

This reverts commit 4c58c6687b.

---------

Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com>
2024-12-19 16:09:19 +01:00
Ivan Ortega Alba a06779614e
Implement detect changes tracking to V2 Schema (#98153)
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2024-12-19 13:00:59 +02:00
Dominik Prokop f8686be56a
Schema v2: Make DashboardScene accept v1 and v2 schema (#96931)
* WIP

* Refactor useSaveDashboard to make it dashboard type independent when used

* DashboardPrompt: makeit Dashboard type independent

* DashboardScene: accept both v1 and v2 schema

* Update save dashboard command interface

* Fix test

* Lint

* Refactor

* Add onSaveComplete to DashboardSceneSerializer

* Cleanup tests

* Remove unused code

* Refactor dashboard tracking information

* added a todo

* Fix betterer

* Update betterer results
2024-12-13 10:20:22 +01:00