From 00fdb8e2f550d3d6f69a783812de7d6e245f5ae9 Mon Sep 17 00:00:00 2001 From: agagancarczyk <4890675+agagancarczyk@users.noreply.github.com> Date: Wed, 24 Jan 2024 06:49:27 +0000 Subject: [PATCH] Fixed dropdown form in clients authorization policies tab (#26424) * fixed dropdown forms in clients authorization Signed-off-by: Agnieszka Gancarczyk * improved translations Signed-off-by: Agnieszka Gancarczyk * improved Signed-off-by: Agnieszka Gancarczyk --------- Signed-off-by: Agnieszka Gancarczyk Co-authored-by: Agnieszka Gancarczyk --- .../admin/messages/messages_en.properties | 6 ++-- .../src/clients/authorization/Permissions.tsx | 1 + .../src/clients/authorization/Policies.tsx | 1 + .../src/clients/authorization/Resources.tsx | 2 +- .../clients/authorization/SearchDropdown.tsx | 30 +++++++++++-------- 5 files changed, 24 insertions(+), 16 deletions(-) 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 e3f53c4c999b..fb0abb7b9d77 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 @@ -3043,8 +3043,10 @@ chooseBindingType=Choose binding type selectFlowType=Select flow type selectClientAssertionSigningAlg=Select client assertion signing algorithm resourceDetailsTypeHelp=The type of this resource. It can be used to group different resource instances with the same type. -searchForClientPolicy=Search for client policy selectVendor=Select vendor spinnerLoading=Loading enableClientSignatureRequiredModal=Enable client signature required -selectBindType=Select bind type \ No newline at end of file +selectBindType=Select bind type +searchClientAuthorizationResource=Search resource +searchClientAuthorizationPolicy=Search policy +searchClientAuthorizationPermission=Search permission \ No newline at end of file diff --git a/js/apps/admin-ui/src/clients/authorization/Permissions.tsx b/js/apps/admin-ui/src/clients/authorization/Permissions.tsx index e4688c674d16..8579335a0ae0 100644 --- a/js/apps/admin-ui/src/clients/authorization/Permissions.tsx +++ b/js/apps/admin-ui/src/clients/authorization/Permissions.tsx @@ -201,6 +201,7 @@ export const AuthorizationPermissions = ({ types={policyProviders} search={search} onSearch={setSearch} + type="permission" /> diff --git a/js/apps/admin-ui/src/clients/authorization/Policies.tsx b/js/apps/admin-ui/src/clients/authorization/Policies.tsx index 43fc49602104..54d7e44fd54a 100644 --- a/js/apps/admin-ui/src/clients/authorization/Policies.tsx +++ b/js/apps/admin-ui/src/clients/authorization/Policies.tsx @@ -202,6 +202,7 @@ export const AuthorizationPolicies = ({ types={policyProviders} search={search} onSearch={setSearch} + type="policy" /> diff --git a/js/apps/admin-ui/src/clients/authorization/Resources.tsx b/js/apps/admin-ui/src/clients/authorization/Resources.tsx index 7c2cb8b2b0bf..8c2d4ebe8181 100644 --- a/js/apps/admin-ui/src/clients/authorization/Resources.tsx +++ b/js/apps/admin-ui/src/clients/authorization/Resources.tsx @@ -165,7 +165,7 @@ export const AuthorizationResources = ({ diff --git a/js/apps/admin-ui/src/clients/authorization/SearchDropdown.tsx b/js/apps/admin-ui/src/clients/authorization/SearchDropdown.tsx index e0c1b6624a0d..c2d83ce97094 100644 --- a/js/apps/admin-ui/src/clients/authorization/SearchDropdown.tsx +++ b/js/apps/admin-ui/src/clients/authorization/SearchDropdown.tsx @@ -32,14 +32,14 @@ type SearchDropdownProps = { types?: PolicyProviderRepresentation[] | PolicyProviderRepresentation[]; search: SearchForm; onSearch: (form: SearchForm) => void; - isResource?: boolean; + type: "resource" | "policy" | "permission"; }; export const SearchDropdown = ({ types, search, onSearch, - isResource = false, + type, }: SearchDropdownProps) => { const { t } = useTranslation(); const { @@ -84,7 +84,9 @@ export const SearchDropdown = ({ onToggle={toggle} className="keycloak__client_authentication__searchdropdown" > - {t("searchForClientPolicy")} + {type === "resource" && t("searchClientAuthorizationResource")} + {type === "policy" && t("searchClientAuthorizationPolicy")} + {type === "permission" && t("searchClientAuthorizationPermission")} } isOpen={open} @@ -101,7 +103,7 @@ export const SearchDropdown = ({ {...register("name")} /> - {isResource && ( + {type === "resource" && ( <> )} - {!isResource && ( + {type !== "resource" && type !== "policy" && ( )} - - - - {!isResource && ( + {type !== "policy" && ( + + + + )} + {type !== "resource" && (