From b67d5ba376ed0a25887c00b9c9e3bc11f7cb7b53 Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Tue, 13 Nov 2018 22:06:19 -0800 Subject: [PATCH] ui: Reformat with elm-format 0.8.1 --- ui/src/Data/Date.elm | 2 +- ui/src/Data/Message.elm | 2 +- ui/src/Data/MessageHeader.elm | 2 +- ui/src/Data/Metrics.elm | 2 +- ui/src/Data/Session.elm | 22 +++++++++++----------- ui/src/HttpUtil.elm | 2 +- ui/src/Main.elm | 5 ++++- ui/src/Page/Home.elm | 1 + ui/src/Page/Mailbox.elm | 10 ++++++++++ ui/src/Page/Monitor.elm | 2 ++ ui/src/Page/Status.elm | 3 +++ ui/src/Ports.elm | 15 +++++++-------- ui/src/Route.elm | 1 + ui/src/Views/Page.elm | 2 ++ ui/tests/Tests.elm | 3 ++- 15 files changed, 48 insertions(+), 26 deletions(-) diff --git a/ui/src/Data/Date.elm b/ui/src/Data/Date.elm index c7de6e3..2ac0a46 100644 --- a/ui/src/Data/Date.elm +++ b/ui/src/Data/Date.elm @@ -1,4 +1,4 @@ -module Data.Date exposing (..) +module Data.Date exposing (date) import Date exposing (Date) import Json.Decode as Decode exposing (..) diff --git a/ui/src/Data/Message.elm b/ui/src/Data/Message.elm index d6b6287..7377ea2 100644 --- a/ui/src/Data/Message.elm +++ b/ui/src/Data/Message.elm @@ -1,4 +1,4 @@ -module Data.Message exposing (..) +module Data.Message exposing (Attachment, Message, attachmentDecoder, decoder) import Data.Date exposing (date) import Date exposing (Date) diff --git a/ui/src/Data/MessageHeader.elm b/ui/src/Data/MessageHeader.elm index 1e3ee5a..d3fc7fb 100644 --- a/ui/src/Data/MessageHeader.elm +++ b/ui/src/Data/MessageHeader.elm @@ -1,4 +1,4 @@ -module Data.MessageHeader exposing (..) +module Data.MessageHeader exposing (MessageHeader, decoder) import Data.Date exposing (date) import Date exposing (Date) diff --git a/ui/src/Data/Metrics.elm b/ui/src/Data/Metrics.elm index 3dde87d..5662096 100644 --- a/ui/src/Data/Metrics.elm +++ b/ui/src/Data/Metrics.elm @@ -1,4 +1,4 @@ -module Data.Metrics exposing (..) +module Data.Metrics exposing (Metrics, decodeIntList, decoder) import Json.Decode as Decode exposing (..) import Json.Decode.Pipeline exposing (..) diff --git a/ui/src/Data/Session.elm b/ui/src/Data/Session.elm index 189ec22..efcca4c 100644 --- a/ui/src/Data/Session.elm +++ b/ui/src/Data/Session.elm @@ -1,14 +1,13 @@ -module Data.Session - exposing - ( Msg(..) - , Persistent - , Session - , decodeValueWithDefault - , decoder - , init - , none - , update - ) +module Data.Session exposing + ( Msg(..) + , Persistent + , Session + , decodeValueWithDefault + , decoder + , init + , none + , update + ) import Json.Decode as Decode exposing (..) import Json.Decode.Pipeline exposing (..) @@ -63,6 +62,7 @@ update msg session = AddRecent mailbox -> if List.head session.persistent.recentMailboxes == Just mailbox then session + else let recent = diff --git a/ui/src/HttpUtil.elm b/ui/src/HttpUtil.elm index a392e51..4afcb5d 100644 --- a/ui/src/HttpUtil.elm +++ b/ui/src/HttpUtil.elm @@ -1,4 +1,4 @@ -module HttpUtil exposing (..) +module HttpUtil exposing (delete, errorString, patch) import Http diff --git a/ui/src/Main.elm b/ui/src/Main.elm index 5aa24fd..81d73f0 100644 --- a/ui/src/Main.elm +++ b/ui/src/Main.elm @@ -1,4 +1,4 @@ -module Main exposing (..) +module Main exposing (Model, Msg(..), Page(..), applySession, init, main, pageSubscriptions, sessionChange, setRoute, subscriptions, update, updatePage, view) import Data.Session as Session exposing (Session, decoder) import Html exposing (..) @@ -13,6 +13,7 @@ import Route exposing (Route) import Views.Page as Page exposing (ActivePage(..), frame) + -- MODEL @@ -112,6 +113,7 @@ update msg model = -- Responds to new browser URL. if model.session.routing then setRoute route model + else -- Skip once, but re-enable routing. ( model, Cmd.none, Session.EnableRouting ) @@ -256,6 +258,7 @@ applySession ( model, cmd, sessionMsg ) = if session.persistent == model.session.persistent then -- No change ( newModel, cmd ) + else ( newModel , Cmd.batch [ cmd, Ports.storeSession session.persistent ] diff --git a/ui/src/Page/Home.elm b/ui/src/Page/Home.elm index c08630e..a460d47 100644 --- a/ui/src/Page/Home.elm +++ b/ui/src/Page/Home.elm @@ -9,6 +9,7 @@ import Json.Encode as Encode import Ports + -- MODEL -- diff --git a/ui/src/Page/Mailbox.elm b/ui/src/Page/Mailbox.elm index e36ae3e..84e871a 100644 --- a/ui/src/Page/Mailbox.elm +++ b/ui/src/Page/Mailbox.elm @@ -31,6 +31,7 @@ import Task import Time exposing (Time) + -- MODEL @@ -105,6 +106,7 @@ subscriptions model = ShowingList _ (ShowingMessage { message }) -> if message.seen then Sub.none + else Time.every (250 * Time.millisecond) SeenTick @@ -212,6 +214,7 @@ update session msg model = ShowingList list (ShowingMessage visible) -> if visible.message.seen then ( model, Cmd.none, Session.none ) + else -- Set delay before reporting message as seen to backend. ( { model @@ -246,6 +249,7 @@ update session msg model = Just deadline -> if now >= deadline then updateMarkMessageSeen model message + else ( model, Cmd.none, Session.none ) @@ -267,6 +271,7 @@ updateMessageResult model message = bodyMode = if message.html == "" then TextBody + else model.bodyMode in @@ -313,6 +318,7 @@ updateSearchInput model searchInput = searchFilter = if String.length searchInput > 1 then String.toLower searchInput + else "" in @@ -393,6 +399,7 @@ updateMarkMessageSeen model message = updateSeen header = if header.id == message.id then { header | seen = True } + else header @@ -568,6 +575,7 @@ messageBody message bodyMode = tabs = if message.html == "" then [ plainText ] + else [ safeHtml, plainText ] in @@ -592,6 +600,7 @@ attachments message = in if List.isEmpty message.attachments then div [] [] + else table [ class "attachments well" ] (List.map (attachmentRow baseUrl) message.attachments) @@ -645,6 +654,7 @@ filterMessageList : MessageList -> List MessageHeader filterMessageList list = if list.searchFilter == "" then list.headers + else let matches header = diff --git a/ui/src/Page/Monitor.elm b/ui/src/Page/Monitor.elm index 8cc5a56..d88594a 100644 --- a/ui/src/Page/Monitor.elm +++ b/ui/src/Page/Monitor.elm @@ -20,6 +20,7 @@ import Ports import Route + -- MODEL @@ -104,6 +105,7 @@ view session model = [ text (if model.connected then "Connected." + else "Disconnected!" ) diff --git a/ui/src/Page/Status.elm b/ui/src/Page/Status.elm index fb5fb72..7413047 100644 --- a/ui/src/Page/Status.elm +++ b/ui/src/Page/Status.elm @@ -12,6 +12,7 @@ import Svg.Attributes as SvgAttrib import Time exposing (Time) + -- MODEL -- @@ -381,6 +382,7 @@ zeroPadList numbers = in if needed > 0 then List.repeat needed 0 ++ numbers + else numbers @@ -394,6 +396,7 @@ fmtInt n = thousands str = if String.length str <= 3 then str + else thousands (String.slice 0 -3 str) ++ "," ++ String.right 3 str in diff --git a/ui/src/Ports.elm b/ui/src/Ports.elm index 73f273b..108c1f0 100644 --- a/ui/src/Ports.elm +++ b/ui/src/Ports.elm @@ -1,11 +1,10 @@ -port module Ports - exposing - ( monitorCommand - , monitorMessage - , onSessionChange - , storeSession - , windowTitle - ) +port module Ports exposing + ( monitorCommand + , monitorMessage + , onSessionChange + , storeSession + , windowTitle + ) import Data.Session exposing (Persistent) import Json.Encode exposing (Value) diff --git a/ui/src/Route.elm b/ui/src/Route.elm index 05868a5..64bb271 100644 --- a/ui/src/Route.elm +++ b/ui/src/Route.elm @@ -75,6 +75,7 @@ fromLocation : Location -> Route fromLocation location = if String.isEmpty location.hash then Home + else case parseHash matcher location of Nothing -> diff --git a/ui/src/Views/Page.elm b/ui/src/Views/Page.elm index 1df354e..c6860a1 100644 --- a/ui/src/Views/Page.elm +++ b/ui/src/Views/Page.elm @@ -91,6 +91,7 @@ navbarRecent page controls = title = if active then controls.recentActive + else "Recent Mailboxes" @@ -98,6 +99,7 @@ navbarRecent page controls = items = if active then List.tail controls.recentOptions |> Maybe.withDefault [] + else controls.recentOptions in diff --git a/ui/tests/Tests.elm b/ui/tests/Tests.elm index 10ee035..c730ab6 100644 --- a/ui/tests/Tests.elm +++ b/ui/tests/Tests.elm @@ -1,9 +1,10 @@ -module Tests exposing (..) +module Tests exposing (all) import Expect import Test exposing (..) + -- Check out http://package.elm-lang.org/packages/elm-community/elm-test/latest to learn more about testing in Elm!