From 0e306d4e6a30f7b0e01bcfe2aedb20f0ebdded60 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 18 Mar 2016 14:33:24 -0700 Subject: [PATCH 01/11] [filterBar] do not warn if the click is being simulated --- src/ui/public/filter_bar/filter_bar_click_handler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/public/filter_bar/filter_bar_click_handler.js b/src/ui/public/filter_bar/filter_bar_click_handler.js index 8f2c7eb004a1..ea56af6510a2 100644 --- a/src/ui/public/filter_bar/filter_bar_click_handler.js +++ b/src/ui/public/filter_bar/filter_bar_click_handler.js @@ -39,7 +39,9 @@ export default function (Notifier) { try { return result.createFilter(); } catch (e) { - notify.warning(e.message); + if (!simulate) { + notify.warning(e.message); + } } }) .filter(Boolean) From 65dc7679f4769f550471a39e9c84d056709c819e Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 18 Mar 2016 15:09:37 -0700 Subject: [PATCH 02/11] [filterBar] added tests to verify 0e306d4 --- src/fixtures/logstash_fields.js | 2 +- .../__tests__/filter_bar_click_handler.js | 61 +++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js diff --git a/src/fixtures/logstash_fields.js b/src/fixtures/logstash_fields.js index 92b57c27b965..c23cfafbbcaf 100644 --- a/src/fixtures/logstash_fields.js +++ b/src/fixtures/logstash_fields.js @@ -16,7 +16,7 @@ function stubbedLogstashFields() { { name: 'extension', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: 'machine.os', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: 'geo.src', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, - { name: '_type', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: '_type', type: 'string', indexed: false, analyzed: true, sortable: true, filterable: true }, { name: '_id', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: true}, { name: '_source', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: false}, { name: 'custom_user_field', type: 'conflict', indexed: false, analyzed: false, sortable: false, filterable: true }, diff --git a/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js b/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js new file mode 100644 index 000000000000..23b80580c516 --- /dev/null +++ b/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js @@ -0,0 +1,61 @@ +import ngMock from 'ng_mock'; +import expect from 'expect.js'; + +import MockState from 'fixtures/mock_state'; +import notify from 'ui/notify'; +import AggConfigResult from 'ui/vis/agg_config_result'; + +import VisProvider from 'ui/vis'; +import StubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; +import FilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; + +describe('filterBarClickHandler', function () { + let setup = null; + + beforeEach(ngMock.module('kibana')); + beforeEach(ngMock.inject(function (Private) { + setup = function () { + const Vis = Private(VisProvider); + const createClickHandler = Private(FilterBarClickHandlerProvider); + const indexPattern = Private(StubbedLogstashIndexPatternProvider); + + const vis = new Vis(indexPattern, { + type: 'histogram', + aggs: [ + { type: 'count', schema: 'metric' }, + { + type: 'terms', + schema: 'segment', + params: { field: '_type' } + } + ] + }); + const aggConfigResult = new AggConfigResult(vis.aggs[1], void 0, 'apache', 'apache'); + + const $state = new MockState({ filters: [] }); + const clickHandler = createClickHandler($state); + + return { clickHandler, $state, aggConfigResult }; + }; + })); + + afterEach(function () { + notify._notifs.splice(0); + }); + + context('on non-filterable fields', function () { + it('warns about trying to filter on a non-filterable field', function () { + const { clickHandler, aggConfigResult } = setup(); + expect(notify._notifs).to.have.length(0); + clickHandler({ point: { aggConfigResult }}); + expect(notify._notifs).to.have.length(1); + }); + + it('does not warn if the event is click is being simulated', function () { + const { clickHandler, aggConfigResult } = setup(); + expect(notify._notifs).to.have.length(0); + clickHandler({ point: { aggConfigResult }}, true); + expect(notify._notifs).to.have.length(0); + }); + }); +}); From d392af818c549e19bf4ed90d1df192fae3f27678 Mon Sep 17 00:00:00 2001 From: ume Date: Wed, 23 Mar 2016 15:47:44 +0900 Subject: [PATCH 03/11] Add min attribute --- src/ui/public/timepicker/timepicker.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/public/timepicker/timepicker.html b/src/ui/public/timepicker/timepicker.html index f1af4b4fbe6f..62d7ae367fd8 100644 --- a/src/ui/public/timepicker/timepicker.html +++ b/src/ui/public/timepicker/timepicker.html @@ -69,6 +69,7 @@ ng-model="relative.count" ng-change="formatRelative()" greater-than="-1" + min="0" type="number" class="form-control"> From e95e57797159e863207db4763ef03f2309b6e4e0 Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Thu, 24 Mar 2016 16:21:11 +0000 Subject: [PATCH 04/11] Don't use extended_bounds for time filter in date_histogram vis The date histogram vis currently uses extended_bounds on the date_histogram if a time filter is applied which means that these requests can't be cached since the cache key for the request cache for Elasticsearch is based on the request body. The `extended_bounds` here has no effect on the response of the date histogram aggregation because it also sets minDocCount to 0 so will not return any empty buckets. This change removes the extended bounds parameter for the time filter so these requests can be cached by Elasticsearch. --- src/ui/public/agg_types/buckets/date_histogram.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/ui/public/agg_types/buckets/date_histogram.js b/src/ui/public/agg_types/buckets/date_histogram.js index 485ce7e664d0..d25b4c5786fe 100644 --- a/src/ui/public/agg_types/buckets/date_histogram.js +++ b/src/ui/public/agg_types/buckets/date_histogram.js @@ -150,14 +150,6 @@ export default function DateHistogramAggType(timefilter, config, Private) { return; } - - var bounds = timefilter.getActiveBounds(); - if (bounds) { - output.params.extended_bounds = { - min: moment(bounds.min).valueOf(), - max: moment(bounds.max).valueOf() - }; - } } } ] From 5c492e7ec8814e1a6def7c1b8b7899e6315954d4 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 24 Mar 2016 10:56:43 -0700 Subject: [PATCH 05/11] [discover/tests] update rigid test data --- .../public/discover/controllers/discover.js | 3 +-- test/functional/apps/discover/_discover.js | 18 +++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/plugins/kibana/public/discover/controllers/discover.js b/src/plugins/kibana/public/discover/controllers/discover.js index 9790b05e60f3..e8c3c4ad1233 100644 --- a/src/plugins/kibana/public/discover/controllers/discover.js +++ b/src/plugins/kibana/public/discover/controllers/discover.js @@ -481,8 +481,7 @@ app.controller('discover', function ($scope, config, courier, $route, $window, N schema: 'segment', params: { field: $scope.opts.timefield, - interval: $state.interval, - min_doc_count: 0 + interval: $state.interval } } ]; diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 86271155f8cc..9cec39dc31ca 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -108,12 +108,11 @@ define(function (require) { }); bdd.it('should show the correct bar chart', function () { - var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '3.237', + var expectedBarChartData = [ '3.237', '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', - '118.562', '63.524', '17.587', '2.537', '0', '0', '0', '0', '0', - '0', '0' + '118.562', '63.524', '17.587', '2.537' ]; return common.sleep(4000) .then(function () { @@ -142,8 +141,7 @@ define(function (require) { bdd.it('should show correct data for chart interval Hourly', function () { var chartInterval = 'Hourly'; - var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1.527', '2.290', + var expectedBarChartData = [ '1.527', '2.290', '5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8', '112', '122.181', '131.6', '132.872', '113.527', '102.581', '81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109', @@ -154,8 +152,7 @@ define(function (require) { '2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945', '61.345', '79.672', '102.836', '125.236', '130.327', '128.036', '120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490', - '12.472', '4.072', '2.290', '1.018', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' + '12.472', '4.072', '2.290', '1.018' ]; return discoverPage.setChartInterval(chartInterval) .then(function () { @@ -170,7 +167,7 @@ define(function (require) { bdd.it('should show correct data for chart interval Daily', function () { var chartInterval = 'Daily'; var expectedBarChartData = [ - '0', '133.196', '129.192', '129.724', '0' + '133.196', '129.192', '129.724' ]; return discoverPage.setChartInterval(chartInterval) .then(function () { @@ -223,12 +220,11 @@ define(function (require) { bdd.it('should show correct data for chart interval Auto', function () { var chartInterval = 'Auto'; - var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '3.237', + var expectedBarChartData = [ '3.237', '17.674', '64.75', '125.737', '119.962', '65.712', '16.449', '2.712', '3.675', '17.674', '59.762', '119.087', '123.812', '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', - '118.562', '63.524', '17.587', '2.537', '0', '0', '0', '0', '0', - '0', '0' + '118.562', '63.524', '17.587', '2.537' ]; return discoverPage.setChartInterval(chartInterval) .then(function () { From 8a4992640bf1e8f74316dbbad0d5875182b91bbf Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 24 Mar 2016 14:35:00 -0700 Subject: [PATCH 06/11] [courier/segmentedRequest] mark the request "started" synchronously --- src/ui/public/courier/fetch/request/segmented.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ui/public/courier/fetch/request/segmented.js b/src/ui/public/courier/fetch/request/segmented.js index 71ae5e2fa8b8..7ea9c1893a97 100644 --- a/src/ui/public/courier/fetch/request/segmented.js +++ b/src/ui/public/courier/fetch/request/segmented.js @@ -42,6 +42,8 @@ export default function SegmentedReqProvider(es, Private, Promise, timefilter, c *********/ start() { + super.start(); + this._complete = []; this._active = null; this._segments = []; @@ -61,12 +63,12 @@ export default function SegmentedReqProvider(es, Private, Promise, timefilter, c // parameters via the handle if (_.isFunction(this._initFn)) this._initFn(this._handle); return this._createQueue().then((queue) => { + if (this.stopped) return; + this._all = queue.slice(0); // Send the initial fetch status this._reportStatus(); - - return super.start(); }); } From c12f18df2733f36819d482ad1c8b7152a5450584 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 24 Mar 2016 14:35:46 -0700 Subject: [PATCH 07/11] [courier/fetch] detect aborted requests more agressively --- src/ui/public/courier/fetch/fetch_these.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/public/courier/fetch/fetch_these.js b/src/ui/public/courier/fetch/fetch_these.js index 78affdf29ac5..27b0c3cc1e36 100644 --- a/src/ui/public/courier/fetch/fetch_these.js +++ b/src/ui/public/courier/fetch/fetch_these.js @@ -29,22 +29,26 @@ export default function FetchTheseProvider(Private, Promise) { } function fetchWithStrategy(strategy, requests) { + function replaceAbortedRequests() { + requests = requests.map(r => r.aborted ? ABORTED : r); + } - requests = requests.map(function (req) { - return req.aborted ? ABORTED : req; - }); - + replaceAbortedRequests(); return startRequests(requests) .then(function () { + replaceAbortedRequests(); return callClient(strategy, requests); }) .then(function (responses) { + replaceAbortedRequests(); return callResponseHandlers(requests, responses); }) .then(function (responses) { + replaceAbortedRequests(); return continueIncomplete(strategy, requests, responses, fetchWithStrategy); }) .then(function (responses) { + replaceAbortedRequests(); return responses.map(function (resp) { switch (resp) { case ABORTED: From 8fef03b816e016a1637a2557c1a1cb6e0cab7bc2 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 24 Mar 2016 14:36:18 -0700 Subject: [PATCH 08/11] [courier/callClient] if there are no executable requests, do nothing --- src/ui/public/courier/fetch/call_client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ui/public/courier/fetch/call_client.js b/src/ui/public/courier/fetch/call_client.js index 2157e4420d95..5f3aa747aef5 100644 --- a/src/ui/public/courier/fetch/call_client.js +++ b/src/ui/public/courier/fetch/call_client.js @@ -20,6 +20,8 @@ export default function CourierFetchCallClient(Private, Promise, es, esShardTime const executable = statuses.filter(isRequest); let execCount = executable.length; + if (!execCount) return Promise.resolve([]); + // resolved by respond() let esPromise; const defer = Promise.defer(); From 985f9970f3b73863b20d55369ac0e902e27384fd Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 24 Mar 2016 15:25:31 -0700 Subject: [PATCH 09/11] [courier/tests] updated test --- src/ui/public/courier/fetch/request/__tests__/segmented.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ui/public/courier/fetch/request/__tests__/segmented.js b/src/ui/public/courier/fetch/request/__tests__/segmented.js index 4ccb32e0c38b..a30f3da68747 100644 --- a/src/ui/public/courier/fetch/request/__tests__/segmented.js +++ b/src/ui/public/courier/fetch/request/__tests__/segmented.js @@ -32,9 +32,7 @@ describe('ui/courier/fetch/request/segmented', () => { expect(returned.then).to.be.Function; }); - it('does not call super.start() until promise is resolved', () => { - expect(searchReqStart.called).to.be(false); - $rootScope.$apply(); + it('calls super.start() synchronously', () => { expect(searchReqStart.called).to.be(true); }); }); From a7a9b0bb008b94048c5677d1038bb80001b24147 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 28 Mar 2016 11:44:37 -0700 Subject: [PATCH 10/11] [npm] upgrade grunt-esvm --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index edf5a1930b1f..9227ccf9378f 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "grunt-cli": "0.1.13", "grunt-contrib-clean": "0.6.0", "grunt-contrib-copy": "0.8.1", - "grunt-esvm": "3.0.4", + "grunt-esvm": "3.1.1", "grunt-karma": "0.12.0", "grunt-run": "0.5.0", "grunt-s3": "0.2.0-alpha.3", From 1b2dd7da2f73e6bccf43ea5324eb4e2e701d1f62 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 28 Mar 2016 12:21:52 -0700 Subject: [PATCH 11/11] [esvm] 127.0.0.1 is the default anyway, avoid min_master_nodes warning --- tasks/config/esvm.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tasks/config/esvm.js b/tasks/config/esvm.js index 478df34b2429..91ebfb7b40b0 100644 --- a/tasks/config/esvm.js +++ b/tasks/config/esvm.js @@ -9,9 +9,6 @@ module.exports = function (grunt) { branch: 'master', fresh: !grunt.option('esvm-no-fresh'), config: { - network: { - host: '127.0.0.1' - }, http: { port: 9200 }