mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-12 01:17:04 +02:00
feat: remove sort by user on flags overview (#9826)
We don't aggregate all users, for filters on flags overview. Let's drop this filter
This commit is contained in:
parent
f6eb572a14
commit
a38bf8ea4c
@ -102,11 +102,6 @@ export const FeatureToggleListTable: FC = () => {
|
||||
tableState,
|
||||
setTableState,
|
||||
);
|
||||
const onAvatarClick = useTableStateFilter(
|
||||
['createdBy', 'IS'],
|
||||
tableState,
|
||||
setTableState,
|
||||
);
|
||||
|
||||
const { projects } = useProjects();
|
||||
const bodyLoadingRef = useLoading(loading);
|
||||
@ -172,7 +167,7 @@ export const FeatureToggleListTable: FC = () => {
|
||||
columnHelper.accessor('createdBy', {
|
||||
id: 'createdBy',
|
||||
header: 'By',
|
||||
cell: AvatarCell(onAvatarClick),
|
||||
cell: AvatarCell(),
|
||||
meta: { width: '1%', align: 'center' },
|
||||
enableSorting: false,
|
||||
}),
|
||||
@ -347,12 +342,11 @@ export const FeatureToggleListTable: FC = () => {
|
||||
],
|
||||
[tableState.favoritesFirst],
|
||||
);
|
||||
const data = useMemo(
|
||||
const data = useMemo<FeatureSearchResponseSchema[]>(
|
||||
() =>
|
||||
features?.length === 0 && loading ? featuresPlaceholder : features,
|
||||
[initialLoad, features, loading],
|
||||
);
|
||||
|
||||
const table = useReactTable(
|
||||
withTableState(tableState, setTableState, {
|
||||
columns,
|
||||
|
@ -41,12 +41,12 @@ const StyledAvatar = styled(UserAvatar)(({ theme }) => ({
|
||||
}));
|
||||
|
||||
export const AvatarCell =
|
||||
(onAvatarClick: (userId: number) => void): FC<AvatarCellProps> =>
|
||||
(onAvatarClick?: (userId: number) => void): FC<AvatarCellProps> =>
|
||||
({ row: { original } }) => {
|
||||
const ariaDisabled = original.createdBy.id === 0;
|
||||
const clickAction = ariaDisabled
|
||||
? () => {}
|
||||
: () => onAvatarClick(original.createdBy.id);
|
||||
: () => onAvatarClick?.(original.createdBy.id);
|
||||
const tooltipContent = ariaDisabled ? (
|
||||
<>
|
||||
<p>{original.createdBy.name}</p>
|
||||
@ -58,29 +58,37 @@ export const AvatarCell =
|
||||
<p>{original.createdBy.name}</p>
|
||||
);
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<ScreenReaderOnly>
|
||||
<span>
|
||||
Show only flags created by {original.createdBy.name}
|
||||
</span>
|
||||
</ScreenReaderOnly>
|
||||
<StyledAvatar
|
||||
disableTooltip
|
||||
user={{
|
||||
id: original.createdBy.id,
|
||||
name: original.createdBy.name,
|
||||
imageUrl: original.createdBy.imageUrl,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
<HtmlTooltip arrow describeChild title={tooltipContent}>
|
||||
<StyledAvatarButton
|
||||
aria-disabled={ariaDisabled}
|
||||
onClick={clickAction}
|
||||
>
|
||||
<ScreenReaderOnly>
|
||||
<span>
|
||||
Show only flags created by{' '}
|
||||
{original.createdBy.name}
|
||||
</span>
|
||||
</ScreenReaderOnly>
|
||||
|
||||
<StyledAvatar
|
||||
disableTooltip
|
||||
user={{
|
||||
id: original.createdBy.id,
|
||||
name: original.createdBy.name,
|
||||
imageUrl: original.createdBy.imageUrl,
|
||||
}}
|
||||
/>
|
||||
</StyledAvatarButton>
|
||||
{onAvatarClick ? (
|
||||
<StyledAvatarButton
|
||||
aria-disabled={ariaDisabled}
|
||||
onClick={clickAction}
|
||||
>
|
||||
{content}
|
||||
</StyledAvatarButton>
|
||||
) : (
|
||||
<div>{content}</div>
|
||||
)}
|
||||
</HtmlTooltip>
|
||||
</StyledContainer>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user