Rename DispatchCtx to Dispatch (#43563)

This commit is contained in:
idafurjes
2021-12-28 17:36:22 +01:00
committed by GitHub
parent 7936c4c522
commit 8e6d6af744
107 changed files with 291 additions and 291 deletions
+11 -11
View File
@@ -34,7 +34,7 @@ func isDashboardStarredByUser(c *models.ReqContext, dashID int64) (bool, error)
}
query := models.IsStarredByUserQuery{UserId: c.UserId, DashboardId: dashID}
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
if err := bus.Dispatch(c.Req.Context(), &query); err != nil {
return false, err
}
@@ -142,7 +142,7 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
// lookup folder title
if dash.FolderId > 0 {
query := models.GetDashboardQuery{Id: dash.FolderId, OrgId: c.OrgId}
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
if err := bus.Dispatch(c.Req.Context(), &query); err != nil {
if errors.Is(err, models.ErrFolderNotFound) {
return response.Error(404, "Folder not found", err)
}
@@ -196,7 +196,7 @@ func (hs *HTTPServer) GetDashboard(c *models.ReqContext) response.Response {
func getUserLogin(ctx context.Context, userID int64) string {
query := models.GetUserByIdQuery{Id: userID}
err := bus.DispatchCtx(ctx, &query)
err := bus.Dispatch(ctx, &query)
if err != nil {
return anonString
}
@@ -212,7 +212,7 @@ func getDashboardHelper(ctx context.Context, orgID int64, id int64, uid string)
query = models.GetDashboardQuery{Id: id, OrgId: orgID}
}
if err := bus.DispatchCtx(ctx, &query); err != nil {
if err := bus.Dispatch(ctx, &query); err != nil {
return nil, response.Error(404, "Dashboard not found", err)
}
@@ -222,7 +222,7 @@ func getDashboardHelper(ctx context.Context, orgID int64, id int64, uid string)
func (hs *HTTPServer) DeleteDashboardBySlug(c *models.ReqContext) response.Response {
query := models.GetDashboardsBySlugQuery{OrgId: c.OrgId, Slug: web.Params(c.Req)[":slug"]}
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
if err := bus.Dispatch(c.Req.Context(), &query); err != nil {
return response.Error(500, "Failed to retrieve dashboards by slug", err)
}
@@ -448,7 +448,7 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response {
prefsQuery := models.GetPreferencesWithDefaultsQuery{User: c.SignedInUser}
homePage := hs.Cfg.HomePage
if err := hs.Bus.DispatchCtx(c.Req.Context(), &prefsQuery); err != nil {
if err := hs.Bus.Dispatch(c.Req.Context(), &prefsQuery); err != nil {
return response.Error(500, "Failed to get preferences", err)
}
@@ -459,7 +459,7 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response {
if prefsQuery.Result.HomeDashboardId != 0 {
slugQuery := models.GetDashboardRefByIdQuery{Id: prefsQuery.Result.HomeDashboardId}
err := hs.Bus.DispatchCtx(c.Req.Context(), &slugQuery)
err := hs.Bus.Dispatch(c.Req.Context(), &slugQuery)
if err == nil {
url := models.GetDashboardUrl(slugQuery.Result.Uid, slugQuery.Result.Slug)
dashRedirect := dtos.DashboardRedirect{RedirectUri: url}
@@ -543,7 +543,7 @@ func GetDashboardVersions(c *models.ReqContext) response.Response {
Start: c.QueryInt("start"),
}
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
if err := bus.Dispatch(c.Req.Context(), &query); err != nil {
return response.Error(404, fmt.Sprintf("No versions found for dashboardId %d", dashID), err)
}
@@ -582,7 +582,7 @@ func GetDashboardVersion(c *models.ReqContext) response.Response {
Version: int(version),
}
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
if err := bus.Dispatch(c.Req.Context(), &query); err != nil {
return response.Error(500, fmt.Sprintf("Dashboard version %d not found for dashboardId %d", query.Version, dashID), err)
}
@@ -671,7 +671,7 @@ func (hs *HTTPServer) RestoreDashboardVersion(c *models.ReqContext) response.Res
}
versionQuery := models.GetDashboardVersionQuery{DashboardId: dash.Id, Version: apiCmd.Version, OrgId: c.OrgId}
if err := bus.DispatchCtx(c.Req.Context(), &versionQuery); err != nil {
if err := bus.Dispatch(c.Req.Context(), &versionQuery); err != nil {
return response.Error(404, "Dashboard version not found", nil)
}
@@ -692,7 +692,7 @@ func (hs *HTTPServer) RestoreDashboardVersion(c *models.ReqContext) response.Res
func GetDashboardTags(c *models.ReqContext) {
query := models.GetDashboardTagsQuery{OrgId: c.OrgId}
err := bus.DispatchCtx(c.Req.Context(), &query)
err := bus.Dispatch(c.Req.Context(), &query)
if err != nil {
c.JsonApiErr(500, "Failed to get tags from database", err)
return