Add receiver name to the alerts page (#3289)

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
Julien Pivotto 2023-03-09 17:32:13 +01:00 committed by GitHub
parent e35e13d7a1
commit 14a265b710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ module Views.AlertList.Views exposing (view)
import Data.AlertGroup exposing (AlertGroup)
import Data.GettableAlert exposing (GettableAlert)
import Data.Receiver exposing (Receiver)
import Dict
import Html exposing (..)
import Html.Attributes exposing (..)
@ -91,25 +92,25 @@ defaultAlertGroups activeId activeGroups expandAll groups =
[] ->
Utils.Views.error "No alert groups found"
[ { labels, alerts } ] ->
[ { labels, receiver, alerts } ] ->
let
labels_ =
Dict.toList labels
in
alertGroup activeId (Set.singleton 0) labels_ alerts 0 expandAll
alertGroup activeId (Set.singleton 0) receiver labels_ alerts 0 expandAll
_ ->
div [ class "pl-5" ]
(List.indexedMap
(\index group ->
alertGroup activeId activeGroups (Dict.toList group.labels) group.alerts index expandAll
alertGroup activeId activeGroups group.receiver (Dict.toList group.labels) group.alerts index expandAll
)
groups
)
alertGroup : Maybe String -> Set Int -> Labels -> List GettableAlert -> Int -> Bool -> Html Msg
alertGroup activeId activeGroups labels alerts groupId expandAll =
alertGroup : Maybe String -> Set Int -> Receiver -> Labels -> List GettableAlert -> Int -> Bool -> Html Msg
alertGroup activeId activeGroups receiver labels alerts groupId expandAll =
let
groupActive =
expandAll || Set.member groupId activeGroups
@ -142,7 +143,7 @@ alertGroup activeId activeGroups labels alerts groupId expandAll =
labels
expandButton =
expandAlertGroup groupActive groupId
expandAlertGroup groupActive groupId receiver
|> Html.map (\msg -> MsgForAlertList (ActiveGroups msg))
alertCount =
@ -168,8 +169,8 @@ alertGroup activeId activeGroups labels alerts groupId expandAll =
]
expandAlertGroup : Bool -> Int -> Html Int
expandAlertGroup expanded groupId =
expandAlertGroup : Bool -> Int -> Receiver -> Html Int
expandAlertGroup expanded groupId receiver =
let
icon =
if expanded then
@ -183,4 +184,10 @@ expandAlertGroup expanded groupId =
, class "btn btn-outline-info border-0 mr-1 mb-1"
, style "margin-left" "-3rem"
]
[ i [ class ("fa " ++ icon) ] [] ]
[ i
[ class ("fa " ++ icon)
, class "mr-2"
]
[]
, text receiver.name
]