UI cleanup dead code with elm-review (#2528)
* Add elm-review Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com> * elm-review --fix-all Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com> * Update vfsdata Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com>
This commit is contained in:
parent
d4169dcd63
commit
54431be888
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"type": "application",
|
||||
"source-directories": [
|
||||
"src"
|
||||
],
|
||||
"elm-version": "0.19.1",
|
||||
"dependencies": {
|
||||
"direct": {
|
||||
"elm/core": "1.0.5",
|
||||
"elm/json": "1.1.3",
|
||||
"elm/project-metadata-utils": "1.0.1",
|
||||
"jfmengels/elm-review": "2.3.11",
|
||||
"jfmengels/elm-review-unused": "1.1.6",
|
||||
"stil4m/elm-syntax": "7.2.2"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/html": "1.0.0",
|
||||
"elm/parser": "1.1.0",
|
||||
"elm/random": "1.0.0",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.2",
|
||||
"elm-community/list-extra": "8.3.0",
|
||||
"elm-explorations/test": "1.2.2",
|
||||
"rtfeldman/elm-hex": "1.0.0",
|
||||
"stil4m/structured-writer": "1.0.3"
|
||||
}
|
||||
},
|
||||
"test-dependencies": {
|
||||
"direct": {
|
||||
"elm-explorations/test": "1.2.2"
|
||||
},
|
||||
"indirect": {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
module ReviewConfig exposing (config)
|
||||
|
||||
{-| Do not rename the ReviewConfig module or the config function, because
|
||||
`elm-review` will look for these.
|
||||
|
||||
To add packages that contain rules, add them to this review project using
|
||||
|
||||
`elm install author/packagename`
|
||||
|
||||
when inside the directory containing this file.
|
||||
|
||||
-}
|
||||
|
||||
import NoUnused.CustomTypeConstructorArgs
|
||||
import NoUnused.CustomTypeConstructors
|
||||
import NoUnused.Dependencies
|
||||
import NoUnused.Exports
|
||||
import NoUnused.Modules
|
||||
import NoUnused.Parameters
|
||||
import NoUnused.Patterns
|
||||
import NoUnused.Variables
|
||||
import Review.Rule exposing (Rule)
|
||||
|
||||
|
||||
config : List Rule
|
||||
config =
|
||||
List.map
|
||||
(Review.Rule.ignoreErrorsForDirectories [ "src/Data/" ])
|
||||
[ NoUnused.CustomTypeConstructors.rule []
|
||||
, NoUnused.CustomTypeConstructorArgs.rule
|
||||
, NoUnused.Dependencies.rule
|
||||
, NoUnused.Exports.rule
|
||||
, NoUnused.Modules.rule
|
||||
, NoUnused.Parameters.rule
|
||||
, NoUnused.Patterns.rule
|
||||
, NoUnused.Variables.rule
|
||||
]
|
|
@ -4,8 +4,7 @@ import Data.AlertGroup exposing (AlertGroup)
|
|||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Data.Receiver exposing (Receiver)
|
||||
import Json.Decode
|
||||
import Regex
|
||||
import Utils.Api exposing (iso8601Time)
|
||||
import Utils.Api
|
||||
import Utils.Filter exposing (Filter, generateAPIQueryString)
|
||||
import Utils.Types exposing (ApiData)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import Views.AlertList.Types exposing (initAlertList)
|
|||
import Views.SilenceForm.Types exposing (initSilenceForm)
|
||||
import Views.SilenceList.Types exposing (initSilenceList)
|
||||
import Views.SilenceView.Types exposing (initSilenceView)
|
||||
import Views.Status.Types exposing (StatusModel, initStatusModel)
|
||||
import Views.Status.Types exposing (initStatusModel)
|
||||
|
||||
|
||||
main : Program Json.Value Model Msg
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module Parsing exposing (routeParser, urlParser)
|
||||
module Parsing exposing (urlParser)
|
||||
|
||||
import Regex
|
||||
import Types exposing (Route(..))
|
||||
import Url exposing (Url)
|
||||
import Url.Parser exposing ((</>), (<?>), Parser, int, map, oneOf, parse, s, string, top)
|
||||
import Url.Parser exposing (Parser, map, oneOf, parse, top)
|
||||
import Views.AlertList.Parsing exposing (alertsParser)
|
||||
import Views.SilenceForm.Parsing exposing (silenceFormEditParser, silenceFormNewParser)
|
||||
import Views.SilenceList.Parsing exposing (silenceListParser)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
module Silences.Decoders exposing (create, destroy)
|
||||
|
||||
import Json.Decode as Json exposing (fail, field, succeed)
|
||||
import Utils.Api exposing (andMap, iso8601Time)
|
||||
import Utils.Types exposing (ApiData(..), Matcher, Time)
|
||||
import Json.Decode as Json
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
|
||||
|
||||
create : Json.Decoder String
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
module Silences.Types exposing
|
||||
( nullMatcher
|
||||
, nullSilence
|
||||
, nullSilenceStatus
|
||||
( nullSilence
|
||||
, stateToString
|
||||
)
|
||||
|
||||
import Data.Matcher exposing (Matcher)
|
||||
import Data.PostableSilence exposing (PostableSilence)
|
||||
import Data.SilenceStatus exposing (SilenceStatus, State(..))
|
||||
import Time exposing (Posix)
|
||||
import Data.SilenceStatus exposing (State(..))
|
||||
import Time
|
||||
|
||||
|
||||
nullSilence : PostableSilence
|
||||
|
@ -22,12 +20,6 @@ nullSilence =
|
|||
}
|
||||
|
||||
|
||||
nullSilenceStatus : SilenceStatus
|
||||
nullSilenceStatus =
|
||||
{ state = Expired
|
||||
}
|
||||
|
||||
|
||||
nullMatchers : List Matcher
|
||||
nullMatchers =
|
||||
[ nullMatcher ]
|
||||
|
|
|
@ -2,8 +2,6 @@ module Status.Api exposing (clusterStatusToString, getStatus)
|
|||
|
||||
import Data.AlertmanagerStatus exposing (AlertmanagerStatus)
|
||||
import Data.ClusterStatus exposing (Status(..))
|
||||
import Json.Decode exposing (Decoder, at, bool, field, int, list, map2, maybe, string)
|
||||
import Status.Types exposing (ClusterPeer, ClusterStatus, StatusResponse, VersionInfo)
|
||||
import Utils.Api exposing (get, send)
|
||||
import Utils.Types exposing (ApiData)
|
||||
|
||||
|
@ -31,43 +29,3 @@ clusterStatusToString status =
|
|||
|
||||
Disabled ->
|
||||
"disabled"
|
||||
|
||||
|
||||
decodeStatusResponse : Decoder StatusResponse
|
||||
decodeStatusResponse =
|
||||
field "data" decodeData
|
||||
|
||||
|
||||
decodeData : Decoder StatusResponse
|
||||
decodeData =
|
||||
Json.Decode.map4 StatusResponse
|
||||
(field "configYAML" string)
|
||||
(field "uptime" string)
|
||||
(field "versionInfo" decodeVersionInfo)
|
||||
(field "clusterStatus" (maybe decodeClusterStatus))
|
||||
|
||||
|
||||
decodeVersionInfo : Decoder VersionInfo
|
||||
decodeVersionInfo =
|
||||
Json.Decode.map6 VersionInfo
|
||||
(field "branch" string)
|
||||
(field "buildDate" string)
|
||||
(field "buildUser" string)
|
||||
(field "goVersion" string)
|
||||
(field "revision" string)
|
||||
(field "version" string)
|
||||
|
||||
|
||||
decodeClusterStatus : Decoder ClusterStatus
|
||||
decodeClusterStatus =
|
||||
Json.Decode.map3 ClusterStatus
|
||||
(field "name" string)
|
||||
(field "status" string)
|
||||
(field "peers" (list decodeClusterPeer))
|
||||
|
||||
|
||||
decodeClusterPeer : Decoder ClusterPeer
|
||||
decodeClusterPeer =
|
||||
Json.Decode.map2 ClusterPeer
|
||||
(field "name" string)
|
||||
(field "address" string)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Status.Types exposing (ClusterPeer, ClusterStatus, StatusResponse, VersionInfo)
|
||||
module Status.Types exposing (ClusterPeer, ClusterStatus, VersionInfo)
|
||||
|
||||
|
||||
type alias StatusResponse =
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Types exposing (Model, Msg(..), Route(..))
|
||||
|
||||
import Browser.Navigation exposing (Key)
|
||||
import Utils.Filter exposing (Filter, Matcher, SilenceFormGetParams)
|
||||
import Utils.Filter exposing (Filter, SilenceFormGetParams)
|
||||
import Utils.Types exposing (ApiData)
|
||||
import Views.AlertList.Types as AlertList exposing (AlertListMsg)
|
||||
import Views.SilenceForm.Types as SilenceForm exposing (SilenceFormMsg)
|
||||
|
@ -45,9 +45,7 @@ type Msg
|
|||
| NavigateToStatus
|
||||
| NavigateToInternalUrl String
|
||||
| NavigateToExternalUrl String
|
||||
| Noop
|
||||
| RedirectAlerts
|
||||
| UpdateFilter String
|
||||
| BootstrapCSSLoaded (ApiData String)
|
||||
| FontAwesomeCSSLoaded (ApiData String)
|
||||
| ElmDatepickerCSSLoaded (ApiData String)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module Updates exposing (update)
|
||||
|
||||
import Browser.Navigation as Navigation
|
||||
import String exposing (trim)
|
||||
import Task
|
||||
import Types exposing (Model, Msg(..), Route(..))
|
||||
import Views.AlertList.Types exposing (AlertListMsg(..))
|
||||
|
@ -67,25 +66,8 @@ update msg ({ basePath, apiUrl } as model) =
|
|||
RedirectAlerts ->
|
||||
( model, Navigation.pushUrl model.key (basePath ++ "#/alerts") )
|
||||
|
||||
UpdateFilter text ->
|
||||
let
|
||||
t =
|
||||
if trim text == "" then
|
||||
Nothing
|
||||
|
||||
else
|
||||
Just text
|
||||
|
||||
prevFilter =
|
||||
model.filter
|
||||
in
|
||||
( { model | filter = { prevFilter | text = t } }, Cmd.none )
|
||||
|
||||
Noop ->
|
||||
( model, Cmd.none )
|
||||
|
||||
MsgForStatus subMsg ->
|
||||
Views.Status.Updates.update subMsg model apiUrl
|
||||
Views.Status.Updates.update subMsg model
|
||||
|
||||
MsgForAlertList subMsg ->
|
||||
let
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
module Utils.Api exposing (andMap, delete, errorToString, fromResult, get, iso8601Time, makeApiUrl, map, parseError, post, request, send, withDefault)
|
||||
module Utils.Api exposing (delete, get, makeApiUrl, map, post, send)
|
||||
|
||||
import Http exposing (Error(..))
|
||||
import Json.Decode as Json exposing (field)
|
||||
import Time exposing (Posix)
|
||||
import Utils.Date
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
|
||||
|
||||
|
@ -23,16 +21,6 @@ map fn response =
|
|||
Failure a
|
||||
|
||||
|
||||
withDefault : a -> ApiData a -> a
|
||||
withDefault default response =
|
||||
case response of
|
||||
Success value ->
|
||||
value
|
||||
|
||||
_ ->
|
||||
default
|
||||
|
||||
|
||||
parseError : String -> Maybe String
|
||||
parseError =
|
||||
Json.decodeString (field "error" Json.string) >> Result.toMaybe
|
||||
|
@ -51,7 +39,7 @@ errorToString err =
|
|||
parseError resp.body
|
||||
|> Maybe.withDefault (String.fromInt resp.status.code ++ " " ++ resp.status.message)
|
||||
|
||||
BadPayload err_ resp ->
|
||||
BadPayload err_ _ ->
|
||||
-- OK status, unexpected payload
|
||||
"Unexpected response from api: " ++ err_
|
||||
|
||||
|
@ -102,20 +90,6 @@ request method headers url body decoder =
|
|||
}
|
||||
|
||||
|
||||
iso8601Time : Json.Decoder Posix
|
||||
iso8601Time =
|
||||
Json.andThen
|
||||
(\strTime ->
|
||||
case Utils.Date.timeFromString strTime of
|
||||
Ok time ->
|
||||
Json.succeed time
|
||||
|
||||
Err err ->
|
||||
Json.fail ("Could not decode time " ++ strTime ++ ": " ++ err)
|
||||
)
|
||||
Json.string
|
||||
|
||||
|
||||
makeApiUrl : String -> String
|
||||
makeApiUrl externalUrl =
|
||||
let
|
||||
|
@ -127,8 +101,3 @@ makeApiUrl externalUrl =
|
|||
externalUrl
|
||||
in
|
||||
url ++ "/api/v2"
|
||||
|
||||
|
||||
andMap : Json.Decoder a -> Json.Decoder (a -> b) -> Json.Decoder b
|
||||
andMap =
|
||||
Json.map2 (|>)
|
||||
|
|
|
@ -2,22 +2,16 @@ module Utils.Date exposing
|
|||
( addDuration
|
||||
, dateTimeFormat
|
||||
, durationFormat
|
||||
, durationParser
|
||||
, encode
|
||||
, fromTime
|
||||
, parseDuration
|
||||
, term
|
||||
, timeDifference
|
||||
, timeFromString
|
||||
, timeToString
|
||||
, units
|
||||
)
|
||||
|
||||
import Iso8601
|
||||
import Parser exposing ((|.), (|=), Parser)
|
||||
import Time exposing (Month(..), Posix, toDay, toHour, toMinute, toMonth, toSecond, toYear, utc)
|
||||
import Time exposing (Posix)
|
||||
import Tuple
|
||||
import Utils.Types as Types
|
||||
|
||||
|
||||
parseDuration : String -> Result String Float
|
||||
|
@ -108,11 +102,6 @@ dateTimeFormat =
|
|||
Iso8601.fromTime
|
||||
|
||||
|
||||
encode : Posix -> String
|
||||
encode =
|
||||
Iso8601.fromTime
|
||||
|
||||
|
||||
timeFromString : String -> Result String Posix
|
||||
timeFromString string =
|
||||
if string == "" then
|
||||
|
@ -121,10 +110,3 @@ timeFromString string =
|
|||
else
|
||||
Iso8601.toTime string
|
||||
|> Result.mapError (always "Wrong ISO8601 format")
|
||||
|
||||
|
||||
fromTime : Posix -> Types.Time
|
||||
fromTime time =
|
||||
{ s = Iso8601.fromTime time
|
||||
, t = Just time
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ update msg dateTimePicker =
|
|||
, Just end
|
||||
)
|
||||
|
||||
( Just start, Just end ) ->
|
||||
( Just _, Just _ ) ->
|
||||
( Just m
|
||||
, Nothing
|
||||
)
|
||||
|
|
|
@ -17,7 +17,7 @@ module Utils.DateTimePicker.Utils exposing
|
|||
|
||||
import Html.Events exposing (targetValue)
|
||||
import Json.Decode as Decode
|
||||
import Time exposing (Month(..), Posix, Weekday(..), Zone, utc)
|
||||
import Time exposing (Month(..), Posix, Weekday(..), utc)
|
||||
import Time.Extra as Time exposing (Interval(..))
|
||||
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@ import Html exposing (Html, br, button, div, i, input, p, strong, text)
|
|||
import Html.Attributes exposing (class, maxlength, value)
|
||||
import Html.Events exposing (on, onClick, onMouseOut, onMouseOver)
|
||||
import Iso8601
|
||||
import Json.Decode as Decode exposing (Decoder)
|
||||
import Json.Decode as Decode
|
||||
import Time exposing (Posix, utc)
|
||||
import Utils.DateTimePicker.Types exposing (DateTimePicker, InputHourOrMinute(..), Msg(..), StartOrEnd(..))
|
||||
import Utils.DateTimePicker.Updates exposing (update)
|
||||
import Utils.DateTimePicker.Utils
|
||||
exposing
|
||||
( floorDate
|
||||
|
@ -38,13 +37,13 @@ viewCalendar dateTimePicker =
|
|||
|> Maybe.withDefault (Time.millisToPosix 0)
|
||||
in
|
||||
div [ class "calendar_ month" ]
|
||||
[ viewMonthHeader dateTimePicker justViewTime
|
||||
[ viewMonthHeader justViewTime
|
||||
, viewMonth dateTimePicker justViewTime
|
||||
]
|
||||
|
||||
|
||||
viewMonthHeader : DateTimePicker -> Posix -> Html Msg
|
||||
viewMonthHeader dateTimePicker justViewTime =
|
||||
viewMonthHeader : Posix -> Html Msg
|
||||
viewMonthHeader justViewTime =
|
||||
div [ class "row month-header" ]
|
||||
[ div
|
||||
[ class "prev-month d-flex-center"
|
||||
|
@ -148,7 +147,7 @@ viewDay dateTimePicker justViewTime day =
|
|||
setClass_ dateTimePicker.endDate " end"
|
||||
|
||||
( startClassBack, endClassBack ) =
|
||||
Maybe.map2 (\sd ed -> ( startClass, endClass )) dateTimePicker.startDate dateTimePicker.endDate
|
||||
Maybe.map2 (\_ _ -> ( startClass, endClass )) dateTimePicker.startDate dateTimePicker.endDate
|
||||
|> Maybe.withDefault ( "", "" )
|
||||
|
||||
betweenClass =
|
||||
|
@ -281,7 +280,7 @@ viewTimePicker dateTimePicker startOrEnd =
|
|||
Maybe.map
|
||||
(\t ->
|
||||
case maybeDate of
|
||||
Just d ->
|
||||
Just _ ->
|
||||
Iso8601.fromTime t
|
||||
|> String.dropRight 8
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ module Utils.Filter exposing
|
|||
, emptySilenceFormGetParams
|
||||
, fromApiMatcher
|
||||
, generateAPIQueryString
|
||||
, generateQueryParam
|
||||
, nullFilter
|
||||
, parseFilter
|
||||
, parseGroup
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module Utils.FormValidation exposing
|
||||
( ValidatedField
|
||||
, ValidationState(..)
|
||||
, fromResult
|
||||
, initialField
|
||||
, stringNotEmpty
|
||||
, updateValue
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Utils.List exposing (groupBy, lastElem, mstring, nextElem, replaceIf, replaceIndex, zip)
|
||||
module Utils.List exposing (groupBy, lastElem, mstring, nextElem, zip)
|
||||
|
||||
import Data.Matcher exposing (Matcher)
|
||||
import Dict exposing (Dict)
|
||||
|
@ -23,32 +23,6 @@ lastElem =
|
|||
List.foldl (Just >> always) Nothing
|
||||
|
||||
|
||||
replaceIf : (a -> Bool) -> a -> List a -> List a
|
||||
replaceIf predicate replacement list =
|
||||
List.map
|
||||
(\item ->
|
||||
if predicate item then
|
||||
replacement
|
||||
|
||||
else
|
||||
item
|
||||
)
|
||||
list
|
||||
|
||||
|
||||
replaceIndex : Int -> (a -> a) -> List a -> List a
|
||||
replaceIndex index replacement list =
|
||||
List.indexedMap
|
||||
(\currentIndex item ->
|
||||
if index == currentIndex then
|
||||
replacement item
|
||||
|
||||
else
|
||||
item
|
||||
)
|
||||
list
|
||||
|
||||
|
||||
mstring : Matcher -> String
|
||||
mstring m =
|
||||
let
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Utils.Match exposing (consecutiveChars, jaro, jaroWinkler)
|
||||
module Utils.Match exposing (consecutiveChars, jaroWinkler)
|
||||
|
||||
import Char
|
||||
import Utils.List exposing (zip)
|
||||
|
|
|
@ -32,7 +32,7 @@ linkifyHelp words linkified =
|
|||
-- append space to last word
|
||||
linkifyHelp restWords (Ok word :: Err (lastWord ++ " ") :: restLinkified)
|
||||
|
||||
(Ok lastWord) :: restLinkified ->
|
||||
(Ok _) :: _ ->
|
||||
-- insert space between two links
|
||||
linkifyHelp restWords (Ok word :: Err " " :: linkified)
|
||||
|
||||
|
@ -45,7 +45,7 @@ linkifyHelp words linkified =
|
|||
-- concatenate with last word
|
||||
linkifyHelp restWords (Err (lastWord ++ " " ++ word) :: restLinkified)
|
||||
|
||||
(Ok lastWord) :: restLinkified ->
|
||||
(Ok _) :: _ ->
|
||||
-- insert space after the link
|
||||
linkifyHelp restWords (Err (" " ++ word) :: linkified)
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
module Utils.Types exposing (ApiData(..), Duration, Label, Labels, Matcher, Matchers, Time)
|
||||
|
||||
import Time exposing (Posix)
|
||||
module Utils.Types exposing (ApiData(..), Label, Labels, Matcher)
|
||||
|
||||
|
||||
type ApiData a
|
||||
|
@ -28,15 +26,3 @@ type alias Labels =
|
|||
|
||||
type alias Label =
|
||||
( String, String )
|
||||
|
||||
|
||||
type alias Time =
|
||||
{ t : Maybe Posix
|
||||
, s : String
|
||||
}
|
||||
|
||||
|
||||
type alias Duration =
|
||||
{ d : Maybe Float
|
||||
, s : String
|
||||
}
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
module Utils.Views exposing
|
||||
( apiData
|
||||
, buttonLink
|
||||
, checkbox
|
||||
, error
|
||||
, formField
|
||||
, formInput
|
||||
, iconButtonMsg
|
||||
, labelButton
|
||||
, linkifyText
|
||||
, loading
|
||||
, tab
|
||||
, textField
|
||||
, validatedField
|
||||
, validatedTextareaField
|
||||
)
|
||||
|
@ -76,13 +71,6 @@ linkifyText str =
|
|||
(Utils.String.linkify str)
|
||||
|
||||
|
||||
iconButtonMsg : String -> String -> msg -> Html msg
|
||||
iconButtonMsg classString icon msg =
|
||||
button [ class classString, onClick msg ]
|
||||
[ i [ class <| "fa fa-3 " ++ icon ] []
|
||||
]
|
||||
|
||||
|
||||
checkbox : String -> Bool -> (Bool -> msg) -> Html msg
|
||||
checkbox name status msg =
|
||||
label [ class "f6 dib mb2 mr2 d-flex align-items-center" ]
|
||||
|
@ -185,34 +173,6 @@ validatedTextareaField labelText classes inputMsg blurMsg field =
|
|||
]
|
||||
|
||||
|
||||
formField : String -> String -> String -> (String -> msg) -> Html msg
|
||||
formField labelText content classes msg =
|
||||
div [ class <| "d-flex flex-column " ++ classes ]
|
||||
[ label [] [ strong [] [ text labelText ] ]
|
||||
, input [ value content, onInput msg ] []
|
||||
]
|
||||
|
||||
|
||||
textField : String -> String -> String -> (String -> msg) -> Html msg
|
||||
textField labelText content classes msg =
|
||||
div [ class <| "d-flex flex-column " ++ classes ]
|
||||
[ label [] [ strong [] [ text labelText ] ]
|
||||
, textarea [ value content, onInput msg, disableGrammarly ] []
|
||||
]
|
||||
|
||||
|
||||
buttonLink : String -> String -> String -> msg -> Html msg
|
||||
buttonLink icon link color msg =
|
||||
a [ class <| "" ++ color, href link, onClick msg ]
|
||||
[ i [ class <| "" ++ icon ] []
|
||||
]
|
||||
|
||||
|
||||
formInput : String -> String -> (String -> msg) -> Html msg
|
||||
formInput inputValue classes msg =
|
||||
Html.input [ class <| "w-100 " ++ classes, value inputValue, onInput msg ] []
|
||||
|
||||
|
||||
apiData : (a -> Html msg) -> Types.ApiData a -> Html msg
|
||||
apiData onSuccess data =
|
||||
case data of
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
module Views exposing (cssNode, currentView, failureView, renderCSS, view)
|
||||
module Views exposing (view)
|
||||
|
||||
import Html exposing (Html, div, node, text)
|
||||
import Html.Attributes exposing (class, href, rel, src, style)
|
||||
import Html.Attributes exposing (class, href, rel, style)
|
||||
import Html.Events exposing (on)
|
||||
import Json.Decode exposing (succeed)
|
||||
import Types exposing (Model, Msg(..), Route(..))
|
||||
import Utils.Filter exposing (emptySilenceFormGetParams)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Utils.Views exposing (error, loading)
|
||||
import Utils.Views
|
||||
import Views.AlertList.Views as AlertList
|
||||
import Views.NavBar.Views exposing (navBar)
|
||||
import Views.NotFound.Views as NotFound
|
||||
|
@ -77,7 +77,7 @@ currentView model =
|
|||
StatusRoute ->
|
||||
Status.view model.status
|
||||
|
||||
SilenceViewRoute silenceId ->
|
||||
SilenceViewRoute _ ->
|
||||
SilenceView.view model.silenceView
|
||||
|
||||
AlertsRoute filter ->
|
||||
|
|
|
@ -3,11 +3,10 @@ module Views.AlertList.AlertView exposing (addLabelMsg, view)
|
|||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Dict
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (class, href, readonly, style, title, value)
|
||||
import Html.Attributes exposing (class, href, style, title, value)
|
||||
import Html.Events exposing (onClick)
|
||||
import Types exposing (Msg(..))
|
||||
import Utils.Filter
|
||||
import Utils.Views
|
||||
import Views.AlertList.Types exposing (AlertListMsg(..))
|
||||
import Views.FilterBar.Types as FilterBarTypes
|
||||
import Views.Shared.Alert exposing (annotation, annotationsButton, generatorUrlButton, titleView)
|
||||
|
@ -123,7 +122,7 @@ silenceButton alert =
|
|||
inhibitedIcon : GettableAlert -> Html Msg
|
||||
inhibitedIcon alert =
|
||||
case List.head alert.status.inhibitedBy of
|
||||
Just sId ->
|
||||
Just _ ->
|
||||
a
|
||||
[ class "btn btn-outline-info border-0 text-info"
|
||||
]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module Views.AlertList.Parsing exposing (alertsParser)
|
||||
|
||||
import Url.Parser exposing ((</>), (<?>), Parser, int, map, oneOf, s, string)
|
||||
import Url.Parser exposing ((<?>), Parser, map, s)
|
||||
import Url.Parser.Query as Query
|
||||
import Utils.Filter exposing (Filter, MatchOperator(..), parseMatcher)
|
||||
import Utils.Filter exposing (Filter, MatchOperator(..))
|
||||
|
||||
|
||||
boolParam : String -> Query.Parser Bool
|
||||
|
|
|
@ -9,7 +9,7 @@ import Browser.Navigation exposing (Key)
|
|||
import Data.AlertGroup exposing (AlertGroup)
|
||||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Set exposing (Set)
|
||||
import Utils.Types exposing (ApiData(..), Labels)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Views.FilterBar.Types as FilterBar
|
||||
import Views.GroupBar.Types as GroupBar
|
||||
import Views.ReceiverBar.Types as ReceiverBar
|
||||
|
|
|
@ -2,20 +2,18 @@ module Views.AlertList.Views exposing (view)
|
|||
|
||||
import Data.AlertGroup exposing (AlertGroup)
|
||||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Dict exposing (Dict)
|
||||
import Dict
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (..)
|
||||
import Set exposing (Set)
|
||||
import Types exposing (Msg(..))
|
||||
import Utils.Filter exposing (Filter)
|
||||
import Utils.List
|
||||
import Utils.Types exposing (ApiData(..), Labels)
|
||||
import Utils.Views
|
||||
import Views.AlertList.AlertView as AlertView
|
||||
import Views.AlertList.Types exposing (AlertListMsg(..), Model, Tab(..))
|
||||
import Views.FilterBar.Views as FilterBar
|
||||
import Views.GroupBar.Types as GroupBar
|
||||
import Views.GroupBar.Views as GroupBar
|
||||
import Views.ReceiverBar.Views as ReceiverBar
|
||||
|
||||
|
@ -47,7 +45,7 @@ groupTabName customGrouping =
|
|||
|
||||
|
||||
view : Model -> Filter -> Html Msg
|
||||
view { alerts, alertGroups, groupBar, filterBar, receiverBar, tab, activeId, activeGroups, expandAll } filter =
|
||||
view { alertGroups, groupBar, filterBar, receiverBar, tab, activeId, activeGroups, expandAll } filter =
|
||||
div []
|
||||
[ div
|
||||
[ class "card mb-3" ]
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module Views.FilterBar.Views exposing (view)
|
||||
|
||||
import Html exposing (Attribute, Html, a, button, div, i, input, small, span, text)
|
||||
import Html exposing (Html, a, button, div, i, input, small, span, text)
|
||||
import Html.Attributes exposing (class, disabled, href, id, style, value)
|
||||
import Html.Events exposing (keyCode, on, onClick, onInput)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Utils.Filter exposing (Matcher, convertFilterMatcher)
|
||||
import Utils.Keyboard exposing (keys, onKeyDown, onKeyUp)
|
||||
import Utils.Keyboard exposing (onKeyDown, onKeyUp)
|
||||
import Utils.List
|
||||
import Views.FilterBar.Types exposing (Model, Msg(..))
|
||||
import Views.SilenceForm.Parsing exposing (newSilenceFromMatchers)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module Views.GroupBar.Views exposing (view)
|
||||
|
||||
import Html exposing (Attribute, Html, a, button, div, i, input, li, small, span, text, ul)
|
||||
import Html.Attributes exposing (class, disabled, href, id, style, value)
|
||||
import Html.Events exposing (keyCode, on, onBlur, onClick, onFocus, onInput, onMouseEnter, onMouseLeave)
|
||||
import Html exposing (Html, a, button, div, input, small, span, text)
|
||||
import Html.Attributes exposing (class, disabled, id, style, value)
|
||||
import Html.Events exposing (onBlur, onClick, onFocus, onInput, onMouseEnter, onMouseLeave)
|
||||
import Set
|
||||
import Utils.Keyboard exposing (keys, onKeyDown, onKeyUp)
|
||||
import Utils.List
|
||||
|
|
|
@ -3,7 +3,7 @@ module Views.ReceiverBar.Views exposing (view)
|
|||
import Html exposing (Html, div, input, li, text)
|
||||
import Html.Attributes exposing (class, id, style, tabindex, value)
|
||||
import Html.Events exposing (onBlur, onClick, onInput, onMouseEnter, onMouseLeave)
|
||||
import Utils.Keyboard exposing (keys, onKeyDown, onKeyUp)
|
||||
import Utils.Keyboard exposing (keys, onKeyDown)
|
||||
import Utils.List
|
||||
import Views.ReceiverBar.Types exposing (Model, Msg(..), Receiver)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module Views.Shared.Alert exposing (annotation, annotationsButton, generatorUrlButton, titleView)
|
||||
|
||||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Html exposing (Html, a, button, div, i, li, span, table, td, text, th, tr)
|
||||
import Html.Attributes exposing (class, href, style)
|
||||
import Html exposing (Html, a, button, i, span, td, text, th, tr)
|
||||
import Html.Attributes exposing (class, href)
|
||||
import Html.Events exposing (onClick)
|
||||
import Utils.Date exposing (dateTimeFormat)
|
||||
import Utils.Views exposing (linkifyText)
|
||||
|
|
|
@ -3,7 +3,7 @@ module Views.Shared.AlertCompact exposing (view)
|
|||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Dict
|
||||
import Html exposing (Html, div, table, text)
|
||||
import Html.Attributes exposing (class, href, style)
|
||||
import Html.Attributes exposing (class, style)
|
||||
import Utils.Views exposing (labelButton)
|
||||
import Views.Shared.Alert exposing (annotation, annotationsButton, generatorUrlButton, titleView)
|
||||
import Views.Shared.Types exposing (Msg)
|
||||
|
|
|
@ -3,9 +3,9 @@ module Views.SilenceForm.Parsing exposing (newSilenceFromAlertLabels, newSilence
|
|||
import Data.Matcher
|
||||
import Dict exposing (Dict)
|
||||
import Url exposing (percentEncode)
|
||||
import Url.Parser exposing ((</>), (<?>), Parser, map, oneOf, s, string)
|
||||
import Url.Parser exposing ((</>), (<?>), Parser, s, string)
|
||||
import Url.Parser.Query as Query
|
||||
import Utils.Filter exposing (Matcher, SilenceFormGetParams, parseFilter)
|
||||
import Utils.Filter exposing (SilenceFormGetParams, parseFilter)
|
||||
|
||||
|
||||
newSilenceFromAlertLabels : Dict String String -> String
|
||||
|
|
|
@ -9,7 +9,6 @@ module Views.SilenceForm.Types exposing
|
|||
, initSilenceForm
|
||||
, parseEndsAt
|
||||
, toSilence
|
||||
, validMatchers
|
||||
, validateForm
|
||||
, validateMatchers
|
||||
)
|
||||
|
@ -17,7 +16,7 @@ module Views.SilenceForm.Types exposing
|
|||
import Browser.Navigation exposing (Key)
|
||||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Data.GettableSilence exposing (GettableSilence)
|
||||
import Data.Matcher exposing (Matcher)
|
||||
import Data.Matcher
|
||||
import Data.PostableSilence exposing (PostableSilence)
|
||||
import DateTime
|
||||
import Silences.Types exposing (nullSilence)
|
||||
|
@ -33,7 +32,7 @@ import Utils.FormValidation
|
|||
, stringNotEmpty
|
||||
, validate
|
||||
)
|
||||
import Utils.Types exposing (ApiData(..), Duration)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Views.FilterBar.Types as FilterBar
|
||||
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ import Utils.Date exposing (timeFromString)
|
|||
import Utils.DateTimePicker.Types exposing (initFromStartAndEndTime)
|
||||
import Utils.DateTimePicker.Updates as DateTimePickerUpdates
|
||||
import Utils.Filter exposing (silencePreviewFilter)
|
||||
import Utils.FormValidation exposing (fromResult, initialField, stringNotEmpty, updateValue, validate)
|
||||
import Utils.List
|
||||
import Utils.FormValidation exposing (initialField, stringNotEmpty, updateValue, validate)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Views.FilterBar.Types as FilterBar
|
||||
import Views.FilterBar.Updates as FilterBar
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
module Views.SilenceForm.Views exposing (view)
|
||||
|
||||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Html exposing (Html, a, button, div, fieldset, h1, h5, i, input, label, legend, span, strong, text, textarea)
|
||||
import Html.Attributes exposing (class, href, style)
|
||||
import Html exposing (Html, button, div, h1, i, input, label, strong, text)
|
||||
import Html.Attributes exposing (class, style)
|
||||
import Html.Events exposing (onClick)
|
||||
import Utils.DateTimePicker.Views exposing (viewDateTimePicker)
|
||||
import Utils.Filter exposing (SilenceFormGetParams)
|
||||
import Utils.FormValidation exposing (ValidatedField, ValidationState(..))
|
||||
import Utils.Types exposing (ApiData)
|
||||
import Utils.Views exposing (checkbox, iconButtonMsg, loading, validatedField, validatedTextareaField)
|
||||
import Utils.Views exposing (loading, validatedField, validatedTextareaField)
|
||||
import Views.FilterBar.Types as FilterBar
|
||||
import Views.FilterBar.Views as FilterBar
|
||||
import Views.Shared.SilencePreview
|
||||
import Views.Shared.Types exposing (Msg)
|
||||
import Views.SilenceForm.Types exposing (Model, SilenceForm, SilenceFormFieldMsg(..), SilenceFormMsg(..), validMatchers)
|
||||
import Views.SilenceForm.Types exposing (Model, SilenceForm, SilenceFormFieldMsg(..), SilenceFormMsg(..))
|
||||
|
||||
|
||||
view : Maybe String -> SilenceFormGetParams -> String -> Model -> Html SilenceFormMsg
|
||||
|
@ -45,7 +44,7 @@ view maybeId silenceFormGetParams defaultCreator { form, filterBar, filterBarVal
|
|||
form.comment
|
||||
, div [ class inputSectionPadding ]
|
||||
[ informationBlock activeAlertId silenceId alerts
|
||||
, silenceActionButtons maybeId form resetClick
|
||||
, silenceActionButtons maybeId resetClick
|
||||
]
|
||||
, dateTimePickerDialog form
|
||||
]
|
||||
|
@ -180,8 +179,8 @@ informationBlock activeAlertId silence alerts =
|
|||
loading
|
||||
|
||||
|
||||
silenceActionButtons : Maybe String -> SilenceForm -> SilenceFormMsg -> Html SilenceFormMsg
|
||||
silenceActionButtons maybeId form resetClick =
|
||||
silenceActionButtons : Maybe String -> SilenceFormMsg -> Html SilenceFormMsg
|
||||
silenceActionButtons maybeId resetClick =
|
||||
div [ class ("mb-4 " ++ inputSectionPadding) ]
|
||||
[ previewSilenceBtn
|
||||
, createSilenceBtn maybeId
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
module Views.SilenceList.SilenceView exposing (deleteButton, editButton, view)
|
||||
module Views.SilenceList.SilenceView exposing (editButton, view)
|
||||
|
||||
import Data.GettableSilence exposing (GettableSilence)
|
||||
import Data.Matcher exposing (Matcher)
|
||||
import Data.SilenceStatus exposing (State(..))
|
||||
import Dict exposing (Dict)
|
||||
import Html exposing (Html, a, b, button, div, h3, i, li, p, small, span, text)
|
||||
import Html exposing (Html, a, button, div, li, span, text)
|
||||
import Html.Attributes exposing (class, href, style)
|
||||
import Html.Events exposing (onClick)
|
||||
import Time exposing (Posix)
|
||||
|
@ -12,10 +11,10 @@ import Types exposing (Msg(..))
|
|||
import Utils.Date
|
||||
import Utils.Filter
|
||||
import Utils.List
|
||||
import Utils.Views exposing (buttonLink)
|
||||
import Utils.Views
|
||||
import Views.FilterBar.Types as FilterBarTypes
|
||||
import Views.Shared.Dialog as Dialog
|
||||
import Views.SilenceForm.Parsing exposing (newSilenceFromMatchers, newSilenceFromMatchersAndComment)
|
||||
import Views.SilenceForm.Parsing exposing (newSilenceFromMatchersAndComment)
|
||||
import Views.SilenceList.Types exposing (SilenceListMsg(..))
|
||||
|
||||
|
||||
|
@ -39,7 +38,7 @@ view showConfirmationDialog silence =
|
|||
dateView "Expired" silence.endsAt
|
||||
, detailsButton silence.id
|
||||
, editButton silence
|
||||
, deleteButton silence False
|
||||
, deleteButton silence
|
||||
]
|
||||
, div [ class "" ] (List.map matcherButton silence.matchers)
|
||||
, Dialog.view
|
||||
|
@ -137,8 +136,8 @@ editButton silence =
|
|||
default
|
||||
|
||||
|
||||
deleteButton : GettableSilence -> Bool -> Html Msg
|
||||
deleteButton silence refresh =
|
||||
deleteButton : GettableSilence -> Html Msg
|
||||
deleteButton silence =
|
||||
case silence.status.state of
|
||||
Expired ->
|
||||
text ""
|
||||
|
@ -146,7 +145,7 @@ deleteButton silence refresh =
|
|||
Active ->
|
||||
button
|
||||
[ class "btn btn-outline-danger border-0"
|
||||
, onClick (MsgForSilenceList (ConfirmDestroySilence silence refresh))
|
||||
, onClick (MsgForSilenceList (ConfirmDestroySilence silence))
|
||||
]
|
||||
[ text "Expire"
|
||||
]
|
||||
|
@ -154,7 +153,7 @@ deleteButton silence refresh =
|
|||
Pending ->
|
||||
button
|
||||
[ class "btn btn-outline-danger border-0"
|
||||
, onClick (MsgForSilenceList (ConfirmDestroySilence silence refresh))
|
||||
, onClick (MsgForSilenceList (ConfirmDestroySilence silence))
|
||||
]
|
||||
[ text "Delete"
|
||||
]
|
||||
|
|
|
@ -8,7 +8,7 @@ import Views.FilterBar.Types as FilterBar
|
|||
|
||||
|
||||
type SilenceListMsg
|
||||
= ConfirmDestroySilence GettableSilence Bool
|
||||
= ConfirmDestroySilence GettableSilence
|
||||
| DestroySilence GettableSilence Bool
|
||||
| SilencesFetch (ApiData (List GettableSilence))
|
||||
| FetchSilences
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Views.SilenceList.Updates exposing (update, urlUpdate)
|
||||
module Views.SilenceList.Updates exposing (update)
|
||||
|
||||
import Browser.Navigation as Navigation
|
||||
import Data.GettableSilence exposing (GettableSilence)
|
||||
|
@ -6,7 +6,7 @@ import Data.SilenceStatus exposing (State(..))
|
|||
import Silences.Api as Api
|
||||
import Utils.Api as ApiData
|
||||
import Utils.Filter exposing (Filter)
|
||||
import Utils.Types as Types exposing (ApiData(..), Matchers, Time)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Views.FilterBar.Updates as FilterBar
|
||||
import Views.SilenceList.Types exposing (Model, SilenceListMsg(..), SilenceTab)
|
||||
|
||||
|
@ -33,7 +33,7 @@ update msg model filter basePath apiUrl =
|
|||
, Api.getSilences apiUrl filter SilencesFetch
|
||||
)
|
||||
|
||||
ConfirmDestroySilence silence refresh ->
|
||||
ConfirmDestroySilence silence ->
|
||||
( { model | showConfirmationDialog = Just silence.id }
|
||||
, Cmd.none
|
||||
)
|
||||
|
@ -105,20 +105,3 @@ filterSilencesByState state =
|
|||
filterSilenceByState : State -> GettableSilence -> Bool
|
||||
filterSilenceByState state silence =
|
||||
silence.status.state == state
|
||||
|
||||
|
||||
urlUpdate : Maybe String -> ( SilenceListMsg, Filter )
|
||||
urlUpdate maybeString =
|
||||
( FetchSilences, updateFilter maybeString )
|
||||
|
||||
|
||||
updateFilter : Maybe String -> Filter
|
||||
updateFilter maybeFilter =
|
||||
{ receiver = Nothing
|
||||
, showSilenced = Nothing
|
||||
, showInhibited = Nothing
|
||||
, showActive = Nothing
|
||||
, group = Nothing
|
||||
, customGrouping = False
|
||||
, text = maybeFilter
|
||||
}
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
module Views.SilenceList.Views exposing (filterSilencesByState, groupSilencesByState, silencesView, states, tabView, tabsView, view)
|
||||
module Views.SilenceList.Views exposing (view)
|
||||
|
||||
import Data.GettableSilence exposing (GettableSilence)
|
||||
import Data.SilenceStatus exposing (State(..))
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Keyed
|
||||
import Html.Lazy exposing (lazy, lazy2, lazy3)
|
||||
import Html.Lazy exposing (lazy2, lazy3)
|
||||
import Silences.Types exposing (stateToString)
|
||||
import Types exposing (Msg(..))
|
||||
import Utils.String as StringUtils
|
||||
import Utils.Types exposing (ApiData(..), Matcher)
|
||||
import Utils.Views exposing (buttonLink, checkbox, error, formField, formInput, iconButtonMsg, loading, textField)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Utils.Views exposing (error, loading)
|
||||
import Views.FilterBar.Views as FilterBar
|
||||
import Views.SilenceList.SilenceView
|
||||
import Views.SilenceList.Types exposing (Model, SilenceListMsg(..), SilenceTab)
|
||||
|
@ -89,21 +88,6 @@ silencesView showConfirmationDialog tab silencesTab =
|
|||
loading
|
||||
|
||||
|
||||
groupSilencesByState : List GettableSilence -> List ( State, List GettableSilence )
|
||||
groupSilencesByState silences =
|
||||
List.map (\state -> ( state, filterSilencesByState state silences )) states
|
||||
|
||||
|
||||
states : List State
|
||||
states =
|
||||
[ Active, Pending, Expired ]
|
||||
|
||||
|
||||
filterSilencesByState : State -> List GettableSilence -> List GettableSilence
|
||||
filterSilencesByState state =
|
||||
List.filter (filterSilenceByState state)
|
||||
|
||||
|
||||
filterSilenceByState : State -> GettableSilence -> Bool
|
||||
filterSilenceByState state silence =
|
||||
silence.status.state == state
|
||||
|
|
|
@ -7,12 +7,11 @@ import Utils.Types exposing (ApiData(..))
|
|||
|
||||
|
||||
type SilenceViewMsg
|
||||
= FetchSilence String
|
||||
| SilenceFetched (ApiData GettableSilence)
|
||||
= SilenceFetched (ApiData GettableSilence)
|
||||
| SetActiveAlert (Maybe String)
|
||||
| AlertGroupsPreview (ApiData (List GettableAlert))
|
||||
| InitSilenceView String
|
||||
| ConfirmDestroySilence GettableSilence Bool
|
||||
| ConfirmDestroySilence
|
||||
| Reload String
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import Alerts.Api
|
|||
import Browser.Navigation as Navigation
|
||||
import Silences.Api exposing (getSilence)
|
||||
import Utils.Filter exposing (silencePreviewFilter)
|
||||
import Utils.List
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Views.SilenceView.Types exposing (Model, SilenceViewMsg(..))
|
||||
|
||||
|
@ -12,9 +11,6 @@ import Views.SilenceView.Types exposing (Model, SilenceViewMsg(..))
|
|||
update : SilenceViewMsg -> Model -> String -> ( Model, Cmd SilenceViewMsg )
|
||||
update msg model apiUrl =
|
||||
case msg of
|
||||
FetchSilence id ->
|
||||
( model, getSilence apiUrl id SilenceFetched )
|
||||
|
||||
AlertGroupsPreview alerts ->
|
||||
( { model | alerts = alerts }
|
||||
, Cmd.none
|
||||
|
@ -36,7 +32,7 @@ update msg model apiUrl =
|
|||
|> Cmd.map AlertGroupsPreview
|
||||
)
|
||||
|
||||
ConfirmDestroySilence silence refresh ->
|
||||
ConfirmDestroySilence ->
|
||||
( { model | showConfirmationDialog = True }
|
||||
, Cmd.none
|
||||
)
|
||||
|
|
|
@ -3,8 +3,8 @@ module Views.SilenceView.Views exposing (view)
|
|||
import Data.GettableAlert exposing (GettableAlert)
|
||||
import Data.GettableSilence exposing (GettableSilence)
|
||||
import Data.SilenceStatus
|
||||
import Html exposing (Html, b, button, div, h1, h2, h3, label, p, span, text)
|
||||
import Html.Attributes exposing (class, href)
|
||||
import Html exposing (Html, b, button, div, h1, label, span, text)
|
||||
import Html.Attributes exposing (class)
|
||||
import Html.Events exposing (onClick)
|
||||
import Silences.Types exposing (stateToString)
|
||||
import Types exposing (Msg(..))
|
||||
|
@ -14,7 +14,6 @@ import Utils.Types exposing (ApiData(..))
|
|||
import Utils.Views exposing (error, loading)
|
||||
import Views.Shared.Dialog as Dialog
|
||||
import Views.Shared.SilencePreview
|
||||
import Views.Shared.Types as SharedTypes
|
||||
import Views.SilenceList.SilenceView exposing (editButton)
|
||||
import Views.SilenceList.Types exposing (SilenceListMsg(..))
|
||||
import Views.SilenceView.Types as SilenceViewTypes exposing (Model)
|
||||
|
@ -53,7 +52,7 @@ viewSilence activeAlertId alerts silence showPromptDialog =
|
|||
, span
|
||||
[ class "ml-3" ]
|
||||
[ editButton silence
|
||||
, expireButton silence False
|
||||
, expireButton silence
|
||||
]
|
||||
]
|
||||
, formGroup "ID" <| text silence.id
|
||||
|
@ -101,8 +100,8 @@ formGroup key content =
|
|||
]
|
||||
|
||||
|
||||
expireButton : GettableSilence -> Bool -> Html Msg
|
||||
expireButton silence refresh =
|
||||
expireButton : GettableSilence -> Html Msg
|
||||
expireButton silence =
|
||||
case silence.status.state of
|
||||
Data.SilenceStatus.Expired ->
|
||||
text ""
|
||||
|
@ -110,7 +109,7 @@ expireButton silence refresh =
|
|||
Data.SilenceStatus.Active ->
|
||||
button
|
||||
[ class "btn btn-outline-danger border-0"
|
||||
, onClick (MsgForSilenceView (SilenceViewTypes.ConfirmDestroySilence silence refresh))
|
||||
, onClick (MsgForSilenceView SilenceViewTypes.ConfirmDestroySilence)
|
||||
]
|
||||
[ text "Expire"
|
||||
]
|
||||
|
@ -118,7 +117,7 @@ expireButton silence refresh =
|
|||
Data.SilenceStatus.Pending ->
|
||||
button
|
||||
[ class "btn btn-outline-danger border-0"
|
||||
, onClick (MsgForSilenceView (SilenceViewTypes.ConfirmDestroySilence silence refresh))
|
||||
, onClick (MsgForSilenceView SilenceViewTypes.ConfirmDestroySilence)
|
||||
]
|
||||
[ text "Delete"
|
||||
]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module Views.Status.Types exposing (StatusModel, StatusMsg(..), initStatusModel)
|
||||
|
||||
import Data.AlertmanagerStatus exposing (AlertmanagerStatus)
|
||||
import Status.Types exposing (StatusResponse)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import Types exposing (Model, Msg(..))
|
|||
import Views.Status.Types exposing (StatusMsg(..))
|
||||
|
||||
|
||||
update : StatusMsg -> Model -> String -> ( Model, Cmd Msg )
|
||||
update msg model basePath =
|
||||
update : StatusMsg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
NewStatus apiResponse ->
|
||||
( { model | status = { statusInfo = apiResponse } }, Cmd.none )
|
||||
|
|
|
@ -7,8 +7,8 @@ import Data.VersionInfo exposing (VersionInfo)
|
|||
import Html exposing (..)
|
||||
import Html.Attributes exposing (class, classList, style)
|
||||
import Status.Api exposing (clusterStatusToString)
|
||||
import Status.Types exposing (StatusResponse, VersionInfo)
|
||||
import Types exposing (Msg(..))
|
||||
import Status.Types exposing (VersionInfo)
|
||||
import Types
|
||||
import Utils.Date exposing (timeToString)
|
||||
import Utils.Types exposing (ApiData(..))
|
||||
import Utils.Views
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Filter exposing (parseMatcher, stringifyFilter, toUrl)
|
||||
|
||||
import Expect
|
||||
import Fuzz exposing (int, list, string, tuple)
|
||||
import Fuzz exposing (string, tuple)
|
||||
import Helpers exposing (isNotEmptyTrimmedAlphabetWord)
|
||||
import Test exposing (..)
|
||||
import Utils.Filter exposing (MatchOperator(..), Matcher)
|
||||
|
|
Loading…
Reference in New Issue