Add the attachment-only option to a source

The upload request can now contain a boolean for importing only
attachments when e-mails are uploaded. This option is now also added
to a source url.

Refs: #983
This commit is contained in:
eikek
2021-08-23 14:19:11 +02:00
parent 45f6357f49
commit 993a391c13
9 changed files with 71 additions and 7 deletions

View File

@ -57,6 +57,7 @@ type alias Model =
, fileFilter : Maybe String
, languageModel : Comp.Dropdown.Model Language
, language : Maybe String
, attachmentsOnly : Bool
}
@ -80,6 +81,7 @@ emptyModel =
, selected = Nothing
}
, language = Nothing
, attachmentsOnly = False
}
@ -119,6 +121,7 @@ getSource model =
, folder = model.folderId
, fileFilter = model.fileFilter
, language = model.language
, attachmentsOnly = model.attachmentsOnly
}
in
{ st | source = n, tags = TagList (List.length tags) tags }
@ -136,6 +139,7 @@ type Msg
| TagDropdownMsg (Comp.Dropdown.Msg Tag)
| SetFileFilter String
| LanguageMsg (Comp.Dropdown.Msg Language)
| ToggleAttachmentsOnly
@ -219,6 +223,9 @@ update flags msg model =
ToggleEnabled ->
( { model | enabled = not model.enabled }, Cmd.none )
ToggleAttachmentsOnly ->
( { model | attachmentsOnly = not model.attachmentsOnly }, Cmd.none )
SetAbbrev n ->
( { model | abbrev = n }, Cmd.none )
@ -496,6 +503,24 @@ view2 flags texts settings model =
[ Markdown.toHtml [] texts.fileFilterInfo
]
]
, div [ class "mb-4" ]
[ label
[ class "inline-flex items-center"
, for "attachments-only"
]
[ input
[ type_ "checkbox"
, onCheck (\_ -> ToggleAttachmentsOnly)
, checked model.attachmentsOnly
, class S.checkboxInput
, id "attachments-only"
]
[]
, span [ class "ml-2" ]
[ text texts.attachmentsOnly
]
]
]
, div [ class "mb-4" ]
[ label [ class S.inputLabel ]
[ text (texts.language ++ ":")

View File

@ -31,6 +31,7 @@ type alias Texts =
, language : String
, languageInfo : String
, languageLabel : Language -> String
, attachmentsOnly : String
}
@ -61,6 +62,7 @@ Specify a file glob to filter files when uploading archives
"Used for text extraction and analysis. The collective's "
++ "default language is used if not specified here."
, languageLabel = Messages.Data.Language.gb
, attachmentsOnly = "Only import attachments for e-mails"
}
@ -93,4 +95,5 @@ importieren: `*.pdf`. Globs können auch mittels OR kombiniert werden:
"Wird für die Texterkennung und -analyse verwendet. Die Standardsprache des Kollektivs "
++ "wird verwendet, falls hier nicht angegeben."
, languageLabel = Messages.Data.Language.de
, attachmentsOnly = "Bei E-Mails nur die Anhänge importieren"
}