mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-03-28 17:55:06 +00:00
Add search field to organization view
This commit is contained in:
parent
8814de3c38
commit
906ee9034e
@ -365,10 +365,10 @@ getOrgLight flags receive =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getOrganizations : Flags -> (Result Http.Error OrganizationList -> msg) -> Cmd msg
|
getOrganizations : Flags -> String -> (Result Http.Error OrganizationList -> msg) -> Cmd msg
|
||||||
getOrganizations flags receive =
|
getOrganizations flags query receive =
|
||||||
Http2.authGet
|
Http2.authGet
|
||||||
{ url = flags.config.baseUrl ++ "/api/v1/sec/organization?full=true"
|
{ url = flags.config.baseUrl ++ "/api/v1/sec/organization?full=true&q=" ++ query
|
||||||
, account = getAccount flags
|
, account = getAccount flags
|
||||||
, expect = Http.expectJson receive Api.Model.OrganizationList.decoder
|
, expect = Http.expectJson receive Api.Model.OrganizationList.decoder
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import Comp.YesNoDimmer
|
|||||||
import Data.Flags exposing (Flags)
|
import Data.Flags exposing (Flags)
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import Html.Events exposing (onClick, onSubmit)
|
import Html.Events exposing (onClick, onInput, onSubmit)
|
||||||
import Http
|
import Http
|
||||||
import Util.Http
|
import Util.Http
|
||||||
import Util.Maybe
|
import Util.Maybe
|
||||||
@ -59,6 +59,7 @@ type Msg
|
|||||||
| SubmitResp (Result Http.Error BasicResult)
|
| SubmitResp (Result Http.Error BasicResult)
|
||||||
| YesNoMsg Comp.YesNoDimmer.Msg
|
| YesNoMsg Comp.YesNoDimmer.Msg
|
||||||
| RequestDelete
|
| RequestDelete
|
||||||
|
| SetQuery String
|
||||||
|
|
||||||
|
|
||||||
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
||||||
@ -101,7 +102,7 @@ update flags msg model =
|
|||||||
( { model | formModel = m2 }, Cmd.map FormMsg c2 )
|
( { model | formModel = m2 }, Cmd.map FormMsg c2 )
|
||||||
|
|
||||||
LoadOrgs ->
|
LoadOrgs ->
|
||||||
( { model | loading = True }, Api.getOrganizations flags OrgResp )
|
( { model | loading = True }, Api.getOrganizations flags "" OrgResp )
|
||||||
|
|
||||||
OrgResp (Ok orgs) ->
|
OrgResp (Ok orgs) ->
|
||||||
let
|
let
|
||||||
@ -186,6 +187,9 @@ update flags msg model =
|
|||||||
in
|
in
|
||||||
( { model | deleteConfirm = cm }, cmd )
|
( { model | deleteConfirm = cm }, cmd )
|
||||||
|
|
||||||
|
SetQuery str ->
|
||||||
|
( model, Api.getOrganizations flags str OrgResp )
|
||||||
|
|
||||||
|
|
||||||
view : Model -> Html Msg
|
view : Model -> Html Msg
|
||||||
view model =
|
view model =
|
||||||
@ -199,9 +203,33 @@ view model =
|
|||||||
viewTable : Model -> Html Msg
|
viewTable : Model -> Html Msg
|
||||||
viewTable model =
|
viewTable model =
|
||||||
div []
|
div []
|
||||||
[ button [ class "ui basic button", onClick InitNewOrg ]
|
[ div [ class "ui secondary menu" ]
|
||||||
[ i [ class "plus icon" ] []
|
[ div [ class "ui container" ]
|
||||||
, text "Create new"
|
[ div [ class "fitted-item" ]
|
||||||
|
[ div [ class "ui icon input" ]
|
||||||
|
[ input
|
||||||
|
[ type_ "text"
|
||||||
|
, onInput SetQuery
|
||||||
|
, placeholder "Search…"
|
||||||
|
]
|
||||||
|
[]
|
||||||
|
, i [ class "ui search icon" ]
|
||||||
|
[]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
, div [ class "right menu" ]
|
||||||
|
[ div [ class "fitted-item" ]
|
||||||
|
[ a
|
||||||
|
[ class "ui primary button"
|
||||||
|
, href "#"
|
||||||
|
, onClick InitNewOrg
|
||||||
|
]
|
||||||
|
[ i [ class "plus icon" ] []
|
||||||
|
, text "New Organization"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
, Html.map TableMsg (Comp.OrgTable.view model.tableModel)
|
, Html.map TableMsg (Comp.OrgTable.view model.tableModel)
|
||||||
, div
|
, div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user