mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
refactoring based on @jbudz review
This commit is contained in:
parent
165cdf7c81
commit
3269b0287c
1 changed files with 4 additions and 8 deletions
|
@ -44,17 +44,13 @@ define(function (require) {
|
|||
var getVisEl = getter('.visualize-chart');
|
||||
var getVisContainer = getter('.vis-container');
|
||||
|
||||
// Show no results message when hasZeroHits is true and it requires search
|
||||
// Show no results message when isZeroHits is true and it requires search
|
||||
$scope.showNoResultsMessage = function () {
|
||||
var requiresSearch = _.get($scope, 'vis.type.requiresSearch');
|
||||
var requiresSearch = _.has($scope, 'vis.type.requiresSearch');
|
||||
var isZeroHits = _.get($scope,'esResp.hits.total') === 0;
|
||||
var shouldNotShowMessage = _.get($scope, 'vis.params.handleNoResults');
|
||||
var shouldShowMessage = !_.has($scope, 'vis.params.handleNoResults');
|
||||
|
||||
if (requiresSearch && isZeroHits) {
|
||||
// if the vis type handles instances when there are no results,
|
||||
// do not show a no results message
|
||||
return shouldNotShowMessage ? false : true;
|
||||
}
|
||||
return Boolean(requiresSearch && isZeroHits && shouldShowMessage);
|
||||
};
|
||||
|
||||
$scope.fullScreenSpy = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue