Merge branch 'master' of github.com:elastic/kibana into renameAllFiles

This commit is contained in:
spalger 2016-03-07 14:09:39 -07:00
commit 00bf02ab29
32 changed files with 120 additions and 105 deletions

View file

@ -1 +1 @@
4.3.0
4.3.2

View file

@ -13,7 +13,7 @@ At any given time the Kibana team at Elastic is working on dozens of features an
Let's just get this out there: **Feel free to +1 an issue**. That said, a +1 isn't a vote. We keep up on highly commented issues, but comments are but one of many reasons we might, or might not, work on an issue. A solid write up of your use case is more likely to make your case than a comment that says *+10000*.
#### My issue isn't getting enough attention
First of all, sorry about that, we want you to have a great time with Kibana! You should join us on IRC (#kibana on freenode) and chat about it. Github is terrible for conversations. With that out of the way, there are a number of variables that go into deciding what to work on. These include priority, impact, difficulty, applicability to use cases, and last, and importantly: What we feel like working on.
First of all, sorry about that, we want you to have a great time with Kibana! You should join us on IRC ([#kibana](https://kiwiirc.com/client/irc.freenode.net/?#kibana) on freenode) and chat about it. Github is terrible for conversations. With that out of the way, there are a number of variables that go into deciding what to work on. These include priority, impact, difficulty, applicability to use cases, and last, and importantly: What we feel like working on.
### I want to help!
**Now we're talking**. If you have a bugfix or new feature that you would like to contribute to Kibana, please **find or open an issue about it before you start working on it.** Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change.
@ -111,36 +111,73 @@ 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.
<dl>
<dt><code>npm run test:quick</code></dt>
<dd>Runs both server and browser tests, but skips linting</dd>
<dt><code>npm run test:server</code> or <code>npm run test:browser</code></dt>
<dd>Runs the tests for just the server or browser</dd>
`npm run test:quick`
Runs both server and browser tests, but skips linting
<dt><code>npm run test:dev</code></dt>
<dd>
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.
<br>
<img src="http://i.imgur.com/DwHxgfq.png">
</dd>
`npm run test:server`
Run only the server tests
<dt><code>npm run mocha [test file or dir]</code> or <code>npm run mocha:debug [test file or dir]</code></dt>
<dd>
Run a one off test with the local project version of mocha, babel compilation, and optional debugging. Great
for development and fixing individual tests.
</dd>
</dl>
`npm run test:browser`
Run only the browser tests
Distributable packages can be found in `target/` after the build completes.
`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)
`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.
#### 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.
`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 browser automation tests:
*The Selenium server that is started currently only runs the tests in Firefox*
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: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.
##### 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
npm run test:ui:runner
```
#### 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
@ -157,48 +194,7 @@ To specify a package to build you can add `rpm` or `deb` as an argument.
npm run build:ospackages -- --rpm
```
### Functional UI Testing
#### Handy references
- https://theintern.github.io/
- https://theintern.github.io/leadfoot/Element.html
#### Running tests using npm task:
*The Selenium server that is started currently only runs the tests in Firefox*
To run the functional UI tests use the following commands
<dl>
<dt><code>npm run test:ui</code></dt>
<dd>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.</dd>
<dt><code>npm run test:ui:server</code></dt>
<dd>Start the server required for the <code>test:ui:runner</code> tasks. Once the server is started <code>test:ui:runner</code> can be run multiple times without waiting for the server to start.</dd>
<dt><code>npm run test:ui:runner</code></dt>
<dd>Execute the front-end selenium tests. This requires the server started by the <code>test:ui:server</code> task.</dd>
</dl>
#### Running tests locally with your existing (and already running) ElasticSearch, Kibana, and Selenium Server:
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
npm run test:ui:runner
```
#### General 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.
Distributable packages can be found in `target/` after the build completes.
## Submitting a pull request

View file

@ -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

View file

@ -22,11 +22,11 @@ has the following fingerprint:
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
--------------------------------------------------
+
. Add the repository definition to your `/etc/apt/sources.list` file:
. Add the repository definition to your `/etc/apt/sources.list.d/kibana.list` file:
+
[source, sh]
--------------------------------------------------
echo "deb http://packages.elastic.co/kibana/{branch}/debian stable main" | sudo tee -a /etc/apt/sources.list
echo "deb http://packages.elastic.co/kibana/{branch}/debian stable main" | sudo tee -a /etc/apt/sources.list.d/kibana.list
--------------------------------------------------
+
[WARNING]
@ -37,7 +37,7 @@ When the `deb-src` entry, is present, the commands in this procedure generate an
Unable to find expected entry 'main/source/Sources' in Release file (Wrong sources.list entry or malformed file)
Delete the `deb-src` entry from the `/etc/apt/sources.list` file to clear the error.
Delete the `deb-src` entry from the `/etc/apt/sources.list.d/kibana.list` file to clear the error.
==================================================
+
. Run `apt-get update` and the repository is ready for use. Install Kibana with the following command:

View file

@ -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"
@ -130,7 +131,7 @@
"rimraf": "2.4.3",
"rjs-repack-loader": "1.0.6",
"script-loader": "0.6.1",
"semver": "4.3.6",
"semver": "5.1.0",
"style-loader": "0.12.3",
"tar": "2.2.0",
"url-loader": "0.5.6",
@ -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",
@ -187,7 +189,7 @@
"supertest-as-promised": "2.0.2"
},
"engines": {
"node": "4.3.0",
"npm": "2.14.15"
"node": "4.3.2",
"npm": "2.14.22"
}
}

View file

@ -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();
},

View file

@ -11,6 +11,8 @@ describe('plugins/elasticsearch', function () {
let kbnServer;
before(function () {
this.timeout(60000); // sometimes waiting for server takes longer than 10
kbnServer = kbnTestServer.createServer();
return kbnServer.ready()
.then(() => kbnServer.server.plugins.elasticsearch.waitUntilReady());

View file

@ -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);
};

View file

@ -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();
},

View file

@ -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')));

View file

@ -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,

View file

@ -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'))

View file

@ -3,7 +3,7 @@
<div class="bs-callout bs-callout-warning">
<h4>Caution: You can break stuff here</h4>
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

View file

@ -13,7 +13,7 @@
<!-- tabs -->
<ul class="nav navbar-nav">
<li ng-class="{active: sidebar.section == 'data'}" ng-show="vis.type.schemas.metrics">
<li ng-class="{active: sidebar.section == 'data'}" ng-show="sidebar.showData">
<a class="navbar-link active" ng-click="sidebar.section='data'">Data</a>
</li>
<li ng-class="{active: sidebar.section == 'options'}">
@ -60,10 +60,9 @@
<div class="vis-editor-config" ng-show="sidebar.section == 'options'">
<!-- vis options -->
<vis-editor-vis-options vis="vis"></vis-editor-vis-options>
<vis-editor-vis-options vis="vis" saved-vis="savedVis"></vis-editor-vis-options>
</div>
</form>
</div>

View file

@ -16,7 +16,12 @@ uiModules
controller: function ($scope) {
$scope.$bind('vis', 'editableVis');
$scope.$bind('outputVis', 'vis');
this.section = _.get($scope, 'vis.type.requiresSearch') ? 'data' : 'options';
$scope.$watch('vis.type', (visType) => {
if (visType) {
this.showData = visType.schemas.buckets || visType.schemas.metrics;
this.section = this.section || (this.showData ? 'data' : 'options');
}
});
}
};
});

View file

@ -57,6 +57,7 @@
&-content {
.flex-parent();
z-index: 0;
// overrides for tablet and desktop
@media (min-width: @screen-md-min) {

View file

@ -11,6 +11,7 @@ uiModules
template: visOptionsTemplate,
scope: {
vis: '=',
savedVis: '=',
},
link: function ($scope, $el) {
const $optionContainer = $el.find('.visualization-options');

View file

@ -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}
}

View file

@ -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}
}

View file

@ -27,6 +27,7 @@ window.__KBN__ = {
kbnIndex: '.kibana',
esShardTimeout: 1500,
esApiVersion: '2.0',
esRequestTimeout: '300000'
}
};

View file

@ -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);
}
});

View file

@ -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');
}

View file

@ -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',

View file

@ -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) {

View file

@ -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());
}

View file

@ -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) {

View file

@ -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);
});

View file

@ -230,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="' + label + '"]').css('opacity', 0.5);
$('[data-label]', element.parentNode).not(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5);
};
/**

View file

@ -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];

View file

@ -30,7 +30,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(function (els, el) { return $(el).data('label') !== label;}).css('opacity', 0.5);
};
$scope.unhighlightSeries = function () {

View file

@ -21,7 +21,6 @@ module.exports = {
'mapping': {
'type': 'string',
'index': 'analyzed',
'omit_norms': true,
'fields': {
'raw': {
'index': 'not_analyzed',

View file

@ -21,7 +21,6 @@ module.exports = {
'mapping': {
'type': 'string',
'index': 'analyzed',
'omit_norms': true,
'fields': {
'raw': {
'index': 'not_analyzed',