Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Jan 8, 2025
1 parent 66d5f4b commit cf90d89
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 46 deletions.
36 changes: 33 additions & 3 deletions src/elm/Components/Form.elm
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ viewInput :
, wrap_ : Maybe String
, msg : String -> msg
, disabled_ : Bool
, min : Maybe String
, max : Maybe String
, required : Bool
}
-> Html msg
viewInput { id_, title, subtitle, val, placeholder_, classList_, wrapperClassList, rows_, wrap_, msg, disabled_ } =
viewInput { id_, title, subtitle, val, placeholder_, classList_, wrapperClassList, rows_, wrap_, msg, disabled_, min, max, required} =
let
target =
String.join "-" [ "input", id_ ]
Expand All @@ -110,6 +113,9 @@ viewInput { id_, title, subtitle, val, placeholder_, classList_, wrapperClassLis
, Maybe.Extra.unwrap Util.attrNone wrap wrap_
, onInput msg
, disabled disabled_
, Maybe.Extra.unwrap Util.attrNone Html.Attributes.min min
, Maybe.Extra.unwrap Util.attrNone Html.Attributes.max max
, Html.Attributes.required required
, Util.testAttribute target
]
[]
Expand Down Expand Up @@ -148,9 +154,10 @@ viewNumberInput :
, disabled_ : Bool
, min : Maybe Int
, max : Maybe Int
, required : Bool
}
-> Html msg
viewNumberInput { id_, title, subtitle, val, placeholder_, wrapperClassList, classList_, rows_, wrap_, msg, disabled_, min, max } =
viewNumberInput { id_, title, subtitle, val, placeholder_, wrapperClassList, classList_, rows_, wrap_, msg, disabled_, min, max, required } =
let
target =
String.join "-" [ "input", id_ ]
Expand All @@ -171,6 +178,7 @@ viewNumberInput { id_, title, subtitle, val, placeholder_, wrapperClassList, cla
, Maybe.Extra.unwrap Util.attrNone wrap wrap_
, onInput msg
, disabled disabled_
, Html.Attributes.required required
, Util.testAttribute target
]
[]
Expand Down Expand Up @@ -266,17 +274,19 @@ viewCheckbox :
, subtitle : Maybe (Html msg)
, field : String
, state : Bool
, wrapperClassList : List ( String, Bool )
, msg : Bool -> msg
, disabled_ : Bool
}
-> Html msg
viewCheckbox { id_, title, subtitle, field, state, msg, disabled_ } =
viewCheckbox { id_, title, subtitle, field, state, wrapperClassList, msg, disabled_ } =
let
target =
String.join "-" [ "checkbox", id_, field ]
in
div
[ class "form-control"
, classList wrapperClassList
, Util.testAttribute target
]
[ input
Expand Down Expand Up @@ -397,6 +407,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_push_branch"
, state = allowEvents.push.branch
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PushBranch }
, disabled_ = False
, id_ = "allow-events-push-branch"
Expand All @@ -406,6 +417,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_push_tag"
, state = allowEvents.push.tag
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PushTag }
, disabled_ = False
, id_ = "allow-events-push-tag"
Expand All @@ -418,6 +430,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_opened"
, state = allowEvents.pull.opened
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullOpened }
, disabled_ = False
, id_ = "allow-events-pull-opened"
Expand All @@ -427,6 +440,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_synchronize"
, state = allowEvents.pull.synchronize
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullSynchronize }
, disabled_ = False
, id_ = "allow-events-pull-synchronize"
Expand All @@ -436,6 +450,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_edited"
, state = allowEvents.pull.edited
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullEdited }
, disabled_ = False
, id_ = "allow-events-pull-edited"
Expand All @@ -445,6 +460,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_reopened"
, state = allowEvents.pull.reopened
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullReopened }
, disabled_ = False
, id_ = "allow-events-pull-reopened"
Expand All @@ -454,6 +470,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_labeled"
, state = allowEvents.pull.labeled
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullLabeled }
, disabled_ = False
, id_ = "allow-events-pull-labeled"
Expand All @@ -463,6 +480,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_pull_unlabeled"
, state = allowEvents.pull.unlabeled
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PullUnlabeled }
, disabled_ = False
, id_ = "allow-events-pull-unlabeled"
Expand All @@ -475,6 +493,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_deploy_created"
, state = allowEvents.deploy.created
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.DeployCreated }
, disabled_ = False
, id_ = "allow-events-deploy-created"
Expand All @@ -487,6 +506,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_comment_created"
, state = allowEvents.comment.created
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.CommentCreated }
, disabled_ = False
, id_ = "allow-events-comment-created"
Expand All @@ -496,6 +516,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_comment_edited"
, state = allowEvents.comment.edited
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.CommentEdited }
, disabled_ = False
, id_ = "allow-events-comment-edited"
Expand All @@ -508,6 +529,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_push_delete_branch"
, state = allowEvents.push.deleteBranch
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PushDeleteBranch }
, disabled_ = False
, id_ = "allow-events-push-delete-branch"
Expand All @@ -517,6 +539,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_push_delete_tag"
, state = allowEvents.push.deleteTag
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.PushDeleteTag }
, disabled_ = False
, id_ = "allow-events-push-delete-tag"
Expand All @@ -529,6 +552,7 @@ viewAllowEvents shared { msg, allowEvents } =
, subtitle = Nothing
, field = "allow_schedule_run"
, state = allowEvents.schedule.run
, wrapperClassList = []
, msg = msg { allowEvents = allowEvents, event = Vela.ScheduleRun }
, disabled_ = False
, id_ = "allow-events-schedule-run"
Expand Down Expand Up @@ -595,6 +619,9 @@ viewEditableList props =
, wrap_ = Nothing
, msg = addProps.addOnInputMsg
, disabled_ = False
, min = Nothing
, max = Nothing
, required = False
}
, viewButton
{ id_ = target ++ "-add"
Expand Down Expand Up @@ -675,6 +702,9 @@ viewEditableListItem props item =
, wrap_ = Nothing
, msg = props.itemEditOnInputMsg { id = itemId }
, disabled_ = False
, min = Nothing
, max = Nothing
, required = False
}

Nothing ->
Expand Down
5 changes: 5 additions & 0 deletions src/elm/Pages/Admin/Settings.elm
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,9 @@ view shared route model =
, wrap_ = Nothing
, msg = CloneImageOnInput
, disabled_ = False
, min = Nothing
, max = Nothing
, required = False
}
, Components.Form.viewButton
{ id_ = cloneImageHtmlId ++ "-update"
Expand Down Expand Up @@ -892,6 +895,7 @@ view shared route model =
, disabled_ = False
, min = Just starlarkExecLimitMin
, max = Just <| starlarkExecLimitMax shared
, required = False
}
, Components.Form.viewButton
{ id_ = starlarkExecLimitHtmlId ++ "-update"
Expand Down Expand Up @@ -942,6 +946,7 @@ view shared route model =
, disabled_ = False
, min = Just templateDepthLimitMin
, max = Just templateDepthLimitMax
, required = False
}
, Components.Form.viewButton
{ id_ = "template-depth-update"
Expand Down
Loading

0 comments on commit cf90d89

Please sign in to comment.