Support dashboard restore across API versions (#110694)
What This commit refactors the logic to restore a dashboard from a version. The logic is moved from the API handler to the dashboard versions service, which now supports restoring dashboards of different API versions. Why To make sure that dashboard version restoration works with v2 dashboards API, as well as future API versions. Signed-off-by: Igor Suleymanov <igor.suleymanov@grafana.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
)
|
||||
|
||||
@@ -60,6 +61,15 @@ type DeleteExpiredVersionsCommand struct {
|
||||
DeletedRows int64
|
||||
}
|
||||
|
||||
// RestoreVersionCommand is used to restore a dashboard version.
|
||||
// Only one of DashboardID and DashboardUID are required.
|
||||
type RestoreVersionCommand struct {
|
||||
Requester identity.Requester
|
||||
DashboardUID string
|
||||
DashboardID int64
|
||||
Version int64
|
||||
}
|
||||
|
||||
type ListDashboardVersionsQuery struct {
|
||||
DashboardID int64
|
||||
DashboardUID string
|
||||
|
||||
Reference in New Issue
Block a user