Skip to content

Commit

Permalink
Fixes #26213: Make it possible to edit the values of items in a foreach
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelGauthier committed Jan 17, 2025
1 parent d3404c9 commit c44d8ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ update msg model =
Just uiBlock -> Just { uiBlock | validation = blockState}
Nothing -> Just (MethodBlockUiInfo Closed Children blockState False)
in
{ ui | blockUI = Dict.update block.id.value updateBlockState ui.blockUI }
{ ui | blockUI = Dict.update block.id.value updateBlockState ui.blockUI }
Call _ _ -> {ui | callsUI = Dict.update callId.value (Maybe.map (always newMethodUi )) ui.callsUI }
newModel = {model | mode = TechniqueDetails {t | elems = updateElemIf (getId >> (==) (getId method) ) (always method) t.elems} s newUi editInfo}
in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ showMethodTab model method parentId call uiInfo=
]
]
]
ForEach ->
ForEach ->
let
foreachUI = uiInfo.foreachUI
newForeach = foreachUI.newForeach
Expand Down Expand Up @@ -469,8 +469,21 @@ showMethodTab model method parentId call uiInfo=
val = case Dict.get k f of
Just v -> v
Nothing -> ""

updateForeachVal : String -> List (Dict String String) -> Dict String String -> Maybe (List (Dict String String))
updateForeachVal newVal list currentForeach =
Just (List.Extra.updateIf (\i -> i == currentForeach) (\i -> Dict.update k (always (Just newVal)) i) list)
in
td[][span[][text val]]
td[]
[ input
[ type_ "text"
, value val
, class "form-control input-sm"
, onInput(\s ->
(MethodCallModified (Call (Just call.id) {call | foreach = (updateForeachVal s foreach f) }))
)
][]
]
)
actionBtns =
[ td[class "text-center"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,16 @@ ul li.hide-method {
min-width: 100px;
}
}
td{
vertical-align: middle;
padding: 6px;
}
tr.item-foreach.new{
border-top: 2px solid $rudder-border-color-default !important;
td{
background-color: $rudder-bg-light-gray !important;
}
}
}
}

Expand Down

0 comments on commit c44d8ae

Please sign in to comment.