mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Add stub form scan-mailbox form
This commit is contained in:
@ -9,6 +9,7 @@ import Comp.ChangePasswordForm
|
||||
import Comp.EmailSettingsManage
|
||||
import Comp.ImapSettingsManage
|
||||
import Comp.NotificationForm
|
||||
import Comp.ScanMailboxForm
|
||||
import Data.Flags exposing (Flags)
|
||||
|
||||
|
||||
@ -18,6 +19,7 @@ type alias Model =
|
||||
, emailSettingsModel : Comp.EmailSettingsManage.Model
|
||||
, imapSettingsModel : Comp.ImapSettingsManage.Model
|
||||
, notificationModel : Comp.NotificationForm.Model
|
||||
, scanMailboxModel : Comp.ScanMailboxForm.Model
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +30,7 @@ emptyModel flags =
|
||||
, emailSettingsModel = Comp.EmailSettingsManage.emptyModel
|
||||
, imapSettingsModel = Comp.ImapSettingsManage.emptyModel
|
||||
, notificationModel = Tuple.first (Comp.NotificationForm.init flags)
|
||||
, scanMailboxModel = Tuple.first (Comp.ScanMailboxForm.init flags)
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +39,7 @@ type Tab
|
||||
| EmailSettingsTab
|
||||
| ImapSettingsTab
|
||||
| NotificationTab
|
||||
| ScanMailboxTab
|
||||
|
||||
|
||||
type Msg
|
||||
@ -44,3 +48,4 @@ type Msg
|
||||
| EmailSettingsMsg Comp.EmailSettingsManage.Msg
|
||||
| NotificationMsg Comp.NotificationForm.Msg
|
||||
| ImapSettingsMsg Comp.ImapSettingsManage.Msg
|
||||
| ScanMailboxMsg Comp.ScanMailboxForm.Msg
|
||||
|
@ -4,6 +4,7 @@ import Comp.ChangePasswordForm
|
||||
import Comp.EmailSettingsManage
|
||||
import Comp.ImapSettingsManage
|
||||
import Comp.NotificationForm
|
||||
import Comp.ScanMailboxForm
|
||||
import Data.Flags exposing (Flags)
|
||||
import Page.UserSettings.Data exposing (..)
|
||||
|
||||
@ -42,6 +43,14 @@ update flags msg model =
|
||||
(Tuple.second (Comp.NotificationForm.init flags))
|
||||
in
|
||||
( m, initCmd )
|
||||
|
||||
ScanMailboxTab ->
|
||||
let
|
||||
initCmd =
|
||||
Cmd.map ScanMailboxMsg
|
||||
(Tuple.second (Comp.ScanMailboxForm.init flags))
|
||||
in
|
||||
( m, initCmd )
|
||||
in
|
||||
( m2, cmd )
|
||||
|
||||
@ -74,3 +83,12 @@ update flags msg model =
|
||||
( { model | notificationModel = m2 }
|
||||
, Cmd.map NotificationMsg c2
|
||||
)
|
||||
|
||||
ScanMailboxMsg lm ->
|
||||
let
|
||||
( m2, c2 ) =
|
||||
Comp.ScanMailboxForm.update flags lm model.scanMailboxModel
|
||||
in
|
||||
( { model | scanMailboxModel = m2 }
|
||||
, Cmd.map ScanMailboxMsg c2
|
||||
)
|
||||
|
@ -4,6 +4,7 @@ import Comp.ChangePasswordForm
|
||||
import Comp.EmailSettingsManage
|
||||
import Comp.ImapSettingsManage
|
||||
import Comp.NotificationForm
|
||||
import Comp.ScanMailboxForm
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (..)
|
||||
import Html.Events exposing (onClick)
|
||||
@ -24,6 +25,7 @@ view model =
|
||||
, makeTab model EmailSettingsTab "E-Mail Settings (SMTP)" "mail icon"
|
||||
, makeTab model ImapSettingsTab "E-Mail Settings (IMAP)" "mail icon"
|
||||
, makeTab model NotificationTab "Notification Task" "bullhorn icon"
|
||||
, makeTab model ScanMailboxTab "Scan Mailbox Task" "envelope open outline icon"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -42,6 +44,9 @@ view model =
|
||||
Just ImapSettingsTab ->
|
||||
viewImapSettings model
|
||||
|
||||
Just ScanMailboxTab ->
|
||||
viewScanMailboxForm model
|
||||
|
||||
Nothing ->
|
||||
[]
|
||||
)
|
||||
@ -118,3 +123,26 @@ viewNotificationForm model =
|
||||
, Html.map NotificationMsg
|
||||
(Comp.NotificationForm.view "segment" model.notificationModel)
|
||||
]
|
||||
|
||||
|
||||
viewScanMailboxForm : Model -> List (Html Msg)
|
||||
viewScanMailboxForm model =
|
||||
[ h2 [ class "ui header" ]
|
||||
[ i [ class "ui bullhorn icon" ] []
|
||||
, div [ class "content" ]
|
||||
[ text "Scan Mailbox"
|
||||
]
|
||||
]
|
||||
, p []
|
||||
[ text "Docspell can scan folders of your mailbox for mails to import. "
|
||||
, text "You need to provide a connection in "
|
||||
, text "your e-mail (imap) settings."
|
||||
]
|
||||
, p []
|
||||
[ text "Each time this is executed, docspell goes through all configured folders "
|
||||
, text "and imports mails matching the search criteria. The number of mails to import "
|
||||
, text "at one task run is limited. Mails already read in are skipped."
|
||||
]
|
||||
, Html.map ScanMailboxMsg
|
||||
(Comp.ScanMailboxForm.view "segment" model.scanMailboxModel)
|
||||
]
|
||||
|
Reference in New Issue
Block a user