97 Commits

Author SHA1 Message Date
b30f501bff backendsrv: Implement optional URL path fetch sanitize (#106540)
* feat: Implement optional URL path sanitization in BackendSrv methods

* add comment

* revert

* remove namespace import from backendsrv

* change method to validatePath, remove query params and fragments

* Moved validatePath call into fetch and make it throw an error instead

* update pluginSettings tests

* prettier

* Update public/app/features/plugins/pluginSettings.ts

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>

* change name to validatePath

* fix other tests

* rename property in backend_srv tests

* rename to validatePath in backend_srv, add extra tests

* Move path validation into parseUrlFromOptions

* fix

* Add additional check

* Add test

---------

Co-authored-by: joshhunt <josh.hunt@grafana.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
2025-06-20 11:27:53 +01:00
ffc16ee072 Schema: Change how origin filters are added to AdHocVariable (#106086)
* refactor origin filters schema

* add canary version

* update schema

* fix failing tests

* refactor

* remove autogenerated import

* tests

* maintain only dashboard originated filters

* refactor

* refactor

* Schema: Persist defaultValue for groupBy in schema (#106542)

* persist defaultValue for groupBy in schema

* fix

* type

* refactor

* refactor

* bump scenes
2025-06-16 11:15:00 +03:00
f9fb9d268f Restore dashboards: Add API client endpoints (#106435)
* Dashboards: Add restore endpoints to the API

* Fix unified api

* Fix resource version

* Add tests

* Update api

* Update type guards

* Update comments

* Add missing type

* Cleanup

* Move spec checking logic to v1 client

* Handle mixed versions in deleted dbs list

* Update tests

* comment

* type
2025-06-12 15:49:55 +03:00
2b8c74de2e i18n: removes useTranslate hook (#106556)
* i18n: removes useTranslate hook

* chore: fix duplicate imports

* chore: fix import sorting and hook dependencies
2025-06-12 11:03:52 +02:00
7bfa78c6e6 I18n: Update eslint rule to catch some untranslated object properties (#105072) 2025-05-28 21:14:43 +01:00
4f18ad30c9 SchemaV2: Remove legacy rows from schema v2. (#105238)
* save transparent setting

* make sure we test both transparent and non transparent

* no more legacy rows

* schema changes

* Add testing, fix first row offset

* Remove legacy row from transform test

* Remove panel that's not present in layout

* Remove expects after removing the row, fix lint issues

* Remove unused commit

* update codegen

* update openapi snapshot

* Fix snapshot

* add missing default prop

* Fix repeating, fix first row, fix not flushing last row

* Use correct repeater

* fix lint, remove unused empty check

* update codegen

* update openapi test snapshot
2025-05-26 14:33:30 +02:00
d11d8ec111 Dashboards: Make serializer a single source of truth for passing k8s props on save (#105576)
* make serializer a single source of truth for passing k8s props on save

* remove resourceVersion when updating

* don't pass result.version to resourceVersion

* remove k8s update on saveCompleted from dash scene
2025-05-21 07:24:41 -06:00
03f1bb950b DashboardSchemaV2: add missing allowCustomValue property in variables (#105416)
* add missing allowCustomValue property to variables in schema V2

* fix K8s Codegen Check

* updade snapshots for backend tests
2025-05-20 11:50:46 +01:00
8cb9f0a36c Dashboard: Use metadata.generation for dash version in v1 (#105499) 2025-05-16 10:00:34 +03:00
da24ad06bd Provisioning: Hide full path for classic provisioing resources (#105440) 2025-05-15 16:01:12 +00:00
30c2a11a06 Dashboards V2 API: Ignore conversion status when the /dto response is V2 spec (#105381)
* Dashboards V2 API: Ignore conversion status when the /dto response is V2 spec

* fix lint
2025-05-15 14:00:07 +02:00
119d5897ea i18n: imports use @grafana/i18n (#105177)
* i18n: everything should target @grafana/i18n

* wip

* chore: updates after PR feedback

* Trigger build

* Trigger build

* Trigger build

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: revert all flaky tests

* chore: some incorrect usages of useTranslate
2025-05-15 09:17:14 +02:00
242cb8edbd Dashboards: Use string for AnnoKeyDashboardIsSnapshot (#105306) 2025-05-13 10:09:34 +03:00
719b5fe9cc Dashboards: Remove numeric folder id from annotation metadata (#105225) 2025-05-12 10:11:55 +03:00
1114d33936 Dashboard export: Allow exports by resource and in YAML format (#104149)
* Dashboard export: Allow YAML export

* use js-yaml to fix ci errors

* add yaml transformation in the "Copy to cilpboard"

* simplify

* new ui for resource exports

* simplify

* Don't show export mode for v2 dashboard

* Add metadata, apiVersion, add logic for export type resources

* i18n; switch title to as code

* update export as file button

* Remove managedFields from metadata export

* Remove metadata fields that are not needed for sharing externally

* Copy

* fix legacy mode

* address bugs

* Update public/app/features/dashboard-scene/sharing/ExportButton/ExportMenu.tsx

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>

* i18n

* improve classic mode; rename

* Update public/app/features/dashboard-scene/sharing/ShareExportTab.tsx

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

* change order

---------

Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
2025-05-01 09:06:07 -06:00
b09d79b21c K8s/Dashboard: Promote from alpha1 to beta1 (#104009) 2025-04-23 20:54:35 +03:00
af8a70bbab K8s/Permissions: Enable a grant-permissions annotation action to set default permissions (#102527)
* create permissions

* add key

* lint

* structure as a delayed callback

* legacy API hook

* merge main

* wired up

* and folders

* watch repos

* missing return statement

* Set the correct permissions

* add TestAfterCreatePermissionCreator

* do not add perms on folder create

* fix tests

* add annotation on create

* lint

* lint

* ensure we set permissions when the FT is disabled

* remove custom folder_storage

* fix lint

* change default

* lint

* lint

* fix: annotation

* ensure permissions are added on folder legacy

* remove folderstorage again

* fix tests

* add FT

* undo change to folder

* dashboard on create

* remove annotation for folder

* fix tests

* fix prepare after rebase

* fix tests

* fix tests

* fix tests

* lint

* address comments

* add test for prepareObjectForStorage

* add again skipIfMode as per comment

---------

Co-authored-by: Georges Chaudy <chaudyg@gmail.com>
2025-04-09 13:05:37 +02:00
c1cadc7d6f K8s/Client: Ignore validation from dashboards frontend v1 (#103641) 2025-04-09 11:08:33 +03:00
3c3e5754b3 Dashboard: Enable JSON editor for Schema v2 (#102466)
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-04-07 10:46:43 +02:00
ae700e7632 Schema V2: Handle v2 custom home dashboard (#103332)
* Schema V2: Handle v2 custom home dashboard

* Clean interface

* Fix old arch
2025-04-03 15:24:19 +02:00
17d089d38a Schema V2: Use App SDK generated types (#103100)
* Use App SDK generated types

* Move examples

* Merge fix

* PAth updates
2025-04-02 16:22:24 +02:00
1a53e85bc5 DashboardSchemaV2: Fix crash in response transformer (#103041)
* DashboardSchemaV2: Fix crash in response transformer

* update test only test for the missing current prop

* restore warning
2025-04-01 09:13:11 +02:00
6822805c32 Grafana Runtime: Use package.json exports for internal code (#102100)
* refactor(frontend): update runtime import paths for grafana/runtime/src -> grafana/runtime

* feat(runtime): introduce internal api entrypoint and exports property

* refactor(frontend): update runtime imports to use internal entrypoint

* chore(betterer): update results file

* refactor(bookmarks): update runtime/unstable import

* chore(betterer): update results file

* test(frontend): fix failing tests due to mocking nested runtime imports

* test(datasourcesrv): fix failing tests due to mocks

* chore(alerting): clean up redundant import

* fix(packages): fix default require export pointing to types declaration file

* docs(packages): update readme related to exports

* chore(internationalization): fix import paths

* chore(betterer): update results file
2025-03-27 08:59:57 +01:00
960c13c1e5 K8S Dashboards: Prevent duplicate dashboards when updating an existing dashboard (#102835)
* use metadata for k8s v1

* handle version and uid update in the api layer

* add test

* cleanup
2025-03-26 16:54:55 -06:00
3d1497b56a Schema V2: Replace resourceVersion usage with generation (#100080)
* Schema V2: Replace resourceVersion usage with generation

* revert auto generated files

---------

Co-authored-by: Ivan Ortega <ivanortegaalba@gmail.com>
Co-authored-by: Haris Rozajac <haris.rozajac12@gmail.com>
2025-03-26 12:47:24 -06:00
35e3d26987 Dashboards: Do not throw error if backend cannot migrate schemaVersion to latest (#102357)
* Refactor migration error handling to use MinimumVersionError for schema version checks

- Updated migration logic to return MinimumVersionError instead of MigrationError for outdated schema versions.
- Enhanced MinimumVersionError message for clarity on migration constraints.
- Added tests for version error handling in the dashboard API to ensure proper error throwing for specific conversion errors.

* Fix tests and remove folder dependencies
2025-03-19 09:57:05 +02:00
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
f910238185 Dashboards: Fix crashing dashboards after save (#102048) 2025-03-12 18:41:39 +02:00
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
070d4b2ee4 SchemaV2: Accept rows with no panel property (#101503)
accept rows with no panel property
2025-03-03 11:19:17 +01:00
01b57f412f Dashboards: WeekStart is now of type WeekStart | undefined instead of string (#101123)
* change weektype from string to WeekStart | undefined

* Change to WeekStart in more places, fix lint

* change in more places

* More weekstart changes

* fix snapshot, update betterer

* keep weekstart as '' in test dashboards to make sure it doesn't break old dashboards
2025-02-24 11:35:55 +01:00
be81314e21 Replace v0 by k8s v1 when kubernetesDashboards is enabled (#101033)
Use v1 by default when kubernetesDashboards is on
2025-02-20 12:42:59 +01:00
ff1b22297c Dashboard Schema V2: Delete dashboard (#100929)
* working version wip

* add TODO

* support alert success for k8s
2025-02-19 10:35:00 -07:00
f25d163a82 Dashboard Schema V2: Fix query variable bug (#100773)
fix
2025-02-18 07:18:45 -07:00
9ad6653871 Dashboard Schema V2: Improve diffing (#100022)
* improve diffing

* define dash spec props a-z

* Fix

* sort deep initialSaveModel

* update tests

* Fix test, description, and query ds issues

* Fix seralizer test

* response transformers

* skip panelMerge tests
2025-02-13 07:20:17 -07:00
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
bbe21bb1d2 Bump Scenes to 5.42.0 (#100205)
* update scenes and weekStart prop type

* update test

* adjust weekStart type in schemaV2

* clean up weekStart error message

* clean up weekStart in test data
2025-02-11 13:20:47 +00:00
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
a412394a14 Dashboards: Save rows and responsive grid layouts in v2 (#100035)
* save rows and responsive grid layouts in v2

* Add back accidentally removed assert

* adress feedback

* use getGridItemKeyForPanel

* Fix import

* fix another import

* Remove RowGridLayout
2025-02-07 14:45:04 +01:00
4c52abb6b4 Dashboard Schema V2: Introduce __legacyStringValue and deprecate string type for query prop in QueryVariableSpec (#99716)
* Introduce __legacyStringValue and deprecate string type for query

* Fix tests

* Fix tests

* remove default

* kind should default to default ds if variable doesn't have ds field

* lint

* getDefaultDataSourceRef should not return undefined
2025-02-06 07:33:06 -07:00
0fced84796 Dashboards: SchemaV2 - Fix saving dashboards on folder (#100037)
* Remove folder annotations not relevant to v2 api
* Add unit test for folder annotations
2025-02-04 12:57:38 +02:00
f51eacef9a RTK APIs: Extract base query logic (#99800)
* RTK APIs: Extract base query function

* Add error handling

* Add return type

* Use createBaseQuery in browseDashboards

* Support custom manageError

* Export getConfigError

* Remove redundant type

* data -> body
2025-01-31 14:25:16 +02:00
bfdd00665b Schema V2: Support v2 custom home dashboards (#99748) 2025-01-31 10:36:56 +01:00
bda4deb20c Dashboards - Schema V2 - Implement move dashboards using v2 api (#99664)
* Dashboards - Schema V2 - Implement move dashboards using v2 api
* Fix root folder uid not being picked by FolderPicker
2025-01-31 10:30:39 +01:00
800c9fa3e6 SchemaV2: Rows in dashboard schema v2 (#99239)
* Testing out rows in schemav2

* update schema

* loading sort of works

* descibe position in relation to row

* add row repeats by variable

* explain ts-expect-error

* Save repeats as well

* Update tests for repeat behavior of rows

* Don't add the clones of the repeated rows

* Add row support for response transformer for V2

* Add row actions

* fix panel name

* fix merge issue

* fix tests

* Implement ensureV1

* set key of GridRow

* fix lint issue

* When going from V2 to V1 rows should be assigned unique ids following max panel id

* remove old comment

* Add panel repeats in V2 -> V1 transform
2025-01-30 15:24:37 +02:00
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
ae62b3817b Dashboards: Change the way dashboard not found error is handled (#98950)
* Get rid of _dashboardLoadFailed

* Get rid of dashboardNotFound meta

* Update public dashboards tests

* Fix DashboardPage tests

* DashboardPageProxy tests

* DashboardScenePageStateManager test fix

* Beterer

* Fix merge

* Nits

* Fix test

* remove debugger

* Update get folder to throw

* translate error title

* Update public/app/features/apiserver/types.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

* Update public/app/features/dashboard/services/DashboardLoaderSrv.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

* Update public/app/features/dashboard/services/DashboardLoaderSrv.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

* Update public/app/features/dashboard/services/DashboardLoaderSrv.ts

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

* Betterer

* Update test cases

* More test updates

* More translations

---------

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
Co-authored-by: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com>
2025-01-27 15:54:10 +01:00
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
83bbdbf8b6 LibraryPanel: Use id and title from panel model (#99281) 2025-01-23 13:57:45 +02:00
a0e7569e4f Dashboard Schema V2: ResponseTransformers: Transform layout, panels, annotations and variables when ensuring v1 (#99050)
* wip

* Fix annotationV1

* variables

* tests

* Fix query variable

* Don't need extra chaining arg in maxPerRow

* Logic for libary panels; tests for variables and library panels

* lint
2025-01-22 08:56:20 -07:00