change a few empty state problems

This commit is contained in:
Nate Kelley 2025-03-20 11:35:17 -06:00
parent 01823a7cc0
commit a27a315a80
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
8 changed files with 44 additions and 24 deletions

View File

@ -109,9 +109,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{
[canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfDatasetGroups] [canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfDatasetGroups]
); );
const memoizedEmptyState = useMemo(() => { const emptyStateComponent = useMemo(() => <EmptyStateList text="No dataset groups found" />, []);
return <EmptyStateList text="No dataset groups found" />;
}, []);
return ( return (
<InfiniteListContainer <InfiniteListContainer
@ -130,7 +128,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{
useRowClickSelectChange={true} useRowClickSelectChange={true}
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys}
onSelectChange={setSelectedRowKeys} onSelectChange={setSelectedRowKeys}
emptyState={memoizedEmptyState} emptyState={emptyStateComponent}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -106,6 +106,11 @@ export const PermissionListPermissionGroupContainer: React.FC<{
[canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfPermissionGroups] [canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfPermissionGroups]
); );
const emptyStateComponent = useMemo(
() => <EmptyStateList text="No permission groups found" />,
[]
);
return ( return (
<InfiniteListContainer <InfiniteListContainer
popupNode={ popupNode={
@ -122,7 +127,7 @@ export const PermissionListPermissionGroupContainer: React.FC<{
showSelectAll={false} showSelectAll={false}
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys}
onSelectChange={setSelectedRowKeys} onSelectChange={setSelectedRowKeys}
emptyState={<EmptyStateList text="No permission groups found" />} emptyState={emptyStateComponent}
useRowClickSelectChange={true} useRowClickSelectChange={true}
/> />
</InfiniteListContainer> </InfiniteListContainer>

View File

@ -6,8 +6,8 @@ import {
} from '@/components/ui/list'; } from '@/components/ui/list';
import { BusterInfiniteList } from '@/components/ui/list/BusterInfiniteList'; import { BusterInfiniteList } from '@/components/ui/list/BusterInfiniteList';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { BusterRoutes, createBusterRoute } from '@/routes';
import type { DatasetGroup } from '@/api/asset_interfaces'; import type { DatasetGroup } from '@/api/asset_interfaces';
import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes';
export const ListDatasetGroupsComponent: React.FC<{ export const ListDatasetGroupsComponent: React.FC<{
datasetGroups: DatasetGroup[]; datasetGroups: DatasetGroup[];
@ -24,20 +24,18 @@ export const ListDatasetGroupsComponent: React.FC<{
); );
const datasetGroupsRows: BusterListRowItem[] = useMemo(() => { const datasetGroupsRows: BusterListRowItem[] = useMemo(() => {
return datasetGroups.reduce<BusterListRowItem[]>((acc, datasetGroup) => { return datasetGroups.map((datasetGroup) => ({
const rowItem: BusterListRowItem = { id: datasetGroup.id,
id: datasetGroup.id, data: datasetGroup,
data: datasetGroup, link: createBusterRoute({
link: createBusterRoute({ route: BusterRoutes.SETTINGS_DATASET_GROUPS_ID_DATASETS,
route: BusterRoutes.SETTINGS_DATASET_GROUPS_ID_DATASETS, datasetGroupId: datasetGroup.id
datasetGroupId: datasetGroup.id })
}) }));
};
acc.push(rowItem);
return acc;
}, []);
}, [datasetGroups]); }, [datasetGroups]);
const emptyStateComponent = useMemo(() => <EmptyStateList text="No dataset groups found" />, []);
return ( return (
<InfiniteListContainer <InfiniteListContainer
showContainerBorder={false} showContainerBorder={false}
@ -54,7 +52,7 @@ export const ListDatasetGroupsComponent: React.FC<{
showHeader={true} showHeader={true}
showSelectAll={false} showSelectAll={false}
rowClassName="pl-[30px]!" rowClassName="pl-[30px]!"
emptyState={<EmptyStateList text="No dataset groups found" />} emptyState={emptyStateComponent}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -94,6 +94,11 @@ export const ListUsersComponent: React.FC<{
[activeUsers, inactiveUsers] [activeUsers, inactiveUsers]
); );
const emptyStateComponent = useMemo(
() => <EmptyStateList text="No users found" variant="card" show={isFetched} />,
[isFetched]
);
return ( return (
<InfiniteListContainer showContainerBorder={false}> <InfiniteListContainer showContainerBorder={false}>
<BusterInfiniteList <BusterInfiniteList
@ -104,7 +109,7 @@ export const ListUsersComponent: React.FC<{
rowClassName="pl-[30px]!" rowClassName="pl-[30px]!"
// onSelectChange={setSelectedRowKeys} // onSelectChange={setSelectedRowKeys}
// selectedRowKeys={selectedRowKeys} // selectedRowKeys={selectedRowKeys}
emptyState={<EmptyStateList text="No users found" variant="card" show={isFetched} />} emptyState={emptyStateComponent}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -101,7 +101,12 @@ export const UserDatasetListContainer = React.memo(
rows={rows} rows={rows}
showHeader={false} showHeader={false}
showSelectAll={false} showSelectAll={false}
emptyState={<EmptyStateList text="No datasets found" />} emptyState={useMemo(
() => (
<EmptyStateList text="No datasets found" />
),
[]
)}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -118,6 +118,8 @@ export const UserDatasetGroupListContainer: React.FC<{
[canQueryPermissionUsers, cannotQueryPermissionUsers, numberOfDatasetGroups] [canQueryPermissionUsers, cannotQueryPermissionUsers, numberOfDatasetGroups]
); );
const emptyStateComponent = useMemo(() => <EmptyStateList text="No dataset groups found" />, []);
return ( return (
<InfiniteListContainer <InfiniteListContainer
popupNode={ popupNode={
@ -135,7 +137,7 @@ export const UserDatasetGroupListContainer: React.FC<{
useRowClickSelectChange={false} useRowClickSelectChange={false}
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys}
onSelectChange={setSelectedRowKeys} onSelectChange={setSelectedRowKeys}
emptyState={<EmptyStateList text="No dataset groups found" />} emptyState={emptyStateComponent}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -128,6 +128,8 @@ export const UserTeamsListContainer: React.FC<{
[managerTeams, memberTeams, notAMemberTeams] [managerTeams, memberTeams, notAMemberTeams]
); );
const emptyStateComponent = useMemo(() => <EmptyStateList text="No teams found" />, []);
return ( return (
<InfiniteListContainer <InfiniteListContainer
popupNode={ popupNode={
@ -145,7 +147,7 @@ export const UserTeamsListContainer: React.FC<{
useRowClickSelectChange={false} useRowClickSelectChange={false}
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys}
onSelectChange={setSelectedRowKeys} onSelectChange={setSelectedRowKeys}
emptyState={<EmptyStateList text="No datasets found" />} emptyState={emptyStateComponent}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );

View File

@ -135,7 +135,12 @@ export const PermissionListUsersContainer: React.FC<{
selectedRowKeys={selectedRowKeys} selectedRowKeys={selectedRowKeys}
onSelectChange={setSelectedRowKeys} onSelectChange={setSelectedRowKeys}
useRowClickSelectChange={false} useRowClickSelectChange={false}
emptyState={<EmptyStateList text="No users found" />} emptyState={useMemo(
() => (
<EmptyStateList text="No users found" />
),
[]
)}
/> />
</InfiniteListContainer> </InfiniteListContainer>
); );