Prepopulate matchers when recreating a silence (#1270)

* Fix #1268

Pre-populate matches list when recreating expired
silences.

* Update bindata
This commit is contained in:
stuart nelson 2018-03-02 10:59:50 +01:00 committed by GitHub
parent e67aa8edae
commit 2ecd4d6c3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 20 deletions

View File

@ -98,25 +98,29 @@ matcherButton matcher =
editButton : Silence -> Html Msg
editButton silence =
case silence.status.state of
-- If the silence is expired, do not edit it, but instead create a new
-- one with the old matchers
Expired ->
a
[ class "btn btn-outline-info border-0"
, href (newSilenceFromAlertLabels [])
]
[ text "Recreate"
]
_ ->
let
editUrl =
String.join "/" [ "#/silences", silence.id, "edit" ]
in
a [ class "btn btn-outline-info border-0", href editUrl ]
[ text "Edit"
let
matchers =
List.map (\s -> ( s.name, s.value )) silence.matchers
in
case silence.status.state of
-- If the silence is expired, do not edit it, but instead create a new
-- one with the old matchers
Expired ->
a
[ class "btn btn-outline-info border-0"
, href (newSilenceFromAlertLabels matchers)
]
[ text "Recreate"
]
_ ->
let
editUrl =
String.join "/" [ "#/silences", silence.id, "edit" ]
in
a [ class "btn btn-outline-info border-0", href editUrl ]
[ text "Edit"
]
deleteButton : Silence -> Bool -> Html Msg

File diff suppressed because one or more lines are too long