Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Support displaying filters without parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ottosichert committed Dec 13, 2017
1 parent a07afb5 commit e1bffed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/components/filters/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ class Filters extends Component {
const { filter } = this.state;

return unannotatedFilters.map(unannotatedFilter => {
const parameter = unannotatedFilter.parameters[0];
const filterType = parameter.widgetType;
const parameter =
unannotatedFilter.parameters && unannotatedFilter.parameters[0];
const filterType = parameter && parameter.widgetType;
const isActive = this.isFilterActive(unannotatedFilter.filterId);
const activeParameter = isActive && filter[0] && filter[0].parameters[0];
const activeParameter =
parameter && isActive && filter[0] && filter[0].parameters[0];
const captionValue = activeParameter
? TableCell.fieldValueToString(
activeParameter.valueTo
Expand Down
5 changes: 4 additions & 1 deletion src/components/filters/FiltersFrequent.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ class FiltersFrequent extends Component {
})}
>
<i className="meta-icon-preview" />
{item.isActive && item.parameters.length === 1 ? (
{item.isActive &&
item.parameters &&
item.parameters.length === 1 &&
item.captionValue ? (
<Fragment>
{`${item.caption}: `}
{item.captionValue}
Expand Down
4 changes: 3 additions & 1 deletion src/components/filters/FiltersNotFrequent.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class FiltersNotFrequent extends Component {
>
<i className="meta-icon-preview" />
{activeFilter ? (
activeFilter.parameters.length === 1 ? (
activeFilter.parameters &&
activeFilter.parameters.length === 1 &&
activeFilter.captionValue ? (
<Fragment>
{`${activeFilter.caption}: `}
{activeFilter.captionValue}
Expand Down

1 comment on commit e1bffed

@teosarca
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task #1435

Please sign in to comment.