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:
idafurjes
2023-01-27 08:50:36 +01:00
committed by GitHub
parent 8379a29b53
commit 6c5a573772
180 changed files with 1208 additions and 1182 deletions
@@ -12,30 +12,30 @@ 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"
"github.com/grafana/grafana/pkg/services/ngalert/metrics"
"github.com/grafana/grafana/pkg/web"
)
type PrometheusApi interface {
RouteGetAlertStatuses(*models.ReqContext) response.Response
RouteGetGrafanaAlertStatuses(*models.ReqContext) response.Response
RouteGetGrafanaRuleStatuses(*models.ReqContext) response.Response
RouteGetRuleStatuses(*models.ReqContext) response.Response
RouteGetAlertStatuses(*contextmodel.ReqContext) response.Response
RouteGetGrafanaAlertStatuses(*contextmodel.ReqContext) response.Response
RouteGetGrafanaRuleStatuses(*contextmodel.ReqContext) response.Response
RouteGetRuleStatuses(*contextmodel.ReqContext) response.Response
}
func (f *PrometheusApiHandler) RouteGetAlertStatuses(ctx *models.ReqContext) response.Response {
func (f *PrometheusApiHandler) RouteGetAlertStatuses(ctx *contextmodel.ReqContext) response.Response {
// Parse Path Parameters
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
return f.handleRouteGetAlertStatuses(ctx, datasourceUIDParam)
}
func (f *PrometheusApiHandler) RouteGetGrafanaAlertStatuses(ctx *models.ReqContext) response.Response {
func (f *PrometheusApiHandler) RouteGetGrafanaAlertStatuses(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetGrafanaAlertStatuses(ctx)
}
func (f *PrometheusApiHandler) RouteGetGrafanaRuleStatuses(ctx *models.ReqContext) response.Response {
func (f *PrometheusApiHandler) RouteGetGrafanaRuleStatuses(ctx *contextmodel.ReqContext) response.Response {
return f.handleRouteGetGrafanaRuleStatuses(ctx)
}
func (f *PrometheusApiHandler) RouteGetRuleStatuses(ctx *models.ReqContext) response.Response {
func (f *PrometheusApiHandler) RouteGetRuleStatuses(ctx *contextmodel.ReqContext) response.Response {
// Parse Path Parameters
datasourceUIDParam := web.Params(ctx.Req)[":DatasourceUID"]
return f.handleRouteGetRuleStatuses(ctx, datasourceUIDParam)