Cleanup
This commit is contained in:
parent
f4f619b354
commit
0ab7ef024e
5 changed files with 33 additions and 26 deletions
15
src/App.elm
15
src/App.elm
|
@ -1,18 +1,10 @@
|
|||
module App exposing (..)
|
||||
module App exposing (main)
|
||||
|
||||
import Config
|
||||
import Gitlab
|
||||
import Html
|
||||
import Html.Events as Events
|
||||
import Paginated
|
||||
import Pass
|
||||
import Ports
|
||||
import RemoteData
|
||||
import Task
|
||||
|
||||
|
||||
type alias ObjectsResponse =
|
||||
RemoteData.WebData (List Gitlab.Object)
|
||||
|
||||
|
||||
type Model
|
||||
|
@ -27,7 +19,6 @@ type Msg
|
|||
| UpdatePass Pass.Msg
|
||||
| SaveConfig
|
||||
| Configure
|
||||
| GotObjects ObjectsResponse
|
||||
|
||||
|
||||
main : Program Never Model Msg
|
||||
|
@ -75,9 +66,9 @@ update msg model =
|
|||
, Cmd.none
|
||||
)
|
||||
|
||||
( UpdateConfig update, Configuring cfg ) ->
|
||||
( UpdateConfig msg_, Configuring cfg ) ->
|
||||
( Configuring <|
|
||||
Config.update update cfg
|
||||
Config.update msg_ cfg
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
module Config exposing (..)
|
||||
module Config
|
||||
exposing
|
||||
( Msg
|
||||
, init
|
||||
, fromGitlab
|
||||
, toClient
|
||||
, toRepo
|
||||
, update
|
||||
, view
|
||||
)
|
||||
|
||||
import Gitlab
|
||||
import Html
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Gitlab exposing (..)
|
||||
module Gitlab exposing (Client, Repo, getFiles)
|
||||
|
||||
import Http
|
||||
import Json.Decode exposing (Decoder)
|
||||
|
@ -9,11 +9,6 @@ import RemoteData exposing (WebData)
|
|||
import Task exposing (Task)
|
||||
|
||||
|
||||
type Msg
|
||||
= FetchFiles
|
||||
| AddFiles (Result Http.Error (List Object))
|
||||
|
||||
|
||||
type alias Client =
|
||||
{ url : String
|
||||
, token : Maybe String
|
||||
|
|
18
src/Pass.elm
18
src/Pass.elm
|
@ -1,4 +1,11 @@
|
|||
module Pass exposing (..)
|
||||
module Pass
|
||||
exposing
|
||||
( Msg
|
||||
, Model
|
||||
, init
|
||||
, update
|
||||
, view
|
||||
)
|
||||
|
||||
import Dict exposing (Dict)
|
||||
import Gitlab
|
||||
|
@ -6,7 +13,6 @@ import Html exposing (Html)
|
|||
import Html.Attributes as Attr
|
||||
import Html.Events as Events
|
||||
import Maybe.Extra
|
||||
import Paginated
|
||||
import Regex
|
||||
import RemoteData exposing (WebData)
|
||||
import Task
|
||||
|
@ -66,7 +72,7 @@ fromFilename filename =
|
|||
|
||||
toFilename : Pass -> String
|
||||
toFilename pass =
|
||||
(String.join "/" pass) ++ ".gpg"
|
||||
String.join "/" pass ++ ".gpg"
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
|
@ -115,11 +121,11 @@ filter search entries =
|
|||
regex =
|
||||
Regex.caseInsensitive (Regex.regex search)
|
||||
|
||||
matches : String -> Pass -> Bool
|
||||
matches search entry =
|
||||
matches : Pass -> Bool
|
||||
matches entry =
|
||||
List.any (Regex.contains regex) entry
|
||||
in
|
||||
List.filter (matches search) entries
|
||||
List.filter matches entries
|
||||
|
||||
|
||||
viewPass : Pass -> Html Msg
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
port module Ports exposing (..)
|
||||
port module Ports
|
||||
exposing
|
||||
( Config
|
||||
, loadConfig
|
||||
, saveConfig
|
||||
, config
|
||||
)
|
||||
|
||||
|
||||
type alias Config =
|
||||
|
|
Loading…
Reference in a new issue