Fix add remove button for multifield attributes

This commit is contained in:
Joseph Garrone
2024-06-02 00:31:08 +02:00
parent 6cdb83d730
commit 96a88fe865
2 changed files with 41 additions and 15 deletions

View File

@ -426,21 +426,23 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
return (
<>
{hasRemove && (
<button
id={`kc-remove${idPostfix}`}
type="button"
className="pf-c-button pf-m-inline pf-m-link"
onClick={() =>
dispatchFormAction({
action: "update",
name: attribute.name,
valueOrValues: values.filter((_, i) => i !== fieldIndex)
})
}
>
{msg("remove")}
{hasRemove ? <>&nbsp;|&nbsp;</> : null}
</button>
<>
<button
id={`kc-remove${idPostfix}`}
type="button"
className="pf-c-button pf-m-inline pf-m-link"
onClick={() =>
dispatchFormAction({
action: "update",
name: attribute.name,
valueOrValues: values.filter((_, i) => i !== fieldIndex)
})
}
>
{msg("remove")}
</button>
{hasAdd ? <>&nbsp;|&nbsp;</> : null}
</>
)}
{hasAdd && (
<button