This commit is contained in:
Correl Roush 2018-02-08 18:27:52 -05:00
parent f4f619b354
commit 0ab7ef024e
5 changed files with 33 additions and 26 deletions

View file

@ -1,18 +1,10 @@
module App exposing (..) module App exposing (main)
import Config import Config
import Gitlab
import Html import Html
import Html.Events as Events import Html.Events as Events
import Paginated
import Pass import Pass
import Ports import Ports
import RemoteData
import Task
type alias ObjectsResponse =
RemoteData.WebData (List Gitlab.Object)
type Model type Model
@ -27,7 +19,6 @@ type Msg
| UpdatePass Pass.Msg | UpdatePass Pass.Msg
| SaveConfig | SaveConfig
| Configure | Configure
| GotObjects ObjectsResponse
main : Program Never Model Msg main : Program Never Model Msg
@ -75,9 +66,9 @@ update msg model =
, Cmd.none , Cmd.none
) )
( UpdateConfig update, Configuring cfg ) -> ( UpdateConfig msg_, Configuring cfg ) ->
( Configuring <| ( Configuring <|
Config.update update cfg Config.update msg_ cfg
, Cmd.none , Cmd.none
) )

View file

@ -1,4 +1,13 @@
module Config exposing (..) module Config
exposing
( Msg
, init
, fromGitlab
, toClient
, toRepo
, update
, view
)
import Gitlab import Gitlab
import Html import Html

View file

@ -1,4 +1,4 @@
module Gitlab exposing (..) module Gitlab exposing (Client, Repo, getFiles)
import Http import Http
import Json.Decode exposing (Decoder) import Json.Decode exposing (Decoder)
@ -9,11 +9,6 @@ import RemoteData exposing (WebData)
import Task exposing (Task) import Task exposing (Task)
type Msg
= FetchFiles
| AddFiles (Result Http.Error (List Object))
type alias Client = type alias Client =
{ url : String { url : String
, token : Maybe String , token : Maybe String

View file

@ -1,4 +1,11 @@
module Pass exposing (..) module Pass
exposing
( Msg
, Model
, init
, update
, view
)
import Dict exposing (Dict) import Dict exposing (Dict)
import Gitlab import Gitlab
@ -6,7 +13,6 @@ import Html exposing (Html)
import Html.Attributes as Attr import Html.Attributes as Attr
import Html.Events as Events import Html.Events as Events
import Maybe.Extra import Maybe.Extra
import Paginated
import Regex import Regex
import RemoteData exposing (WebData) import RemoteData exposing (WebData)
import Task import Task
@ -66,7 +72,7 @@ fromFilename filename =
toFilename : Pass -> String toFilename : Pass -> String
toFilename pass = toFilename pass =
(String.join "/" pass) ++ ".gpg" String.join "/" pass ++ ".gpg"
update : Msg -> Model -> ( Model, Cmd Msg ) update : Msg -> Model -> ( Model, Cmd Msg )
@ -115,11 +121,11 @@ filter search entries =
regex = regex =
Regex.caseInsensitive (Regex.regex search) Regex.caseInsensitive (Regex.regex search)
matches : String -> Pass -> Bool matches : Pass -> Bool
matches search entry = matches entry =
List.any (Regex.contains regex) entry List.any (Regex.contains regex) entry
in in
List.filter (matches search) entries List.filter matches entries
viewPass : Pass -> Html Msg viewPass : Pass -> Html Msg

View file

@ -1,4 +1,10 @@
port module Ports exposing (..) port module Ports
exposing
( Config
, loadConfig
, saveConfig
, config
)
type alias Config = type alias Config =