PublicDashboards: service and store methods rename (#57463)
This commit is contained in:
@@ -89,11 +89,10 @@ func (api *Api) GetPublicDashboard(c *models.ReqContext) response.Response {
|
||||
return response.Error(http.StatusBadRequest, "Invalid Access Token", nil)
|
||||
}
|
||||
|
||||
pubdash, dash, err := api.PublicDashboardService.GetPublicDashboard(
|
||||
pubdash, dash, err := api.PublicDashboardService.GetPublicDashboardAndDashboard(
|
||||
c.Req.Context(),
|
||||
accessToken,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return api.handleError(c.Req.Context(), http.StatusInternalServerError, "GetPublicDashboard: failed to get public dashboard", err)
|
||||
}
|
||||
@@ -133,7 +132,7 @@ func (api *Api) ListPublicDashboards(c *models.ReqContext) response.Response {
|
||||
// GetPublicDashboardConfig Gets public dashboard configuration for dashboard
|
||||
// GET /api/dashboards/uid/:uid/public-config
|
||||
func (api *Api) GetPublicDashboardConfig(c *models.ReqContext) response.Response {
|
||||
pdc, err := api.PublicDashboardService.GetPublicDashboardConfig(c.Req.Context(), c.OrgID, web.Params(c.Req)[":uid"])
|
||||
pdc, err := api.PublicDashboardService.GetPublicDashboard(c.Req.Context(), c.OrgID, web.Params(c.Req)[":uid"])
|
||||
if err != nil {
|
||||
return api.handleError(c.Req.Context(), http.StatusInternalServerError, "GetPublicDashboardConfig: failed to get public dashboard config", err)
|
||||
}
|
||||
@@ -164,7 +163,7 @@ func (api *Api) SavePublicDashboardConfig(c *models.ReqContext) response.Respons
|
||||
}
|
||||
|
||||
// Save the public dashboard
|
||||
pubdash, err := api.PublicDashboardService.SavePublicDashboardConfig(c.Req.Context(), c.SignedInUser, &dto)
|
||||
pubdash, err := api.PublicDashboardService.SavePublicDashboard(c.Req.Context(), c.SignedInUser, &dto)
|
||||
if err != nil {
|
||||
return api.handleError(c.Req.Context(), http.StatusInternalServerError, "SavePublicDashboardConfig: failed to save public dashboard configuration", err)
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ func TestAPIGetPublicDashboard(t *testing.T) {
|
||||
for _, test := range testCases {
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
service := publicdashboards.NewFakePublicDashboardService(t)
|
||||
service.On("GetPublicDashboard", mock.Anything, mock.AnythingOfType("string")).
|
||||
service.On("GetPublicDashboardAndDashboard", mock.Anything, mock.AnythingOfType("string")).
|
||||
Return(&PublicDashboard{}, test.DashboardResult, test.Err).Maybe()
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
@@ -396,7 +396,7 @@ func TestAPIGetPublicDashboardConfig(t *testing.T) {
|
||||
service := publicdashboards.NewFakePublicDashboardService(t)
|
||||
|
||||
if test.ShouldCallService {
|
||||
service.On("GetPublicDashboardConfig", mock.Anything, mock.AnythingOfType("int64"), mock.AnythingOfType("string")).
|
||||
service.On("GetPublicDashboard", mock.Anything, mock.AnythingOfType("int64"), mock.AnythingOfType("string")).
|
||||
Return(test.PublicDashboardResult, test.PublicDashboardErr)
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ func TestApiSavePublicDashboardConfig(t *testing.T) {
|
||||
|
||||
// this is to avoid AssertExpectations fail at t.Cleanup when the middleware returns before calling the service
|
||||
if test.ShouldCallService {
|
||||
service.On("SavePublicDashboardConfig", mock.Anything, mock.Anything, mock.AnythingOfType("*models.SavePublicDashboardConfigDTO")).
|
||||
service.On("SavePublicDashboard", mock.Anything, mock.Anything, mock.AnythingOfType("*models.SavePublicDashboardConfigDTO")).
|
||||
Return(&PublicDashboard{IsEnabled: true}, test.SaveDashboardErr)
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ func TestIntegrationUnauthenticatedUserCanGetPubdashPanelQueryData(t *testing.T)
|
||||
ac := acmock.New()
|
||||
cfg.RBACEnabled = false
|
||||
service := publicdashboardsService.ProvideService(cfg, store, qds, annotationsService, ac)
|
||||
pubdash, err := service.SavePublicDashboardConfig(context.Background(), &user.SignedInUser{}, savePubDashboardCmd)
|
||||
pubdash, err := service.SavePublicDashboard(context.Background(), &user.SignedInUser{}, savePubDashboardCmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
// setup test server
|
||||
|
||||
Reference in New Issue
Block a user