From dc5535f8c0ffecbd2f2e5174a261b665b8de72bd Mon Sep 17 00:00:00 2001 From: Agnieszka Gancarczyk <4890675+agagancarczyk@users.noreply.github.com> Date: Wed, 4 Dec 2024 08:09:54 +0000 Subject: [PATCH] Fixed showing actions for event auth and representation (#35561) * Extended KeyckloakDataTable to make the actions available for expandable rows Signed-off-by: Agnieszka Gancarczyk * Extended KeyckloakDataTable to make the actions available for expandable rows Signed-off-by: Agnieszka Gancarczyk --------- Signed-off-by: Agnieszka Gancarczyk --- .../src/controls/table/KeycloakDataTable.tsx | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx b/js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx index ab00d57a498..0a698c68c05 100644 --- a/js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx +++ b/js/libs/ui-shared/src/controls/table/KeycloakDataTable.tsx @@ -75,15 +75,34 @@ type DataTableProps = { type CellRendererProps = { row: IRow; + index?: number; + actions?: IActions; + actionResolver?: IActionsResolver; }; const isRow = (c: ReactNode | IRowCell): c is IRowCell => !!c && (c as IRowCell).title !== undefined; -const CellRenderer = ({ row }: CellRendererProps) => - row.cells!.map((c, i) => ( - {(isRow(c) ? c.title : c) as ReactNode} - )); +const CellRenderer = ({ + row, + index, + actions, + actionResolver, +}: CellRendererProps) => ( + <> + {row.cells!.map((c, i) => ( + {(isRow(c) ? c.title : c) as ReactNode} + ))} + {(actions || actionResolver) && ( + + + + )} + +); const ExpandableRowRenderer = ({ row }: CellRendererProps) => row.cells!.map((c, i) => ( @@ -212,15 +231,12 @@ function DataTable({ }} /> )} - - {(actions || actionResolver) && ( - - - - )} + ))} @@ -242,7 +258,12 @@ function DataTable({ }, }} /> - + ) : (