From 7bf8841e31315924c6d77f15d12a074802b5fd22 Mon Sep 17 00:00:00 2001 From: Ricardo Martin Date: Fri, 16 Aug 2024 17:23:40 +0200 Subject: [PATCH] better unset check (#32062) (#32207) * better unset check fixes: #32059 Signed-off-by: Erik Jan de Wit * better explanation Signed-off-by: Erik Jan de Wit * fix min value Signed-off-by: Erik Jan de Wit * Steal some code from `react-hook-form` Signed-off-by: Jon Koops --------- Signed-off-by: Erik Jan de Wit Signed-off-by: Jon Koops Co-authored-by: Jon Koops (cherry picked from commit 862854bc2915516a1d7a9b3874c39bdfc48f8422) Co-authored-by: Erik Jan de Wit --- .../admin/messages/messages_en.properties | 2 +- .../initial-access/CreateInitialAccessToken.tsx | 4 +++- .../ui-shared/src/controls/NumberControl.tsx | 12 ++++++++---- js/libs/ui-shared/src/utils/getRuleValue.ts | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 js/libs/ui-shared/src/utils/getRuleValue.ts diff --git a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties index 2dadc40c1c4..099c853f918 100644 --- a/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties +++ b/js/apps/admin-ui/maven-resources/theme/keycloak.v2/admin/messages/messages_en.properties @@ -2767,7 +2767,7 @@ javaKeystore=java-keystore updatedUserProfileSuccess=User Profile configuration has been saved deleteProviderMapper=Delete mapper? clientsPermissionsHint=Fine grained permissions for administrators that want to manage this client or apply roles defined by this client. -lookAroundHelp=How far around should the server look just in case the token generator and server are out of time sync or counter sync? +lookAroundHelp=How far around (extra token periods or counts) should the server look just in case the token generator and server are out of time sync or counter sync? usersLeft_one={{count}} user left the group sync-keycloak-groups-to-ldap=Sync Keycloak groups to LDAP saveError=User federation provider could not be saved\: {{error}} diff --git a/js/apps/admin-ui/src/clients/initial-access/CreateInitialAccessToken.tsx b/js/apps/admin-ui/src/clients/initial-access/CreateInitialAccessToken.tsx index 1fe3b80b753..a7e2dc1125f 100644 --- a/js/apps/admin-ui/src/clients/initial-access/CreateInitialAccessToken.tsx +++ b/js/apps/admin-ui/src/clients/initial-access/CreateInitialAccessToken.tsx @@ -85,9 +85,11 @@ export default function CreateInitialAccessToken() { label={t("count")} labelIcon={t("countHelp")} controller={{ + rules: { + min: 1, + }, defaultValue: 1, }} - min={1} />