mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Allow to search in source names in webui
This commit is contained in:
@ -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"
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user