diff --git a/modules/webapp/src/main/elm/Api.elm b/modules/webapp/src/main/elm/Api.elm index 73cac0e0..51366ecc 100644 --- a/modules/webapp/src/main/elm/Api.elm +++ b/modules/webapp/src/main/elm/Api.elm @@ -365,10 +365,10 @@ getOrgLight flags receive = } -getOrganizations : Flags -> (Result Http.Error OrganizationList -> msg) -> Cmd msg -getOrganizations flags receive = +getOrganizations : Flags -> String -> (Result Http.Error OrganizationList -> msg) -> Cmd msg +getOrganizations flags query receive = 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 , expect = Http.expectJson receive Api.Model.OrganizationList.decoder } diff --git a/modules/webapp/src/main/elm/Comp/OrgManage.elm b/modules/webapp/src/main/elm/Comp/OrgManage.elm index 58742efb..9d936f74 100644 --- a/modules/webapp/src/main/elm/Comp/OrgManage.elm +++ b/modules/webapp/src/main/elm/Comp/OrgManage.elm @@ -16,7 +16,7 @@ import Comp.YesNoDimmer import Data.Flags exposing (Flags) import Html exposing (..) import Html.Attributes exposing (..) -import Html.Events exposing (onClick, onSubmit) +import Html.Events exposing (onClick, onInput, onSubmit) import Http import Util.Http import Util.Maybe @@ -59,6 +59,7 @@ type Msg | SubmitResp (Result Http.Error BasicResult) | YesNoMsg Comp.YesNoDimmer.Msg | RequestDelete + | SetQuery String update : Flags -> Msg -> Model -> ( Model, Cmd Msg ) @@ -101,7 +102,7 @@ update flags msg model = ( { model | formModel = m2 }, Cmd.map FormMsg c2 ) LoadOrgs -> - ( { model | loading = True }, Api.getOrganizations flags OrgResp ) + ( { model | loading = True }, Api.getOrganizations flags "" OrgResp ) OrgResp (Ok orgs) -> let @@ -186,6 +187,9 @@ update flags msg model = in ( { model | deleteConfirm = cm }, cmd ) + SetQuery str -> + ( model, Api.getOrganizations flags str OrgResp ) + view : Model -> Html Msg view model = @@ -199,9 +203,33 @@ view model = viewTable : Model -> Html Msg viewTable model = div [] - [ button [ class "ui basic button", onClick InitNewOrg ] - [ i [ class "plus icon" ] [] - , text "Create new" + [ div [ class "ui secondary menu" ] + [ div [ class "ui container" ] + [ 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) , div