publicdashboards: split create/update api paths (#57940)
This PR splits the create and update paths for public dashboards and includes assorted refactors toward a proper REST API. Additionally, we removed the concept of a "public dashboard config" in favor of "public dashboard" Co-authored-by: juanicabanas <juan.cabanas@grafana.com> Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
This commit is contained in:
co-authored by
juanicabanas
Ezequiel Victorero
parent
0367f61bb3
commit
6fcc5b42c0
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestValidateSavePublicDashboard(t *testing.T) {
|
||||
func TestValidatePublicDashboard(t *testing.T) {
|
||||
t.Run("Returns validation error when dashboard has template variables", func(t *testing.T) {
|
||||
templateVars := []byte(`{
|
||||
"templating": {
|
||||
@@ -24,7 +24,7 @@ func TestValidateSavePublicDashboard(t *testing.T) {
|
||||
dashboard := models.NewDashboardFromJson(dashboardData)
|
||||
dto := &SavePublicDashboardDTO{DashboardUid: "abc123", OrgId: 1, UserId: 1, PublicDashboard: nil}
|
||||
|
||||
err := ValidateSavePublicDashboard(dto, dashboard)
|
||||
err := ValidatePublicDashboard(dto, dashboard)
|
||||
require.ErrorContains(t, err, ErrPublicDashboardHasTemplateVariables.Reason)
|
||||
})
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestValidateSavePublicDashboard(t *testing.T) {
|
||||
dashboard := models.NewDashboardFromJson(dashboardData)
|
||||
dto := &SavePublicDashboardDTO{DashboardUid: "abc123", OrgId: 1, UserId: 1, PublicDashboard: nil}
|
||||
|
||||
err := ValidateSavePublicDashboard(dto, dashboard)
|
||||
err := ValidatePublicDashboard(dto, dashboard)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user