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