Refactor: Add UID endpoint for dashboard versions and restore (#48364)

* Refactor: Add UID endpoint for dashboard versions and restore

* Fix: User dashID instead of dash.id

* 💩

* Move apiCmd error handling outside of dashUID check

* fix the panic in test

* Fix handler and update docs

Co-authored-by: Kat Yang <yangkb09@users.noreply.github.com>

* Docs: add deprecated warning to restore and version docs

* Fix hyperlink text

* Add swagger endpoints for restore and versions

* Add deprecated tag on swagger for both endpoints

* Fix: Update access control to be dashboards

* Return UID in response; Update docs to reflect this; Implement Ying suggestion

* Update docs/sources/http_api/dashboard_versions.md

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Update pkg/models/dashboard_version.go

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Update pkg/models/dashboard_version.go

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Update query to refer to DashboardUID

Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
Co-authored-by: Kat Yang <yangkb09@users.noreply.github.com>
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Kat Yang
2022-05-17 12:57:27 -04:00
committed by GitHub
co-authored by Kat Yang Sofia Papagiannaki Ying WANG Sofia Papagiannaki
parent c652849303
commit 719af24235
9 changed files with 409 additions and 22 deletions
+6 -4
View File
@@ -49,6 +49,7 @@ type DashboardVersionMeta struct {
type DashboardVersionDTO struct {
Id int64 `json:"id"`
DashboardId int64 `json:"dashboardId"`
DashboardUID string `json:"dashboardUid"`
ParentVersion int `json:"parentVersion"`
RestoredFrom int `json:"restoredFrom"`
Version int `json:"version"`
@@ -70,10 +71,11 @@ type GetDashboardVersionQuery struct {
}
type GetDashboardVersionsQuery struct {
DashboardId int64
OrgId int64
Limit int
Start int
DashboardId int64
DashboardUID string
OrgId int64
Limit int
Start int
Result []*DashboardVersionDTO
}