Skip to content

Commit

Permalink
prefill defaults for events
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Jan 17, 2024
1 parent c809ddb commit 4d21290
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/elm/Pages/Secrets/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Http.Detailed
import LinkHeader exposing (WebLink)
import Pages exposing (Page)
import RemoteData exposing (WebData)
import Vela exposing (AllowEventsPayload, Copy, Engine, Key, Org, Repo, Secret, SecretType, Secrets, Team, defaultAllowEvents)
import Vela exposing (AllowEventsPayload, Copy, Engine, Key, Org, Repo, Secret, SecretType, Secrets, Team, defaultSecretAllowEvents)



Expand Down Expand Up @@ -87,7 +87,7 @@ type alias SecretForm =

defaultSecretUpdate : SecretForm
defaultSecretUpdate =
SecretForm "" "" defaultSecretEvents "" [] defaultAllowEvents True ""
SecretForm "" "" defaultSecretEvents "" [] defaultSecretAllowEvents True ""


defaultSecretEvents : List String
Expand Down
11 changes: 5 additions & 6 deletions src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module Vela exposing
, decodeSourceRepositories
, decodeStep
, decodeTheme
, defaultAllowEvents
, defaultSecretAllowEvents
, defaultBuildGraph
, defaultEnableRepositoryPayload
, defaultFavicon
Expand Down Expand Up @@ -2500,10 +2500,9 @@ secretToKey secret =
secret.org ++ "/" ++ secret.repo ++ "/" ++ secret.name


defaultAllowEvents : AllowEvents
defaultAllowEvents =
{ push = defaultPushActionsPayload Nothing, pull = defaultPullActionsPayload Nothing, deploy = defaultDeployActionsPayload Nothing, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing }

defaultSecretAllowEvents : AllowEvents
defaultSecretAllowEvents =
{ push = { branch = True, tag = True }, pull = defaultPullActionsPayload Nothing, deploy = { created = True }, comment = defaultCommentActionsPayload Nothing, schedule = defaultScheduleActionsPayload Nothing }

decodeSecret : Decoder Secret
decodeSecret =
Expand All @@ -2517,7 +2516,7 @@ decodeSecret =
|> optional "type" secretTypeDecoder RepoSecret
|> optional "images" (Decode.list string) []
|> optional "events" (Decode.list string) []
|> optional "allow_events" decodeAllowEvents defaultAllowEvents
|> optional "allow_events" decodeAllowEvents defaultSecretAllowEvents
|> optional "allow_command" bool False


Expand Down

0 comments on commit 4d21290

Please sign in to comment.