mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 18:38:26 +00:00
Allow to give human readable summary to user tasks
This commit is contained in:
@ -28,6 +28,7 @@ import Data.UiSettings exposing (UiSettings)
|
||||
import Data.Validated exposing (Validated(..))
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onInput)
|
||||
import Http
|
||||
import Styles as S
|
||||
import Util.Http
|
||||
@ -52,6 +53,7 @@ type alias Model =
|
||||
, formMsg : Maybe BasicResult
|
||||
, loading : Int
|
||||
, yesNoDelete : Comp.YesNoDimmer.Model
|
||||
, summary : Maybe String
|
||||
}
|
||||
|
||||
|
||||
@ -79,6 +81,7 @@ type Msg
|
||||
| Cancel
|
||||
| RequestDelete
|
||||
| YesNoDeleteMsg Comp.YesNoDimmer.Msg
|
||||
| SetSummary String
|
||||
|
||||
|
||||
initWith : Flags -> NotificationSettings -> ( Model, Cmd Msg )
|
||||
@ -121,6 +124,7 @@ initWith flags s =
|
||||
, formMsg = Nothing
|
||||
, loading = im.loading
|
||||
, yesNoDelete = Comp.YesNoDimmer.emptyModel
|
||||
, summary = s.summary
|
||||
}
|
||||
, Cmd.batch
|
||||
[ nc
|
||||
@ -158,6 +162,7 @@ init flags =
|
||||
, formMsg = Nothing
|
||||
, loading = 2
|
||||
, yesNoDelete = Comp.YesNoDimmer.emptyModel
|
||||
, summary = Nothing
|
||||
}
|
||||
, Cmd.batch
|
||||
[ Api.getMailSettings flags "" ConnResp
|
||||
@ -203,6 +208,7 @@ makeSettings model =
|
||||
, capOverdue = model.capOverdue
|
||||
, enabled = model.enabled
|
||||
, schedule = Data.CalEvent.makeEvent timer
|
||||
, summary = model.summary
|
||||
}
|
||||
in
|
||||
Data.Validated.map4 make
|
||||
@ -450,6 +456,12 @@ update flags msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
SetSummary str ->
|
||||
( { model | summary = Util.Maybe.fromString str }
|
||||
, NoAction
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
|
||||
--- View2
|
||||
@ -544,6 +556,22 @@ view2 extraClasses settings model =
|
||||
, id = "notify-enabled"
|
||||
}
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Summary"
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetSummary
|
||||
, class S.textInput
|
||||
, Maybe.withDefault "" model.summary
|
||||
|> value
|
||||
]
|
||||
[]
|
||||
, span [ class "opacity-50 text-sm" ]
|
||||
[ text "Some human readable name, only for displaying"
|
||||
]
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Send via"
|
||||
|
@ -54,13 +54,13 @@ view2 _ items =
|
||||
, th [ class "text-center mr-2" ]
|
||||
[ i [ class "fa fa-check" ] []
|
||||
]
|
||||
, th [ class "text-left " ] [ text "Summary" ]
|
||||
, th [ class "text-left hidden sm:table-cell mr-2" ]
|
||||
[ text "Schedule" ]
|
||||
, th [ class "text-left mr-2" ]
|
||||
[ text "Connection" ]
|
||||
, th [ class "text-left hidden sm:table-cell mr-2" ]
|
||||
[ text "Recipients" ]
|
||||
, th [ class "text-center " ] [ text "Remind Days" ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
@ -76,6 +76,10 @@ viewItem2 item =
|
||||
, td [ class "w-px whitespace-nowrap px-2 text-center" ]
|
||||
[ Util.Html.checkbox2 item.enabled
|
||||
]
|
||||
, td [ class "text-left" ]
|
||||
[ Maybe.withDefault "" item.summary
|
||||
|> text
|
||||
]
|
||||
, td [ class "text-left hidden sm:table-cell mr-2" ]
|
||||
[ code [ class "font-mono text-sm" ]
|
||||
[ text item.schedule
|
||||
@ -87,8 +91,4 @@ viewItem2 item =
|
||||
, td [ class "text-left hidden sm:table-cell mr-2" ]
|
||||
[ String.join ", " item.recipients |> text
|
||||
]
|
||||
, td [ class "text-center" ]
|
||||
[ String.fromInt item.remindDays
|
||||
|> text
|
||||
]
|
||||
]
|
||||
|
@ -75,6 +75,7 @@ type alias Model =
|
||||
, languageModel : Comp.FixedDropdown.Model Language
|
||||
, language : Maybe Language
|
||||
, postHandleAll : Bool
|
||||
, summary : Maybe String
|
||||
, openTabs : Set String
|
||||
}
|
||||
|
||||
@ -121,6 +122,7 @@ type Msg
|
||||
| RemoveLanguage
|
||||
| TogglePostHandleAll
|
||||
| ToggleAkkordionTab String
|
||||
| SetSummary String
|
||||
|
||||
|
||||
initWith : Flags -> ScanMailboxSettings -> ( Model, Cmd Msg )
|
||||
@ -167,6 +169,7 @@ initWith flags s =
|
||||
Comp.FixedDropdown.init (List.map mkLanguageItem Data.Language.all)
|
||||
, language = Maybe.andThen Data.Language.fromString s.language
|
||||
, postHandleAll = Maybe.withDefault False s.postHandleAll
|
||||
, summary = s.summary
|
||||
}
|
||||
, Cmd.batch
|
||||
[ Api.getImapSettings flags "" ConnResp
|
||||
@ -221,6 +224,7 @@ init flags =
|
||||
Comp.FixedDropdown.init (List.map mkLanguageItem Data.Language.all)
|
||||
, language = Nothing
|
||||
, postHandleAll = False
|
||||
, summary = Nothing
|
||||
, openTabs = Set.insert (tabTitle TabGeneral) Set.empty
|
||||
}
|
||||
, Cmd.batch
|
||||
@ -283,6 +287,7 @@ makeSettings model =
|
||||
|> Just
|
||||
, language = Maybe.map Data.Language.toIso3 model.language
|
||||
, postHandleAll = Just model.postHandleAll
|
||||
, summary = model.summary
|
||||
}
|
||||
in
|
||||
Data.Validated.map3 make
|
||||
@ -689,6 +694,12 @@ update flags msg model =
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
SetSummary str ->
|
||||
( { model | summary = Util.Maybe.fromString str }
|
||||
, NoAction
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
|
||||
--- View2
|
||||
@ -870,6 +881,22 @@ viewGeneral2 settings model =
|
||||
[ text "Mailbox"
|
||||
, B.inputRequired
|
||||
]
|
||||
, div [ class "mb-4" ]
|
||||
[ label [ class S.inputLabel ]
|
||||
[ text "Summary"
|
||||
]
|
||||
, input
|
||||
[ type_ "text"
|
||||
, onInput SetSummary
|
||||
, class S.textInput
|
||||
, Maybe.withDefault "" model.summary
|
||||
|> value
|
||||
]
|
||||
[]
|
||||
, span [ class "opacity-50 text-sm" ]
|
||||
[ text "Some human readable name, only for displaying"
|
||||
]
|
||||
]
|
||||
, Html.map ConnMsg
|
||||
(Comp.Dropdown.view2
|
||||
DS.mainStyle
|
||||
|
@ -54,12 +54,11 @@ view2 _ items =
|
||||
, th [ class "" ]
|
||||
[ i [ class "fa fa-check" ] []
|
||||
]
|
||||
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Schedule" ]
|
||||
, th [ class "text-left mr-2" ] [ text "Connection" ]
|
||||
, th [ class "text-left mr-2" ] [ text "Folders" ]
|
||||
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Received Since" ]
|
||||
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Target" ]
|
||||
, th [ class "hidden md:table-cell" ] [ text "Delete" ]
|
||||
, th [ class "text-left" ] [ text "Summary" ]
|
||||
, th [ class "text-left mr-2" ] [ text "Schedule" ]
|
||||
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Connection" ]
|
||||
, th [ class "text-left mr-2 hidden md:table-cell" ] [ text "Folders" ]
|
||||
, th [ class "text-left mr-2 hidden lg:table-cell" ] [ text "Received Since" ]
|
||||
]
|
||||
]
|
||||
, tbody []
|
||||
@ -75,28 +74,24 @@ viewItem2 item =
|
||||
, td [ class "w-px px-2" ]
|
||||
[ Util.Html.checkbox2 item.enabled
|
||||
]
|
||||
, td [ class "mr-2 hidden md:table-cell" ]
|
||||
, td [ class "text-left" ]
|
||||
[ Maybe.withDefault "–" item.summary |> text
|
||||
]
|
||||
, td [ class "mr-2" ]
|
||||
[ code [ class "font-mono text-sm" ]
|
||||
[ text item.schedule
|
||||
]
|
||||
]
|
||||
, td [ class "text-left mr-2" ]
|
||||
, td [ class "text-left mr-2 hidden md:table-cell" ]
|
||||
[ text item.imapConnection
|
||||
]
|
||||
, td [ class "text-left mr-2" ]
|
||||
, td [ class "text-left mr-2 hidden md:table-cell" ]
|
||||
[ String.join ", " item.folders |> text
|
||||
]
|
||||
, td [ class "text-left mr-2 hidden md:table-cell" ]
|
||||
, td [ class "text-left mr-2 hidden lg:table-cell" ]
|
||||
[ Maybe.map String.fromInt item.receivedSinceHours
|
||||
|> Maybe.withDefault "-"
|
||||
|> text
|
||||
, text " h"
|
||||
]
|
||||
, td [ class "text-left mr-2 hidden md:table-cell" ]
|
||||
[ Maybe.withDefault "-" item.targetFolder
|
||||
|> text
|
||||
]
|
||||
, td [ class "w-px px-2 hidden md:table-cell" ]
|
||||
[ Util.Html.checkbox2 item.deleteMail
|
||||
]
|
||||
]
|
||||
|
Reference in New Issue
Block a user