1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

ui: Add request context for error flash

- webui: Update mailbox, attachment paths
This commit is contained in:
James Hillyerd
2018-12-15 20:16:20 -08:00
parent 6fd13a5215
commit caec5e7c17
12 changed files with 247 additions and 86 deletions

View File

@@ -1,5 +1,6 @@
module Data.Session exposing
( Msg(..)
( Flash
, Msg(..)
, Persistent
, Session
, decodeValueWithDefault
@@ -10,6 +11,7 @@ module Data.Session exposing
)
import Browser.Navigation as Nav
import Html exposing (Html)
import Json.Decode as D
import Json.Decode.Pipeline exposing (..)
import Json.Encode as E
@@ -21,13 +23,19 @@ import Url exposing (Url)
type alias Session =
{ key : Nav.Key
, host : String
, flash : String
, flash : Maybe Flash
, routing : Bool
, zone : Time.Zone
, persistent : Persistent
}
type alias Flash =
{ title : String
, table : List ( String, String )
}
type alias Persistent =
{ recentMailboxes : List String
}
@@ -35,7 +43,7 @@ type alias Persistent =
type Msg
= None
| SetFlash String
| SetFlash Flash
| ClearFlash
| DisableRouting
| EnableRouting
@@ -46,7 +54,7 @@ init : Nav.Key -> Url -> Persistent -> Session
init key location persistent =
{ key = key
, host = location.host
, flash = ""
, flash = Nothing
, routing = True
, zone = Time.utc
, persistent = persistent
@@ -62,10 +70,10 @@ update msg session =
session
SetFlash flash ->
{ session | flash = flash }
{ session | flash = Just flash }
ClearFlash ->
{ session | flash = "" }
{ session | flash = Nothing }
DisableRouting ->
{ session | routing = False }