UI: add 'Link' button to alerts in list (#2880)
* add 'Link' button adds a button to each alert that allows linking to a single alert. This works by generating a link that filters on _all_ of the alert's label values, similar to the button to create a new silence from an alert. Signed-off-by: Christopher Taylor <chris.taylor@soundcloud.com> * update asset/assets_vfsdata.go Signed-off-by: Christopher Taylor <chris.taylor@soundcloud.com> Signed-off-by: Christopher Taylor <chris.taylor@soundcloud.com>
This commit is contained in:
parent
ae510d09c0
commit
2c04c5aaa7
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ import Html exposing (..)
|
|||
import Html.Attributes exposing (class, href, style, title, value)
|
||||
import Html.Events exposing (onClick)
|
||||
import Types exposing (Msg(..))
|
||||
import Url exposing (percentEncode)
|
||||
import Utils.Filter
|
||||
import Views.AlertList.Types exposing (AlertListMsg(..))
|
||||
import Views.FilterBar.Types as FilterBarTypes
|
||||
|
@ -47,6 +48,7 @@ view labels maybeActiveId alert =
|
|||
text ""
|
||||
, silenceButton alert
|
||||
, inhibitedIcon alert
|
||||
, linkButton alert
|
||||
]
|
||||
, if maybeActiveId == Just alert.fingerprint then
|
||||
table [ class "table w-100 mb-1" ] (List.map annotation <| Dict.toList alert.annotations)
|
||||
|
@ -97,6 +99,26 @@ addLabelMsg ( key, value ) =
|
|||
|> MsgForAlertList
|
||||
|
||||
|
||||
linkButton : GettableAlert -> Html Msg
|
||||
linkButton alert =
|
||||
let
|
||||
link =
|
||||
alert.labels
|
||||
|> Dict.toList
|
||||
|> List.map (\( k, v ) -> Utils.Filter.Matcher k Utils.Filter.Eq v)
|
||||
|> Utils.Filter.stringifyFilter
|
||||
|> percentEncode
|
||||
|> (++) "#/alerts?filter="
|
||||
in
|
||||
a
|
||||
[ class "btn btn-outline-info border-0"
|
||||
, href link
|
||||
]
|
||||
[ i [ class "fa fa-link mr-2" ] []
|
||||
, text "Link"
|
||||
]
|
||||
|
||||
|
||||
silenceButton : GettableAlert -> Html Msg
|
||||
silenceButton alert =
|
||||
case List.head alert.status.silencedBy of
|
||||
|
|
Loading…
Reference in New Issue