public-dashboards: Add log statement when public dashboard enabled or disabled (#54133)
* refactor apis for consistent outputs * add dashboardUid validation at API layer * add check for empty dashboardUid on SavePublicDashboard * remove public dashboard errors from models package. Co-authored-by: Ezequiel Victorero <evictorero@gmail.com>
This commit is contained in:
co-authored by
Ezequiel Victorero
parent
b9be2815d3
commit
5cb9fca990
@@ -10,22 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func TestValidateSavePublicDashboard(t *testing.T) {
|
||||
t.Run("Returns validation error when dto has no dashboard uid", func(t *testing.T) {
|
||||
dashboard := models.NewDashboard("dashboardTitle")
|
||||
dto := &publicdashboardModels.SavePublicDashboardConfigDTO{DashboardUid: "", OrgId: 1, UserId: 1, PublicDashboard: nil}
|
||||
|
||||
err := ValidateSavePublicDashboard(dto, dashboard)
|
||||
require.ErrorContains(t, err, "Unique identifier needed to be able to get a dashboard")
|
||||
})
|
||||
|
||||
t.Run("Returns no validation error when dto has dashboard uid", func(t *testing.T) {
|
||||
dashboard := models.NewDashboard("dashboardTitle")
|
||||
dto := &publicdashboardModels.SavePublicDashboardConfigDTO{DashboardUid: "abc123", OrgId: 1, UserId: 1, PublicDashboard: nil}
|
||||
|
||||
err := ValidateSavePublicDashboard(dto, dashboard)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("Returns validation error when dashboard has template variables", func(t *testing.T) {
|
||||
templateVars := []byte(`{
|
||||
"templating": {
|
||||
|
||||
Reference in New Issue
Block a user