1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-27 13:49:10 +02:00

feat: display total count (#9753)

This commit is contained in:
Mateusz Kwasniewski 2025-04-14 14:30:21 +02:00 committed by GitHub
parent 5b52a6e8d1
commit e6d55ab17a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,7 @@ const StyledChip = styled(Chip, {
interface ILifecycleFiltersProps { interface ILifecycleFiltersProps {
state: FilterItemParamHolder; state: FilterItemParamHolder;
onChange: (value: FilterItemParamHolder) => void; onChange: (value: FilterItemParamHolder) => void;
total?: number;
} }
const Wrapper = styled(Box)(({ theme }) => ({ const Wrapper = styled(Box)(({ theme }) => ({
@ -49,6 +50,7 @@ const lifecycleOptions: {
export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({ export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
state, state,
onChange, onChange,
total,
}) => { }) => {
const current = state.lifecycle?.values ?? []; const current = state.lifecycle?.values ?? [];
@ -57,6 +59,10 @@ export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
{lifecycleOptions.map(({ label, value }) => { {lifecycleOptions.map(({ label, value }) => {
const isActive = const isActive =
value === null ? !state.lifecycle : current.includes(value); value === null ? !state.lifecycle : current.includes(value);
const dynamicLabel =
isActive && Number.isInteger(total)
? `${label} (${total})`
: label;
const handleClick = () => const handleClick = () =>
onChange( onChange(
@ -73,7 +79,7 @@ export const LifecycleFilters: FC<ILifecycleFiltersProps> = ({
return ( return (
<StyledChip <StyledChip
key={label} key={label}
label={label} label={dynamicLabel}
variant='outlined' variant='outlined'
isActive={isActive} isActive={isActive}
onClick={handleClick} onClick={handleClick}

View File

@ -466,6 +466,7 @@ export const FeatureToggleListTable: FC = () => {
<LifecycleFilters <LifecycleFilters
state={filterState} state={filterState}
onChange={setTableState} onChange={setTableState}
total={loading ? undefined : total}
/> />
) : null} ) : null}
<FeatureToggleFilters <FeatureToggleFilters