[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:
co-authored by
Gilles De Mey
parent
70e4499f83
commit
c8cf18d8f6
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user