mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 15:15:58 +00:00
commit
7ee69f7a57
@ -11,7 +11,7 @@ val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources")
|
|||||||
|
|
||||||
val scalafixSettings = Seq(
|
val scalafixSettings = Seq(
|
||||||
semanticdbEnabled := true, // enable SemanticDB
|
semanticdbEnabled := true, // enable SemanticDB
|
||||||
semanticdbVersion := "4.4.0",//scalafixSemanticdb.revision
|
semanticdbVersion := scalafixSemanticdb.revision, //"4.4.0"
|
||||||
ThisBuild / scalafixDependencies ++= Dependencies.organizeImports
|
ThisBuild / scalafixDependencies ++= Dependencies.organizeImports
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ object OMail {
|
|||||||
item: Ident,
|
item: Ident,
|
||||||
subject: String,
|
subject: String,
|
||||||
recipients: List[MailAddress],
|
recipients: List[MailAddress],
|
||||||
|
cc: List[MailAddress],
|
||||||
|
bcc: List[MailAddress],
|
||||||
body: String,
|
body: String,
|
||||||
attach: AttachSelection
|
attach: AttachSelection
|
||||||
)
|
)
|
||||||
@ -230,6 +232,8 @@ object OMail {
|
|||||||
val fields: Seq[Trans[F]] = Seq(
|
val fields: Seq[Trans[F]] = Seq(
|
||||||
From(sett.mailFrom),
|
From(sett.mailFrom),
|
||||||
Tos(m.recipients),
|
Tos(m.recipients),
|
||||||
|
Ccs(m.cc),
|
||||||
|
Bccs(m.bcc),
|
||||||
XMailer.emil,
|
XMailer.emil,
|
||||||
Subject(m.subject),
|
Subject(m.subject),
|
||||||
TextBody[F](m.body)
|
TextBody[F](m.body)
|
||||||
|
@ -4012,6 +4012,8 @@ components:
|
|||||||
is ignored, if `addAllAttachments` is set to `true`.
|
is ignored, if `addAllAttachments` is set to `true`.
|
||||||
required:
|
required:
|
||||||
- recipients
|
- recipients
|
||||||
|
- cc
|
||||||
|
- bcc
|
||||||
- subject
|
- subject
|
||||||
- body
|
- body
|
||||||
- addAllAttachments
|
- addAllAttachments
|
||||||
@ -4021,6 +4023,14 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
cc:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
bcc:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
subject:
|
subject:
|
||||||
type: string
|
type: string
|
||||||
body:
|
body:
|
||||||
|
@ -39,11 +39,13 @@ object MailSendRoutes {
|
|||||||
def convertIn(item: Ident, s: SimpleMail): Either[String, ItemMail] =
|
def convertIn(item: Ident, s: SimpleMail): Either[String, ItemMail] =
|
||||||
for {
|
for {
|
||||||
rec <- s.recipients.traverse(MailAddress.parse)
|
rec <- s.recipients.traverse(MailAddress.parse)
|
||||||
|
cc <- s.cc.traverse(MailAddress.parse)
|
||||||
|
bcc <- s.bcc.traverse(MailAddress.parse)
|
||||||
fileIds <- s.attachmentIds.traverse(Ident.fromString)
|
fileIds <- s.attachmentIds.traverse(Ident.fromString)
|
||||||
sel =
|
sel =
|
||||||
if (s.addAllAttachments) AttachSelection.All
|
if (s.addAllAttachments) AttachSelection.All
|
||||||
else AttachSelection.Selected(fileIds)
|
else AttachSelection.Selected(fileIds)
|
||||||
} yield ItemMail(item, s.subject, rec, s.body, sel)
|
} yield ItemMail(item, s.subject, rec, cc, bcc, s.body, sel)
|
||||||
|
|
||||||
def convertOut(res: SendResult): BasicResult =
|
def convertOut(res: SendResult): BasicResult =
|
||||||
res match {
|
res match {
|
||||||
|
@ -198,7 +198,7 @@ loginInfo model =
|
|||||||
div [ class "right menu" ]
|
div [ class "right menu" ]
|
||||||
(case model.flags.account of
|
(case model.flags.account of
|
||||||
Just acc ->
|
Just acc ->
|
||||||
[ a
|
[ div
|
||||||
[ class "ui dropdown icon link item"
|
[ class "ui dropdown icon link item"
|
||||||
, href "#"
|
, href "#"
|
||||||
, onClick ToggleUserMenu
|
, onClick ToggleUserMenu
|
||||||
@ -238,7 +238,7 @@ loginInfo model =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, a
|
, div
|
||||||
[ class "ui dropdown icon link item"
|
[ class "ui dropdown icon link item"
|
||||||
, onClick ToggleNavMenu
|
, onClick ToggleNavMenu
|
||||||
, href "#"
|
, href "#"
|
||||||
@ -296,10 +296,10 @@ loginInfo model =
|
|||||||
]
|
]
|
||||||
, div [ class "divider" ] []
|
, div [ class "divider" ] []
|
||||||
, a
|
, a
|
||||||
[ class "icon item"
|
[ class "item"
|
||||||
, href "https://docspell.org/doc"
|
, href "https://docspell.org/docs"
|
||||||
, target "_new"
|
, target "_new"
|
||||||
, title "Opens https://docspell.org/doc"
|
, title "Opens https://docspell.org/docs"
|
||||||
]
|
]
|
||||||
[ i [ class "help icon" ] []
|
[ i [ class "help icon" ] []
|
||||||
, text "Help"
|
, text "Help"
|
||||||
|
@ -28,6 +28,10 @@ type alias Model =
|
|||||||
, subject : String
|
, subject : String
|
||||||
, recipients : List String
|
, recipients : List String
|
||||||
, recipientsModel : Comp.EmailInput.Model
|
, recipientsModel : Comp.EmailInput.Model
|
||||||
|
, ccRecipients : List String
|
||||||
|
, ccRecipientsModel : Comp.EmailInput.Model
|
||||||
|
, bccRecipients : List String
|
||||||
|
, bccRecipientsModel : Comp.EmailInput.Model
|
||||||
, body : String
|
, body : String
|
||||||
, attachAll : Bool
|
, attachAll : Bool
|
||||||
, formError : Maybe String
|
, formError : Maybe String
|
||||||
@ -37,6 +41,8 @@ type alias Model =
|
|||||||
type Msg
|
type Msg
|
||||||
= SetSubject String
|
= SetSubject String
|
||||||
| RecipientMsg Comp.EmailInput.Msg
|
| RecipientMsg Comp.EmailInput.Msg
|
||||||
|
| CCRecipientMsg Comp.EmailInput.Msg
|
||||||
|
| BCCRecipientMsg Comp.EmailInput.Msg
|
||||||
| SetBody String
|
| SetBody String
|
||||||
| ConnMsg (Comp.Dropdown.Msg String)
|
| ConnMsg (Comp.Dropdown.Msg String)
|
||||||
| ConnResp (Result Http.Error EmailSettingsList)
|
| ConnResp (Result Http.Error EmailSettingsList)
|
||||||
@ -67,6 +73,10 @@ emptyModel =
|
|||||||
, subject = ""
|
, subject = ""
|
||||||
, recipients = []
|
, recipients = []
|
||||||
, recipientsModel = Comp.EmailInput.init
|
, recipientsModel = Comp.EmailInput.init
|
||||||
|
, ccRecipients = []
|
||||||
|
, ccRecipientsModel = Comp.EmailInput.init
|
||||||
|
, bccRecipients = []
|
||||||
|
, bccRecipientsModel = Comp.EmailInput.init
|
||||||
, body = ""
|
, body = ""
|
||||||
, attachAll = True
|
, attachAll = True
|
||||||
, formError = Nothing
|
, formError = Nothing
|
||||||
@ -83,6 +93,8 @@ clear model =
|
|||||||
{ model
|
{ model
|
||||||
| subject = ""
|
| subject = ""
|
||||||
, recipients = []
|
, recipients = []
|
||||||
|
, ccRecipients = []
|
||||||
|
, bccRecipients = []
|
||||||
, body = ""
|
, body = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +115,26 @@ update flags msg model =
|
|||||||
, FormNone
|
, FormNone
|
||||||
)
|
)
|
||||||
|
|
||||||
|
CCRecipientMsg m ->
|
||||||
|
let
|
||||||
|
( em, ec, rec ) =
|
||||||
|
Comp.EmailInput.update flags model.ccRecipients m model.ccRecipientsModel
|
||||||
|
in
|
||||||
|
( { model | ccRecipients = rec, ccRecipientsModel = em }
|
||||||
|
, Cmd.map CCRecipientMsg ec
|
||||||
|
, FormNone
|
||||||
|
)
|
||||||
|
|
||||||
|
BCCRecipientMsg m ->
|
||||||
|
let
|
||||||
|
( em, ec, rec ) =
|
||||||
|
Comp.EmailInput.update flags model.bccRecipients m model.bccRecipientsModel
|
||||||
|
in
|
||||||
|
( { model | bccRecipients = rec, bccRecipientsModel = em }
|
||||||
|
, Cmd.map BCCRecipientMsg ec
|
||||||
|
, FormNone
|
||||||
|
)
|
||||||
|
|
||||||
SetBody str ->
|
SetBody str ->
|
||||||
( { model | body = str }, Cmd.none, FormNone )
|
( { model | body = str }, Cmd.none, FormNone )
|
||||||
|
|
||||||
@ -153,8 +185,18 @@ update flags msg model =
|
|||||||
case ( model.formError, Comp.Dropdown.getSelected model.connectionModel ) of
|
case ( model.formError, Comp.Dropdown.getSelected model.connectionModel ) of
|
||||||
( Nothing, conn :: [] ) ->
|
( Nothing, conn :: [] ) ->
|
||||||
let
|
let
|
||||||
|
emptyMail =
|
||||||
|
Api.Model.SimpleMail.empty
|
||||||
|
|
||||||
sm =
|
sm =
|
||||||
SimpleMail model.recipients model.subject model.body model.attachAll []
|
{ emptyMail
|
||||||
|
| recipients = model.recipients
|
||||||
|
, cc = model.ccRecipients
|
||||||
|
, bcc = model.bccRecipients
|
||||||
|
, subject = model.subject
|
||||||
|
, body = model.body
|
||||||
|
, addAllAttachments = model.attachAll
|
||||||
|
}
|
||||||
in
|
in
|
||||||
( model, Cmd.none, FormSend { conn = conn, mail = sm } )
|
( model, Cmd.none, FormSend { conn = conn, mail = sm } )
|
||||||
|
|
||||||
@ -195,6 +237,18 @@ view settings model =
|
|||||||
]
|
]
|
||||||
, Html.map RecipientMsg (Comp.EmailInput.view model.recipients model.recipientsModel)
|
, Html.map RecipientMsg (Comp.EmailInput.view model.recipients model.recipientsModel)
|
||||||
]
|
]
|
||||||
|
, div [ class "field" ]
|
||||||
|
[ label []
|
||||||
|
[ text "CC(s)"
|
||||||
|
]
|
||||||
|
, Html.map CCRecipientMsg (Comp.EmailInput.view model.ccRecipients model.ccRecipientsModel)
|
||||||
|
]
|
||||||
|
, div [ class "field" ]
|
||||||
|
[ label []
|
||||||
|
[ text "BCC(s)"
|
||||||
|
]
|
||||||
|
, Html.map BCCRecipientMsg (Comp.EmailInput.view model.bccRecipients model.bccRecipientsModel)
|
||||||
|
]
|
||||||
, div [ class "field" ]
|
, div [ class "field" ]
|
||||||
[ label [] [ text "Subject" ]
|
[ label [] [ text "Subject" ]
|
||||||
, input
|
, input
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
module Page.Home.Data exposing
|
module Page.Home.Data exposing
|
||||||
( Model
|
( Model
|
||||||
, Msg(..)
|
, Msg(..)
|
||||||
|
, SearchParam
|
||||||
, SearchType(..)
|
, SearchType(..)
|
||||||
, SelectActionMode(..)
|
, SelectActionMode(..)
|
||||||
, SelectViewModel
|
, SelectViewModel
|
||||||
@ -49,8 +50,8 @@ type alias Model =
|
|||||||
, moreInProgress : Bool
|
, moreInProgress : Bool
|
||||||
, throttle : Throttle Msg
|
, throttle : Throttle Msg
|
||||||
, searchTypeDropdown : Comp.FixedDropdown.Model SearchType
|
, searchTypeDropdown : Comp.FixedDropdown.Model SearchType
|
||||||
, searchType : SearchType
|
, searchTypeDropdownValue : SearchType
|
||||||
, searchTypeForm : SearchType
|
, lastSearchType : SearchType
|
||||||
, contentOnlySearch : Maybe String
|
, contentOnlySearch : Maybe String
|
||||||
, dragDropData : DD.DragDropData
|
, dragDropData : DD.DragDropData
|
||||||
, scrollToCard : Maybe String
|
, scrollToCard : Maybe String
|
||||||
@ -104,8 +105,8 @@ init flags viewMode =
|
|||||||
, searchTypeDropdown =
|
, searchTypeDropdown =
|
||||||
Comp.FixedDropdown.initMap searchTypeString
|
Comp.FixedDropdown.initMap searchTypeString
|
||||||
searchTypeOptions
|
searchTypeOptions
|
||||||
, searchType = BasicSearch
|
, searchTypeDropdownValue = defaultSearchType flags
|
||||||
, searchTypeForm = defaultSearchType flags
|
, lastSearchType = BasicSearch
|
||||||
, contentOnlySearch = Nothing
|
, contentOnlySearch = Nothing
|
||||||
, dragDropData =
|
, dragDropData =
|
||||||
DD.DragDropData DD.init Nothing
|
DD.DragDropData DD.init Nothing
|
||||||
@ -156,14 +157,14 @@ type Msg
|
|||||||
| ItemCardListMsg Comp.ItemCardList.Msg
|
| ItemCardListMsg Comp.ItemCardList.Msg
|
||||||
| ItemSearchResp Bool (Result Http.Error ItemLightList)
|
| ItemSearchResp Bool (Result Http.Error ItemLightList)
|
||||||
| ItemSearchAddResp (Result Http.Error ItemLightList)
|
| ItemSearchAddResp (Result Http.Error ItemLightList)
|
||||||
| DoSearch
|
| DoSearch SearchType
|
||||||
| ToggleSearchMenu
|
| ToggleSearchMenu
|
||||||
| ToggleSelectView
|
| ToggleSelectView
|
||||||
| LoadMore
|
| LoadMore
|
||||||
| UpdateThrottle
|
| UpdateThrottle
|
||||||
| SetBasicSearch String
|
| SetBasicSearch String
|
||||||
| SearchTypeMsg (Comp.FixedDropdown.Msg SearchType)
|
| SearchTypeMsg (Comp.FixedDropdown.Msg SearchType)
|
||||||
| KeyUpMsg (Maybe KeyCode)
|
| KeyUpSearchbarMsg (Maybe KeyCode)
|
||||||
| SetContentOnly String
|
| SetContentOnly String
|
||||||
| ScrollResult (Result Dom.Error ())
|
| ScrollResult (Result Dom.Error ())
|
||||||
| ClearItemDetailId
|
| ClearItemDetailId
|
||||||
@ -182,7 +183,6 @@ type Msg
|
|||||||
|
|
||||||
type SearchType
|
type SearchType
|
||||||
= BasicSearch
|
= BasicSearch
|
||||||
| ContentSearch
|
|
||||||
| ContentOnlySearch
|
| ContentOnlySearch
|
||||||
|
|
||||||
|
|
||||||
@ -192,15 +192,21 @@ type SelectActionMode
|
|||||||
| EditSelected
|
| EditSelected
|
||||||
|
|
||||||
|
|
||||||
|
type alias SearchParam =
|
||||||
|
{ flags : Flags
|
||||||
|
, searchType : SearchType
|
||||||
|
, pageSize : Int
|
||||||
|
, offset : Int
|
||||||
|
, scroll : Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
searchTypeString : SearchType -> String
|
searchTypeString : SearchType -> String
|
||||||
searchTypeString st =
|
searchTypeString st =
|
||||||
case st of
|
case st of
|
||||||
BasicSearch ->
|
BasicSearch ->
|
||||||
"Names"
|
"Names"
|
||||||
|
|
||||||
ContentSearch ->
|
|
||||||
"Contents"
|
|
||||||
|
|
||||||
ContentOnlySearch ->
|
ContentOnlySearch ->
|
||||||
"Contents Only"
|
"Contents Only"
|
||||||
|
|
||||||
@ -219,54 +225,51 @@ itemNav id model =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
doSearchCmd : Flags -> UiSettings -> Int -> Bool -> Model -> Cmd Msg
|
doSearchCmd : SearchParam -> Model -> Cmd Msg
|
||||||
doSearchCmd flags settings offset scroll model =
|
doSearchCmd param model =
|
||||||
case model.searchType of
|
case param.searchType of
|
||||||
BasicSearch ->
|
BasicSearch ->
|
||||||
doSearchDefaultCmd flags settings offset scroll model
|
doSearchDefaultCmd param model
|
||||||
|
|
||||||
ContentSearch ->
|
|
||||||
doSearchDefaultCmd flags settings offset scroll model
|
|
||||||
|
|
||||||
ContentOnlySearch ->
|
ContentOnlySearch ->
|
||||||
doSearchIndexCmd flags settings offset scroll model
|
doSearchIndexCmd param model
|
||||||
|
|
||||||
|
|
||||||
doSearchDefaultCmd : Flags -> UiSettings -> Int -> Bool -> Model -> Cmd Msg
|
doSearchDefaultCmd : SearchParam -> Model -> Cmd Msg
|
||||||
doSearchDefaultCmd flags settings offset scroll model =
|
doSearchDefaultCmd param model =
|
||||||
let
|
let
|
||||||
smask =
|
smask =
|
||||||
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
||||||
|
|
||||||
mask =
|
mask =
|
||||||
{ smask
|
{ smask
|
||||||
| limit = settings.itemSearchPageSize
|
| limit = param.pageSize
|
||||||
, offset = offset
|
, offset = param.offset
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
if offset == 0 then
|
if param.offset == 0 then
|
||||||
Api.itemSearch flags mask (ItemSearchResp scroll)
|
Api.itemSearch param.flags mask (ItemSearchResp param.scroll)
|
||||||
|
|
||||||
else
|
else
|
||||||
Api.itemSearch flags mask ItemSearchAddResp
|
Api.itemSearch param.flags mask ItemSearchAddResp
|
||||||
|
|
||||||
|
|
||||||
doSearchIndexCmd : Flags -> UiSettings -> Int -> Bool -> Model -> Cmd Msg
|
doSearchIndexCmd : SearchParam -> Model -> Cmd Msg
|
||||||
doSearchIndexCmd flags settings offset scroll model =
|
doSearchIndexCmd param model =
|
||||||
case model.contentOnlySearch of
|
case model.contentOnlySearch of
|
||||||
Just q ->
|
Just q ->
|
||||||
let
|
let
|
||||||
mask =
|
mask =
|
||||||
{ query = q
|
{ query = q
|
||||||
, limit = settings.itemSearchPageSize
|
, limit = param.pageSize
|
||||||
, offset = offset
|
, offset = param.offset
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
if offset == 0 then
|
if param.offset == 0 then
|
||||||
Api.itemIndexSearch flags mask (ItemSearchResp scroll)
|
Api.itemIndexSearch param.flags mask (ItemSearchResp param.scroll)
|
||||||
|
|
||||||
else
|
else
|
||||||
Api.itemIndexSearch flags mask ItemSearchAddResp
|
Api.itemIndexSearch param.flags mask ItemSearchAddResp
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
-- If there is no fulltext query, render simply the most
|
-- If there is no fulltext query, render simply the most
|
||||||
@ -276,9 +279,9 @@ doSearchIndexCmd flags settings offset scroll model =
|
|||||||
Api.Model.ItemSearch.empty
|
Api.Model.ItemSearch.empty
|
||||||
|
|
||||||
mask =
|
mask =
|
||||||
{ emptyMask | limit = settings.itemSearchPageSize }
|
{ emptyMask | limit = param.pageSize }
|
||||||
in
|
in
|
||||||
Api.itemSearch flags mask (ItemSearchResp scroll)
|
Api.itemSearch param.flags mask (ItemSearchResp param.scroll)
|
||||||
|
|
||||||
|
|
||||||
resultsBelowLimit : UiSettings -> Model -> Bool
|
resultsBelowLimit : UiSettings -> Model -> Bool
|
||||||
|
@ -6,7 +6,6 @@ import Api.Model.ItemLightList exposing (ItemLightList)
|
|||||||
import Api.Model.ItemSearch
|
import Api.Model.ItemSearch
|
||||||
import Browser.Navigation as Nav
|
import Browser.Navigation as Nav
|
||||||
import Comp.FixedDropdown
|
import Comp.FixedDropdown
|
||||||
import Comp.ItemCard
|
|
||||||
import Comp.ItemCardList
|
import Comp.ItemCardList
|
||||||
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
import Comp.ItemDetail.EditMenu exposing (SaveNameState(..))
|
||||||
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
import Comp.ItemDetail.FormChange exposing (FormChange(..))
|
||||||
@ -28,7 +27,6 @@ import Time
|
|||||||
import Util.Html exposing (KeyCode(..))
|
import Util.Html exposing (KeyCode(..))
|
||||||
import Util.ItemDragDrop as DD
|
import Util.ItemDragDrop as DD
|
||||||
import Util.Maybe
|
import Util.Maybe
|
||||||
import Util.String
|
|
||||||
import Util.Update
|
import Util.Update
|
||||||
|
|
||||||
|
|
||||||
@ -36,9 +34,18 @@ update : Maybe String -> Nav.Key -> Flags -> UiSettings -> Msg -> Model -> ( Mod
|
|||||||
update mId key flags settings msg model =
|
update mId key flags settings msg model =
|
||||||
case msg of
|
case msg of
|
||||||
Init ->
|
Init ->
|
||||||
|
let
|
||||||
|
searchParam =
|
||||||
|
{ flags = flags
|
||||||
|
, searchType = model.lastSearchType
|
||||||
|
, pageSize = settings.itemSearchPageSize
|
||||||
|
, offset = 0
|
||||||
|
, scroll = True
|
||||||
|
}
|
||||||
|
in
|
||||||
Util.Update.andThen2
|
Util.Update.andThen2
|
||||||
[ update mId key flags settings (SearchMenuMsg Comp.SearchMenu.Init)
|
[ update mId key flags settings (SearchMenuMsg Comp.SearchMenu.Init)
|
||||||
, doSearch flags settings True
|
, doSearch searchParam
|
||||||
]
|
]
|
||||||
model
|
model
|
||||||
|
|
||||||
@ -47,7 +54,6 @@ update mId key flags settings msg model =
|
|||||||
nm =
|
nm =
|
||||||
{ model
|
{ model
|
||||||
| searchOffset = 0
|
| searchOffset = 0
|
||||||
, searchType = defaultSearchType flags
|
|
||||||
, contentOnlySearch = Nothing
|
, contentOnlySearch = Nothing
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
@ -64,7 +70,7 @@ update mId key flags settings msg model =
|
|||||||
model.searchMenuModel
|
model.searchMenuModel
|
||||||
|
|
||||||
dropCmd =
|
dropCmd =
|
||||||
DD.makeUpdateCmd flags (\_ -> DoSearch) nextState.dragDrop.dropped
|
DD.makeUpdateCmd flags (\_ -> DoSearch model.lastSearchType) nextState.dragDrop.dropped
|
||||||
|
|
||||||
newModel =
|
newModel =
|
||||||
{ model
|
{ model
|
||||||
@ -74,7 +80,7 @@ update mId key flags settings msg model =
|
|||||||
|
|
||||||
( m2, c2, s2 ) =
|
( m2, c2, s2 ) =
|
||||||
if nextState.stateChange && not model.searchInProgress then
|
if nextState.stateChange && not model.searchInProgress then
|
||||||
doSearch flags settings False newModel
|
doSearch (SearchParam flags BasicSearch settings.itemSearchPageSize 0 False) newModel
|
||||||
|
|
||||||
else
|
else
|
||||||
withSub ( newModel, Cmd.none )
|
withSub ( newModel, Cmd.none )
|
||||||
@ -181,16 +187,24 @@ update mId key flags settings msg model =
|
|||||||
, Cmd.none
|
, Cmd.none
|
||||||
)
|
)
|
||||||
|
|
||||||
DoSearch ->
|
DoSearch stype ->
|
||||||
let
|
let
|
||||||
nm =
|
nm =
|
||||||
{ model | searchOffset = 0 }
|
{ model | searchOffset = 0 }
|
||||||
|
|
||||||
|
param =
|
||||||
|
{ flags = flags
|
||||||
|
, searchType = stype
|
||||||
|
, pageSize = settings.itemSearchPageSize
|
||||||
|
, offset = 0
|
||||||
|
, scroll = False
|
||||||
|
}
|
||||||
in
|
in
|
||||||
if model.searchInProgress then
|
if model.searchInProgress then
|
||||||
withSub ( model, Cmd.none )
|
withSub ( model, Cmd.none )
|
||||||
|
|
||||||
else
|
else
|
||||||
doSearch flags settings False nm
|
doSearch param nm
|
||||||
|
|
||||||
ToggleSearchMenu ->
|
ToggleSearchMenu ->
|
||||||
let
|
let
|
||||||
@ -247,13 +261,10 @@ update mId key flags settings msg model =
|
|||||||
SetBasicSearch str ->
|
SetBasicSearch str ->
|
||||||
let
|
let
|
||||||
smMsg =
|
smMsg =
|
||||||
case model.searchTypeForm of
|
case model.searchTypeDropdownValue of
|
||||||
BasicSearch ->
|
BasicSearch ->
|
||||||
SearchMenuMsg (Comp.SearchMenu.SetAllName str)
|
SearchMenuMsg (Comp.SearchMenu.SetAllName str)
|
||||||
|
|
||||||
ContentSearch ->
|
|
||||||
SearchMenuMsg (Comp.SearchMenu.SetFulltext str)
|
|
||||||
|
|
||||||
ContentOnlySearch ->
|
ContentOnlySearch ->
|
||||||
SetContentOnly str
|
SetContentOnly str
|
||||||
in
|
in
|
||||||
@ -271,12 +282,12 @@ update mId key flags settings msg model =
|
|||||||
Comp.FixedDropdown.update lm model.searchTypeDropdown
|
Comp.FixedDropdown.update lm model.searchTypeDropdown
|
||||||
|
|
||||||
mvChange =
|
mvChange =
|
||||||
Util.Maybe.filter (\a -> a /= model.searchTypeForm) mv
|
Util.Maybe.filter (\a -> a /= model.searchTypeDropdownValue) mv
|
||||||
|
|
||||||
m0 =
|
m0 =
|
||||||
{ model
|
{ model
|
||||||
| searchTypeDropdown = sm
|
| searchTypeDropdown = sm
|
||||||
, searchTypeForm = Maybe.withDefault model.searchTypeForm mv
|
, searchTypeDropdownValue = Maybe.withDefault model.searchTypeDropdownValue mv
|
||||||
}
|
}
|
||||||
|
|
||||||
next =
|
next =
|
||||||
@ -303,10 +314,10 @@ update mId key flags settings msg model =
|
|||||||
Nothing ->
|
Nothing ->
|
||||||
withSub ( m0, Cmd.none )
|
withSub ( m0, Cmd.none )
|
||||||
|
|
||||||
KeyUpMsg (Just Enter) ->
|
KeyUpSearchbarMsg (Just Enter) ->
|
||||||
update mId key flags settings DoSearch model
|
update mId key flags settings (DoSearch model.searchTypeDropdownValue) model
|
||||||
|
|
||||||
KeyUpMsg _ ->
|
KeyUpSearchbarMsg _ ->
|
||||||
withSub ( model, Cmd.none )
|
withSub ( model, Cmd.none )
|
||||||
|
|
||||||
ScrollResult _ ->
|
ScrollResult _ ->
|
||||||
@ -393,8 +404,16 @@ update mId key flags settings msg model =
|
|||||||
let
|
let
|
||||||
nm =
|
nm =
|
||||||
{ model | viewMode = SearchView }
|
{ model | viewMode = SearchView }
|
||||||
|
|
||||||
|
param =
|
||||||
|
{ flags = flags
|
||||||
|
, searchType = model.lastSearchType
|
||||||
|
, pageSize = settings.itemSearchPageSize
|
||||||
|
, offset = 0
|
||||||
|
, scroll = False
|
||||||
|
}
|
||||||
in
|
in
|
||||||
doSearch flags settings False nm
|
doSearch param nm
|
||||||
|
|
||||||
else
|
else
|
||||||
noSub ( model, Cmd.none )
|
noSub ( model, Cmd.none )
|
||||||
@ -543,7 +562,7 @@ update mId key flags settings msg model =
|
|||||||
model_ =
|
model_ =
|
||||||
{ model | viewMode = viewMode }
|
{ model | viewMode = viewMode }
|
||||||
in
|
in
|
||||||
update mId key flags settings DoSearch model_
|
update mId key flags settings (DoSearch model.lastSearchType) model_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -651,33 +670,24 @@ loadEditModel flags =
|
|||||||
Cmd.map EditMenuMsg (Comp.ItemDetail.EditMenu.loadModel flags)
|
Cmd.map EditMenuMsg (Comp.ItemDetail.EditMenu.loadModel flags)
|
||||||
|
|
||||||
|
|
||||||
doSearch : Flags -> UiSettings -> Bool -> Model -> ( Model, Cmd Msg, Sub Msg )
|
doSearch : SearchParam -> Model -> ( Model, Cmd Msg, Sub Msg )
|
||||||
doSearch flags settings scroll model =
|
doSearch param model =
|
||||||
let
|
let
|
||||||
stype =
|
param_ =
|
||||||
if
|
{ param | offset = 0 }
|
||||||
not (menuCollapsed model)
|
|
||||||
|| Util.String.isNothingOrBlank model.contentOnlySearch
|
|
||||||
then
|
|
||||||
BasicSearch
|
|
||||||
|
|
||||||
else
|
|
||||||
model.searchTypeForm
|
|
||||||
|
|
||||||
model_ =
|
|
||||||
{ model | searchType = stype }
|
|
||||||
|
|
||||||
searchCmd =
|
searchCmd =
|
||||||
doSearchCmd flags settings 0 scroll model_
|
doSearchCmd param_ model
|
||||||
|
|
||||||
( newThrottle, cmd ) =
|
( newThrottle, cmd ) =
|
||||||
Throttle.try searchCmd model.throttle
|
Throttle.try searchCmd model.throttle
|
||||||
in
|
in
|
||||||
withSub
|
withSub
|
||||||
( { model_
|
( { model
|
||||||
| searchInProgress = cmd /= Cmd.none
|
| searchInProgress = cmd /= Cmd.none
|
||||||
, searchOffset = 0
|
, searchOffset = 0
|
||||||
, throttle = newThrottle
|
, throttle = newThrottle
|
||||||
|
, lastSearchType = param.searchType
|
||||||
}
|
}
|
||||||
, cmd
|
, cmd
|
||||||
)
|
)
|
||||||
@ -711,8 +721,16 @@ linkTargetMsg linkTarget =
|
|||||||
doSearchMore : Flags -> UiSettings -> Model -> ( Model, Cmd Msg )
|
doSearchMore : Flags -> UiSettings -> Model -> ( Model, Cmd Msg )
|
||||||
doSearchMore flags settings model =
|
doSearchMore flags settings model =
|
||||||
let
|
let
|
||||||
|
param =
|
||||||
|
{ flags = flags
|
||||||
|
, searchType = model.lastSearchType
|
||||||
|
, pageSize = settings.itemSearchPageSize
|
||||||
|
, offset = model.searchOffset
|
||||||
|
, scroll = False
|
||||||
|
}
|
||||||
|
|
||||||
cmd =
|
cmd =
|
||||||
doSearchCmd flags settings model.searchOffset False model
|
doSearchCmd param model
|
||||||
in
|
in
|
||||||
( { model | moreInProgress = True }
|
( { model | moreInProgress = True }
|
||||||
, cmd
|
, cmd
|
||||||
|
@ -83,7 +83,7 @@ view flags settings model =
|
|||||||
]
|
]
|
||||||
, a
|
, a
|
||||||
[ class "borderless item"
|
[ class "borderless item"
|
||||||
, onClick DoSearch
|
, onClick (DoSearch BasicSearch)
|
||||||
, title "Run search query"
|
, title "Run search query"
|
||||||
, href ""
|
, href ""
|
||||||
, disabled model.searchInProgress
|
, disabled model.searchInProgress
|
||||||
@ -281,17 +281,14 @@ viewSearchBar flags model =
|
|||||||
let
|
let
|
||||||
searchTypeItem =
|
searchTypeItem =
|
||||||
Comp.FixedDropdown.Item
|
Comp.FixedDropdown.Item
|
||||||
model.searchTypeForm
|
model.searchTypeDropdownValue
|
||||||
(searchTypeString model.searchTypeForm)
|
(searchTypeString model.searchTypeDropdownValue)
|
||||||
|
|
||||||
searchInput =
|
searchInput =
|
||||||
case model.searchTypeForm of
|
case model.searchTypeDropdownValue of
|
||||||
BasicSearch ->
|
BasicSearch ->
|
||||||
model.searchMenuModel.allNameModel
|
model.searchMenuModel.allNameModel
|
||||||
|
|
||||||
ContentSearch ->
|
|
||||||
model.searchMenuModel.fulltextModel
|
|
||||||
|
|
||||||
ContentOnlySearch ->
|
ContentOnlySearch ->
|
||||||
model.contentOnlySearch
|
model.contentOnlySearch
|
||||||
|
|
||||||
@ -329,9 +326,9 @@ viewSearchBar flags model =
|
|||||||
, ( "loading spinner icon", model.searchInProgress )
|
, ( "loading spinner icon", model.searchInProgress )
|
||||||
]
|
]
|
||||||
, href "#"
|
, href "#"
|
||||||
, onClick DoSearch
|
, onClick (DoSearch model.searchTypeDropdownValue)
|
||||||
]
|
]
|
||||||
(if hasMoreSearch model && model.searchTypeForm == BasicSearch then
|
(if hasMoreSearch model && model.searchTypeDropdownValue == BasicSearch then
|
||||||
[ i [ class "icons search-corner-icons" ]
|
[ i [ class "icons search-corner-icons" ]
|
||||||
[ i [ class "tiny blue circle icon" ] []
|
[ i [ class "tiny blue circle icon" ] []
|
||||||
]
|
]
|
||||||
@ -344,7 +341,7 @@ viewSearchBar flags model =
|
|||||||
[ type_ "text"
|
[ type_ "text"
|
||||||
, placeholder "Quick Search …"
|
, placeholder "Quick Search …"
|
||||||
, onInput SetBasicSearch
|
, onInput SetBasicSearch
|
||||||
, Util.Html.onKeyUpCode KeyUpMsg
|
, Util.Html.onKeyUpCode KeyUpSearchbarMsg
|
||||||
, Maybe.map value searchInput
|
, Maybe.map value searchInput
|
||||||
|> Maybe.withDefault (value "")
|
|> Maybe.withDefault (value "")
|
||||||
]
|
]
|
||||||
@ -384,13 +381,10 @@ hasMoreSearch model =
|
|||||||
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
Comp.SearchMenu.getItemSearch model.searchMenuModel
|
||||||
|
|
||||||
is_ =
|
is_ =
|
||||||
case model.searchType of
|
case model.lastSearchType of
|
||||||
BasicSearch ->
|
BasicSearch ->
|
||||||
{ is | allNames = Nothing }
|
{ is | allNames = Nothing }
|
||||||
|
|
||||||
ContentSearch ->
|
|
||||||
{ is | fullText = Nothing }
|
|
||||||
|
|
||||||
ContentOnlySearch ->
|
ContentOnlySearch ->
|
||||||
Api.Model.ItemSearch.empty
|
Api.Model.ItemSearch.empty
|
||||||
in
|
in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user