Skip to content

Commit

Permalink
[APM] Only show "Clear filters" button when values are not empty (#43967
Browse files Browse the repository at this point in the history
) (#43992)

Closes #43853.
  • Loading branch information
dgieselaar authored Aug 26, 2019
1 parent ea7e407 commit ae2083a
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const LocalUIFilters = ({
params
});

const hasValues = filters.some(filter => filter.value.length > 0);

return (
<>
<EuiTitle size="s">
Expand All @@ -68,19 +70,23 @@ const LocalUIFilters = ({
</React.Fragment>
);
})}
<EuiSpacer size="s" />
<ButtonWrapper>
<EuiButtonEmpty
size="xs"
iconType="cross"
flush="left"
onClick={clearValues}
>
{i18n.translate('xpack.apm.clearFilters', {
defaultMessage: 'Clear filters'
})}
</EuiButtonEmpty>
</ButtonWrapper>
{hasValues ? (
<>
<EuiSpacer size="s" />
<ButtonWrapper>
<EuiButtonEmpty
size="xs"
iconType="cross"
flush="left"
onClick={clearValues}
>
{i18n.translate('xpack.apm.clearFilters', {
defaultMessage: 'Clear filters'
})}
</EuiButtonEmpty>
</ButtonWrapper>
</>
) : null}
</>
);
};
Expand Down

0 comments on commit ae2083a

Please sign in to comment.