From 71e1557d81904f7ce548cb1aa34654c331da3dee Mon Sep 17 00:00:00 2001 From: Stanislas Bernard Date: Sat, 13 Jun 2015 10:17:05 +0200 Subject: [PATCH] [search] Make empty component a prop --- page/search/common/group-by-mixin.js | 18 ++++++++---------- page/search/common/search-mixin.js | 6 ++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/page/search/common/group-by-mixin.js b/page/search/common/group-by-mixin.js index 13b1d5e98..317f96be1 100644 --- a/page/search/common/group-by-mixin.js +++ b/page/search/common/group-by-mixin.js @@ -30,7 +30,12 @@ let GroupByMixin = { orderableColumnList: {}, lineComponentMapper() { throw new ArgumentNullException('Please provide a inferLineComponentFromList(list) function.'); - } + }, + emptyComponent: ( +
+ {this.i18n('search.empty')} +
+ ) }); }, /** @@ -47,7 +52,7 @@ let GroupByMixin = { getResultListComponent(advancedSearch) { // First check if there is any result if (this.state.totalRecords === 0) { - return this._getEmptyResultList(); + return this.props.emptyComponent; } let isBounded = keys(this.state.map).length > 1; let noDecoration = keys(this.state.map).length === 1; @@ -73,7 +78,7 @@ let GroupByMixin = { }, _getSingleTypeResultList(groupKey, list, maxRows) { if (list.length === 0) { - return this._getEmptyResultList(); + return this.emptyComponent; } if (maxRows) { list = list.slice(0, maxRows); @@ -97,13 +102,6 @@ let GroupByMixin = { /> ); }, - _getEmptyResultList() { - return ( -
- {this.i18n('search.empty')} -
- ); - }, renderGroupByBlock(groupKey, list, maxRows) { let GroupWrapper = this.props.groupComponent; return ( diff --git a/page/search/common/search-mixin.js b/page/search/common/search-mixin.js index bd39f5a78..ed00f2859 100644 --- a/page/search/common/search-mixin.js +++ b/page/search/common/search-mixin.js @@ -57,6 +57,12 @@ let SearchMixin = { if(!isFunction(this.props.searchAction)){ console.warn(`Your page seems to miss a search action, add in your props a {searchAction: function(scope, query, facets){}}`, this.props.searchAction); } +<<<<<<< Updated upstream +======= + return this._buildSearchCriteria(this.state.scope, this.state.query, facets); + }, + search() { +>>>>>>> Stashed changes this.props.searchAction( this.getSearchCriteria(this.state.scope, this.state.query, facets) );