put loading spinner inside table as proposed by PF (#418)

This commit is contained in:
Erik Jan de Wit 2021-03-09 07:34:39 +01:00 committed by GitHub
parent ad1fa1340f
commit 4ba5fcc723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -242,7 +242,6 @@ export function KeycloakDataTable<T>({
return ( return (
<> <>
{!rows && <Loading />}
{rows && (rows.length > 0 || !emptyState) && isPaginated && ( {rows && (rows.length > 0 || !emptyState) && isPaginated && (
<PaginatingTableToolbar <PaginatingTableToolbar
count={rows.length} count={rows.length}
@ -263,15 +262,17 @@ export function KeycloakDataTable<T>({
searchTypeComponent={searchTypeComponent} searchTypeComponent={searchTypeComponent}
toolbarItem={toolbarItem} toolbarItem={toolbarItem}
> >
<DataTable {!loading && (
canSelectAll={canSelectAll} <DataTable
onSelect={onSelect ? _onSelect : undefined} canSelectAll={canSelectAll}
actions={convertAction()} onSelect={onSelect ? _onSelect : undefined}
actionResolver={actionResolver} actions={convertAction()}
rows={rows} actionResolver={actionResolver}
columns={columns} rows={rows}
ariaLabelKey={ariaLabelKey} columns={columns}
/> ariaLabelKey={ariaLabelKey}
/>
)}
{loading && <Loading />} {loading && <Loading />}
</PaginatingTableToolbar> </PaginatingTableToolbar>
)} )}
@ -286,15 +287,18 @@ export function KeycloakDataTable<T>({
toolbarItem={toolbarItem} toolbarItem={toolbarItem}
searchTypeComponent={searchTypeComponent} searchTypeComponent={searchTypeComponent}
> >
<DataTable {!loading && (
canSelectAll={canSelectAll} <DataTable
onSelect={onSelect ? _onSelect : undefined} canSelectAll={canSelectAll}
actions={convertAction()} onSelect={onSelect ? _onSelect : undefined}
actionResolver={actionResolver} actions={convertAction()}
rows={filteredData || rows} actionResolver={actionResolver}
columns={columns} rows={filteredData || rows}
ariaLabelKey={ariaLabelKey} columns={columns}
/> ariaLabelKey={ariaLabelKey}
/>
)}
{loading && <Loading />}
</TableToolbar> </TableToolbar>
)} )}
<>{!loading && rows?.length === 0 && emptyState}</> <>{!loading && rows?.length === 0 && emptyState}</>