From a27a315a809255f9f70d1966dad5ecb00390fed3 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Thu, 20 Mar 2025 11:35:17 -0600 Subject: [PATCH] change a few empty state problems --- .../PermissionListDatasetGroupContainer.tsx | 6 ++--- ...PermissionListPermissionGroupContainer.tsx | 7 ++++- .../ListDatasetGroupsComponent.tsx | 26 +++++++++---------- .../users/ListUsersComponent.tsx | 7 ++++- .../_overview/UserDatasetListContainer.tsx | 7 ++++- .../UserDatasetGroupListContainer.tsx | 4 ++- .../[userId]/teams/UserTeamsListContainer.tsx | 4 ++- .../PermissionListUsersContainer.tsx | 7 ++++- 8 files changed, 44 insertions(+), 24 deletions(-) diff --git a/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/dataset-groups/_PermissionDatasetGroups/PermissionListDatasetGroupContainer.tsx b/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/dataset-groups/_PermissionDatasetGroups/PermissionListDatasetGroupContainer.tsx index 033b1fe79..18ad6b84e 100644 --- a/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/dataset-groups/_PermissionDatasetGroups/PermissionListDatasetGroupContainer.tsx +++ b/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/dataset-groups/_PermissionDatasetGroups/PermissionListDatasetGroupContainer.tsx @@ -109,9 +109,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{ [canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfDatasetGroups] ); - const memoizedEmptyState = useMemo(() => { - return ; - }, []); + const emptyStateComponent = useMemo(() => , []); return ( ); diff --git a/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/permission-groups/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx b/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/permission-groups/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx index e79a3f191..59409a28b 100644 --- a/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/permission-groups/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx +++ b/web/src/app/app/(primary_layout)/datasets/[datasetId]/permissions/permission-groups/_PermissionPermissionGroup/PermissionListPermissionGroupContainer.tsx @@ -106,6 +106,11 @@ export const PermissionListPermissionGroupContainer: React.FC<{ [canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfPermissionGroups] ); + const emptyStateComponent = useMemo( + () => , + [] + ); + return ( } + emptyState={emptyStateComponent} useRowClickSelectChange={true} /> diff --git a/web/src/app/app/(settings_layout)/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx b/web/src/app/app/(settings_layout)/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx index b013a6387..a2bcfadda 100644 --- a/web/src/app/app/(settings_layout)/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx +++ b/web/src/app/app/(settings_layout)/settings/(permissions)/dataset-groups/ListDatasetGroupsComponent.tsx @@ -6,8 +6,8 @@ import { } from '@/components/ui/list'; import { BusterInfiniteList } from '@/components/ui/list/BusterInfiniteList'; import React, { useMemo } from 'react'; -import { BusterRoutes, createBusterRoute } from '@/routes'; import type { DatasetGroup } from '@/api/asset_interfaces'; +import { BusterRoutes, createBusterRoute } from '@/routes/busterRoutes'; export const ListDatasetGroupsComponent: React.FC<{ datasetGroups: DatasetGroup[]; @@ -24,20 +24,18 @@ export const ListDatasetGroupsComponent: React.FC<{ ); const datasetGroupsRows: BusterListRowItem[] = useMemo(() => { - return datasetGroups.reduce((acc, datasetGroup) => { - const rowItem: BusterListRowItem = { - id: datasetGroup.id, - data: datasetGroup, - link: createBusterRoute({ - route: BusterRoutes.SETTINGS_DATASET_GROUPS_ID_DATASETS, - datasetGroupId: datasetGroup.id - }) - }; - acc.push(rowItem); - return acc; - }, []); + return datasetGroups.map((datasetGroup) => ({ + id: datasetGroup.id, + data: datasetGroup, + link: createBusterRoute({ + route: BusterRoutes.SETTINGS_DATASET_GROUPS_ID_DATASETS, + datasetGroupId: datasetGroup.id + }) + })); }, [datasetGroups]); + const emptyStateComponent = useMemo(() => , []); + return ( } + emptyState={emptyStateComponent} /> ); diff --git a/web/src/app/app/(settings_layout)/settings/(permissions)/users/ListUsersComponent.tsx b/web/src/app/app/(settings_layout)/settings/(permissions)/users/ListUsersComponent.tsx index fd368ecea..6ca9ab5a4 100644 --- a/web/src/app/app/(settings_layout)/settings/(permissions)/users/ListUsersComponent.tsx +++ b/web/src/app/app/(settings_layout)/settings/(permissions)/users/ListUsersComponent.tsx @@ -94,6 +94,11 @@ export const ListUsersComponent: React.FC<{ [activeUsers, inactiveUsers] ); + const emptyStateComponent = useMemo( + () => , + [isFetched] + ); + return ( } + emptyState={emptyStateComponent} /> ); diff --git a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx index aa2dbaf09..f99f11ae5 100644 --- a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx +++ b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/_overview/UserDatasetListContainer.tsx @@ -101,7 +101,12 @@ export const UserDatasetListContainer = React.memo( rows={rows} showHeader={false} showSelectAll={false} - emptyState={} + emptyState={useMemo( + () => ( + + ), + [] + )} /> ); diff --git a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx index 5e4748959..337221b4c 100644 --- a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx +++ b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/dataset-groups/UserDatasetGroupListContainer.tsx @@ -118,6 +118,8 @@ export const UserDatasetGroupListContainer: React.FC<{ [canQueryPermissionUsers, cannotQueryPermissionUsers, numberOfDatasetGroups] ); + const emptyStateComponent = useMemo(() => , []); + return ( } + emptyState={emptyStateComponent} /> ); diff --git a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx index b7a8b9ee3..82d0b8101 100644 --- a/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx +++ b/web/src/app/app/(settings_layout)/settings/(permissions)/users/[userId]/teams/UserTeamsListContainer.tsx @@ -128,6 +128,8 @@ export const UserTeamsListContainer: React.FC<{ [managerTeams, memberTeams, notAMemberTeams] ); + const emptyStateComponent = useMemo(() => , []); + return ( } + emptyState={emptyStateComponent} /> ); diff --git a/web/src/controllers/DatasetPermissionUser/PermissionListUsersContainer.tsx b/web/src/controllers/DatasetPermissionUser/PermissionListUsersContainer.tsx index 4ab240ffa..4a6bb998b 100644 --- a/web/src/controllers/DatasetPermissionUser/PermissionListUsersContainer.tsx +++ b/web/src/controllers/DatasetPermissionUser/PermissionListUsersContainer.tsx @@ -135,7 +135,12 @@ export const PermissionListUsersContainer: React.FC<{ selectedRowKeys={selectedRowKeys} onSelectChange={setSelectedRowKeys} useRowClickSelectChange={false} - emptyState={} + emptyState={useMemo( + () => ( + + ), + [] + )} /> );