[v9.4.x] Alerting: hide "silence" button for external AM setups (#62691)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2023-02-01 15:10:51 +00:00
committed by GitHub
co-authored by Gilles De Mey
parent 70e4499f83
commit c8cf18d8f6
14 changed files with 244 additions and 103 deletions
@@ -148,8 +148,15 @@ func (srv ConfigSrv) RouteGetAlertingStatus(c *contextmodel.ReqContext) response
sendsAlertsTo = cfg.SendAlertsTo
}
// handle errors
externalAlertManagers, err := srv.externalAlertmanagers(c.Req.Context(), c.OrgID)
if err != nil {
return ErrResp(http.StatusInternalServerError, err, "")
}
resp := apimodels.AlertingStatus{
AlertmanagersChoice: apimodels.AlertmanagersChoice(sendsAlertsTo.String()),
AlertmanagersChoice: apimodels.AlertmanagersChoice(sendsAlertsTo.String()),
NumExternalAlertmanagers: len(externalAlertManagers),
}
return response.JSON(http.StatusOK, resp)
}
@@ -92,5 +92,6 @@ type GettableAlertmanagers struct {
// swagger:model
type AlertingStatus struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
NumExternalAlertmanagers int `json:"numExternalAlertmanagers"`
}