Externalize error messages

This commit is contained in:
Eike Kettner
2021-04-17 11:14:29 +02:00
parent c9b54e80b7
commit b2cffb22ef
65 changed files with 1518 additions and 683 deletions

View File

@@ -1,5 +1,6 @@
module Page.Queue.Data exposing
( Model
( FormState(..)
, Model
, Msg(..)
, QueueView(..)
, emptyModel
@@ -20,7 +21,7 @@ import Util.Maybe
type alias Model =
{ state : JobQueueState
, error : String
, formState : FormState
, pollingInterval : Float
, init : Bool
, stopRefresh : Bool
@@ -32,6 +33,11 @@ type alias Model =
}
type FormState
= InitialForm
| HttpError Http.Error
type QueueView
= CurrentJobs
| QueueAll
@@ -44,7 +50,7 @@ type QueueView
emptyModel : Model
emptyModel =
{ state = Api.Model.JobQueueState.empty
, error = ""
, formState = InitialForm
, pollingInterval = 1200
, init = False
, stopRefresh = False

View File

@@ -4,10 +4,8 @@ import Api
import Comp.YesNoDimmer
import Data.Flags exposing (Flags)
import Page.Queue.Data exposing (..)
import Ports
import Task
import Time
import Util.Http
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
@@ -42,7 +40,7 @@ update flags msg model =
( { model | state = s, stopRefresh = False }, refresh )
StateResp (Err err) ->
( { model | error = Util.Http.errorToString err }, Cmd.none )
( { model | formState = HttpError err }, Cmd.none )
StopRefresh ->
( { model | stopRefresh = True, init = False }, Cmd.none )