From 8d120c805de0a1a51909dd7c59d5a4dbb9c6a5bd Mon Sep 17 00:00:00 2001 From: Trevan Richins Date: Thu, 29 Oct 2015 13:18:23 -0600 Subject: [PATCH 01/50] Leaflet.heat intensity is between 0.0 and 1.0 --- .../public/vislib/__tests__/visualizations/tile_maps/markers.js | 2 +- src/ui/public/vislib/visualizations/marker_types/heatmap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js b/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js index 4ead77f9f4953..24d8378f96a5e 100644 --- a/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js +++ b/src/ui/public/vislib/__tests__/visualizations/tile_maps/markers.js @@ -305,7 +305,7 @@ describe('Marker Tests', function () { var arr = markerLayer._dataToHeatArray(max); var index = _.random(mapData.features.length - 1); var feature = mapData.features[index]; - var featureValue = parseInt(feature.properties.value / max * 100); + var featureValue = feature.properties.value / max; var featureArr = feature.geometry.coordinates.slice(0).concat(featureValue); expect(arr[index]).to.eql(featureArr); }); diff --git a/src/ui/public/vislib/visualizations/marker_types/heatmap.js b/src/ui/public/vislib/visualizations/marker_types/heatmap.js index 1973053be1e9c..4272342a67208 100644 --- a/src/ui/public/vislib/visualizations/marker_types/heatmap.js +++ b/src/ui/public/vislib/visualizations/marker_types/heatmap.js @@ -199,7 +199,7 @@ export default function HeatmapMarkerFactory(Private) { heatIntensity = feature.properties.value; } else { // show bucket value normalized to max value - heatIntensity = parseInt(feature.properties.value / max * 100); + heatIntensity = feature.properties.value / max; } return [lat, lng, heatIntensity]; From a7716d7cab76e40bedcb576a2e26423c1a89e406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Qu=C3=A9m=C3=A9ner?= Date: Tue, 15 Dec 2015 12:48:54 +0100 Subject: [PATCH 02/50] Make default columns configurable --- src/plugins/kibana/public/discover/controllers/discover.js | 2 +- src/ui/public/config/defaults.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/kibana/public/discover/controllers/discover.js b/src/plugins/kibana/public/discover/controllers/discover.js index a7b17b5afd22c..c89b823fc8f8b 100644 --- a/src/plugins/kibana/public/discover/controllers/discover.js +++ b/src/plugins/kibana/public/discover/controllers/discover.js @@ -126,7 +126,7 @@ app.controller('discover', function ($scope, config, courier, $route, $window, N return { query: $scope.searchSource.get('query') || '', sort: getSort.array(savedSearch.sort, $scope.indexPattern), - columns: savedSearch.columns || ['_source'], + columns: savedSearch.columns.length > 0 ? savedSearch.columns : config.get('defaultColumns'), index: $scope.indexPattern.id, interval: 'auto', filters: _.cloneDeep($scope.searchSource.getOwn('filter')) diff --git a/src/ui/public/config/defaults.js b/src/ui/public/config/defaults.js index c167e814bf3e3..ef56c170dad72 100644 --- a/src/ui/public/config/defaults.js +++ b/src/ui/public/config/defaults.js @@ -50,6 +50,10 @@ export default function configDefaultsProvider() { value: null, description: 'The index to access if no index is set', }, + 'defaultColumns': { + value: ['_source'], + description: 'Columns displayed by default in the Discovery tab', + }, 'metaFields': { value: ['_source', '_id', '_type', '_index', '_score'], description: 'Fields that exist outside of _source to merge into our document when displaying it', From 8992535b31af45a7ec49a42f7b61525c5126c8f1 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Fri, 12 Feb 2016 09:42:07 -0700 Subject: [PATCH 03/50] Escape attributes, closes #6174 --- src/ui/public/utils/escape_attr.js | 7 +++++++ src/ui/public/vislib/lib/dispatch.js | 3 ++- src/ui/public/visualize/visualize_legend.js | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/ui/public/utils/escape_attr.js diff --git a/src/ui/public/utils/escape_attr.js b/src/ui/public/utils/escape_attr.js new file mode 100644 index 0000000000000..4fad6b8570128 --- /dev/null +++ b/src/ui/public/utils/escape_attr.js @@ -0,0 +1,7 @@ +export default function escapeAttribute(attr) { + const specials = ['#', '&', '~', '=', '>', '\'', ':', '"', '!', ';', ',']; + const regexSpecials = ['.', '*', '+', '|', '[', ']', '(', ')', '/', '^', '$']; + const sRE = new RegExp('(' + specials.join('|') + '|\\' + regexSpecials.join('|\\') + ')', 'g'); + + return attr.replace(sRE, '\\$1'); +} diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index 93766383b58e4..7dd8577779020 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -1,6 +1,7 @@ import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; +import escapeAttr from 'ui/utils/escape_attr'; import SimpleEmitter from 'ui/utils/SimpleEmitter'; import VislibComponentsTooltipProvider from 'ui/vislib/components/Tooltip'; export default function DispatchClass(Private) { @@ -230,7 +231,7 @@ export default function DispatchClass(Private) { Dispatch.prototype.highlightLegend = function (element) { var label = this.getAttribute('data-label'); if (!label) return; - $('[data-label]', element.parentNode).not('[data-label="' + label + '"]').css('opacity', 0.5); + $('[data-label]', element.parentNode).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5); }; /** diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 9d3edea59b79d..3171b8d111427 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -2,6 +2,7 @@ import _ from 'lodash'; import html from 'ui/visualize/visualize_legend.html'; import $ from 'jquery'; import d3 from 'd3'; +import escapeAttr from 'ui/utils/escape_attr'; import findByParam from 'ui/utils/find_by_param'; import VislibLibDataProvider from 'ui/vislib/lib/data'; import VislibComponentsColorColorProvider from 'ui/vislib/components/color/color'; @@ -30,7 +31,7 @@ uiModules.get('kibana') }); $scope.highlightSeries = function (label) { - $('[data-label]', $elem.siblings()).not('[data-label="' + label + '"]').css('opacity', 0.5); + $('[data-label]', $elem.siblings()).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5); }; $scope.unhighlightSeries = function () { From 3791f1b2aefae442e71b3fab6f9a1d038efa5ba4 Mon Sep 17 00:00:00 2001 From: spalger Date: Sun, 14 Feb 2016 02:06:16 -0700 Subject: [PATCH 04/50] [filters/label] use _.words and _.capitalize --- src/ui/public/filters/label.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/ui/public/filters/label.js b/src/ui/public/filters/label.js index d21f98edfef7f..7c471d96c6e97 100644 --- a/src/ui/public/filters/label.js +++ b/src/ui/public/filters/label.js @@ -1,15 +1,10 @@ import uiModules from 'ui/modules'; +import { words, capitalize } from 'lodash'; + uiModules .get('kibana') .filter('label', function () { return function (str) { - var words = str.split(' '); - return words.map(capFirst).join(' '); + return words(str).map(capitalize).join(' '); }; }); - -function capFirst(str) { - var i = str[0]; - var r = new RegExp(i, 'i'); - return str.replace(r, i.toUpperCase()); -} From f9fd042eb18b5aa8a56e68c3bc1db57e7b982356 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 22 Feb 2016 20:53:47 -0800 Subject: [PATCH 05/50] [vis/editor] auto select the options when appropriate --- src/plugins/kibana/public/visualize/editor/sidebar.html | 3 +-- src/plugins/kibana/public/visualize/editor/sidebar.js | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/kibana/public/visualize/editor/sidebar.html b/src/plugins/kibana/public/visualize/editor/sidebar.html index d2de10a1d6c13..95725d72a16f0 100644 --- a/src/plugins/kibana/public/visualize/editor/sidebar.html +++ b/src/plugins/kibana/public/visualize/editor/sidebar.html @@ -13,7 +13,7 @@ - \ No newline at end of file + diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 9d3edea59b79d..5821d7501183a 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -29,12 +29,26 @@ uiModules.get('kibana') refresh(); }); - $scope.highlightSeries = function (label) { - $('[data-label]', $elem.siblings()).not('[data-label="' + label + '"]').css('opacity', 0.5); + $scope.highlightSeries = function (event) { + var el = event.currentTarget; + var handler = $scope.renderbot.vislibVis.handler; + if(handler.highlight) { + handler.highlight.call(el, handler.el); + }else{ + var label = el.getAttribute('data-label'); + if (!label) return; + $('[data-label]', el.siblings()).not('[data-label="' + label + '"]').css('opacity', 0.5); + } }; - $scope.unhighlightSeries = function () { - $('[data-label]', $elem.siblings()).css('opacity', 1); + $scope.unhighlightSeries = function (event) { + var el = event.currentTarget; + var handler = $scope.renderbot.vislibVis.handler; + if(handler.unHighlight) { + handler.unHighlight.call(el, handler.el); + }else{ + $('[data-label]', el.siblings()).css('opacity', 1); + } }; $scope.setColor = function (label, color) { From 3602964435af031bd738a16ae8a9bdfda454353d Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Sun, 28 Feb 2016 01:21:18 +0100 Subject: [PATCH 15/50] Fixes an issue when hovering the legend in area charts. Also, other charts now have the same behavior --- src/ui/public/vislib/visualizations/area_chart.js | 5 ++++- src/ui/public/visualize/visualize_legend.html | 4 ++-- src/ui/public/visualize/visualize_legend.js | 10 ++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/ui/public/vislib/visualizations/area_chart.js b/src/ui/public/vislib/visualizations/area_chart.js index 7872cdf1d7511..cd18fd947e50c 100644 --- a/src/ui/public/vislib/visualizations/area_chart.js +++ b/src/ui/public/vislib/visualizations/area_chart.js @@ -45,7 +45,10 @@ export default function AreaChartFactory(Private) { highlightElements.css('opacity', highlightOpacity); }; handler.unHighlight = function (element) { - $('[data-label]', element.parentNode).css('opacity', defaultOpacity); + $('[data-label]', element).css('opacity', defaultOpacity); + + //The legend should keep max opacity + $('[data-label]', $(element).siblings()).css('opacity', 1); }; } diff --git a/src/ui/public/visualize/visualize_legend.html b/src/ui/public/visualize/visualize_legend.html index 45856c58d182a..3f8e2b4a09b39 100644 --- a/src/ui/public/visualize/visualize_legend.html +++ b/src/ui/public/visualize/visualize_legend.html @@ -6,8 +6,8 @@
  • diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 5821d7501183a..2cf9651650d1b 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -29,7 +29,7 @@ uiModules.get('kibana') refresh(); }); - $scope.highlightSeries = function (event) { + $scope.highlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; if(handler.highlight) { @@ -37,17 +37,19 @@ uiModules.get('kibana') }else{ var label = el.getAttribute('data-label'); if (!label) return; - $('[data-label]', el.siblings()).not('[data-label="' + label + '"]').css('opacity', 0.5); + var highlightElements = $('[data-label="' + label + '"]', handler.el.parentNode); + $('[data-label]', handler.el.parentNode).not(highlightElements).css('opacity', 0.5); + $(highlightElements).css('opacity', 1); } }; - $scope.unhighlightSeries = function (event) { + $scope.unhighlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; if(handler.unHighlight) { handler.unHighlight.call(el, handler.el); }else{ - $('[data-label]', el.siblings()).css('opacity', 1); + $('[data-label]', handler.el.parentNode).css('opacity', 1); } }; From 9c969346b1f757a8d45b4a2bde13a0846a04878e Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Sun, 28 Feb 2016 01:50:59 +0100 Subject: [PATCH 16/50] Harmonizes the hover behavior --- src/ui/public/vislib/lib/dispatch.js | 12 ++++++++---- src/ui/public/visualize/visualize_legend.js | 18 ++++-------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index 6c1f41b9f2e8c..924fb91be4139 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -106,7 +106,9 @@ export default function DispatchClass(Private) { var isClickable = this.listenerCount('click') > 0; var addEvent = this.addEvent; var $el = this.handler.el; - var highlight = this.handler.highlight || self.highlight; + if(!this.handler.highlight) { + this.handler.highlight = self.highlight; + } function hover(d, i) { // Add pointer if item is clickable @@ -114,7 +116,7 @@ export default function DispatchClass(Private) { self.addMousePointer.call(this, arguments); } - highlight.call(this, $el); + self.handler.highlight.call(this, $el); self.emit('hover', self.eventResponse(d, i)); } @@ -130,10 +132,12 @@ export default function DispatchClass(Private) { var self = this; var addEvent = this.addEvent; var $el = this.handler.el; - var unHighlight = this.handler.unHighlight || self.unHighlight; + if(!this.handler.unHighlight) { + this.handler.unHighlight = self.unHighlight; + } function mouseout() { - unHighlight.call(this, $el); + self.handler.unHighlight.call(this, $el); } return addEvent('mouseout', mouseout); diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 2cf9651650d1b..1924e4e97cc09 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -32,25 +32,15 @@ uiModules.get('kibana') $scope.highlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; - if(handler.highlight) { - handler.highlight.call(el, handler.el); - }else{ - var label = el.getAttribute('data-label'); - if (!label) return; - var highlightElements = $('[data-label="' + label + '"]', handler.el.parentNode); - $('[data-label]', handler.el.parentNode).not(highlightElements).css('opacity', 0.5); - $(highlightElements).css('opacity', 1); - } + if(!handler) return; + handler.highlight.call(el, handler.el); }; $scope.unhighlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; - if(handler.unHighlight) { - handler.unHighlight.call(el, handler.el); - }else{ - $('[data-label]', handler.el.parentNode).css('opacity', 1); - } + if(!handler) return; + handler.unHighlight.call(el, handler.el); }; $scope.setColor = function (label, color) { From 59f890985318c8116dfb61fbe3d6b9c49647b1e6 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Mon, 29 Feb 2016 09:47:30 -0600 Subject: [PATCH 17/50] [url shortener] Add base path --- src/server/http/index.js | 2 +- src/ui/public/share/lib/url_shortener.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/http/index.js b/src/server/http/index.js index 71830d85d72f3..c03a08ec30c52 100644 --- a/src/server/http/index.js +++ b/src/server/http/index.js @@ -111,7 +111,7 @@ module.exports = async function (kbnServer, server, config) { path: '/goto/{urlId}', handler: async function (request, reply) { const url = await shortUrlLookup.getUrl(request.params.urlId); - reply().redirect(url); + reply().redirect(config.get('server.basePath') + url); } }); diff --git a/src/ui/public/share/lib/url_shortener.js b/src/ui/public/share/lib/url_shortener.js index 3e29500d8d2f0..d20afb2a9af9e 100644 --- a/src/ui/public/share/lib/url_shortener.js +++ b/src/ui/public/share/lib/url_shortener.js @@ -1,15 +1,18 @@ +import chrome from 'ui/chrome'; + export default function createUrlShortener(Notifier, $http, $location) { const notify = new Notifier({ location: 'Url Shortener' }); - const baseUrl = `${$location.protocol()}://${$location.host()}:${$location.port()}`; + const basePath = chrome.getBasePath(); + const baseUrl = `${$location.protocol()}://${$location.host()}:${$location.port()}${basePath}`; async function shortenUrl(url) { const relativeUrl = url.replace(baseUrl, ''); const formData = { url: relativeUrl }; try { - const result = await $http.post('/shorten', formData); + const result = await $http.post(`${basePath}/shorten`, formData); return `${baseUrl}/goto/${result.data}`; } catch (err) { From 20b31849e1a034a19623e07336e88ddd1bf00517 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Mon, 29 Feb 2016 13:56:37 -0500 Subject: [PATCH 18/50] Bump node to 4.3.1 --- .node-version | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.node-version b/.node-version index 80895903a15c8..f77856a6f1af5 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -4.3.0 +4.3.1 diff --git a/package.json b/package.json index 62f50e960dbb0..f0f13dc824500 100644 --- a/package.json +++ b/package.json @@ -187,7 +187,7 @@ "supertest-as-promised": "2.0.2" }, "engines": { - "node": "4.3.0", + "node": "4.3.1", "npm": "2.14.15" } } From d36231c117094942d74f9946d8f87dc14e9b4eb9 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Mon, 29 Feb 2016 13:56:57 -0500 Subject: [PATCH 19/50] Bump npm to 2.14.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f0f13dc824500..8ddd9f0b1b607 100644 --- a/package.json +++ b/package.json @@ -188,6 +188,6 @@ }, "engines": { "node": "4.3.1", - "npm": "2.14.15" + "npm": "2.14.21" } } From 7bd76bef6b54c07684c8812beef103b135cd319d Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Mon, 29 Feb 2016 14:12:58 -0500 Subject: [PATCH 20/50] Makelogs as a dev dependency Different versions of makelogs are required based on the current Kibana branch/version, so we now include it as a dev dependency that we can version accordingly. There is also an npm script for makelogs so you do not need to traverse the node_modules bin directory. --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index 62f50e960dbb0..2a8b91267b666 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "elasticsearchWithPlugins": "grunt esvm:withPlugins:keepalive", "lint": "grunt eslint:source", "lintroller": "grunt eslint:fixSource", + "makelogs": "makelogs", "mocha": "mocha", "mocha:debug": "mocha --debug-brk", "sterilize": "grunt sterilize" @@ -176,6 +177,7 @@ "libesvm": "3.3.0", "license-checker": "3.1.0", "load-grunt-config": "0.7.2", + "makelogs": "3.0.0-beta3", "marked-text-renderer": "0.1.0", "mocha": "2.3.0", "nock": "2.10.0", From 4b6c643b587c2489c3cd7814638215401bc31f46 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Mon, 29 Feb 2016 14:34:28 -0500 Subject: [PATCH 21/50] [tests] Longer timeout in es routes test setup It can take longer than 10 seconds for kibana to be ready, but that doesn't mean we fail the tests. --- src/plugins/elasticsearch/lib/__tests__/routes.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/elasticsearch/lib/__tests__/routes.js b/src/plugins/elasticsearch/lib/__tests__/routes.js index 660ab2ff6e060..b5f94d8f3e82f 100644 --- a/src/plugins/elasticsearch/lib/__tests__/routes.js +++ b/src/plugins/elasticsearch/lib/__tests__/routes.js @@ -11,6 +11,8 @@ describe('plugins/elasticsearch', function () { let kbnServer; before(function () { + this.timeout(15000); // sometimes waiting for server takes longer than 10 + kbnServer = kbnTestServer.createServer(); return kbnServer.ready() .then(() => kbnServer.server.plugins.elasticsearch.waitUntilReady()); From 5ad9ad29ff5459482cc7572f2354204e263dc722 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 29 Feb 2016 14:48:41 -0700 Subject: [PATCH 22/50] [courier/test] fix some module ids --- src/ui/public/courier/fetch/__tests__/fetch_these.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/public/courier/fetch/__tests__/fetch_these.js b/src/ui/public/courier/fetch/__tests__/fetch_these.js index 456a9ec0e9ff1..8dcd80080d650 100644 --- a/src/ui/public/courier/fetch/__tests__/fetch_these.js +++ b/src/ui/public/courier/fetch/__tests__/fetch_these.js @@ -1,9 +1,9 @@ -import _ from 'lodash'; +// import _ from 'lodash'; import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ngMock'; -import FetchTheseProvider from '../fetch/fetch_these'; +import FetchTheseProvider from '../fetch_these'; describe('ui/courier/fetch/_fetch_these', () => { @@ -24,9 +24,9 @@ describe('ui/courier/fetch/_fetch_these', () => { return fakeResponses; } - PrivateProvider.swap(require('ui/courier/fetch/_call_client'), FakeResponsesProvider); - PrivateProvider.swap(require('ui/courier/fetch/_call_response_handlers'), FakeResponsesProvider); - PrivateProvider.swap(require('ui/courier/fetch/_continue_incomplete'), FakeResponsesProvider); + PrivateProvider.swap(require('ui/courier/fetch/call_client'), FakeResponsesProvider); + PrivateProvider.swap(require('ui/courier/fetch/call_response_handlers'), FakeResponsesProvider); + PrivateProvider.swap(require('ui/courier/fetch/continue_incomplete'), FakeResponsesProvider); })); beforeEach(ngMock.inject((Private, $injector) => { From 810eded957d2ddadd6d1bcf216815bb22ec9f22a Mon Sep 17 00:00:00 2001 From: Mathias Arens Date: Tue, 1 Mar 2016 11:46:16 +0100 Subject: [PATCH 23/50] Fix typo in histogram visualization description --- src/plugins/kbn_vislib_vis_types/public/histogram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/kbn_vislib_vis_types/public/histogram.js b/src/plugins/kbn_vislib_vis_types/public/histogram.js index e0879e41d7823..80851875efd83 100644 --- a/src/plugins/kbn_vislib_vis_types/public/histogram.js +++ b/src/plugins/kbn_vislib_vis_types/public/histogram.js @@ -11,7 +11,7 @@ export default function HistogramVisType(Private) { title: 'Vertical bar chart', icon: 'fa-bar-chart', description: 'The goto chart for oh-so-many needs. Great for time and non-time data. Stacked or grouped, ' + - 'exact numbers or percentages. If you are not sure which chart your need, you could do worse than to start here.', + 'exact numbers or percentages. If you are not sure which chart you need, you could do worse than to start here.', params: { defaults: { shareYAxis: true, From 705a7b44ccc383a7070426c6d3793dec2996873d Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 1 Mar 2016 10:16:27 -0700 Subject: [PATCH 24/50] Update CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e0d1bd712d3a..9cbfd8b794dd4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -138,6 +138,11 @@ The standard `npm run test` task runs several sub tasks and can take several min Run a one off test with the local project version of mocha, babel compilation, and optional debugging. Great for development and fixing individual tests. + +
    npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin
    +
    + Run the tests for just your particular plugin +
    Distributable packages can be found in `target/` after the build completes. From 0f07dac4f40fb193b80d5f6518c6d874b024c34b Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 1 Mar 2016 10:36:55 -0700 Subject: [PATCH 25/50] Add plugin testing notes, clean up test section formatting --- CONTRIBUTING.md | 109 ++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 59 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9cbfd8b794dd4..20499d10d616c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,99 +111,90 @@ Before running the tests you will need to install the projects dependencies as d Once that is complete just run: -```sh +``` +sh npm run test && npm run build ``` -#### Testing and debugging tests +#### Debugging unit tests The standard `npm run test` task runs several sub tasks and can take several minutes to complete, making debugging failures pretty painful. In order to ease the pain specialized tasks provide alternate methods for running the tests. -
    -
    npm run test:quick
    -
    Runs both server and browser tests, but skips linting
    - -
    npm run test:server or npm run test:browser
    -
    Runs the tests for just the server or browser
    - -
    npm run test:dev
    -
    - Initializes an environment for debugging the browser tests. Includes an dedicated instance of the kibana server for building the test bundle, and a karma server. When running this task the build is optimized for the first time and then a karma-owned instance of the browser is opened. Click the "debug" button to open a new tab that executes the unit tests. -
    - -
    - -
    npm run mocha [test file or dir] or npm run mocha:debug [test file or dir]
    -
    - Run a one off test with the local project version of mocha, babel compilation, and optional debugging. Great - for development and fixing individual tests. -
    - -
    npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin
    -
    - Run the tests for just your particular plugin -
    -
    -Distributable packages can be found in `target/` after the build completes. +`npm run test:quick` +Runs both server and browser tests, but skips linting -#### Building OS packages +`npm run test:server` +Run only the server tests -Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can be installed using gem. Package building has only been tested on Linux and is not supported on any other platform. -```sh -gem install pleaserun -apt-get install ruby-dev -gem install fpm -npm run build:ospackages -``` +`npm run test:browser` +Run only the browser tests -To specify a package to build you can add `rpm` or `deb` as an argument. -```sh -npm run build:ospackages -- --rpm -``` +`npm run test:dev` +Initializes an environment for debugging the browser tests. Includes an dedicated instance of the kibana server for building the test bundle, and a karma server. When running this task the build is optimized for the first time and then a karma-owned instance of the browser is opened. Click the "debug" button to open a new tab that executes the unit tests. +![Browser test debugging](http://i.imgur.com/DwHxgfq.png) -### Functional UI Testing +`npm run mocha [test file or dir]` or `npm run mocha:debug [test file or dir]` +Run a one off test with the local project version of mocha, babel compilation, and optional debugging. Great +for development and fixing individual tests. -#### Handy references +#### Unit testing plugins +This should work super if you're using the [Kibana plugin generator](https://github.com/elastic/generator-kibana-plugin). If you're not using the generator, well, you're on your own. We suggest you look at how the generator works. -- https://theintern.github.io/ -- https://theintern.github.io/leadfoot/Element.html +`npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin` +Run the tests for just your particular plugin. Assuming you plugin lives outside of the `installedPlugins directory`, which it should. -#### Running tests using npm task: +#### Running browser automation tests: *The Selenium server that is started currently only runs the tests in Firefox* -To run the functional UI tests use the following commands - -
    +The following will start Kibana, Elasticsearch and Selenium for you. To run the functional UI tests use the following commands -
    npm run test:ui
    -
    Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks.
    +`npm run test:ui` +Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. -
    npm run test:ui:server
    -
    Start the server required for the test:ui:runner tasks. Once the server is started test:ui:runner can be run multiple times without waiting for the server to start.
    +`npm run test:ui:server` +Start the server required for the `test:ui:runner` tasks. Once the server is started `test:ui:runner` can be run multiple times without waiting for the server to start. -
    npm run test:ui:runner
    -
    Execute the front-end selenium tests. This requires the server started by the test:ui:server task.
    +`npm run test:ui:runner` +Execute the front-end selenium tests. This requires the server started by the `test:ui:server` task. -
    - -#### Running tests locally with your existing (and already running) ElasticSearch, Kibana, and Selenium Server: +##### If you already have ElasticSearch, Kibana, and Selenium Server running: Set your es and kibana ports in `test/intern.js` to 9220 and 5620, respectively. You can configure your Selenium server to run the tests on Chrome,IE, or other browsers here. Once you've got the services running, execute the following: -```sh +``` +sh npm run test:ui:runner ``` -#### General notes: +#### Browser automation notes: - Using Page Objects pattern (https://theintern.github.io/intern/#writing-functional-test) - At least the initial tests for the Settings, Discover, and Visualize tabs all depend on a very specific set of logstash-type data (generated with makelogs). Since that is a static set of data, all the Discover and Visualize tests use a specific Absolute time range. This guarantees the same results each run. - These tests have been developed and tested with Chrome and Firefox browser. In theory, they should work on all browsers (that's the benefit of Intern using Leadfoot). - These tests should also work with an external testing service like https://saucelabs.com/ or https://www.browserstack.com/ but that has not been tested. +- https://theintern.github.io/ +- https://theintern.github.io/leadfoot/Element.html + +#### Building OS packages + +Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can be installed using gem. Package building has only been tested on Linux and is not supported on any other platform. +```sh +gem install pleaserun +apt-get install ruby-dev +gem install fpm +npm run build:ospackages +``` + +To specify a package to build you can add `rpm` or `deb` as an argument. +```sh +npm run build:ospackages -- --rpm +``` + +Distributable packages can be found in `target/` after the build completes. ## Submitting a pull request From fd56bb12d72782e9d424082da29ec12c3e73faeb Mon Sep 17 00:00:00 2001 From: Patrick Fournier Date: Tue, 1 Mar 2016 15:52:49 -0500 Subject: [PATCH 26/50] Add a stacking context for .vis-editor-content. Add a z-index property to introduce a stacking context for .vis-editor-content, grouping all children in the same stacking context. --- src/plugins/kibana/public/visualize/editor/styles/_editor.less | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/kibana/public/visualize/editor/styles/_editor.less b/src/plugins/kibana/public/visualize/editor/styles/_editor.less index 36a42ac49f636..00ebb510e805b 100644 --- a/src/plugins/kibana/public/visualize/editor/styles/_editor.less +++ b/src/plugins/kibana/public/visualize/editor/styles/_editor.less @@ -57,6 +57,7 @@ &-content { .flex-parent(); + z-index: 0; // overrides for tablet and desktop @media (min-width: @screen-md-min) { From a7074da257289e9afcd8c3f2341fb900d453edb6 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 1 Mar 2016 15:43:05 -0700 Subject: [PATCH 27/50] Use a filter function instead of string concatonation --- src/ui/public/utils/escape_attr.js | 7 ------- src/ui/public/vislib/lib/dispatch.js | 3 +-- src/ui/public/visualize/visualize_legend.js | 3 +-- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 src/ui/public/utils/escape_attr.js diff --git a/src/ui/public/utils/escape_attr.js b/src/ui/public/utils/escape_attr.js deleted file mode 100644 index 4fad6b8570128..0000000000000 --- a/src/ui/public/utils/escape_attr.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function escapeAttribute(attr) { - const specials = ['#', '&', '~', '=', '>', '\'', ':', '"', '!', ';', ',']; - const regexSpecials = ['.', '*', '+', '|', '[', ']', '(', ')', '/', '^', '$']; - const sRE = new RegExp('(' + specials.join('|') + '|\\' + regexSpecials.join('|\\') + ')', 'g'); - - return attr.replace(sRE, '\\$1'); -} diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index 7dd8577779020..1e3dc82711d03 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -1,7 +1,6 @@ import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; -import escapeAttr from 'ui/utils/escape_attr'; import SimpleEmitter from 'ui/utils/SimpleEmitter'; import VislibComponentsTooltipProvider from 'ui/vislib/components/Tooltip'; export default function DispatchClass(Private) { @@ -231,7 +230,7 @@ export default function DispatchClass(Private) { Dispatch.prototype.highlightLegend = function (element) { var label = this.getAttribute('data-label'); if (!label) return; - $('[data-label]', element.parentNode).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5); + $('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5); }; /** diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 3171b8d111427..b1a32bdc5d81e 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -2,7 +2,6 @@ import _ from 'lodash'; import html from 'ui/visualize/visualize_legend.html'; import $ from 'jquery'; import d3 from 'd3'; -import escapeAttr from 'ui/utils/escape_attr'; import findByParam from 'ui/utils/find_by_param'; import VislibLibDataProvider from 'ui/vislib/lib/data'; import VislibComponentsColorColorProvider from 'ui/vislib/components/color/color'; @@ -31,7 +30,7 @@ uiModules.get('kibana') }); $scope.highlightSeries = function (label) { - $('[data-label]', $elem.siblings()).not('[data-label="' + escapeAttr(label) + '"]').css('opacity', 0.5); + $('[data-label]', $elem.siblings()).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5); }; $scope.unhighlightSeries = function () { From bd77fc9725bc86b9e5b1a7d1f0b69c5bab449a34 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Wed, 2 Mar 2016 11:11:22 -0500 Subject: [PATCH 28/50] Bump target ES version to 5.0.0 to stay in sync with ES master --- src/plugins/elasticsearch/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/elasticsearch/index.js b/src/plugins/elasticsearch/index.js index 38bdb6da95018..b9debc020ec6f 100644 --- a/src/plugins/elasticsearch/index.js +++ b/src/plugins/elasticsearch/index.js @@ -29,7 +29,7 @@ module.exports = function ({ Plugin }) { key: string() }).default(), apiVersion: Joi.string().default('master'), - engineVersion: Joi.string().valid('^3.0.0').default('^3.0.0') + engineVersion: Joi.string().valid('^5.0.0').default('^5.0.0') }).default(); }, From 419434f5c87c2daef6571492fc8c3c29092c1f26 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 2 Mar 2016 11:37:34 -0700 Subject: [PATCH 29/50] 4.x timeout fixes applied to master see PR #6341 and #6377 Fixes #6385 --- config/kibana.yml | 2 +- src/plugins/elasticsearch/lib/create_proxy.js | 11 +++++++++-- src/plugins/elasticsearch/lib/expose_client.js | 4 ++++ src/plugins/elasticsearch/lib/health_check.js | 2 +- src/plugins/testsBundle/testsEntryTemplate.js | 1 + src/ui/index.js | 1 + src/ui/public/es.js | 4 ++-- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/config/kibana.yml b/config/kibana.yml index 721bd83bfcf8e..0f506c91579bc 100644 --- a/config/kibana.yml +++ b/config/kibana.yml @@ -56,7 +56,7 @@ # Time in milliseconds to wait for responses from the back end or Elasticsearch. This value # must be a positive integer. -# elasticsearch.requestTimeout: 300000 +# elasticsearch.requestTimeout: 30000 # Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable. # elasticsearch.shardTimeout: 0 diff --git a/src/plugins/elasticsearch/lib/create_proxy.js b/src/plugins/elasticsearch/lib/create_proxy.js index 9ec30c8d93065..b2a82a07a1bca 100644 --- a/src/plugins/elasticsearch/lib/create_proxy.js +++ b/src/plugins/elasticsearch/lib/create_proxy.js @@ -1,23 +1,30 @@ import createAgent from './create_agent'; import mapUri from './map_uri'; import { resolve } from 'url'; +import { assign } from 'lodash'; function createProxy(server, method, route, config) { const options = { method: method, path: createProxy.createPath(route), + config: { + timeout: { + socket: server.config().get('elasticsearch.requestTimeout') + } + }, handler: { proxy: { mapUri: mapUri(server), passThrough: true, agent: createAgent(server), - xforward: true + xforward: true, + timeout: server.config().get('elasticsearch.requestTimeout') } }, }; - if (config) options.config = config; + assign(options.config, config); server.route(options); }; diff --git a/src/plugins/elasticsearch/lib/expose_client.js b/src/plugins/elasticsearch/lib/expose_client.js index 9a9c45b3d21be..0e82a78449174 100644 --- a/src/plugins/elasticsearch/lib/expose_client.js +++ b/src/plugins/elasticsearch/lib/expose_client.js @@ -19,6 +19,8 @@ module.exports = function (server) { clientKey: config.get('elasticsearch.ssl.key'), ca: config.get('elasticsearch.ssl.ca'), apiVersion: config.get('elasticsearch.apiVersion'), + pingTimeout: config.get('elasticsearch.pingTimeout'), + requestTimeout: config.get('elasticsearch.requestTimeout'), keepAlive: true, auth: true }); @@ -45,6 +47,8 @@ module.exports = function (server) { plugins: options.plugins, apiVersion: options.apiVersion, keepAlive: options.keepAlive, + pingTimeout: options.pingTimeout, + requestTimeout: options.requestTimeout, defer: function () { return Bluebird.defer(); }, diff --git a/src/plugins/elasticsearch/lib/health_check.js b/src/plugins/elasticsearch/lib/health_check.js index 00285903a57cc..3b4b66425faa5 100644 --- a/src/plugins/elasticsearch/lib/health_check.js +++ b/src/plugins/elasticsearch/lib/health_check.js @@ -22,7 +22,7 @@ module.exports = function (plugin, server) { plugin.status.yellow('Waiting for Elasticsearch'); function waitForPong() { - return client.ping({ requestTimeout: 1500 }).catch(function (err) { + return client.ping().catch(function (err) { if (!(err instanceof NoConnections)) throw err; plugin.status.red(format('Unable to connect to Elasticsearch at %s.', config.get('elasticsearch.url'))); diff --git a/src/plugins/testsBundle/testsEntryTemplate.js b/src/plugins/testsBundle/testsEntryTemplate.js index aff1601d50675..61127f4bfc48f 100644 --- a/src/plugins/testsBundle/testsEntryTemplate.js +++ b/src/plugins/testsBundle/testsEntryTemplate.js @@ -27,6 +27,7 @@ window.__KBN__ = { kbnIndex: '.kibana', esShardTimeout: 1500, esApiVersion: '2.0', + esRequestTimeout: '300000' } }; diff --git a/src/ui/index.js b/src/ui/index.js index 2c3981c5fadf4..28b1fc267f1a8 100644 --- a/src/ui/index.js +++ b/src/ui/index.js @@ -64,6 +64,7 @@ module.exports = async (kbnServer, server, config) => { defaultInjectedVars.kbnIndex = config.get('kibana.index'); } if (config.has('elasticsearch')) { + defaultInjectedVars.esRequestTimeout = config.get('elasticsearch.requestTimeout'); defaultInjectedVars.esShardTimeout = config.get('elasticsearch.shardTimeout'); defaultInjectedVars.esApiVersion = config.get('elasticsearch.apiVersion'); } diff --git a/src/ui/public/es.js b/src/ui/public/es.js index 4dc1b7bdc640c..0dffbbf83172c 100644 --- a/src/ui/public/es.js +++ b/src/ui/public/es.js @@ -5,13 +5,13 @@ import uiModules from 'ui/modules'; var es; // share the client amoungst all apps uiModules .get('kibana', ['elasticsearch', 'kibana/config']) - .service('es', function (esFactory, esUrl, $q, esApiVersion) { + .service('es', function (esFactory, esUrl, $q, esApiVersion, esRequestTimeout) { if (es) return es; es = esFactory({ host: esUrl, log: 'info', - requestTimeout: 0, + requestTimeout: esRequestTimeout, apiVersion: esApiVersion, plugins: [function (Client, config) { From 4899e4b177c789159573d6d435e1a8c4a098c562 Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Thu, 3 Mar 2016 00:35:36 +0100 Subject: [PATCH 30/50] Removes the duplicated folder to be watch. Watching the same folder twice hangs the watcher chokidar. All the plugins folders are watched and this folder is included by default as plugin folder and also directly in the watcher configuration. --- src/cli/cluster/cluster_manager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index a80423be31049..bf5d7283498b9 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -86,7 +86,6 @@ module.exports = class ClusterManager { const fromRoot = require('../../utils/fromRoot'); this.watcher = chokidar.watch([ - 'src/plugins', 'src/server', 'src/ui', 'src/utils', From 7f59d754bdd9ec9eed42709b635b3c280d513cad Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 3 Mar 2016 13:33:00 -0700 Subject: [PATCH 31/50] [courier/fetch] cleanup after some feedback --- src/ui/public/courier/fetch/__tests__/fetch_these.js | 1 - src/ui/public/courier/fetch/request/doc.js | 2 -- src/ui/public/courier/fetch/request/search.js | 2 -- src/ui/public/courier/fetch/request/segmented_handle.js | 2 -- 4 files changed, 7 deletions(-) diff --git a/src/ui/public/courier/fetch/__tests__/fetch_these.js b/src/ui/public/courier/fetch/__tests__/fetch_these.js index 8dcd80080d650..513373af11b7f 100644 --- a/src/ui/public/courier/fetch/__tests__/fetch_these.js +++ b/src/ui/public/courier/fetch/__tests__/fetch_these.js @@ -1,4 +1,3 @@ -// import _ from 'lodash'; import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ngMock'; diff --git a/src/ui/public/courier/fetch/request/doc.js b/src/ui/public/courier/fetch/request/doc.js index ac41d141c8cdd..bbe0d12e7ee6c 100644 --- a/src/ui/public/courier/fetch/request/doc.js +++ b/src/ui/public/courier/fetch/request/doc.js @@ -1,5 +1,3 @@ -import _ from 'lodash'; - import DocStrategyProvider from '../strategy/doc'; import AbstractRequestProvider from './request'; diff --git a/src/ui/public/courier/fetch/request/search.js b/src/ui/public/courier/fetch/request/search.js index 3556a8aee9c42..9ae5b8398bc7d 100644 --- a/src/ui/public/courier/fetch/request/search.js +++ b/src/ui/public/courier/fetch/request/search.js @@ -1,5 +1,3 @@ -import _ from 'lodash'; - import SearchStrategyProvider from '../strategy/search'; import AbstractRequestProvider from './request'; diff --git a/src/ui/public/courier/fetch/request/segmented_handle.js b/src/ui/public/courier/fetch/request/segmented_handle.js index 811267e835b1c..702378d8392ae 100644 --- a/src/ui/public/courier/fetch/request/segmented_handle.js +++ b/src/ui/public/courier/fetch/request/segmented_handle.js @@ -1,5 +1,3 @@ -import _ from 'lodash'; - import EventsProvider from 'ui/events'; export default function CourierSegmentedReqHandle(Private) { From 414ba105c4991b15a383ffe9bd958571da89a50b Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Thu, 3 Mar 2016 22:11:20 +0100 Subject: [PATCH 32/50] Update chokidar to version 1.4.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 222446e3b872c..5bafa0d690d51 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "angular-mocks": "1.4.7", "auto-release-sinon": "1.0.3", "babel-eslint": "4.1.8", - "chokidar": "1.0.5", + "chokidar": "1.4.3", "eslint": "1.10.3", "eslint-plugin-mocha": "1.1.0", "expect.js": "0.3.1", From 32f6667e3d78677c41be9243cbe549401fff24f4 Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Thu, 3 Mar 2016 22:21:04 +0100 Subject: [PATCH 33/50] Watch function now receives a uniq array of absolute paths. --- src/cli/cluster/cluster_manager.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index bf5d7283498b9..ccb591f410335 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -1,8 +1,8 @@ import cluster from 'cluster'; -const { join } = require('path'); +const { join, resolve } = require('path'); const { format: formatUrl } = require('url'); import Hapi from 'hapi'; -const { debounce, compact, get, invoke, bindAll, once, sample } = require('lodash'); +const { debounce, compact, get, invoke, bindAll, once, sample, uniq } = require('lodash'); import Log from '../Log'; import Worker from './worker'; @@ -85,13 +85,16 @@ module.exports = class ClusterManager { const chokidar = require('chokidar'); const fromRoot = require('../../utils/fromRoot'); - this.watcher = chokidar.watch([ + const watchPaths = uniq([ + 'src/plugins', 'src/server', 'src/ui', 'src/utils', 'config', ...extraPaths - ], { + ].map(path => resolve(path))); + + this.watcher = chokidar.watch(watchPaths, { cwd: fromRoot('.'), ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__)[\\\/]/ }); From 75008a2fc92f7932c17319dd3014e5108109d445 Mon Sep 17 00:00:00 2001 From: Shelby Sturgis Date: Thu, 3 Mar 2016 15:55:51 -0800 Subject: [PATCH 34/50] Closes #6283. Fixes date format error for millisecond intervals. --- src/ui/public/config/defaults.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/public/config/defaults.js b/src/ui/public/config/defaults.js index c167e814bf3e3..50f2215192f2c 100644 --- a/src/ui/public/config/defaults.js +++ b/src/ui/public/config/defaults.js @@ -32,7 +32,7 @@ export default function configDefaultsProvider() { type: 'json', value: '[\n' + - ' ["", "hh:mm:ss.SSS"],\n' + + ' ["", "HH:mm:ss.SSS"],\n' + ' ["PT1S", "HH:mm:ss"],\n' + ' ["PT1M", "HH:mm"],\n' + ' ["PT1H",\n' + From e1eafc5567df1b2a284b7b1454511e01ddb07607 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 4 Mar 2016 11:08:15 -0500 Subject: [PATCH 35/50] Bump node to 4.3.2 --- .node-version | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.node-version b/.node-version index f77856a6f1af5..cc2fbe89b6c7c 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -4.3.1 +4.3.2 diff --git a/package.json b/package.json index 222446e3b872c..8777f8ae32f61 100644 --- a/package.json +++ b/package.json @@ -189,7 +189,7 @@ "supertest-as-promised": "2.0.2" }, "engines": { - "node": "4.3.1", + "node": "4.3.2", "npm": "2.14.21" } } From 9d825ef57babafb40659c31c56bf86ac83e80f7e Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Fri, 4 Mar 2016 11:08:32 -0500 Subject: [PATCH 36/50] Bump npm to 2.14.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8777f8ae32f61..bc713698ef02f 100644 --- a/package.json +++ b/package.json @@ -190,6 +190,6 @@ }, "engines": { "node": "4.3.2", - "npm": "2.14.21" + "npm": "2.14.22" } } From 2faa3ee2f58f6e3e2ee839022184c3b52b94b407 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Fri, 4 Mar 2016 15:48:14 -0500 Subject: [PATCH 37/50] Remove outdated mapping options that were copied over from logstash template --- .../kibana/server/lib/create_mappings_from_pattern_fields.js | 2 -- src/plugins/kibana/server/routes/api/ingest/register_post.js | 2 -- .../scenarios/logstashFunctional/makelogsIndexDefinition.js | 1 - test/fixtures/scenarios/makelogs/makelogsIndexDefinition.js | 1 - 4 files changed, 6 deletions(-) diff --git a/src/plugins/kibana/server/lib/create_mappings_from_pattern_fields.js b/src/plugins/kibana/server/lib/create_mappings_from_pattern_fields.js index db8891fb98ece..d05e650991613 100644 --- a/src/plugins/kibana/server/lib/create_mappings_from_pattern_fields.js +++ b/src/plugins/kibana/server/lib/create_mappings_from_pattern_fields.js @@ -15,8 +15,6 @@ module.exports = function createMappingsFromPatternFields(fields) { mapping = { type: 'string', index: 'analyzed', - omit_norms: true, - fielddata: {format: 'disabled'}, fields: { raw: {type: 'string', index: 'not_analyzed', doc_values: true, ignore_above: 256} } diff --git a/src/plugins/kibana/server/routes/api/ingest/register_post.js b/src/plugins/kibana/server/routes/api/ingest/register_post.js index 82972768c6481..b36b778232fdd 100644 --- a/src/plugins/kibana/server/routes/api/ingest/register_post.js +++ b/src/plugins/kibana/server/routes/api/ingest/register_post.js @@ -59,8 +59,6 @@ module.exports = function registerPost(server) { mapping: { type: 'string', index: 'analyzed', - omit_norms: true, - fielddata: {format: 'disabled'}, fields: { raw: {type: 'string', index: 'not_analyzed', doc_values: true, ignore_above: 256} } diff --git a/test/fixtures/scenarios/logstashFunctional/makelogsIndexDefinition.js b/test/fixtures/scenarios/logstashFunctional/makelogsIndexDefinition.js index 67ecf94ca3013..95b416ea852f0 100644 --- a/test/fixtures/scenarios/logstashFunctional/makelogsIndexDefinition.js +++ b/test/fixtures/scenarios/logstashFunctional/makelogsIndexDefinition.js @@ -21,7 +21,6 @@ module.exports = { 'mapping': { 'type': 'string', 'index': 'analyzed', - 'omit_norms': true, 'fields': { 'raw': { 'index': 'not_analyzed', diff --git a/test/fixtures/scenarios/makelogs/makelogsIndexDefinition.js b/test/fixtures/scenarios/makelogs/makelogsIndexDefinition.js index 67ecf94ca3013..95b416ea852f0 100644 --- a/test/fixtures/scenarios/makelogs/makelogsIndexDefinition.js +++ b/test/fixtures/scenarios/makelogs/makelogsIndexDefinition.js @@ -21,7 +21,6 @@ module.exports = { 'mapping': { 'type': 'string', 'index': 'analyzed', - 'omit_norms': true, 'fields': { 'raw': { 'index': 'not_analyzed', From f4d3e03ed319d819f1103e9c1ef228a47ac67067 Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Sat, 5 Mar 2016 06:00:47 +0100 Subject: [PATCH 38/50] Now hightlights the hovered element --- src/ui/public/vislib/lib/dispatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index c375583d3af34..3d75697085287 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -236,7 +236,7 @@ export default function DispatchClass(Private) { Dispatch.prototype.highlight = function (element) { var label = this.getAttribute('data-label'); if (!label) return; - $('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5); + $('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') === label; }).css('opacity', 0.5); }; /** From ca2264d12c04b3a0c30f5bf103fbf7a9edaf4238 Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Sat, 5 Mar 2016 06:19:32 +0100 Subject: [PATCH 39/50] Prevent css application to the hovered element --- src/ui/public/vislib/lib/dispatch.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index 3d75697085287..dfc476054103c 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -236,7 +236,10 @@ export default function DispatchClass(Private) { Dispatch.prototype.highlight = function (element) { var label = this.getAttribute('data-label'); if (!label) return; - $('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') === label; }).css('opacity', 0.5); + //Opacity 1 is needed to avoid the css application + $('[data-label]', element.parentNode).css('opacity', 1).not( + function (els, el) { return `${$(el).data('label')}` === label;} + ).css('opacity', 0.5); }; /** From 2d04b3a09ce9b8446e93269b3b24521c19175125 Mon Sep 17 00:00:00 2001 From: David Vega Fontelos Date: Sat, 5 Mar 2016 06:21:04 +0100 Subject: [PATCH 40/50] Change to a filter function instead of string concatenation --- src/ui/public/vislib/visualizations/area_chart.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ui/public/vislib/visualizations/area_chart.js b/src/ui/public/vislib/visualizations/area_chart.js index cd18fd947e50c..63afcdd282265 100644 --- a/src/ui/public/vislib/visualizations/area_chart.js +++ b/src/ui/public/vislib/visualizations/area_chart.js @@ -40,7 +40,9 @@ export default function AreaChartFactory(Private) { if (!label) return; var highlightOpacity = 0.8; - var highlightElements = $('[data-label="' + label + '"]', element.parentNode); + var highlightElements = $('[data-label]', element.parentNode).filter( + function (els, el) { return `${$(el).data('label')}` === label; + }); $('[data-label]', element.parentNode).not(highlightElements).css('opacity', defaultOpacity / 2); // half of the default opacity highlightElements.css('opacity', highlightOpacity); }; From 0cacfe6ddf9cfc23275f8bd8f58ccf1e8dbc8b38 Mon Sep 17 00:00:00 2001 From: Shivam Dixit Date: Mon, 7 Mar 2016 21:26:41 +0530 Subject: [PATCH 41/50] Fix typo in caution message Signed-off-by: Shivam Dixit --- src/plugins/kibana/public/settings/sections/advanced/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/kibana/public/settings/sections/advanced/index.html b/src/plugins/kibana/public/settings/sections/advanced/index.html index a2894631dc868..13f85f7c88194 100644 --- a/src/plugins/kibana/public/settings/sections/advanced/index.html +++ b/src/plugins/kibana/public/settings/sections/advanced/index.html @@ -3,7 +3,7 @@

    Caution: You can break stuff here

    Be careful in here, these settings are for very advanced users only. - Tweaks you make here can break large portionsof Kibana. Some of these + Tweaks you make here can break large portions of Kibana. Some of these settings may be undocumented, unsupported or experimental. If a field has a default value, blanking the field will reset it to its default which may be unacceptable given other configuration directives. Deleting a From 5d1796bed2c44c52bd1db471b30c5dd007b223fa Mon Sep 17 00:00:00 2001 From: Spencer Date: Mon, 7 Mar 2016 13:39:34 -0700 Subject: [PATCH 42/50] [test] extend timeout to avoid false negatives --- src/plugins/elasticsearch/lib/__tests__/routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/elasticsearch/lib/__tests__/routes.js b/src/plugins/elasticsearch/lib/__tests__/routes.js index b5f94d8f3e82f..c4bacca30d553 100644 --- a/src/plugins/elasticsearch/lib/__tests__/routes.js +++ b/src/plugins/elasticsearch/lib/__tests__/routes.js @@ -11,7 +11,7 @@ describe('plugins/elasticsearch', function () { let kbnServer; before(function () { - this.timeout(15000); // sometimes waiting for server takes longer than 10 + this.timeout(60000); // sometimes waiting for server takes longer than 10 kbnServer = kbnTestServer.createServer(); return kbnServer.ready() From befe5f30d8070488735a0e9fd6080f27f1824391 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 7 Mar 2016 13:48:45 -0700 Subject: [PATCH 43/50] [cli/clustering] resolve our paths relative to root, not CWD --- src/cli/cluster/cluster_manager.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cli/cluster/cluster_manager.js b/src/cli/cluster/cluster_manager.js index ccb591f410335..ca9227912404c 100644 --- a/src/cli/cluster/cluster_manager.js +++ b/src/cli/cluster/cluster_manager.js @@ -85,14 +85,17 @@ module.exports = class ClusterManager { const chokidar = require('chokidar'); const fromRoot = require('../../utils/fromRoot'); - const watchPaths = uniq([ - 'src/plugins', - 'src/server', - 'src/ui', - 'src/utils', - 'config', - ...extraPaths - ].map(path => resolve(path))); + const watchPaths = uniq( + [ + fromRoot('src/plugins'), + fromRoot('src/server'), + fromRoot('src/ui'), + fromRoot('src/utils'), + fromRoot('config'), + ...extraPaths + ] + .map(path => resolve(path)) + ); this.watcher = chokidar.watch(watchPaths, { cwd: fromRoot('.'), From bdf2c0a1a79fa558761129a878c3e33c019a5ef4 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Mon, 7 Mar 2016 17:21:06 -0700 Subject: [PATCH 44/50] [elasticsearch/client] expose client logging class --- .../elasticsearch/lib/expose_client.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/plugins/elasticsearch/lib/expose_client.js b/src/plugins/elasticsearch/lib/expose_client.js index 0e82a78449174..0c81c07d25c7f 100644 --- a/src/plugins/elasticsearch/lib/expose_client.js +++ b/src/plugins/elasticsearch/lib/expose_client.js @@ -9,6 +9,19 @@ import callWithRequest from './call_with_request'; module.exports = function (server) { const config = server.config(); + class ElasticsearchClientLogging { + error(err) { + server.log(['error', 'elasticsearch'], err); + } + warning(message) { + server.log(['warning', 'elasticsearch'], message); + } + info() {} + debug() {} + trace() {} + close() {} + } + function createClient(options) { options = _.defaults(options || {}, { url: config.get('elasticsearch.url'), @@ -52,18 +65,7 @@ module.exports = function (server) { defer: function () { return Bluebird.defer(); }, - log: function () { - this.error = function (err) { - server.log(['error', 'elasticsearch'], err); - }; - this.warning = function (message) { - server.log(['warning', 'elasticsearch'], message); - }; - this.info = _.noop; - this.debug = _.noop; - this.trace = _.noop; - this.close = _.noop; - } + log: ElasticsearchClientLogging }); } @@ -73,6 +75,7 @@ module.exports = function (server) { const noAuthClient = createClient({ auth: false }); server.on('close', _.bindKey(noAuthClient, 'close')); + server.expose('ElasticsearchClientLogging', ElasticsearchClientLogging); server.expose('client', client); server.expose('createClient', createClient); server.expose('callWithRequestFactory', callWithRequest); From 4f72ae2c29bdf33baecf2bc685054ace6efcc429 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 8 Mar 2016 09:11:33 -0700 Subject: [PATCH 45/50] Add step about merging the target branch --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 20499d10d616c..6cbdae5c3e236 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -221,6 +221,7 @@ Remember, someone is blocked by a pull awaiting review, make it count. Be thorou 1. **Understand the issue** that is being fixed, or the feature being added. Check the description on the pull, and check out the related issue. If you don't understand something, ask the person the submitter for clarification. 1. **Reproduce the bug** (or the lack of feature I guess?) in the destination branch, usually `master`. The referenced issue will help you here. If you're unable to reproduce the issue, contact the issue submitter for clarification 1. **Check out the pull** and test it. Is the issue fixed? Does it have nasty side effects? Try to create suspect inputs. If it operates on the value of a field try things like: strings (including an empty string), null, numbers, dates. Try to think of edge cases that might break the code. +1. **Merge the target branch**. It is possible that tests or the linter have been updated in the target branch since the pull was submitted. Merging the pull could cause core to start failing. 1. **Read the code**. Understanding the changes will help you find additional things to test. Contact the submitter if you don't understand something. 1. **Go line-by-line**. Are there [style guide](https://github.com/elastic/kibana/blob/master/STYLEGUIDE.md) violations? Strangely named variables? Magic numbers? Do the abstractions make sense to you? Are things arranged in a testable way? 1. **Speaking of tests** Are they there? If a new function was added does it have tests? Do the tests, well, TEST anything? Do they just run the function or do they properly check the output? From f7f7d0ffa4a64086e9c6d4c0fa16fafd080c8a3b Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Tue, 8 Mar 2016 11:14:25 -0500 Subject: [PATCH 46/50] fix linter errors --- src/ui/public/vislib/lib/dispatch.js | 4 ++-- src/ui/public/vislib/visualizations/area_chart.js | 5 +++-- src/ui/public/visualize/visualize_legend.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ui/public/vislib/lib/dispatch.js b/src/ui/public/vislib/lib/dispatch.js index dfc476054103c..63077e894bbe0 100644 --- a/src/ui/public/vislib/lib/dispatch.js +++ b/src/ui/public/vislib/lib/dispatch.js @@ -106,7 +106,7 @@ export default function DispatchClass(Private) { var isClickable = this.listenerCount('click') > 0; var addEvent = this.addEvent; var $el = this.handler.el; - if(!this.handler.highlight) { + if (!this.handler.highlight) { this.handler.highlight = self.highlight; } @@ -132,7 +132,7 @@ export default function DispatchClass(Private) { var self = this; var addEvent = this.addEvent; var $el = this.handler.el; - if(!this.handler.unHighlight) { + if (!this.handler.unHighlight) { this.handler.unHighlight = self.unHighlight; } diff --git a/src/ui/public/vislib/visualizations/area_chart.js b/src/ui/public/vislib/visualizations/area_chart.js index 63afcdd282265..cda249b458b86 100644 --- a/src/ui/public/vislib/visualizations/area_chart.js +++ b/src/ui/public/vislib/visualizations/area_chart.js @@ -41,8 +41,9 @@ export default function AreaChartFactory(Private) { var highlightOpacity = 0.8; var highlightElements = $('[data-label]', element.parentNode).filter( - function (els, el) { return `${$(el).data('label')}` === label; - }); + function (els, el) { + return `${$(el).data('label')}` === label; + }); $('[data-label]', element.parentNode).not(highlightElements).css('opacity', defaultOpacity / 2); // half of the default opacity highlightElements.css('opacity', highlightOpacity); }; diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 1924e4e97cc09..bd2cbe281ec3c 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -32,14 +32,14 @@ uiModules.get('kibana') $scope.highlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; - if(!handler) return; + if (!handler) return; handler.highlight.call(el, handler.el); }; $scope.unhighlight = function (event) { var el = event.currentTarget; var handler = $scope.renderbot.vislibVis.handler; - if(!handler) return; + if (!handler) return; handler.unHighlight.call(el, handler.el); }; From af5ab8a86bf40389a04e6a42e9101d7c53fa4f24 Mon Sep 17 00:00:00 2001 From: spalger Date: Tue, 8 Mar 2016 09:22:10 -0700 Subject: [PATCH 47/50] [es/kibanaIndex] use unmapped_type rather than ignore_unmapped https://www.elastic.co/guide/en/elasticsearch/reference/1.6/search-request-sort.html#_ignoring_unmapped_fields --- .../elasticsearch/lib/create_kibana_index.js | 13 +++---------- .../elasticsearch/lib/kibana_index_mappings.js | 10 ++++++++++ src/plugins/elasticsearch/lib/migrate_config.js | 12 +++++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 src/plugins/elasticsearch/lib/kibana_index_mappings.js diff --git a/src/plugins/elasticsearch/lib/create_kibana_index.js b/src/plugins/elasticsearch/lib/create_kibana_index.js index d122ef4e3214c..b35e13fa84156 100644 --- a/src/plugins/elasticsearch/lib/create_kibana_index.js +++ b/src/plugins/elasticsearch/lib/create_kibana_index.js @@ -1,5 +1,7 @@ import SetupError from './setup_error'; import { format } from 'util'; +import { mappings } from './kibana_index_mappings'; + module.exports = function (server) { const client = server.plugins.elasticsearch.client; const index = server.config().get('kibana.index'); @@ -16,16 +18,7 @@ module.exports = function (server) { settings: { number_of_shards: 1 }, - mappings: { - config: { - properties: { - buildNum: { - type: 'string', - index: 'not_analyzed' - } - } - } - } + mappings } }) .catch(handleError('Unable to create Kibana index "<%= kibana.index %>"')) diff --git a/src/plugins/elasticsearch/lib/kibana_index_mappings.js b/src/plugins/elasticsearch/lib/kibana_index_mappings.js new file mode 100644 index 0000000000000..0d0204aeeecb5 --- /dev/null +++ b/src/plugins/elasticsearch/lib/kibana_index_mappings.js @@ -0,0 +1,10 @@ +export const mappings = { + config: { + properties: { + buildNum: { + type: 'string', + index: 'not_analyzed' + } + } + } +}; diff --git a/src/plugins/elasticsearch/lib/migrate_config.js b/src/plugins/elasticsearch/lib/migrate_config.js index 0eba1e0621717..7b16990e21297 100644 --- a/src/plugins/elasticsearch/lib/migrate_config.js +++ b/src/plugins/elasticsearch/lib/migrate_config.js @@ -1,4 +1,5 @@ import upgrade from './upgrade_config'; +import { mappings } from './kibana_index_mappings'; module.exports = function (server) { const config = server.config(); @@ -8,11 +9,16 @@ module.exports = function (server) { type: 'config', body: { size: 1000, - sort: [ { buildNum: { order: 'desc', ignore_unmapped: true } } ] + sort: [ + { + buildNum: { + order: 'desc', + unmapped_type: mappings.config.properties.buildNum.type + } + } + ] } }; return client.search(options).then(upgrade(server)); }; - - From e68fdf606de73e687bd91e1930f9f478a4042fe2 Mon Sep 17 00:00:00 2001 From: Jim Unger Date: Tue, 8 Mar 2016 12:13:20 -0600 Subject: [PATCH 48/50] [share url] fixes buttons on share panel using dark theme --- src/ui/public/share/views/share_object_url.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/public/share/views/share_object_url.html b/src/ui/public/share/views/share_object_url.html index 6c1b1438e9e90..b4dbfc3277fdd 100644 --- a/src/ui/public/share/views/share_object_url.html +++ b/src/ui/public/share/views/share_object_url.html @@ -6,14 +6,14 @@ class="form-control url">