mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-07 07:35:59 +00:00
commit
5d2acc2894
@ -5065,6 +5065,8 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/CustomFieldValue"
|
$ref: "#/components/schemas/CustomFieldValue"
|
||||||
|
source:
|
||||||
|
type: string
|
||||||
ItemLight:
|
ItemLight:
|
||||||
description: |
|
description: |
|
||||||
An item with only a few important properties.
|
An item with only a few important properties.
|
||||||
|
@ -144,6 +144,7 @@ trait Conversions {
|
|||||||
.map(_.ids.flatMap(i => Ident.fromString(i).toOption).toSet)
|
.map(_.ids.flatMap(i => Ident.fromString(i).toOption).toSet)
|
||||||
.filter(_.nonEmpty),
|
.filter(_.nonEmpty),
|
||||||
m.customValues.map(mkCustomValue),
|
m.customValues.map(mkCustomValue),
|
||||||
|
m.source,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -216,6 +216,7 @@ object QItem {
|
|||||||
allNames: Option[String],
|
allNames: Option[String],
|
||||||
itemIds: Option[Set[Ident]],
|
itemIds: Option[Set[Ident]],
|
||||||
customValues: Seq[CustomValue],
|
customValues: Seq[CustomValue],
|
||||||
|
source: Option[String],
|
||||||
orderAsc: Option[RItem.Columns.type => Column]
|
orderAsc: Option[RItem.Columns.type => Column]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -242,6 +243,7 @@ object QItem {
|
|||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
Seq.empty,
|
Seq.empty,
|
||||||
|
None,
|
||||||
None
|
None
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -413,9 +415,10 @@ object QItem {
|
|||||||
val tagSelectsExcl =
|
val tagSelectsExcl =
|
||||||
TagItemName.itemsWithTagOrCategory(q.tagsExclude, q.tagCategoryExcl)
|
TagItemName.itemsWithTagOrCategory(q.tagsExclude, q.tagCategoryExcl)
|
||||||
|
|
||||||
val iFolder = IC.folder.prefix("i")
|
val iFolder = IC.folder.prefix("i")
|
||||||
val name = q.name.map(_.toLowerCase).map(QueryWildcard.apply)
|
val name = q.name.map(_.toLowerCase).map(QueryWildcard.apply)
|
||||||
val allNames = q.allNames.map(_.toLowerCase).map(QueryWildcard.apply)
|
val allNames = q.allNames.map(_.toLowerCase).map(QueryWildcard.apply)
|
||||||
|
val sourceName = q.source.map(_.toLowerCase).map(QueryWildcard.apply)
|
||||||
val cond = and(
|
val cond = and(
|
||||||
IC.cid.prefix("i").is(q.account.collective),
|
IC.cid.prefix("i").is(q.account.collective),
|
||||||
IC.state.prefix("i").isOneOf(q.states),
|
IC.state.prefix("i").isOneOf(q.states),
|
||||||
@ -458,6 +461,7 @@ object QItem {
|
|||||||
.getOrElse(Fragment.empty),
|
.getOrElse(Fragment.empty),
|
||||||
q.dueDateFrom.map(d => IC.dueDate.prefix("i").isGt(d)).getOrElse(Fragment.empty),
|
q.dueDateFrom.map(d => IC.dueDate.prefix("i").isGt(d)).getOrElse(Fragment.empty),
|
||||||
q.dueDateTo.map(d => IC.dueDate.prefix("i").isLt(d)).getOrElse(Fragment.empty),
|
q.dueDateTo.map(d => IC.dueDate.prefix("i").isLt(d)).getOrElse(Fragment.empty),
|
||||||
|
sourceName.map(s => IC.source.prefix("i").lowerLike(s)).getOrElse(Fragment.empty),
|
||||||
q.itemIds
|
q.itemIds
|
||||||
.map(ids =>
|
.map(ids =>
|
||||||
NonEmptyList
|
NonEmptyList
|
||||||
|
@ -1603,6 +1603,9 @@ resetField flags item tagger field =
|
|||||||
Data.Fields.CustomFields ->
|
Data.Fields.CustomFields ->
|
||||||
Cmd.none
|
Cmd.none
|
||||||
|
|
||||||
|
Data.Fields.SourceName ->
|
||||||
|
Cmd.none
|
||||||
|
|
||||||
|
|
||||||
resetHiddenFields :
|
resetHiddenFields :
|
||||||
UiSettings
|
UiSettings
|
||||||
|
@ -72,6 +72,7 @@ type alias Model =
|
|||||||
, showNameHelp : Bool
|
, showNameHelp : Bool
|
||||||
, customFieldModel : Comp.CustomFieldMultiInput.Model
|
, customFieldModel : Comp.CustomFieldMultiInput.Model
|
||||||
, customValues : CustomFieldValueCollect
|
, customValues : CustomFieldValueCollect
|
||||||
|
, sourceModel : Maybe String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ init =
|
|||||||
, showNameHelp = False
|
, showNameHelp = False
|
||||||
, customFieldModel = Comp.CustomFieldMultiInput.initWith []
|
, customFieldModel = Comp.CustomFieldMultiInput.initWith []
|
||||||
, customValues = Data.CustomFieldChange.emptyCollect
|
, customValues = Data.CustomFieldChange.emptyCollect
|
||||||
|
, sourceModel = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -196,6 +198,7 @@ getItemSearch model =
|
|||||||
, tagCategoriesInclude = model.tagSelection.includeCats |> List.map .name
|
, tagCategoriesInclude = model.tagSelection.includeCats |> List.map .name
|
||||||
, tagCategoriesExclude = model.tagSelection.excludeCats |> List.map .name
|
, tagCategoriesExclude = model.tagSelection.excludeCats |> List.map .name
|
||||||
, customValues = Data.CustomFieldChange.toFieldValues model.customValues
|
, customValues = Data.CustomFieldChange.toFieldValues model.customValues
|
||||||
|
, source = model.sourceModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +237,7 @@ resetModel model =
|
|||||||
Comp.CustomFieldMultiInput.reset
|
Comp.CustomFieldMultiInput.reset
|
||||||
model.customFieldModel
|
model.customFieldModel
|
||||||
, customValues = Data.CustomFieldChange.emptyCollect
|
, customValues = Data.CustomFieldChange.emptyCollect
|
||||||
|
, sourceModel = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -273,6 +277,7 @@ type Msg
|
|||||||
| SetFolder IdName
|
| SetFolder IdName
|
||||||
| SetTag String
|
| SetTag String
|
||||||
| CustomFieldMsg Comp.CustomFieldMultiInput.Msg
|
| CustomFieldMsg Comp.CustomFieldMultiInput.Msg
|
||||||
|
| SetSource String
|
||||||
|
|
||||||
|
|
||||||
type alias NextState =
|
type alias NextState =
|
||||||
@ -738,6 +743,17 @@ updateDrop ddm flags settings msg model =
|
|||||||
, dragDrop = DD.DragDropData ddm Nothing
|
, dragDrop = DD.DragDropData ddm Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetSource str ->
|
||||||
|
let
|
||||||
|
next =
|
||||||
|
Util.Maybe.fromString str
|
||||||
|
in
|
||||||
|
{ model = { model | sourceModel = next }
|
||||||
|
, cmd = Cmd.none
|
||||||
|
, stateChange = False
|
||||||
|
, dragDrop = DD.DragDropData ddm Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- View
|
-- View
|
||||||
@ -992,6 +1008,24 @@ viewDrop ddd flags settings model =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
, div
|
||||||
|
[ classList
|
||||||
|
[ ( segmentClass, not (fieldHidden Data.Fields.SourceName) )
|
||||||
|
, ( "invisible hidden", fieldHidden Data.Fields.SourceName )
|
||||||
|
]
|
||||||
|
]
|
||||||
|
[ formHeader (Icons.sourceIcon "") "Source"
|
||||||
|
, div [ class "field" ]
|
||||||
|
[ input
|
||||||
|
[ type_ "text"
|
||||||
|
, onInput SetSource
|
||||||
|
, Util.Html.onKeyUpCode KeyUpMsg
|
||||||
|
, model.sourceModel |> Maybe.withDefault "" |> value
|
||||||
|
, placeholder "Search in item source…"
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
]
|
||||||
, div
|
, div
|
||||||
[ classList
|
[ classList
|
||||||
[ ( segmentClass, True )
|
[ ( segmentClass, True )
|
||||||
|
@ -21,6 +21,7 @@ type Field
|
|||||||
| Direction
|
| Direction
|
||||||
| PreviewImage
|
| PreviewImage
|
||||||
| CustomFields
|
| CustomFields
|
||||||
|
| SourceName
|
||||||
|
|
||||||
|
|
||||||
all : List Field
|
all : List Field
|
||||||
@ -37,6 +38,7 @@ all =
|
|||||||
, Direction
|
, Direction
|
||||||
, PreviewImage
|
, PreviewImage
|
||||||
, CustomFields
|
, CustomFields
|
||||||
|
, SourceName
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -81,6 +83,9 @@ fromString str =
|
|||||||
"customfields" ->
|
"customfields" ->
|
||||||
Just CustomFields
|
Just CustomFields
|
||||||
|
|
||||||
|
"sourcename" ->
|
||||||
|
Just SourceName
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
Nothing
|
Nothing
|
||||||
|
|
||||||
@ -121,6 +126,9 @@ toString field =
|
|||||||
CustomFields ->
|
CustomFields ->
|
||||||
"customfields"
|
"customfields"
|
||||||
|
|
||||||
|
SourceName ->
|
||||||
|
"sourcename"
|
||||||
|
|
||||||
|
|
||||||
label : Field -> String
|
label : Field -> String
|
||||||
label field =
|
label field =
|
||||||
@ -158,6 +166,9 @@ label field =
|
|||||||
CustomFields ->
|
CustomFields ->
|
||||||
"Custom Fields"
|
"Custom Fields"
|
||||||
|
|
||||||
|
SourceName ->
|
||||||
|
"Item Source"
|
||||||
|
|
||||||
|
|
||||||
fromList : List String -> List Field
|
fromList : List String -> List Field
|
||||||
fromList strings =
|
fromList strings =
|
||||||
|
@ -29,6 +29,8 @@ module Data.Icons exposing
|
|||||||
, personIcon
|
, personIcon
|
||||||
, search
|
, search
|
||||||
, searchIcon
|
, searchIcon
|
||||||
|
, source
|
||||||
|
, sourceIcon
|
||||||
, tag
|
, tag
|
||||||
, tagIcon
|
, tagIcon
|
||||||
, tags
|
, tags
|
||||||
@ -40,6 +42,16 @@ import Html exposing (Html, i)
|
|||||||
import Html.Attributes exposing (class)
|
import Html.Attributes exposing (class)
|
||||||
|
|
||||||
|
|
||||||
|
source : String
|
||||||
|
source =
|
||||||
|
"upload icon"
|
||||||
|
|
||||||
|
|
||||||
|
sourceIcon : String -> Html msg
|
||||||
|
sourceIcon classes =
|
||||||
|
i [ class (source ++ " " ++ classes) ] []
|
||||||
|
|
||||||
|
|
||||||
customFieldType : CustomFieldType -> String
|
customFieldType : CustomFieldType -> String
|
||||||
customFieldType ftype =
|
customFieldType ftype =
|
||||||
case ftype of
|
case ftype of
|
||||||
|
@ -5,6 +5,7 @@ import Comp.CollectiveSettingsForm
|
|||||||
import Comp.SourceManage
|
import Comp.SourceManage
|
||||||
import Comp.UserManage
|
import Comp.UserManage
|
||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
|
import Data.Icons as Icons
|
||||||
import Data.UiSettings exposing (UiSettings)
|
import Data.UiSettings exposing (UiSettings)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
@ -35,7 +36,7 @@ view flags settings model =
|
|||||||
[ classActive (model.currentTab == Just SourceTab) "link icon item"
|
[ classActive (model.currentTab == Just SourceTab) "link icon item"
|
||||||
, onClick (SetTab SourceTab)
|
, onClick (SetTab SourceTab)
|
||||||
]
|
]
|
||||||
[ i [ class "upload icon" ] []
|
[ Icons.sourceIcon ""
|
||||||
, text "Sources"
|
, text "Sources"
|
||||||
]
|
]
|
||||||
, div
|
, div
|
||||||
@ -183,7 +184,7 @@ makeTagStats nc =
|
|||||||
viewSources : Flags -> UiSettings -> Model -> List (Html Msg)
|
viewSources : Flags -> UiSettings -> Model -> List (Html Msg)
|
||||||
viewSources flags settings model =
|
viewSources flags settings model =
|
||||||
[ h2 [ class "ui header" ]
|
[ h2 [ class "ui header" ]
|
||||||
[ i [ class "ui upload icon" ] []
|
[ Icons.sourceIcon ""
|
||||||
, div [ class "content" ]
|
, div [ class "content" ]
|
||||||
[ text "Sources"
|
[ text "Sources"
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user