Fixed dropdown form in clients authorization policies tab (#26424)

* fixed dropdown forms in clients authorization

Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>

* improved translations

Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>

* improved

Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>

---------

Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>
Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
This commit is contained in:
agagancarczyk 2024-01-24 06:49:27 +00:00 committed by GitHub
parent 93e90789fe
commit 00fdb8e2f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 16 deletions

View file

@ -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
selectBindType=Select bind type
searchClientAuthorizationResource=Search resource
searchClientAuthorizationPolicy=Search policy
searchClientAuthorizationPermission=Search permission

View file

@ -201,6 +201,7 @@ export const AuthorizationPermissions = ({
types={policyProviders}
search={search}
onSearch={setSearch}
type="permission"
/>
</ToolbarItem>
<ToolbarItem>

View file

@ -202,6 +202,7 @@ export const AuthorizationPolicies = ({
types={policyProviders}
search={search}
onSearch={setSearch}
type="policy"
/>
</ToolbarItem>
<ToolbarItem>

View file

@ -165,7 +165,7 @@ export const AuthorizationResources = ({
<SearchDropdown
search={search}
onSearch={setSearch}
isResource
type="resource"
/>
</ToolbarItem>

View file

@ -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")}
</DropdownToggle>
}
isOpen={open}
@ -101,7 +103,7 @@ export const SearchDropdown = ({
{...register("name")}
/>
</FormGroup>
{isResource && (
{type === "resource" && (
<>
<FormGroup label={t("type")} fieldId="type">
<KeycloakTextInput
@ -126,7 +128,7 @@ export const SearchDropdown = ({
</FormGroup>
</>
)}
{!isResource && (
{type !== "resource" && type !== "policy" && (
<FormGroup label={t("resource")} fieldId="resource">
<KeycloakTextInput
id="resource"
@ -135,14 +137,16 @@ export const SearchDropdown = ({
/>
</FormGroup>
)}
<FormGroup label={t("scope")} fieldId="scope">
<KeycloakTextInput
id="scope"
data-testid="searchdropdown_scope"
{...register("scope")}
/>
</FormGroup>
{!isResource && (
{type !== "policy" && (
<FormGroup label={t("scope")} fieldId="scope">
<KeycloakTextInput
id="scope"
data-testid="searchdropdown_scope"
{...register("scope")}
/>
</FormGroup>
)}
{type !== "resource" && (
<FormGroup label={t("type")} fieldId="type">
<Controller
name="type"