mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: modify alertmanager endpoints for proxying using the datasource UID (#47978)
* Alerting: enable proxying alertmanager calls using the datasource UID * Remove use of datasource ID from the API * Update frontend
This commit is contained in:
committed by
GitHub
parent
49491bc73e
commit
3e752a0db1
@@ -60,10 +60,13 @@ func (p *DataSourceProxyService) ProxyDataSourceRequest(c *models.ReqContext) {
|
||||
p.ProxyDatasourceRequestWithID(c, id)
|
||||
}
|
||||
|
||||
func (p *DataSourceProxyService) ProxyDatasourceRequestWithUID(c *models.ReqContext) {
|
||||
func (p *DataSourceProxyService) ProxyDatasourceRequestWithUID(c *models.ReqContext, dsUID string) {
|
||||
c.TimeRequest(metrics.MDataSourceProxyReqTimer)
|
||||
|
||||
dsUID := web.Params(c.Req)[":uid"]
|
||||
if dsUID == "" { // if datasource UID is not provided, fetch it from the uid path parameter
|
||||
dsUID = web.Params(c.Req)[":uid"]
|
||||
}
|
||||
|
||||
if !util.IsValidShortUID(dsUID) {
|
||||
c.JsonApiErr(http.StatusBadRequest, "UID is invalid", nil)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user