mirror of https://github.com/buster-so/buster.git
change a few empty state problems
This commit is contained in:
parent
01823a7cc0
commit
a27a315a80
|
@ -109,9 +109,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{
|
|||
[canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfDatasetGroups]
|
||||
);
|
||||
|
||||
const memoizedEmptyState = useMemo(() => {
|
||||
return <EmptyStateList text="No dataset groups found" />;
|
||||
}, []);
|
||||
const emptyStateComponent = useMemo(() => <EmptyStateList text="No dataset groups found" />, []);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer
|
||||
|
@ -130,7 +128,7 @@ export const PermissionListDatasetGroupContainer: React.FC<{
|
|||
useRowClickSelectChange={true}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onSelectChange={setSelectedRowKeys}
|
||||
emptyState={memoizedEmptyState}
|
||||
emptyState={emptyStateComponent}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -106,6 +106,11 @@ export const PermissionListPermissionGroupContainer: React.FC<{
|
|||
[canQueryPermissionGroups, cannotQueryPermissionGroups, numberOfPermissionGroups]
|
||||
);
|
||||
|
||||
const emptyStateComponent = useMemo(
|
||||
() => <EmptyStateList text="No permission groups found" />,
|
||||
[]
|
||||
);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer
|
||||
popupNode={
|
||||
|
@ -122,7 +127,7 @@ export const PermissionListPermissionGroupContainer: React.FC<{
|
|||
showSelectAll={false}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onSelectChange={setSelectedRowKeys}
|
||||
emptyState={<EmptyStateList text="No permission groups found" />}
|
||||
emptyState={emptyStateComponent}
|
||||
useRowClickSelectChange={true}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
|
|
|
@ -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<BusterListRowItem[]>((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(() => <EmptyStateList text="No dataset groups found" />, []);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer
|
||||
showContainerBorder={false}
|
||||
|
@ -54,7 +52,7 @@ export const ListDatasetGroupsComponent: React.FC<{
|
|||
showHeader={true}
|
||||
showSelectAll={false}
|
||||
rowClassName="pl-[30px]!"
|
||||
emptyState={<EmptyStateList text="No dataset groups found" />}
|
||||
emptyState={emptyStateComponent}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -94,6 +94,11 @@ export const ListUsersComponent: React.FC<{
|
|||
[activeUsers, inactiveUsers]
|
||||
);
|
||||
|
||||
const emptyStateComponent = useMemo(
|
||||
() => <EmptyStateList text="No users found" variant="card" show={isFetched} />,
|
||||
[isFetched]
|
||||
);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer showContainerBorder={false}>
|
||||
<BusterInfiniteList
|
||||
|
@ -104,7 +109,7 @@ export const ListUsersComponent: React.FC<{
|
|||
rowClassName="pl-[30px]!"
|
||||
// onSelectChange={setSelectedRowKeys}
|
||||
// selectedRowKeys={selectedRowKeys}
|
||||
emptyState={<EmptyStateList text="No users found" variant="card" show={isFetched} />}
|
||||
emptyState={emptyStateComponent}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -101,7 +101,12 @@ export const UserDatasetListContainer = React.memo(
|
|||
rows={rows}
|
||||
showHeader={false}
|
||||
showSelectAll={false}
|
||||
emptyState={<EmptyStateList text="No datasets found" />}
|
||||
emptyState={useMemo(
|
||||
() => (
|
||||
<EmptyStateList text="No datasets found" />
|
||||
),
|
||||
[]
|
||||
)}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -118,6 +118,8 @@ export const UserDatasetGroupListContainer: React.FC<{
|
|||
[canQueryPermissionUsers, cannotQueryPermissionUsers, numberOfDatasetGroups]
|
||||
);
|
||||
|
||||
const emptyStateComponent = useMemo(() => <EmptyStateList text="No dataset groups found" />, []);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer
|
||||
popupNode={
|
||||
|
@ -135,7 +137,7 @@ export const UserDatasetGroupListContainer: React.FC<{
|
|||
useRowClickSelectChange={false}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onSelectChange={setSelectedRowKeys}
|
||||
emptyState={<EmptyStateList text="No dataset groups found" />}
|
||||
emptyState={emptyStateComponent}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -128,6 +128,8 @@ export const UserTeamsListContainer: React.FC<{
|
|||
[managerTeams, memberTeams, notAMemberTeams]
|
||||
);
|
||||
|
||||
const emptyStateComponent = useMemo(() => <EmptyStateList text="No teams found" />, []);
|
||||
|
||||
return (
|
||||
<InfiniteListContainer
|
||||
popupNode={
|
||||
|
@ -145,7 +147,7 @@ export const UserTeamsListContainer: React.FC<{
|
|||
useRowClickSelectChange={false}
|
||||
selectedRowKeys={selectedRowKeys}
|
||||
onSelectChange={setSelectedRowKeys}
|
||||
emptyState={<EmptyStateList text="No datasets found" />}
|
||||
emptyState={emptyStateComponent}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
|
@ -135,7 +135,12 @@ export const PermissionListUsersContainer: React.FC<{
|
|||
selectedRowKeys={selectedRowKeys}
|
||||
onSelectChange={setSelectedRowKeys}
|
||||
useRowClickSelectChange={false}
|
||||
emptyState={<EmptyStateList text="No users found" />}
|
||||
emptyState={useMemo(
|
||||
() => (
|
||||
<EmptyStateList text="No users found" />
|
||||
),
|
||||
[]
|
||||
)}
|
||||
/>
|
||||
</InfiniteListContainer>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue