mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-19 12:40:49 +00:00
Simplify silence list view code
This commit is contained in:
parent
b707d5c7f3
commit
215e91da8c
@ -15,6 +15,17 @@ import Utils.Views exposing (..)
|
||||
import Utils.Date
|
||||
|
||||
|
||||
silences : List Silence -> Html Msg
|
||||
silences silences =
|
||||
ul
|
||||
[ classList
|
||||
[ ( "list", True )
|
||||
, ( "pa0", True )
|
||||
]
|
||||
]
|
||||
(List.map silenceList silences)
|
||||
|
||||
|
||||
silenceList : Silence -> Html Msg
|
||||
silenceList silence =
|
||||
li
|
||||
|
@ -51,7 +51,7 @@ view model =
|
||||
-- Add buttons at the top to filter Active/Pending/Expired
|
||||
case model.silences of
|
||||
Success silences ->
|
||||
Html.map silenceTranslator (apiDataList Silences.Views.silenceList silences)
|
||||
Html.map silenceTranslator (Silences.Views.silences silences)
|
||||
|
||||
Loading ->
|
||||
loading
|
||||
@ -121,14 +121,3 @@ error err =
|
||||
[ h1 [] [ text "Error" ]
|
||||
, p [] [ text msg ]
|
||||
]
|
||||
|
||||
|
||||
apiDataList : (a -> Html msg) -> List a -> Html msg
|
||||
apiDataList fn list =
|
||||
ul
|
||||
[ classList
|
||||
[ ( "list", True )
|
||||
, ( "pa0", True )
|
||||
]
|
||||
]
|
||||
(List.map fn list)
|
||||
|
Loading…
Reference in New Issue
Block a user