Alerting: introduce AlertQuery in definitions package (#63825)

* copy AlertQuery from ngmodels to the definition package
* replaces usages of ngmodels.AlertQuery in API models
* create a converter between models of AlertQuery
---------

Co-authored-by: Alex Moreno <alexander.moreno@grafana.com>
This commit is contained in:
Yuri Tseretyan
2023-03-27 11:55:13 -04:00
committed by GitHub
co-authored by Alex Moreno
parent 36e8ca7f13
commit 52a0f59706
21 changed files with 279 additions and 182 deletions
+2 -2
View File
@@ -337,7 +337,7 @@ func (srv *ProvisioningSrv) RouteGetAlertRuleGroup(c *contextmodel.ReqContext, f
}
return ErrResp(http.StatusInternalServerError, err, "")
}
return response.JSON(http.StatusOK, AlertRuleGroupToApi(g))
return response.JSON(http.StatusOK, ApiAlertRuleGroupFromAlertRuleGroup(g))
}
// RouteGetAlertRulesExport retrieves all alert rules in a format compatible with file provisioning.
@@ -403,7 +403,7 @@ func (srv *ProvisioningSrv) RouteGetAlertRuleExport(c *contextmodel.ReqContext,
func (srv *ProvisioningSrv) RoutePutAlertRuleGroup(c *contextmodel.ReqContext, ag definitions.AlertRuleGroup, folderUID string, group string) response.Response {
ag.FolderUID = folderUID
ag.Title = group
groupModel, err := AlertRuleGroupFromApi(ag)
groupModel, err := AlertRuleGroupFromApiAlertRuleGroup(ag)
if err != nil {
ErrResp(http.StatusBadRequest, err, "")
}