From 48ddf1d4f9b05ab46d99cf1db85809598815cabf Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Tue, 23 Apr 2019 19:30:43 +0200 Subject: [PATCH] Restructure Sources.Property record --- src/Applications/UI/Sources/Form.elm | 12 +++---- src/Library/Sources.elm | 8 ++--- src/Library/Sources/Services/AmazonS3.elm | 38 ++++++++++++++++++----- src/Library/Sources/Services/Common.elm | 15 +-------- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/Applications/UI/Sources/Form.elm b/src/Applications/UI/Sources/Form.elm index 97c80ab2..9444da5e 100644 --- a/src/Applications/UI/Sources/Form.elm +++ b/src/Applications/UI/Sources/Form.elm @@ -322,13 +322,13 @@ renderProperty : Source -> Property -> Html Msg renderProperty context property = chunk [ T.mb4 ] - [ UI.Kit.label [ for property.k ] property.l + [ UI.Kit.label [ for property.key ] property.label , UI.Kit.textField - [ name property.k - , onInput (SetData property.k) - , placeholder property.h - , type_ (ifThenElse property.p "password" "text") - , value (Dict.fetch property.k "" context.data) + [ name property.key + , onInput (SetData property.key) + , placeholder property.placeholder + , type_ (ifThenElse property.password "password" "text") + , value (Dict.fetch property.key "" context.data) ] ] diff --git a/src/Library/Sources.elm b/src/Library/Sources.elm index 4b35d2b5..90f1f94c 100644 --- a/src/Library/Sources.elm +++ b/src/Library/Sources.elm @@ -23,10 +23,10 @@ type alias Source = type alias Property = - { k : String -- Key - , l : String -- Label - , h : String -- Placeholder - , p : Bool -- Password? + { key : String + , label : String + , placeholder : String + , password : Bool } diff --git a/src/Library/Sources/Services/AmazonS3.elm b/src/Library/Sources/Services/AmazonS3.elm index f0992365..6419e22f 100644 --- a/src/Library/Sources/Services/AmazonS3.elm +++ b/src/Library/Sources/Services/AmazonS3.elm @@ -15,7 +15,7 @@ import Sources.Pick import Sources.Processing exposing (..) import Sources.Services.AmazonS3.Parser as Parser import Sources.Services.AmazonS3.Presign exposing (..) -import Sources.Services.Common exposing (cleanPath, nameProperty, noPrep) +import Sources.Services.Common exposing (cleanPath, noPrep) import Time @@ -36,12 +36,36 @@ defaults = -} properties : List Property properties = - [ { k = "accessKey", l = "Access key", h = "Fv6EWfLfCcMo", p = True } - , { k = "secretKey", l = "Secret key", h = "qeNcqiMpgqC8", p = True } - , { k = "bucketName", l = "Bucket name", h = "music", p = False } - , { k = "region", l = "Region", h = defaults.region, p = False } - , { k = "directoryPath", l = "Directory", h = defaults.directoryPath, p = False } - , { k = "host", l = "Host (optional)", h = "http://127.0.0.1:9000", p = False } + [ { key = "accessKey" + , label = "Access key" + , placeholder = "Fv6EWfLfCcMo" + , password = True + } + , { key = "secretKey" + , label = "Secret key" + , placeholder = "qeNcqiMpgqC8" + , password = True + } + , { key = "bucketName" + , label = "Bucket name" + , placeholder = "music" + , password = False + } + , { key = "region" + , label = "Region" + , placeholder = defaults.region + , password = False + } + , { key = "directoryPath" + , label = "Directory" + , placeholder = defaults.directoryPath + , password = False + } + , { key = "host" + , label = "Host (optional)" + , placeholder = "http://127.0.0.1:9000" + , password = False + } ] diff --git a/src/Library/Sources/Services/Common.elm b/src/Library/Sources/Services/Common.elm index 15f8576c..a8487a51 100644 --- a/src/Library/Sources/Services/Common.elm +++ b/src/Library/Sources/Services/Common.elm @@ -1,4 +1,4 @@ -module Sources.Services.Common exposing (cleanPath, nameProperty, noPrep) +module Sources.Services.Common exposing (cleanPath, noPrep) import Sources exposing (..) import Sources.Processing exposing (..) @@ -6,19 +6,6 @@ import String.Ext as String --- FORMS - - -nameProperty : String -> Property -nameProperty placeholder = - { k = "name" - , l = "Name" - , h = placeholder - , p = False - } - - - -- PATHS -- 2.51.2