Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/elastic/kibana into saved…
Browse files Browse the repository at this point in the history
…_object_refactor
  • Loading branch information
stacey-gammon committed Nov 28, 2016
2 parents 41441bf + 469a211 commit e3ff0ad
Show file tree
Hide file tree
Showing 70 changed files with 1,747 additions and 351 deletions.
2 changes: 2 additions & 0 deletions docs/visualize.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ include::visualize/pie.asciidoc[]
include::visualize/tilemap.asciidoc[]

include::visualize/vertbar.asciidoc[]

include::visualize/tagcloud.asciidoc[]
44 changes: 44 additions & 0 deletions docs/visualize/tagcloud.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[[tagcloud-chart]]
== Cloud Tag Charts

A tag cloud visualization is a visual representation of text data, typically used to visualize free form text.
Tags are usually single words, and the importance of each tag is shown with font size or color.

The font size for each word is determined by the _metrics_ aggregation. The following aggregations are available for
this chart:

include::y-axis-aggs.asciidoc[]


The _buckets_ aggregations determine what information is being retrieved from your data set.

Before you choose a buckets aggregation, select the *Split Tags* option.

You can specify the following bucket aggregations for tag cloud visualization:

*Terms*:: A {es-ref}search-aggregations-bucket-terms-aggregation.html[_terms_] aggregation enables you to specify the top
or bottom _n_ elements of a given field to display, ordered by count or a custom metric.

You can click the *Advanced* link to display more customization options for your metrics or bucket aggregation:

*JSON Input*:: A text field where you can add specific JSON-formatted properties to merge with the aggregation
definition, as in the following example:

[source,shell]
{ "script" : "doc['grade'].value * 1.2" }

NOTE: In Elasticsearch releases 1.4.3 and later, this functionality requires you to enable
{es-ref}modules-scripting.html[dynamic Groovy scripting].


Select the *Options* tab to change the following aspects of the chart:

*Text Scale*:: You can select *linear*, *log*, or *square root* scales for the text scale. You can use a log
scale to display data that varies exponentially or a square root scale to
regularize the display of data sets with variabilities that are themselves highly variable.
*Orientation*:: You can select how to orientate your text in the tag cloud. You can choose one of the following options:
Single, right angles and multiple.
*Font Size*:: Allows you to set minimum and maximum font size to use for this visualization.


include::visualization-raw-data.asciidoc[]
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"commander": "2.8.1",
"css-loader": "0.17.0",
"d3": "3.5.6",
"d3-cloud": "1.2.1",
"dragula": "3.7.0",
"elasticsearch": "12.0.0-rc5",
"elasticsearch-browser": "12.0.0-rc5",
Expand Down Expand Up @@ -138,6 +139,7 @@
"mkdirp": "0.5.1",
"moment": "2.13.0",
"moment-timezone": "0.5.4",
"no-ui-slider": "1.2.0",
"node-fetch": "1.3.2",
"node-uuid": "1.4.7",
"pegjs": "0.9.0",
Expand Down
24 changes: 24 additions & 0 deletions src/core_plugins/elasticsearch/lib/__tests__/check_es_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ describe('plugins/elasticsearch', () => {
client.nodes.info = sinon.stub().returns(Promise.resolve({ nodes: nodes }));
}

function setNodeWithoutHTTP(version) {
const nodes = { 'node-without-http': { version, ip: 'ip' } };
const client = server.plugins.elasticsearch.client;
client.nodes.info = sinon.stub().returns(Promise.resolve({ nodes: nodes }));
}

it('returns true with single a node that matches', async () => {
setNodes('5.1.0');
const result = await checkEsVersion(server, KIBANA_VERSION);
Expand Down Expand Up @@ -99,6 +105,24 @@ describe('plugins/elasticsearch', () => {
expect(server.log.getCall(1).args[0]).to.contain('warning');
});

it('warns if a node is off by a patch version and without http publish address', async () => {
setNodeWithoutHTTP('5.1.1');
await checkEsVersion(server, KIBANA_VERSION);
sinon.assert.callCount(server.log, 2);
expect(server.log.getCall(0).args[0]).to.contain('debug');
expect(server.log.getCall(1).args[0]).to.contain('warning');
});

it('errors if a node incompatible and without http publish address', async () => {
setNodeWithoutHTTP('6.1.1');
try {
await checkEsVersion(server, KIBANA_VERSION);
} catch (e) {
expect(e.message).to.contain('incompatible nodes');
expect(e).to.be.a(Error);
}
});

it('only warns once per node list', async () => {
setNodes('5.1.1');

Expand Down

This file was deleted.

22 changes: 11 additions & 11 deletions src/core_plugins/elasticsearch/lib/call_with_request.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import _ from 'lodash';
import Promise from 'bluebird';
import Boom from 'boom';
import getBasicAuthRealm from './get_basic_auth_realm';
import toPath from 'lodash/internal/toPath';
import filterHeaders from './filter_headers';

module.exports = (server, client) => {
return (req, endpoint, params = {}) => {
return (req, endpoint, clientParams = {}, options = {}) => {
const wrap401Errors = options.wrap401Errors !== false;
const filteredHeaders = filterHeaders(req.headers, server.config().get('elasticsearch.requestHeadersWhitelist'));
_.set(params, 'headers', filteredHeaders);
_.set(clientParams, 'headers', filteredHeaders);
const path = toPath(endpoint);
const api = _.get(client, path);
let apiContext = _.get(client, path.slice(0, -1));
if (_.isEmpty(apiContext)) {
apiContext = client;
}
if (!api) throw new Error(`callWithRequest called with an invalid endpoint: ${endpoint}`);
return api.call(apiContext, params)
return api.call(apiContext, clientParams)
.catch((err) => {
if (err.status === 401) {
// TODO: The err.message is temporary until we have support for getting headers in the client.
// Once we have that, we should be able to pass the contents of the WWW-Authenticate head to getRealm
const realm = getBasicAuthRealm(err.message) || 'Authorization Required';
const options = { realm: realm };
return Promise.reject(Boom.unauthorized('Unauthorized', 'Basic', options));
if (!wrap401Errors || err.statusCode !== 401) {
return Promise.reject(err);
}
return Promise.reject(err);

const boomError = Boom.wrap(err, err.statusCode);
const wwwAuthHeader = _.get(err, 'body.error.header[WWW-Authenticate]');
boomError.output.headers['WWW-Authenticate'] = wwwAuthHeader || 'Basic realm="Authorization Required"';
throw boomError;
});
};
};
7 changes: 4 additions & 3 deletions src/core_plugins/elasticsearch/lib/check_es_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ module.exports = function checkEsVersion(server, kibanaVersion) {

function getHumanizedNodeNames(nodes) {
return nodes.map(node => {
return 'v' + node.version + ' @ ' + node.http.publish_address + ' (' + node.ip + ')';
const publishAddress = _.get(node, 'http.publish_address') ? (_.get(node, 'http.publish_address') + ' ') : '';
return 'v' + node.version + ' @ ' + publishAddress + '(' + node.ip + ')';
});
}

if (warningNodes.length) {
const simplifiedNodes = warningNodes.map(node => ({
version: node.version,
http: {
publish_address: node.http.publish_address,
publish_address: _.get(node, 'http.publish_address')
},
ip: node.ip,
}));
Expand All @@ -78,7 +79,7 @@ module.exports = function checkEsVersion(server, kibanaVersion) {
throw new Error(
`This version of Kibana requires Elasticsearch v` +
`${kibanaVersion} on all nodes. I found ` +
`the following incompatible nodes in your cluster: ${incompatibleNodeNames.join(',')}`
`the following incompatible nodes in your cluster: ${incompatibleNodeNames.join(', ')}`
);
}

Expand Down
7 changes: 0 additions & 7 deletions src/core_plugins/elasticsearch/lib/get_basic_auth_realm.js

This file was deleted.

1 change: 1 addition & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function HistogramVisType(Private) {
modes: ['stacked', 'overlap', 'percentage', 'wiggle', 'silhouette'],
editor: areaTemplate
},
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function HistogramVisType(Private) {
modes: ['stacked', 'percentage', 'grouped'],
editor: histogramTemplate
},
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function HistogramVisType(Private) {
scales: ['linear', 'log', 'square root'],
editor: lineTemplate
},
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function HistogramVisType(Private) {
},
responseConverter: false,
hierarchicalData: true,
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
Expand Down
1 change: 1 addition & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default function TileMapVisType(Private, getAppState, courier, config) {
}
},
responseConverter: geoJsonConverter,
implementsRenderComplete: true,
schemas: new Schemas([
{
group: 'metrics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
search-source="savedObj.searchSource"
show-spy-panel="chrome.getVisible()"
ui-state="uiState"
render-counter
class="panel-content">
</visualize>

<doc-table ng-switch-when="search"
<doc-table
ng-switch-when="search"
search-source="savedObj.searchSource"
sorting="panel.sort"
columns="panel.columns"
render-counter
class="panel-content"
filter="filter">
</doc-table>
Expand Down
3 changes: 2 additions & 1 deletion src/core_plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ <h2>Searching</h2>
sorting="state.sort"
columns="state.columns"
infinite-scroll="true"
filter="filterQuery">
filter="filterQuery"
render-counter>
</doc-table>

<div ng-if="rows.length == opts.sampleSize" class="discover-table-footer">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<div class="vis-editor-canvas" ng-class="{ embedded: !chrome.getVisible() }">
<visualize
vis="vis"
render-counter
ui-state="uiState"
show-spy-panel="chrome.getVisible()"
editable-vis="editableVis"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export default function registerDelete(server) {
const { key } = req.params;
const uiSettings = server.uiSettings();
uiSettings
.remove(key)
.remove(req, key)
.then(() => uiSettings
.getUserProvided()
.getUserProvided(req)
.then(settings => reply({ settings }).type('application/json'))
)
.catch(reason => reply(Boom.wrap(reason)));
.catch(err => reply(Boom.wrap(err, err.statusCode)));
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export default function registerGet(server) {
handler: function (req, reply) {
server
.uiSettings()
.getUserProvided()
.getUserProvided(req)
.then(settings => reply({ settings }).type('application/json'))
.catch(reason => reply(Boom.wrap(reason)));
.catch(err => reply(Boom.wrap(err, err.statusCode)));
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default function registerSet(server) {
const { value } = req.payload;
const uiSettings = server.uiSettings();
uiSettings
.set(key, value)
.set(req, key, value)
.then(() => uiSettings
.getUserProvided()
.getUserProvided(req)
.then(settings => reply({ settings }).type('application/json'))
)
.catch(reason => reply(Boom.wrap(reason)));
.catch(err => reply(Boom.wrap(err, err.statusCode)));
}
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default function registerSet(server) {
const { changes } = req.payload;
const uiSettings = server.uiSettings();
uiSettings
.setMany(changes)
.setMany(req, changes)
.then(() => uiSettings
.getUserProvided()
.getUserProvided(req)
.then(settings => reply({ settings }).type('application/json'))
)
.catch(reason => reply(Boom.wrap(reason)));
.catch(err => reply(Boom.wrap(err, err.statusCode)));
}
});
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
import $ from 'jquery';

describe('markdown vis controller', function () {
let $scope;
let $el;

beforeEach(ngMock.module('kibana/markdown_vis'));
beforeEach(ngMock.inject(function ($rootScope, $controller) {
$scope = $rootScope.$new();
$scope.vis = {
emit: function () {}
};
$controller('KbnMarkdownVisController', {$scope: $scope});
const $element = $('<div>');
$controller('KbnMarkdownVisController', { $scope, $element });
$scope.$digest();
}));

it('should set html from markdown params', function () {
expect($scope).to.not.have.property('html');
$scope.vis.params = {
markdown: 'This is a test of the [markdown](http://daringfireball.net/projects/markdown) vis.'
$scope.vis = {
params: {
markdown: 'This is a test of the [markdown](http://daringfireball.net/projects/markdown) vis.'
}
};
$scope.$digest();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ marked.setOptions({


const module = uiModules.get('kibana/markdown_vis', ['kibana', 'ngSanitize']);
module.controller('KbnMarkdownVisController', function ($scope) {
module.controller('KbnMarkdownVisController', function ($scope, $element) {
$scope.$watch('vis.params.markdown', function (html) {
if (html) {
$scope.html = marked(html);
}
$scope.vis.emit('renderComplete');
$element.trigger('renderComplete');
});
});
Loading

0 comments on commit e3ff0ad

Please sign in to comment.