[test/functional] Functional tests covering new "No Results" partial directive and time picker.
This commit is contained in:
parent
348a939b54
commit
4036c46b8f
6 changed files with 110 additions and 53 deletions
13
src/plugins/kibana/public/discover/directives/no_results.js
Normal file
13
src/plugins/kibana/public/discover/directives/no_results.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import _ from 'lodash';
|
||||||
|
import $ from 'jquery';
|
||||||
|
import uiModules from 'ui/modules';
|
||||||
|
import noResultsTemplate from '../partials/no_results.html';
|
||||||
|
|
||||||
|
uiModules
|
||||||
|
.get('apps/discover')
|
||||||
|
.directive('discoverNoResults', function () {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
template: noResultsTemplate
|
||||||
|
};
|
||||||
|
});
|
|
@ -94,58 +94,7 @@
|
||||||
|
|
||||||
<div class="discover-wrapper col-md-10">
|
<div class="discover-wrapper col-md-10">
|
||||||
<div class="discover-content">
|
<div class="discover-content">
|
||||||
<!-- no results -->
|
<discover-no-results></discover-no-results>
|
||||||
<div ng-show="resultState === 'none'">
|
|
||||||
<div class="col-md-10 col-md-offset-1">
|
|
||||||
|
|
||||||
<h1>No results found <i aria-hidden="true" class="fa fa-meh-o"></i></h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Unfortunately I could not find any results matching your search. I tried really hard. I looked all over the place and frankly, I just couldn't find anything good. Help me, help you. Here are some ideas:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="shard-failures" ng-show="failures">
|
|
||||||
<h3>Shard Failures</h3>
|
|
||||||
<p>The following shard failures ocurred:</p>
|
|
||||||
<ul>
|
|
||||||
<li ng-repeat="failure in failures | limitTo: failuresShown"><strong>Index:</strong> {{failure.index}} <strong>Shard:</strong> {{failure.shard}} <strong>Reason:</strong> {{failure.reason}} </li>
|
|
||||||
</ul>
|
|
||||||
<a ng-click="showAllFailures()" ng-if="failures.length > failuresShown" title="Show More">Show More</a>
|
|
||||||
<a ng-click="showLessFailures()" ng-if="failures.length === failuresShown && failures.length > 5" title="Show Less">Show Less</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-show="opts.timefield">
|
|
||||||
<p>
|
|
||||||
<h3>Expand your time range</h3>
|
|
||||||
<p>I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the <a class="btn btn-xs navbtn" ng-click="configTemplate.toggle('filter')" aria-expanded="configTemplate.is('filter')" aria-label="time picker"><i aria-hidden="true" class="fa fa-clock-o"></i> time picker</a> button in the top right corner of your screen.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>Refine your query</h3>
|
|
||||||
<p>
|
|
||||||
The search bar at the top uses Elasticsearch's support for Lucene <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax" target="_blank">Query String syntax</a>. Let's say we're searching web server logs that have been parsed into a few fields.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<h4>Examples:</h4>
|
|
||||||
Find requests that contain the number 200, in any field:
|
|
||||||
<pre>200</pre>
|
|
||||||
|
|
||||||
Or we can search in a specific field. Find 200 in the status field:
|
|
||||||
<pre>status:200</pre>
|
|
||||||
|
|
||||||
Find all status codes between 400-499:
|
|
||||||
<pre>status:[400 TO 499]</pre>
|
|
||||||
|
|
||||||
Find status codes 400-499 with the extension php:
|
|
||||||
<pre>status:[400 TO 499] AND extension:PHP</pre>
|
|
||||||
|
|
||||||
Or HTML
|
|
||||||
<pre>status:[400 TO 499] AND (extension:php OR extension:html)</pre>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- loading -->
|
<!-- loading -->
|
||||||
<div ng-show="resultState === 'loading'">
|
<div ng-show="resultState === 'loading'">
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'plugins/kibana/discover/saved_searches/saved_searches';
|
import 'plugins/kibana/discover/saved_searches/saved_searches';
|
||||||
|
import 'plugins/kibana/discover/directives/no_results';
|
||||||
import 'plugins/kibana/discover/directives/timechart';
|
import 'plugins/kibana/discover/directives/timechart';
|
||||||
import 'ui/navbar';
|
import 'ui/navbar';
|
||||||
import 'ui/collapsible_sidebar';
|
import 'ui/collapsible_sidebar';
|
||||||
|
|
51
src/plugins/kibana/public/discover/partials/no_results.html
Normal file
51
src/plugins/kibana/public/discover/partials/no_results.html
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<div ng-show="resultState === 'none'" data-test-subj="discoverNoResults">
|
||||||
|
<div class="col-md-10 col-md-offset-1">
|
||||||
|
|
||||||
|
<h1>No results found <i aria-hidden="true" class="fa fa-meh-o"></i></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Unfortunately I could not find any results matching your search. I tried really hard. I looked all over the place and frankly, I just couldn't find anything good. Help me, help you. Here are some ideas:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="shard-failures" ng-show="failures">
|
||||||
|
<h3>Shard Failures</h3>
|
||||||
|
<p>The following shard failures ocurred:</p>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="failure in failures | limitTo: failuresShown"><strong>Index:</strong> {{failure.index}} <strong>Shard:</strong> {{failure.shard}} <strong>Reason:</strong> {{failure.reason}} </li>
|
||||||
|
</ul>
|
||||||
|
<a ng-click="showAllFailures()" ng-if="failures.length > failuresShown" title="Show More">Show More</a>
|
||||||
|
<a ng-click="showLessFailures()" ng-if="failures.length === failuresShown && failures.length > 5" title="Show Less">Show Less</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="opts.timefield">
|
||||||
|
<p>
|
||||||
|
<h3>Expand your time range</h3>
|
||||||
|
<p>I see you are looking at an index with a date field. It is possible your query does not match anything in the current time range, or that there is no data at all in the currently selected time range. Click the button below to open the time picker. For future reference you can open the time picker by clicking on the <a class="btn btn-xs navbtn" ng-click="configTemplate.toggle('filter')" aria-expanded="configTemplate.is('filter')" aria-label="time picker" data-test-subj="discoverNoResultsTimefilter"><i aria-hidden="true" class="fa fa-clock-o"></i> time picker</a> button in the top right corner of your screen.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3>Refine your query</h3>
|
||||||
|
<p>
|
||||||
|
The search bar at the top uses Elasticsearch's support for Lucene <a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax" target="_blank">Query String syntax</a>. Let's say we're searching web server logs that have been parsed into a few fields.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<h4>Examples:</h4>
|
||||||
|
Find requests that contain the number 200, in any field:
|
||||||
|
<pre>200</pre>
|
||||||
|
|
||||||
|
Or we can search in a specific field. Find 200 in the status field:
|
||||||
|
<pre>status:200</pre>
|
||||||
|
|
||||||
|
Find all status codes between 400-499:
|
||||||
|
<pre>status:[400 TO 499]</pre>
|
||||||
|
|
||||||
|
Find status codes 400-499 with the extension php:
|
||||||
|
<pre>status:[400 TO 499] AND extension:PHP</pre>
|
||||||
|
|
||||||
|
Or HTML
|
||||||
|
<pre>status:[400 TO 499] AND (extension:php OR extension:html)</pre>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -245,6 +245,11 @@ define(function (require) {
|
||||||
.catch(common.handleError(this));
|
.catch(common.handleError(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bdd.it('should not show "no results"', () => {
|
||||||
|
discoverPage.hasNoResults().then(noResults => {
|
||||||
|
expect(noResults).to.be(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function verifyChartData(expectedBarChartData) {
|
function verifyChartData(expectedBarChartData) {
|
||||||
return common.tryForTime(20 * 1000, function tryingForTime() {
|
return common.tryForTime(20 * 1000, function tryingForTime() {
|
||||||
|
@ -274,6 +279,30 @@ define(function (require) {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
bdd.describe('query #2, which has an empty time range', function () {
|
||||||
|
var fromTime = '1999-06-11 09:22:11.000';
|
||||||
|
var toTime = '1999-06-12 11:21:04.000';
|
||||||
|
|
||||||
|
bdd.before(() => {
|
||||||
|
common.debug('setAbsoluteRangeForAnotherQuery');
|
||||||
|
return headerPage.setAbsoluteRange(fromTime, toTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
bdd.it('should show "no results"', () => {
|
||||||
|
discoverPage.hasNoResults().then(noResults => {
|
||||||
|
expect(noResults).to.not.be(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
bdd.it('should suggest a new time range is picked', () => {
|
||||||
|
discoverPage.hasNoResultsTimepicker().then(hasTimepicker => {
|
||||||
|
expect(hasTimepicker).to.be(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -218,7 +218,21 @@ define(function (require) {
|
||||||
return thisTime
|
return thisTime
|
||||||
.findByClassName('sidebar-list')
|
.findByClassName('sidebar-list')
|
||||||
.getProperty('clientWidth');
|
.getProperty('clientWidth');
|
||||||
}
|
},
|
||||||
|
|
||||||
|
hasNoResults: function hasNoResults() {
|
||||||
|
return thisTime
|
||||||
|
.findByCssSelector('[data-test-subj="discoverNoResults"]')
|
||||||
|
.getVisibleText()
|
||||||
|
.then(text => text.length > 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
hasNoResultsTimepicker: function hasNoResults() {
|
||||||
|
return thisTime
|
||||||
|
.findByCssSelector('[data-test-subj="discoverNoResultsTimefilter"]')
|
||||||
|
.getVisibleText()
|
||||||
|
.then(text => text.length > 0);
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue