Skip to content

Commit

Permalink
[APM] Only show "Clear filters" button when values are not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Aug 26, 2019
1 parent 8afc486 commit abf0e4d
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 abf0e4d

Please sign in to comment.