Added alphabetically listing the policies (#3556)
This commit is contained in:
parent
4b2a23b81d
commit
c797f1f62f
1 changed files with 10 additions and 1 deletions
|
@ -17,6 +17,8 @@ import {
|
|||
|
||||
import type PolicyProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyProviderRepresentation";
|
||||
import { isValidComponentType } from "./policy/PolicyDetails";
|
||||
import { useMemo } from "react";
|
||||
import useLocaleSort, { mapByKey } from "../../utils/useLocaleSort";
|
||||
|
||||
type NewPolicyDialogProps = {
|
||||
policyProviders?: PolicyProviderRepresentation[];
|
||||
|
@ -30,6 +32,13 @@ export const NewPolicyDialog = ({
|
|||
toggleDialog,
|
||||
}: NewPolicyDialogProps) => {
|
||||
const { t } = useTranslation("clients");
|
||||
const localeSort = useLocaleSort();
|
||||
|
||||
const sortedPolicies = useMemo(
|
||||
() =>
|
||||
policyProviders ? localeSort(policyProviders, mapByKey("name")) : [],
|
||||
[policyProviders]
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
@ -52,7 +61,7 @@ export const NewPolicyDialog = ({
|
|||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{policyProviders?.map((provider) => (
|
||||
{sortedPolicies.map((provider) => (
|
||||
<Tr
|
||||
key={provider.type}
|
||||
data-testid={provider.type}
|
||||
|
|
Loading…
Reference in a new issue