mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Move ReqContext to contexthandler service (#62102)
* Chore: Move ReqContext to contexthandler service * Rename package to contextmodel * Generate ngalert files * Remove unused imports
This commit is contained in:
@@ -12,20 +12,20 @@ import (
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/middleware"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
type TestingApi interface {
|
||||
BacktestConfig(*models.ReqContext) response.Response
|
||||
RouteEvalQueries(*models.ReqContext) response.Response
|
||||
RouteTestRuleConfig(*models.ReqContext) response.Response
|
||||
RouteTestRuleGrafanaConfig(*models.ReqContext) response.Response
|
||||
BacktestConfig(*contextmodel.ReqContext) response.Response
|
||||
RouteEvalQueries(*contextmodel.ReqContext) response.Response
|
||||
RouteTestRuleConfig(*contextmodel.ReqContext) response.Response
|
||||
RouteTestRuleGrafanaConfig(*contextmodel.ReqContext) response.Response
|
||||
}
|
||||
|
||||
func (f *TestingApiHandler) BacktestConfig(ctx *models.ReqContext) response.Response {
|
||||
func (f *TestingApiHandler) BacktestConfig(ctx *contextmodel.ReqContext) response.Response {
|
||||
// Parse Request Body
|
||||
conf := apimodels.BacktestConfig{}
|
||||
if err := web.Bind(ctx.Req, &conf); err != nil {
|
||||
@@ -33,7 +33,7 @@ func (f *TestingApiHandler) BacktestConfig(ctx *models.ReqContext) response.Resp
|
||||
}
|
||||
return f.handleBacktestConfig(ctx, conf)
|
||||
}
|
||||
func (f *TestingApiHandler) RouteEvalQueries(ctx *models.ReqContext) response.Response {
|
||||
func (f *TestingApiHandler) RouteEvalQueries(ctx *contextmodel.ReqContext) response.Response {
|
||||
// Parse Request Body
|
||||
conf := apimodels.EvalQueriesPayload{}
|
||||
if err := web.Bind(ctx.Req, &conf); err != nil {
|
||||
@@ -41,7 +41,7 @@ func (f *TestingApiHandler) RouteEvalQueries(ctx *models.ReqContext) response.Re
|
||||
}
|
||||
return f.handleRouteEvalQueries(ctx, conf)
|
||||
}
|
||||
func (f *TestingApiHandler) RouteTestRuleConfig(ctx *models.ReqContext) response.Response {
|
||||
func (f *TestingApiHandler) RouteTestRuleConfig(ctx *contextmodel.ReqContext) response.Response {
|
||||
// Parse Path Parameters
|
||||
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
|
||||
// Parse Request Body
|
||||
@@ -51,7 +51,7 @@ func (f *TestingApiHandler) RouteTestRuleConfig(ctx *models.ReqContext) response
|
||||
}
|
||||
return f.handleRouteTestRuleConfig(ctx, conf, datasourceUIDParam)
|
||||
}
|
||||
func (f *TestingApiHandler) RouteTestRuleGrafanaConfig(ctx *models.ReqContext) response.Response {
|
||||
func (f *TestingApiHandler) RouteTestRuleGrafanaConfig(ctx *contextmodel.ReqContext) response.Response {
|
||||
// Parse Request Body
|
||||
conf := apimodels.TestRulePayload{}
|
||||
if err := web.Bind(ctx.Req, &conf); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user