Fix role selection when paging (#3567)
This commit is contained in:
parent
64e0f1c5eb
commit
799442060f
3 changed files with 10 additions and 2 deletions
|
@ -67,7 +67,13 @@ export const AddRoleMappingModal = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const roles = await getAvailableRoles(adminClient, type, { ...params, id });
|
const roles = await getAvailableRoles(adminClient, type, { ...params, id });
|
||||||
return localeSort(roles, compareRow);
|
const sorted = localeSort(roles, compareRow);
|
||||||
|
return sorted.map((row) => {
|
||||||
|
return {
|
||||||
|
role: row.role,
|
||||||
|
id: row.role.id,
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const clientRolesLoader = async (
|
const clientRolesLoader = async (
|
||||||
|
@ -88,6 +94,7 @@ export const AddRoleMappingModal = ({
|
||||||
roles.map((e) => ({
|
roles.map((e) => ({
|
||||||
client: { clientId: e.client, id: e.clientId },
|
client: { clientId: e.client, id: e.clientId },
|
||||||
role: { id: e.id, name: e.role, description: e.description },
|
role: { id: e.id, name: e.role, description: e.description },
|
||||||
|
id: e.id,
|
||||||
})),
|
})),
|
||||||
compareRow
|
compareRow
|
||||||
);
|
);
|
||||||
|
|
|
@ -33,6 +33,7 @@ export type CompositeRole = RoleRepresentation & {
|
||||||
export type Row = {
|
export type Row = {
|
||||||
client?: ClientRepresentation;
|
client?: ClientRepresentation;
|
||||||
role: RoleRepresentation | CompositeRole;
|
role: RoleRepresentation | CompositeRole;
|
||||||
|
id?: string; // KeycloakDataTable expects an id for the row
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mapRoles = (
|
export const mapRoles = (
|
||||||
|
|
|
@ -175,7 +175,7 @@ export type DataListProps<T> = Omit<
|
||||||
* @param {Field<T>} props.detailColumns - definition of the columns expandable columns
|
* @param {Field<T>} props.detailColumns - definition of the columns expandable columns
|
||||||
* @param {Action[]} props.actions - the actions that appear on the row
|
* @param {Action[]} props.actions - the actions that appear on the row
|
||||||
* @param {IActionsResolver} props.actionResolver Resolver for the given action
|
* @param {IActionsResolver} props.actionResolver Resolver for the given action
|
||||||
* @param {ReactNode} props.toolbarItem - Toolbar items that appear on the top of the table {@link ToolbarItem}
|
* @param {ReactNode} props.toolbarItem - Toolbar items that appear on the top of the table {@link toolbarItem}
|
||||||
* @param {ReactNode} props.emptyState - ReactNode show when the list is empty could be any component but best to use {@link ListEmptyState}
|
* @param {ReactNode} props.emptyState - ReactNode show when the list is empty could be any component but best to use {@link ListEmptyState}
|
||||||
*/
|
*/
|
||||||
export function KeycloakDataTable<T>({
|
export function KeycloakDataTable<T>({
|
||||||
|
|
Loading…
Reference in a new issue