Skip to content

Commit

Permalink
on focus out
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Dec 31, 2024
1 parent f8b1fa6 commit 5bbfc6c
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/elm/Components/Form.elm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import RemoteData exposing (WebData)
import Shared
import Utils.Helpers as Util
import Vela
import Effect exposing (Effect)
import Json.Decode



Expand Down Expand Up @@ -188,9 +190,10 @@ viewTextareaSection :
, wrap_ : Maybe String
, msg : String -> msg
, disabled_ : Bool
, focusOutFunc : Maybe msg
}
-> Html msg
viewTextareaSection { id_, title, subtitle, val, placeholder_, classList_, rows_, wrap_, msg, disabled_ } =
viewTextareaSection { id_, title, subtitle, val, placeholder_, classList_, rows_, wrap_, msg, disabled_, focusOutFunc } =
let
target =
String.join "-" [ "textarea", id_ ]
Expand All @@ -214,6 +217,7 @@ viewTextareaSection { id_, title, subtitle, val, placeholder_, classList_, rows_
, Maybe.Extra.unwrap Util.attrNone wrap wrap_
, onInput msg
, disabled disabled_
, Maybe.Extra.unwrap Util.attrNone (Html.Events.on "focusout" << Json.Decode.succeed) focusOutFunc
, Util.testAttribute target
]
[]
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/Dash/Secrets/Engine_/Org/Org_/Add.elm
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = False
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/Dash/Secrets/Engine_/Org/Org_/Name_.elm
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = not <| RemoteData.isSuccess model.secret
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/Dash/Secrets/Engine_/Repo/Org_/Repo_/Add.elm
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = False
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = not <| RemoteData.isSuccess model.secret
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = False
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = ValueOnInput
, disabled_ = not <| RemoteData.isSuccess model.secret
, focusOutFunc = Nothing
}
, Components.SecretForm.viewAllowEventsSelect
shared
Expand Down
17 changes: 17 additions & 0 deletions src/elm/Pages/Org_/Repo_/Deployments/Add.elm
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ type Msg
| AddParameter
| RemoveParameter Vela.KeyValuePair
| CfgParameterValueOnInput String String
| UpdateRef
| AddConfigParameter String String
| DeploymentConfigTargetOnToggle String
| SubmitForm
Expand Down Expand Up @@ -308,6 +309,18 @@ update shared route msg model =
, Effect.none
)

UpdateRef ->
( model
, Effect.getDeploymentConfig
{ baseUrl = shared.velaAPIBaseURL
, session = shared.session
, onResponse = GetDeploymentConfigResponse
, org = route.params.org
, repo = route.params.repo
, ref = Just model.ref
}
)

SubmitForm ->
let
payload =
Expand Down Expand Up @@ -421,6 +434,7 @@ view shared route model =
, rows_ = Just 3
, wrap_ = Just "soft"
, msg = RefOnInput
, focusOutFunc = Just UpdateRef
}
, Components.Form.viewTextareaSection
{ title = Just "Description"
Expand All @@ -433,6 +447,7 @@ view shared route model =
, rows_ = Just 5
, wrap_ = Just "soft"
, msg = DescriptionOnInput
, focusOutFunc = Nothing
}
, case model.config of
RemoteData.Success config ->
Expand All @@ -451,6 +466,7 @@ view shared route model =
, rows_ = Just 2
, wrap_ = Just "soft"
, msg = TargetOnInput
, focusOutFunc = Nothing
}

_ ->
Expand All @@ -466,6 +482,7 @@ view shared route model =
, rows_ = Just 2
, wrap_ = Just "soft"
, msg = TaskOnInput
, focusOutFunc = Nothing
}
, section []
[ div [ class "parameters-inputs", Util.testAttribute "parameters-list" ]
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/Org_/Repo_/Schedules/Add.elm
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = EntryOnInput
, disabled_ = formDisabled
, focusOutFunc = Nothing
}
, Components.ScheduleForm.viewEnabledInput
{ msg = EnabledOnClick
Expand Down
1 change: 1 addition & 0 deletions src/elm/Pages/Org_/Repo_/Schedules/Name_.elm
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ view shared route model =
, wrap_ = Just "soft"
, msg = EntryOnInput
, disabled_ = formDisabled
, focusOutFunc = Nothing
}
, Components.ScheduleForm.viewEnabledInput
{ msg = EnabledOnClick
Expand Down
6 changes: 3 additions & 3 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1990,9 +1990,9 @@ type alias DeploymentConfigParameter =
decodeDeploymentConfigParameter : Decoder DeploymentConfigParameter
decodeDeploymentConfigParameter =
Json.Decode.succeed DeploymentConfigParameter
|> required "description" string
|> required "type" string
|> required "required" bool
|> optional "description" string ""
|> optional "type" string "string"
|> optional "required" bool False
|> optional "options" (Json.Decode.list Json.Decode.string) []
|> optional "min" int 0
|> optional "max" int 0
Expand Down

0 comments on commit 5bbfc6c

Please sign in to comment.