Fix policy profiles (#2120)

This commit is contained in:
Jenny 2022-02-18 05:51:03 -05:00 committed by GitHub
parent 3bf43f15c0
commit 14ab0ceacb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -49,15 +49,18 @@ export const AddClientProfileModal = (props: AddClientProfileModalProps) => {
[]
);
const loader = async () => tableProfiles ?? [];
const loader = async () =>
tableProfiles?.filter((item) => !props.allProfiles.includes(item.name!)) ??
[];
if (!tableProfiles) {
return <KeycloakSpinner />;
}
const AliasRenderer = ({ name }: ClientProfile) => (
const AliasRenderer = ({ name, global }: ClientProfile) => (
<>
{name && <Label color="blue">{name}</Label>} {name}
{name}{" "}
{global && <Label color="blue">{t("realm-settings:global")}</Label>}
</>
);
@ -94,9 +97,6 @@ export const AddClientProfileModal = (props: AddClientProfileModalProps) => {
>
<KeycloakDataTable
loader={loader}
isRowDisabled={(value) =>
props.allProfiles.includes(value.name!) || false
}
ariaLabelKey="realm-settings:profilesList"
searchPlaceholderKey="realm-settings:searchProfile"
canSelectAll

View file

@ -387,7 +387,7 @@ export default function NewClientPolicyForm() {
const addProfiles = async (profiles: string[]) => {
const createdPolicy = {
...currentPolicy,
profiles: (currentPolicy?.profiles ?? []).concat(profiles),
profiles: policyProfiles.concat(profiles),
conditions: currentPolicy?.conditions,
};