return (
<FacetBox property={this.property}>
<FacetHeader
+ clearLabel="reset_verb"
name={translate('issues.facet', this.property)}
onClear={this.handleClear}
onClick={this.handleHeaderClick}
return stats ? stats[type] : undefined;
}
+ isFacetItemActive(type: string) {
+ const { types } = this.props;
+ return (
+ // type is selected explicitly
+ types.includes(type) ||
+ // bugs, vulnerabilities and code smells are selected implicitly by default
+ (types.length === 0 && ['BUG', 'VULNERABILITY', 'CODE_SMELL'].includes(type))
+ );
+ }
+
renderItem = (type: string) => {
- const active = this.props.types.includes(type);
+ const active = this.isFacetItemActive(type);
const stat = this.getStat(type);
return (
return (
<FacetBox property={this.property}>
<FacetHeader
+ clearLabel="reset_verb"
name={translate('issues.facet', this.property)}
onClear={this.handleClear}
onClick={this.handleHeaderClick}
interface Props {
children?: React.ReactNode;
+ clearLabel?: string;
helper?: string;
name: React.ReactNode;
onClear?: () => void;
<Button
className="search-navigator-facet-header-button button-small button-red"
onClick={this.props.onClear}>
- {translate('clear')}
+ {translate(this.props.clearLabel || 'clear')}
</Button>
)}
</div>