Skip to content

Commit

Permalink
Update assets.
Browse files Browse the repository at this point in the history
Signed-off-by: bwplotka <[email protected]>
  • Loading branch information
bwplotka committed Jan 24, 2025
1 parent ff2aee3 commit f0d1ef6
Show file tree
Hide file tree
Showing 29 changed files with 127 additions and 40 deletions.
10 changes: 7 additions & 3 deletions ui/app/src/Data/Alert.elm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Json.Encode as Encode


type alias Alert =
{ labels : Dict String String
, generatorURL : Maybe String
{ labels : (Dict String String)
, generatorURL : Maybe (String)
}


Expand All @@ -31,9 +31,13 @@ decoder =
|> optional "generatorURL" (Decode.nullable Decode.string) Nothing



encoder : Alert -> Encode.Value
encoder model =
Encode.object
[ ( "labels", Encode.dict identity Encode.string model.labels )
[ ( "labels", (Encode.dict identity Encode.string) model.labels )
, ( "generatorURL", Maybe.withDefault Encode.null (Maybe.map Encode.string model.generatorURL) )

]


14 changes: 9 additions & 5 deletions ui/app/src/Data/AlertGroup.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

module Data.AlertGroup exposing (AlertGroup, decoder, encoder)

import Data.GettableAlert as GettableAlert exposing (GettableAlert)
import Data.Receiver as Receiver exposing (Receiver)
import Data.GettableAlert as GettableAlert exposing (GettableAlert)
import Dict exposing (Dict)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Pipeline exposing (optional, required)
import Json.Encode as Encode


type alias AlertGroup =
{ labels : Dict String String
{ labels : (Dict String String)
, receiver : Receiver
, alerts : List GettableAlert
, alerts : (List GettableAlert)
}


Expand All @@ -35,10 +35,14 @@ decoder =
|> required "alerts" (Decode.list GettableAlert.decoder)



encoder : AlertGroup -> Encode.Value
encoder model =
Encode.object
[ ( "labels", Encode.dict identity Encode.string model.labels )
[ ( "labels", (Encode.dict identity Encode.string) model.labels )
, ( "receiver", Receiver.encoder model.receiver )
, ( "alerts", Encode.list GettableAlert.encoder model.alerts )
, ( "alerts", (Encode.list GettableAlert.encoder) model.alerts )

]


16 changes: 12 additions & 4 deletions ui/app/src/Data/AlertStatus.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import Json.Encode as Encode

type alias AlertStatus =
{ state : State
, silencedBy : List String
, inhibitedBy : List String
, silencedBy : (List String)
, inhibitedBy : (List String)
}


Expand All @@ -31,6 +31,7 @@ type State
| Suppressed



decoder : Decoder AlertStatus
decoder =
Decode.succeed AlertStatus
Expand All @@ -39,15 +40,18 @@ decoder =
|> required "inhibitedBy" (Decode.list Decode.string)



encoder : AlertStatus -> Encode.Value
encoder model =
Encode.object
[ ( "state", stateEncoder model.state )
, ( "silencedBy", Encode.list Encode.string model.silencedBy )
, ( "inhibitedBy", Encode.list Encode.string model.inhibitedBy )
, ( "silencedBy", (Encode.list Encode.string) model.silencedBy )
, ( "inhibitedBy", (Encode.list Encode.string) model.inhibitedBy )

]



stateDecoder : Decoder State
stateDecoder =
Decode.string
Expand All @@ -68,6 +72,7 @@ stateDecoder =
)



stateEncoder : State -> Encode.Value
stateEncoder model =
case model of
Expand All @@ -79,3 +84,6 @@ stateEncoder model =

Suppressed ->
Encode.string "suppressed"



4 changes: 4 additions & 0 deletions ui/app/src/Data/AlertmanagerConfig.elm
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ decoder =
|> required "original" Decode.string



encoder : AlertmanagerConfig -> Encode.Value
encoder model =
Encode.object
[ ( "original", Encode.string model.original )

]


6 changes: 5 additions & 1 deletion ui/app/src/Data/AlertmanagerStatus.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

module Data.AlertmanagerStatus exposing (AlertmanagerStatus, decoder, encoder)

import Data.AlertmanagerConfig as AlertmanagerConfig exposing (AlertmanagerConfig)
import Data.ClusterStatus as ClusterStatus exposing (ClusterStatus)
import Data.VersionInfo as VersionInfo exposing (VersionInfo)
import Data.AlertmanagerConfig as AlertmanagerConfig exposing (AlertmanagerConfig)
import DateTime exposing (DateTime)
import Dict exposing (Dict)
import Json.Decode as Decode exposing (Decoder)
Expand All @@ -39,11 +39,15 @@ decoder =
|> required "uptime" DateTime.decoder



encoder : AlertmanagerStatus -> Encode.Value
encoder model =
Encode.object
[ ( "cluster", ClusterStatus.encoder model.cluster )
, ( "versionInfo", VersionInfo.encoder model.versionInfo )
, ( "config", AlertmanagerConfig.encoder model.config )
, ( "uptime", DateTime.encoder model.uptime )

]


12 changes: 10 additions & 2 deletions ui/app/src/Data/ClusterStatus.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import Json.Encode as Encode


type alias ClusterStatus =
{ name : Maybe String
{ name : Maybe (String)
, status : Status
, peers : Maybe (List PeerStatus)
, peers : Maybe ((List PeerStatus))
}


Expand All @@ -32,6 +32,7 @@ type Status
| Disabled



decoder : Decoder ClusterStatus
decoder =
Decode.succeed ClusterStatus
Expand All @@ -40,15 +41,18 @@ decoder =
|> optional "peers" (Decode.nullable (Decode.list PeerStatus.decoder)) Nothing



encoder : ClusterStatus -> Encode.Value
encoder model =
Encode.object
[ ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) )
, ( "status", statusEncoder model.status )
, ( "peers", Maybe.withDefault Encode.null (Maybe.map (Encode.list PeerStatus.encoder) model.peers) )

]



statusDecoder : Decoder Status
statusDecoder =
Decode.string
Expand All @@ -69,6 +73,7 @@ statusDecoder =
)



statusEncoder : Status -> Encode.Value
statusEncoder model =
case model of
Expand All @@ -80,3 +85,6 @@ statusEncoder model =

Disabled ->
Encode.string "disabled"



22 changes: 14 additions & 8 deletions ui/app/src/Data/GettableAlert.elm
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@

module Data.GettableAlert exposing (GettableAlert, decoder, encoder)

import Data.AlertStatus as AlertStatus exposing (AlertStatus)
import Data.Receiver as Receiver exposing (Receiver)
import DateTime exposing (DateTime)
import DateTime exposing (DateTime)
import DateTime exposing (DateTime)
import Data.AlertStatus as AlertStatus exposing (AlertStatus)
import Dict exposing (Dict)
import Json.Decode as Decode exposing (Decoder)
import Json.Decode.Pipeline exposing (optional, required)
import Json.Encode as Encode


type alias GettableAlert =
{ labels : Dict String String
, generatorURL : Maybe String
, annotations : Dict String String
, receivers : List Receiver
{ labels : (Dict String String)
, generatorURL : Maybe (String)
, annotations : (Dict String String)
, receivers : (List Receiver)
, fingerprint : String
, startsAt : DateTime
, updatedAt : DateTime
Expand All @@ -48,16 +50,20 @@ decoder =
|> required "status" AlertStatus.decoder



encoder : GettableAlert -> Encode.Value
encoder model =
Encode.object
[ ( "labels", Encode.dict identity Encode.string model.labels )
[ ( "labels", (Encode.dict identity Encode.string) model.labels )
, ( "generatorURL", Maybe.withDefault Encode.null (Maybe.map Encode.string model.generatorURL) )
, ( "annotations", Encode.dict identity Encode.string model.annotations )
, ( "receivers", Encode.list Receiver.encoder model.receivers )
, ( "annotations", (Encode.dict identity Encode.string) model.annotations )
, ( "receivers", (Encode.list Receiver.encoder) model.receivers )
, ( "fingerprint", Encode.string model.fingerprint )
, ( "startsAt", DateTime.encoder model.startsAt )
, ( "updatedAt", DateTime.encoder model.updatedAt )
, ( "endsAt", DateTime.encoder model.endsAt )
, ( "status", AlertStatus.encoder model.status )

]


10 changes: 8 additions & 2 deletions ui/app/src/Data/GettableSilence.elm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
module Data.GettableSilence exposing (GettableSilence, decoder, encoder)

import Data.Matcher as Matcher exposing (Matcher)
import DateTime exposing (DateTime)
import DateTime exposing (DateTime)
import Data.SilenceStatus as SilenceStatus exposing (SilenceStatus)
import DateTime exposing (DateTime)
import Dict exposing (Dict)
Expand All @@ -22,7 +24,7 @@ import Json.Encode as Encode


type alias GettableSilence =
{ matchers : List Matcher
{ matchers : (List Matcher)
, startsAt : DateTime
, endsAt : DateTime
, createdBy : String
Expand All @@ -46,15 +48,19 @@ decoder =
|> required "updatedAt" DateTime.decoder



encoder : GettableSilence -> Encode.Value
encoder model =
Encode.object
[ ( "matchers", Encode.list Matcher.encoder model.matchers )
[ ( "matchers", (Encode.list Matcher.encoder) model.matchers )
, ( "startsAt", DateTime.encoder model.startsAt )
, ( "endsAt", DateTime.encoder model.endsAt )
, ( "createdBy", Encode.string model.createdBy )
, ( "comment", Encode.string model.comment )
, ( "id", Encode.string model.id )
, ( "status", SilenceStatus.encoder model.status )
, ( "updatedAt", DateTime.encoder model.updatedAt )

]


6 changes: 5 additions & 1 deletion ui/app/src/Data/InlineResponse200.elm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Json.Encode as Encode


type alias InlineResponse200 =
{ silenceID : Maybe String
{ silenceID : Maybe (String)
}


Expand All @@ -29,8 +29,12 @@ decoder =
|> optional "silenceID" (Decode.nullable Decode.string) Nothing



encoder : InlineResponse200 -> Encode.Value
encoder model =
Encode.object
[ ( "silenceID", Maybe.withDefault Encode.null (Maybe.map Encode.string model.silenceID) )

]


6 changes: 5 additions & 1 deletion ui/app/src/Data/Matcher.elm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type alias Matcher =
{ name : String
, value : String
, isRegex : Bool
, isEqual : Maybe Bool
, isEqual : Maybe (Bool)
}


Expand All @@ -35,11 +35,15 @@ decoder =
|> optional "isEqual" (Decode.nullable Decode.bool) (Just True)



encoder : Matcher -> Encode.Value
encoder model =
Encode.object
[ ( "name", Encode.string model.name )
, ( "value", Encode.string model.value )
, ( "isRegex", Encode.bool model.isRegex )
, ( "isEqual", Maybe.withDefault Encode.null (Maybe.map Encode.bool model.isEqual) )

]


4 changes: 4 additions & 0 deletions ui/app/src/Data/PeerStatus.elm
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ decoder =
|> required "address" Decode.string



encoder : PeerStatus -> Encode.Value
encoder model =
Encode.object
[ ( "name", Encode.string model.name )
, ( "address", Encode.string model.address )

]


Loading

0 comments on commit f0d1ef6

Please sign in to comment.