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

Merge branch 'feature/linter-fixes' into develop

This commit is contained in:
James Hillyerd
2020-03-29 12:55:44 -07:00
14 changed files with 107 additions and 71 deletions

1
.gitignore vendored
View File

@@ -41,6 +41,7 @@ _testmain.go
# Elm UI
# elm-package generated files
/ui/index.html
/ui/elm-stuff
/ui/tests/elm-stuff
# elm-repl generated files

View File

@@ -40,7 +40,7 @@ apiV1Url elements =
-}
serveUrl : List String -> String
serveUrl elements =
Url.Builder.absolute ([ "serve" ] ++ elements) []
Url.Builder.absolute ("serve" :: elements) []
deleteMessage : HttpResult msg -> String -> String -> Cmd msg

View File

@@ -1,6 +1,6 @@
module Data.Date exposing (date)
import Json.Decode exposing (..)
import Json.Decode exposing (Decoder, int, map)
import Time exposing (Posix)

View File

@@ -1,8 +1,8 @@
module Data.Message exposing (Attachment, Message, attachmentDecoder, decoder)
import Data.Date exposing (date)
import Json.Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
import Json.Decode exposing (Decoder, bool, int, list, string, succeed)
import Json.Decode.Pipeline exposing (optional, required)
import Time exposing (Posix)

View File

@@ -1,8 +1,8 @@
module Data.MessageHeader exposing (MessageHeader, decoder)
import Data.Date exposing (date)
import Json.Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
import Json.Decode exposing (Decoder, bool, int, list, string, succeed)
import Json.Decode.Pipeline exposing (optional, required)
import Time exposing (Posix)

View File

@@ -1,8 +1,8 @@
module Data.Metrics exposing (Metrics, decodeIntList, decoder)
import Data.Date exposing (date)
import Json.Decode as Decode exposing (..)
import Json.Decode.Pipeline exposing (..)
import Json.Decode exposing (Decoder, int, map, string, succeed)
import Json.Decode.Pipeline exposing (requiredAt)
import Time exposing (Posix)

View File

@@ -15,11 +15,9 @@ module Data.Session exposing
import Browser.Navigation as Nav
import Data.AppConfig as AppConfig exposing (AppConfig)
import Html exposing (Html)
import Json.Decode as D
import Json.Decode.Pipeline exposing (..)
import Json.Decode.Pipeline exposing (optional)
import Json.Encode as E
import Ports
import Time
import Url exposing (Url)

View File

@@ -1,7 +1,6 @@
module HttpUtil exposing (Error, RequestContext, delete, errorFlash, expectJson, expectString, patch)
import Data.Session as Session
import Html exposing (Html, div, text)
import Http
import Json.Decode as Decode

View File

@@ -1,17 +1,37 @@
module Layout exposing (Model, Msg, Page(..), frame, init, reset, update)
import Data.Session as Session exposing (Session)
import Html exposing (..)
import Html
exposing
( Attribute
, Html
, a
, button
, div
, footer
, form
, h2
, header
, i
, input
, li
, nav
, pre
, span
, td
, text
, th
, tr
, ul
)
import Html.Attributes
exposing
( attribute
, class
, classList
, href
, id
, placeholder
, rel
, selected
, target
, type_
, value
@@ -146,7 +166,7 @@ frame { model, session, activePage, activeMailbox, modal, content } =
]
, div [ class "navbar-bg" ] [ text "" ]
, frameModal modal
, div [ class "page" ] ([ errorFlash model session.flash ] ++ content)
, div [ class "page" ] (errorFlash model session.flash :: content)
, footer []
[ div [ class "footer" ]
[ externalLink "https://www.inbucket.org" "Inbucket"
@@ -229,13 +249,6 @@ navbarRecent page activeMailbox model session =
else
session.persistent.recentMailboxes
dropdownExpanded =
if model.recentVisible then
"true"
else
"false"
recentLink mailbox =
a [ Route.href (Route.Mailbox mailbox) ] [ text mailbox ]
in

View File

@@ -4,7 +4,7 @@ import Browser exposing (Document, UrlRequest)
import Browser.Navigation as Nav
import Data.AppConfig as AppConfig exposing (AppConfig)
import Data.Session as Session exposing (Session)
import Html exposing (..)
import Html exposing (Html)
import Json.Decode as D exposing (Value)
import Layout
import Page.Home as Home

View File

@@ -2,12 +2,10 @@ module Page.Home exposing (Model, Msg, init, update, view)
import Api
import Data.Session as Session exposing (Session)
import Html exposing (..)
import Html.Attributes exposing (..)
import Http
import Html exposing (Html)
import Html.Attributes exposing (class, property)
import HttpUtil
import Json.Encode as Encode
import Ports

View File

@@ -2,11 +2,36 @@ module Page.Mailbox exposing (Model, Msg, init, load, subscriptions, update, vie
import Api
import Data.Message as Message exposing (Message)
import Data.MessageHeader as MessageHeader exposing (MessageHeader)
import Data.MessageHeader exposing (MessageHeader)
import Data.Session as Session exposing (Session)
import DateFormat as DF
import DateFormat.Relative as Relative
import Html exposing (..)
import Html
exposing
( Attribute
, Html
, a
, article
, aside
, button
, dd
, div
, dl
, dt
, h3
, i
, input
, li
, main_
, nav
, p
, span
, table
, td
, text
, tr
, ul
)
import Html.Attributes
exposing
( alt
@@ -15,7 +40,6 @@ import Html.Attributes
, disabled
, download
, href
, id
, placeholder
, property
, tabindex
@@ -24,11 +48,9 @@ import Html.Attributes
, value
)
import Html.Events as Events
import Http exposing (Error)
import HttpUtil
import Json.Decode as D
import Json.Encode as E
import Ports
import Route
import Task
import Time exposing (Posix)
@@ -138,7 +160,6 @@ type Msg
= ListLoaded (Result HttpUtil.Error (List MessageHeader))
| ClickMessage MessageID
| ListKeyPress String Int
| OpenMessage MessageID
| CloseMessage
| MessageLoaded (Result HttpUtil.Error Message)
| MessageBody Body
@@ -167,9 +188,6 @@ update msg model =
]
)
OpenMessage id ->
updateOpenMessage model id
CloseMessage ->
case model.state of
ShowingList list _ ->
@@ -350,7 +368,7 @@ updatePurge model =
]
in
case model.state of
ShowingList list _ ->
ShowingList _ _ ->
( { model
| promptPurge = False
, session = Session.disableRouting model.session

View File

@@ -3,8 +3,25 @@ module Page.Monitor exposing (Model, Msg, init, update, view)
import Data.MessageHeader as MessageHeader exposing (MessageHeader)
import Data.Session as Session exposing (Session)
import DateFormat as DF
import Html exposing (..)
import Html.Attributes exposing (..)
import Html
exposing
( Attribute
, Html
, button
, div
, em
, h1
, node
, span
, table
, tbody
, td
, text
, th
, thead
, tr
)
import Html.Attributes exposing (class, tabindex)
import Html.Events as Events
import Json.Decode as D
import Route

View File

@@ -1,14 +1,21 @@
module Page.Status exposing (Model, Msg, init, subscriptions, update, view)
import Api
import Data.Metrics as Metrics exposing (Metrics)
import Data.ServerConfig as ServerConfig exposing (ServerConfig)
import Data.Metrics exposing (Metrics)
import Data.ServerConfig exposing (ServerConfig)
import Data.Session as Session exposing (Session)
import DateFormat.Relative as Relative
import Filesize
import Html exposing (..)
import Html.Attributes exposing (..)
import Http exposing (Error)
import Html
exposing
( Html
, div
, h1
, h2
, i
, text
)
import Html.Attributes exposing (class)
import HttpUtil
import Sparkline as Spark
import Svg.Attributes as SvgAttrib
@@ -93,7 +100,7 @@ initDataSet =
subscriptions : Model -> Sub Msg
subscriptions model =
subscriptions _ =
Time.every (10 * 1000) Tick
@@ -271,18 +278,19 @@ configPanel maybeConfig =
, textEntry "SMTP Listener" config.smtpConfig.addr
, textEntry "POP3 Listener" config.pop3Listener
, textEntry "HTTP Listener" config.webListener
, textEntry "Accept Policy" (acceptPolicy config.smtpConfig)
, textEntry "Store Policy" (storePolicy config.smtpConfig)
, textEntry "Accept Policy" (acceptPolicy config)
, textEntry "Store Policy" (storePolicy config)
, textEntry "Store Type" config.storageConfig.storeType
, textEntry "Message Cap" (mailboxCap config)
, textEntry "Retention Period" (retentionPeriod config)
]
acceptPolicy : ServerConfig -> String
acceptPolicy config =
if config.defaultAccept then
if config.smtpConfig.defaultAccept then
"All domains"
++ (case config.rejectDomains of
++ (case config.smtpConfig.rejectDomains of
Nothing ->
""
@@ -295,7 +303,7 @@ acceptPolicy config =
else
"No domains"
++ (case config.acceptDomains of
++ (case config.smtpConfig.acceptDomains of
Nothing ->
""
@@ -307,10 +315,11 @@ acceptPolicy config =
)
storePolicy : ServerConfig -> String
storePolicy config =
if config.defaultStore then
if config.smtpConfig.defaultStore then
"All domains"
++ (case config.discardDomains of
++ (case config.smtpConfig.discardDomains of
Nothing ->
""
@@ -323,7 +332,7 @@ storePolicy config =
else
"No domains"
++ (case config.storeDomains of
++ (case config.smtpConfig.storeDomains of
Nothing ->
""
@@ -412,23 +421,6 @@ viewMetric metric =
]
viewLiveMetric : String -> (Int -> String) -> Int -> Html a -> Html a
viewLiveMetric label formatter value graph =
div [ class "metric" ]
[ div [ class "label" ] [ text label ]
, div [ class "value" ] [ text (formatter value) ]
, div [ class "graph" ]
[ graph
, text "(10min)"
]
]
graphNull : Html a
graphNull =
div [] []
graphSize : Spark.Size
graphSize =
{ width = 180