Alerting: hide "silence" button for external AM setups (#62133)

This commit is contained in:
Gilles De Mey
2023-02-01 15:51:05 +01:00
committed by GitHub
parent a190e03133
commit 26866953c1
14 changed files with 244 additions and 103 deletions

View File

@@ -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)
}