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:
Jeff Levin
2022-08-26 11:28:54 -08:00
committed by GitHub
co-authored by Ezequiel Victorero
parent b9be2815d3
commit 5cb9fca990
12 changed files with 215 additions and 148 deletions
@@ -240,7 +240,7 @@ func TestApiSavePublicDashboardConfig(t *testing.T) {
for _, test := range testCases {
t.Run(test.Name, func(t *testing.T) {
service := publicdashboards.NewFakePublicDashboardService(t)
service.On("SavePublicDashboardConfig", mock.Anything, mock.AnythingOfType("*models.SavePublicDashboardConfigDTO")).
service.On("SavePublicDashboardConfig", mock.Anything, mock.Anything, mock.AnythingOfType("*models.SavePublicDashboardConfigDTO")).
Return(&PublicDashboard{IsEnabled: true}, test.SaveDashboardErr)
cfg := setting.NewCfg()
@@ -558,7 +558,7 @@ func TestIntegrationUnauthenticatedUserCanGetPubdashPanelQueryData(t *testing.T)
cfg := setting.NewCfg()
cfg.RBACEnabled = false
service := publicdashboardsService.ProvideService(cfg, store)
pubdash, err := service.SavePublicDashboardConfig(context.Background(), savePubDashboardCmd)
pubdash, err := service.SavePublicDashboardConfig(context.Background(), &user.SignedInUser{}, savePubDashboardCmd)
require.NoError(t, err)
// setup test server