Skip to content

Commit

Permalink
Add label attrs in buttons
Browse files Browse the repository at this point in the history
The buttons available in the 'Settings'
page should also have its own independent
`name`. This has been implemented using
the following format:

`<action>-<fieldName>[-<idx>]`
Being `idx` >= 0

E.g.1: `add-krb-principal-alias`
E.g.2: `remove-certificate-mapping-data-1`

Signed-off-by: Carla Martinez <[email protected]>
  • Loading branch information
carma12 committed Dec 5, 2023
1 parent 946fd5f commit 522c6b6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/Form/IpaCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ const IpaCalendar = (props: IPAParamDefinition) => {
return (
<InputGroup>
<DatePicker
name={props.name}
name={"add-date-" + props.name}
value={valueDate !== null ? yyyyMMddFormat(valueDate) : ""}
onChange={onDateChange}
aria-label="Kerberos principal expiration date"
placeholder="YYYY-MM-DD"
isDisabled={readOnly}
/>
<TimePicker
name={props.name}
name={"add-time-" + props.name}
time={valueDate !== null ? hhMMFormat(valueDate) : ""}
aria-label="Kerberos principal expiration time"
onChange={onTimeChange}
Expand Down
6 changes: 5 additions & 1 deletion src/components/Form/IpaCertificateMappingData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ const IpaCertificateMappingData = (props: PropsToIpaCertificateMappingData) => {
<FlexItem>
<SecondaryButton
onClickHandler={() => onDeleteCertMapData(idx)}
name={"remove-certificate-mapping-data-" + idx}
>
Delete
</SecondaryButton>
Expand All @@ -302,7 +303,10 @@ const IpaCertificateMappingData = (props: PropsToIpaCertificateMappingData) => {
})
: null}

<SecondaryButton onClickHandler={() => setIsOpen(true)}>
<SecondaryButton
name={"add-certificate-mapping-data"}
onClickHandler={() => setIsOpen(true)}
>
Add
</SecondaryButton>
<Modal
Expand Down
6 changes: 5 additions & 1 deletion src/components/Form/IpaCertificates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,11 @@ const IpaCertificates = (props: PropsToIpaCertificates) => {
);
})
: null}
<SecondaryButton onClickHandler={onOpenModal} isDisabled={readOnly}>
<SecondaryButton
name={"add-certificate"}
onClickHandler={onOpenModal}
isDisabled={readOnly}
>
Add
</SecondaryButton>
<ModalWithTextAreaLayout
Expand Down
3 changes: 3 additions & 0 deletions src/components/Form/IpaSshPublicKeys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ const IpaSshPublicKeys = (props: PropsToSshPublicKeysModal) => {
<FlexItem>
<SecondaryButton
onClickHandler={() => onShowSetSshKey(idx, publicKey)}
name={"show-ssh-public-key-" + idx}
isDisabled={readOnly}
isSmall
>
Expand All @@ -283,6 +284,7 @@ const IpaSshPublicKeys = (props: PropsToSshPublicKeysModal) => {
<FlexItem className="pf-u-mb-md">
<SecondaryButton
onClickHandler={() => onDeleteSshKey(idx)}
name={"remove-ssh-public-key-" + idx}
isDisabled={readOnly}
isSmall
>
Expand Down Expand Up @@ -319,6 +321,7 @@ const IpaSshPublicKeys = (props: PropsToSshPublicKeysModal) => {
</Modal>
<SecondaryButton
onClickHandler={openSshPublicKeysModal}
name={"add-ssh-public-key"}
isDisabled={readOnly}
isSmall
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/IpaTextInputFromList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const IpaTextInputFromList = (props: PropsToTextInputFromList) => {
order={{ default: "-1" }}
>
<SecondaryButton
name="remove"
name={"remove-principal-alias-" + idx}
onClickHandler={() => props.onRemove(idx)}
isDisabled={readOnly}
>
Expand All @@ -71,7 +71,7 @@ const IpaTextInputFromList = (props: PropsToTextInputFromList) => {
</Flex>
<SecondaryButton
classname="pf-u-mt-md"
name="add"
name="add-principal-alias"
onClickHandler={props.onOpenModal}
isDisabled={readOnly}
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/IpaTextboxList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const IpaTextboxList = (props: PropsToIpaTextboxList) => {
</FlexItem>
<FlexItem key={props.name + "-" + idx + "-delete-button"}>
<SecondaryButton
name="remove"
name={"remove-" + props.name + "-" + idx}
onClickHandler={() => onRemoveHandler(idx)}
>
Delete
Expand All @@ -90,7 +90,7 @@ const IpaTextboxList = (props: PropsToIpaTextboxList) => {
</Flex>
<SecondaryButton
classname="pf-u-mt-sm"
name="add"
name={"add-" + props.name}
onClickHandler={onAddHandler}
>
Add
Expand Down

0 comments on commit 522c6b6

Please sign in to comment.