mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-16 02:27:01 +00:00
Fix UI when no silences are present (#1090)
* Explicitly initialize silences list to avoid "null" JSON * Wrap "No silences found" message in error box * bindata fixup
This commit is contained in:
parent
133c888ef3
commit
fdee5fcbfc
@ -624,7 +624,7 @@ func (api *API) listSilences(w http.ResponseWriter, r *http.Request) {
|
||||
sils = append(sils, s)
|
||||
}
|
||||
|
||||
var active, pending, expired, silences []*types.Silence
|
||||
var active, pending, expired []*types.Silence
|
||||
|
||||
for _, s := range sils {
|
||||
switch s.Status.State {
|
||||
@ -647,6 +647,9 @@ func (api *API) listSilences(w http.ResponseWriter, r *http.Request) {
|
||||
return expired[i].EndsAt.After(expired[j].EndsAt)
|
||||
})
|
||||
|
||||
// Initialize silences explicitly to an empty list (instead of nil)
|
||||
// So that it does not get converted to "null" in JSON.
|
||||
silences := []*types.Silence{}
|
||||
silences = append(silences, active...)
|
||||
silences = append(silences, pending...)
|
||||
silences = append(silences, expired...)
|
||||
|
@ -52,7 +52,7 @@ tabView currentState ( state, silences ) =
|
||||
silencesView : Bool -> List Silence -> Html Msg
|
||||
silencesView showConfirmationDialog silences =
|
||||
if List.isEmpty silences then
|
||||
div [] [ text "No silences found" ]
|
||||
Utils.Views.error "No silences found"
|
||||
else
|
||||
ul [ class "list-group" ]
|
||||
(List.map (Views.SilenceList.SilenceView.view showConfirmationDialog) silences)
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user