mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-18 01:18:23 +02:00
fix: empty paginated table state (#5685)
Table placeholder should be visible if search query returns no data.
This commit is contained in:
parent
8e7e389d1d
commit
6d0e32810c
@ -46,7 +46,7 @@ import { FeatureNameCell } from 'component/common/Table/cells/FeatureNameCell/Fe
|
|||||||
import { FeatureToggleCell } from './FeatureToggleCell/FeatureToggleCell';
|
import { FeatureToggleCell } from './FeatureToggleCell/FeatureToggleCell';
|
||||||
import { ProjectOverviewFilters } from './ProjectOverviewFilters';
|
import { ProjectOverviewFilters } from './ProjectOverviewFilters';
|
||||||
import { useDefaultColumnVisibility } from './hooks/useDefaultColumnVisibility';
|
import { useDefaultColumnVisibility } from './hooks/useDefaultColumnVisibility';
|
||||||
import { Placeholder } from './TablePlaceholder/TablePlaceholder';
|
import { TableEmptyState } from './TableEmptyState/TableEmptyState';
|
||||||
import { useRowActions } from './hooks/useRowActions';
|
import { useRowActions } from './hooks/useRowActions';
|
||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
import { FeatureTagCell } from 'component/common/Table/cells/FeatureTagCell/FeatureTagCell';
|
import { FeatureTagCell } from 'component/common/Table/cells/FeatureTagCell/FeatureTagCell';
|
||||||
@ -457,7 +457,12 @@ export const PaginatedProjectFeatureToggles = ({
|
|||||||
totalItems={total}
|
totalItems={total}
|
||||||
/>
|
/>
|
||||||
</SearchHighlightProvider>
|
</SearchHighlightProvider>
|
||||||
<Placeholder total={total} query={tableState.query || ''} />
|
<ConditionallyRender
|
||||||
|
condition={!data.length && !isPlaceholder}
|
||||||
|
show={
|
||||||
|
<TableEmptyState query={tableState.query || ''} />
|
||||||
|
}
|
||||||
|
/>
|
||||||
{rowActionsDialogs}
|
{rowActionsDialogs}
|
||||||
|
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
|
@ -3,15 +3,10 @@ import { Box } from '@mui/material';
|
|||||||
import { TablePlaceholder } from 'component/common/Table';
|
import { TablePlaceholder } from 'component/common/Table';
|
||||||
|
|
||||||
interface ITablePlaceholderProps {
|
interface ITablePlaceholderProps {
|
||||||
total?: number;
|
|
||||||
query?: string;
|
query?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Placeholder: FC<ITablePlaceholderProps> = ({ total, query }) => {
|
export const TableEmptyState: FC<ITablePlaceholderProps> = ({ query }) => {
|
||||||
if (total !== 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((query || '')?.length > 0) {
|
if ((query || '')?.length > 0) {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -34,10 +29,7 @@ export const Placeholder: FC<ITablePlaceholderProps> = ({ total, query }) => {
|
|||||||
padding: theme.spacing(3),
|
padding: theme.spacing(3),
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<TablePlaceholder>
|
<TablePlaceholder>No feature toggles available.</TablePlaceholder>
|
||||||
No feature toggles available. Get started by adding a new
|
|
||||||
feature toggle.
|
|
||||||
</TablePlaceholder>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user