Skip to content

Commit

Permalink
Disbaling facet filters for users/orgs
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Nov 11, 2020
1 parent 89b0db5 commit 3aa5501
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/common/FilterButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FilterList as FilterListIcon,
} from '@material-ui/icons';

const FilterButton = ({tooltipTitle, label, count, onClick}) => {
const FilterButton = ({tooltipTitle, label, count, disabled, onClick}) => {
const hasFilters = count && count > 0;
const color = hasFilters ? 'primary' : 'secondary';
const buttonLabel = (label || 'Filters') + (hasFilters ? ` (${count})` : '');
Expand All @@ -18,6 +18,7 @@ const FilterButton = ({tooltipTitle, label, count, onClick}) => {
icon={<FilterListIcon fontSize='small' />}
label={buttonLabel}
style={{minWidth: '100px'}}
disabled={disabled}
/>
</Tooltip>
)
Expand Down
5 changes: 3 additions & 2 deletions src/components/search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,15 @@ class Search extends React.Component {
getFilterControls() {
const updatedSinceText = this.getUpdatedSinceText();
const totalResults = this.getCurrentResourceTotalResults();
const { updatedSince, limit, appliedFacets } = this.state;
const { updatedSince, limit, appliedFacets, resource } = this.state;
const isDisabledFilters = includes(['organizations', 'users'], resource);
return (
<span style={{display: 'inline-flex'}}>
<span style={{paddingRight: '5px'}}>
<ChipDatePicker onChange={this.onDateChange} label={updatedSinceText} date={updatedSince} />
</span>
<span style={{paddingRight: '5px'}}>
<FilterButton count={size(appliedFacets)} onClick={this.toggleFacetsDrawer} />
<FilterButton count={size(appliedFacets)} onClick={this.toggleFacetsDrawer} disabled={isDisabledFilters} />
</span>
{
!this.isTable && <span style={{paddingRight: '5px'}}>
Expand Down

0 comments on commit 3aa5501

Please sign in to comment.