OAuth 2.0 Device Polling Interval - Realms settings/Token Tab +- to change value not working (#29767)

* OAuth 2.0 Device Polling Interval - Setting in Realms settings/Token Plus-Minus to change value not working
>
> The input was taking a String type variable. Fixed it by converting it to a number so that numeric calculations can be done on it. Also, applied a condition for Minus button so that the count is never less than zero since the default value is 0.
>
> Closes #29551

Signed-off-by: Ahana Mallik <ahanamallik@gmail.com>

* Satisfy linter.

Signed-off-by: Stan Silvert <ssilvert@redhat.com>

---------

Signed-off-by: Ahana Mallik <ahanamallik@gmail.com>
Signed-off-by: Stan Silvert <ssilvert@redhat.com>
Co-authored-by: Ahana Mallik <ahanamallik@gmail.com>
This commit is contained in:
Stan Silvert 2024-05-23 04:11:24 -04:00 committed by GitHub
parent c08621fa63
commit 5d1166b473
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,8 +179,14 @@ export const RealmSettingsTokensTab = ({
id="oAuthDevicePollingInterval"
value={field.value}
min={0}
onPlus={() => field.onChange(field.value || 0 + 1)}
onMinus={() => field.onChange(field.value || 0 - 1)}
onPlus={() => field.onChange(Number(field?.value) + 1)}
onMinus={() =>
field.onChange(
Number(field?.value) > 0
? Number(field?.value) - 1
: 0,
)
}
onChange={(event) => {
const newValue = Number(event.currentTarget.value);
field.onChange(!isNaN(newValue) ? newValue : 0);