11port module Main exposing (main )
22
33import Dict
4+ import Html.String as Html
5+ import Html.String.Attributes as Html
46import Json.Decode as Decode exposing (Decoder , Error )
57import Json.Decode.Pipeline as Decode
68import Json.Encode as Encode
@@ -137,6 +139,28 @@ main =
137139 }
138140
139141
142+ errorMessage : String -> String
143+ errorMessage msg =
144+ Html . div
145+ [ Html . style " display" " flex"
146+ , Html . style " justify-content" " center"
147+ , Html . style " flex-direction" " column"
148+ , Html . style " align-items" " center"
149+ ]
150+ [ Html . div [] [ Html . h1 [] [ Html . text " Cockpit CMS proxy" ] ]
151+ , Html . div [] [ Html . text " There seems to be an error in the proxy configuration" ]
152+ , Html . div [ Html . style " margin-top" " 20px" ]
153+ [ Html . code
154+ [ Html . style " background-color" " #f1f1f1"
155+ , Html . style " color" " crimson"
156+ , Html . style " padding" " 10px"
157+ ]
158+ [ Html . text msg ]
159+ ]
160+ ]
161+ |> Html . toString 2
162+
163+
140164update : Msg -> Config -> ( Config , Cmd Msg )
141165update msg config =
142166 case msg of
@@ -147,7 +171,7 @@ update msg config =
147171 ( config
148172 , { response = response
149173 , request = request
150- , meta = MetaOutputError { success = False , data = err }
174+ , meta = MetaOutputError { success = False , data = errorMessage err }
151175 }
152176 |> toOutput
153177 )
0 commit comments