mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Remove dummy trim dashboard api (#77249)
Co-authored-by: nikimanoledaki <niki.manoledaki@grafana.com>
This commit is contained in:
@@ -471,7 +471,6 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
|
||||
dashboardRoute.Post("/calculate-diff", authorize(ac.EvalPermission(dashboards.ActionDashboardsWrite)), routing.Wrap(hs.CalculateDashboardDiff))
|
||||
dashboardRoute.Post("/validate", authorize(ac.EvalPermission(dashboards.ActionDashboardsWrite)), routing.Wrap(hs.ValidateDashboard))
|
||||
dashboardRoute.Post("/trim", routing.Wrap(hs.TrimDashboard))
|
||||
|
||||
dashboardRoute.Post("/db", authorize(ac.EvalAny(ac.EvalPermission(dashboards.ActionDashboardsCreate), ac.EvalPermission(dashboards.ActionDashboardsWrite))), routing.Wrap(hs.PostDashboard))
|
||||
dashboardRoute.Get("/home", routing.Wrap(hs.GetHomeDashboard))
|
||||
|
||||
@@ -68,32 +68,6 @@ func dashboardGuardianResponse(err error) response.Response {
|
||||
return response.Error(http.StatusForbidden, "Access denied to this dashboard", nil)
|
||||
}
|
||||
|
||||
// swagger:route POST /dashboards/trim dashboards trimDashboard
|
||||
//
|
||||
// Trim defaults from dashboard.
|
||||
//
|
||||
// Responses:
|
||||
// 200: trimDashboardResponse
|
||||
// 401: unauthorisedError
|
||||
// 500: internalServerError
|
||||
func (hs *HTTPServer) TrimDashboard(c *contextmodel.ReqContext) response.Response {
|
||||
cmd := dashboards.TrimDashboardCommand{}
|
||||
if err := web.Bind(c.Req, &cmd); err != nil {
|
||||
return response.Error(http.StatusBadRequest, "bad request data", err)
|
||||
}
|
||||
dash := cmd.Dashboard
|
||||
meta := cmd.Meta
|
||||
|
||||
// TODO temporarily just return the input as a no-op while we convert to thema calls
|
||||
dto := dtos.TrimDashboardFullWithMeta{
|
||||
Dashboard: dash,
|
||||
Meta: meta,
|
||||
}
|
||||
|
||||
c.TimeRequest(metrics.MApiDashboardGet)
|
||||
return response.JSON(http.StatusOK, dto)
|
||||
}
|
||||
|
||||
// swagger:route GET /dashboards/uid/{uid} dashboards getDashboardByUID
|
||||
//
|
||||
// Get dashboard by uid.
|
||||
@@ -1233,13 +1207,6 @@ type CalcDashboardDiffParams struct {
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:parameters trimDashboard
|
||||
type TrimDashboardParams struct {
|
||||
// in:body
|
||||
// required:true
|
||||
Body dashboards.TrimDashboardCommand
|
||||
}
|
||||
|
||||
// swagger:response dashboardResponse
|
||||
type DashboardResponse struct {
|
||||
// The response message
|
||||
@@ -1315,12 +1282,6 @@ type CalculateDashboardDiffResponse struct {
|
||||
Body []byte `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response trimDashboardResponse
|
||||
type TrimDashboardResponse struct {
|
||||
// in: body
|
||||
Body dtos.TrimDashboardFullWithMeta `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response getHomeDashboardResponse
|
||||
type GetHomeDashboardResponse struct {
|
||||
// in: body
|
||||
|
||||
@@ -51,11 +51,6 @@ type DashboardFullWithMeta struct {
|
||||
Dashboard *simplejson.Json `json:"dashboard"`
|
||||
}
|
||||
|
||||
type TrimDashboardFullWithMeta struct {
|
||||
Meta *simplejson.Json `json:"meta"`
|
||||
Dashboard *simplejson.Json `json:"dashboard"`
|
||||
}
|
||||
|
||||
type DashboardRedirect struct {
|
||||
RedirectUri string `json:"redirectUri"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user