mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Merge branch 'master' into tilemap-heatmap
This commit is contained in:
commit
93478d8997
17 changed files with 161 additions and 76 deletions
|
@ -1,6 +1,6 @@
|
|||
<th width="1%"></th>
|
||||
<th ng-if="indexPattern.timeFieldName">
|
||||
<span ng-click="sort(indexPattern.timeFieldName)" tooltip="Sort by time">Time <i ng-class="headerClass(indexPattern.timeFieldName)"></i></span>
|
||||
<span>Time <i ng-class="headerClass(indexPattern.timeFieldName)" ng-click="sort(indexPattern.timeFieldName)" tooltip="Sort by time"></i></span>
|
||||
</th>
|
||||
<th ng-repeat="name in columns">
|
||||
<span class="table-header-name">
|
||||
|
@ -11,4 +11,4 @@
|
|||
<i ng-click="moveLeft(name)" class="fa fa-angle-double-left" ng-show="!$first" tooltip="Move column to the left" tooltip-append-to-body="1"></i>
|
||||
<i ng-click="moveRight(name)" class="fa fa-angle-double-right" ng-show="!$last" tooltip="Move column to the right" tooltip-append-to-body="1"></i>
|
||||
</span>
|
||||
</th>
|
||||
</th>
|
||||
|
|
|
@ -12,7 +12,7 @@ define(function (require) {
|
|||
require('filters/short_dots');
|
||||
|
||||
|
||||
// guestimate at the minimum number of chars wide cells in the table should be
|
||||
// guesstimate at the minimum number of chars wide cells in the table should be
|
||||
var MIN_LINE_LENGTH = 20;
|
||||
|
||||
/**
|
||||
|
@ -235,4 +235,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -49,9 +49,7 @@
|
|||
tooltip-placement="top"
|
||||
tooltip="Objects in arrays are not well supported."
|
||||
class="fa fa-warning text-color-warning ng-scope doc-viewer-object-array"></i>
|
||||
<span class="doc-viewer-value" ng-bind-html="(typeof(formatted[field]) === 'undefined' ? hit[field] : formatted[field]) | highlight : hit.highlight[field] | trustAsHtml"></span>
|
||||
|
||||
|
||||
<div class="doc-viewer-value" ng-bind-html="(typeof(formatted[field]) === 'undefined' ? hit[field] : formatted[field]) | highlight : hit.highlight[field] | trustAsHtml"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -512,30 +512,24 @@ define(function (require) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Checks whether all pie slices have zero values.
|
||||
* If so, an error is thrown.
|
||||
* Removes zeros from pie chart data
|
||||
* @param slices
|
||||
* @returns {*}
|
||||
*/
|
||||
Data.prototype._validatePieData = function () {
|
||||
var visData = this.getVisData();
|
||||
Data.prototype._removeZeroSlices = function (slices) {
|
||||
var self = this;
|
||||
|
||||
visData.forEach(function (chartData) {
|
||||
chartData.slices = (function withoutZeroSlices(slices) {
|
||||
if (!slices.children) return slices;
|
||||
if (!slices.children) return slices;
|
||||
|
||||
slices = _.clone(slices);
|
||||
slices.children = slices.children.reduce(function (children, child) {
|
||||
if (child.size !== 0) {
|
||||
children.push(withoutZeroSlices(child));
|
||||
}
|
||||
return children;
|
||||
}, []);
|
||||
return slices;
|
||||
}(chartData.slices));
|
||||
|
||||
if (chartData.slices.children.length === 0) {
|
||||
throw new errors.PieContainsAllZeros();
|
||||
slices = _.clone(slices);
|
||||
slices.children = slices.children.reduce(function (children, child) {
|
||||
if (child.size !== 0) {
|
||||
children.push(self._removeZeroSlices(child));
|
||||
}
|
||||
});
|
||||
return children;
|
||||
}, []);
|
||||
|
||||
return slices;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -547,12 +541,12 @@ define(function (require) {
|
|||
*/
|
||||
Data.prototype.pieNames = function () {
|
||||
var self = this;
|
||||
var data = this.getVisData();
|
||||
var names = [];
|
||||
|
||||
this._validatePieData();
|
||||
|
||||
_.forEach(this.getVisData(), function (obj) {
|
||||
_.forEach(data, function (obj) {
|
||||
var columns = obj.raw ? obj.raw.columns : undefined;
|
||||
obj.slices = self._removeZeroSlices(obj.slices);
|
||||
|
||||
_.forEach(self.getNames(obj, columns), function (name) {
|
||||
names.push(name);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
define(function (require) {
|
||||
return function ChartBaseClass(d3, Private) {
|
||||
var _ = require('lodash');
|
||||
var errors = require('errors');
|
||||
|
||||
var Dispatch = Private(require('components/vislib/lib/dispatch'));
|
||||
var Tooltip = Private(require('components/vislib/components/tooltip/tooltip'));
|
||||
|
|
|
@ -24,11 +24,26 @@ define(function (require) {
|
|||
}
|
||||
PieChart.Super.apply(this, arguments);
|
||||
|
||||
var charts = this.handler.data.getVisData();
|
||||
this._validatePieData(charts);
|
||||
|
||||
this._attr = _.defaults(handler._attr || {}, {
|
||||
isDonut: handler._attr.isDonut || false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether pie slices have all zero values.
|
||||
* If so, an error is thrown.
|
||||
*/
|
||||
PieChart.prototype._validatePieData = function (charts) {
|
||||
var isAllZeros = charts.every(function (chart) {
|
||||
return chart.slices.children.length === 0;
|
||||
});
|
||||
|
||||
if (isAllZeros) { throw new errors.PieContainsAllZeros(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds Events to SVG paths
|
||||
*
|
||||
|
@ -150,6 +165,15 @@ define(function (require) {
|
|||
return path;
|
||||
};
|
||||
|
||||
PieChart.prototype._validateContainerSize = function (width, height) {
|
||||
var minWidth = 20;
|
||||
var minHeight = 20;
|
||||
|
||||
if (width <= minWidth || height <= minHeight) {
|
||||
throw new errors.ContainerTooSmall();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders d3 visualization
|
||||
*
|
||||
|
@ -162,17 +186,15 @@ define(function (require) {
|
|||
return function (selection) {
|
||||
selection.each(function (data) {
|
||||
var slices = data.slices;
|
||||
var el = this;
|
||||
var div = d3.select(el);
|
||||
var width = $(el).width();
|
||||
var height = $(el).height();
|
||||
var minWidth = 20;
|
||||
var minHeight = 20;
|
||||
var div = d3.select(this);
|
||||
var width = $(this).width();
|
||||
var height = $(this).height();
|
||||
var path;
|
||||
|
||||
if (width <= minWidth || height <= minHeight) {
|
||||
throw new errors.ContainerTooSmall();
|
||||
}
|
||||
if (!slices.children.length) return;
|
||||
|
||||
self.convertToPercentage(slices);
|
||||
self._validateContainerSize(width, height);
|
||||
|
||||
var svg = div.append('svg')
|
||||
.attr('width', width)
|
||||
|
@ -180,7 +202,6 @@ define(function (require) {
|
|||
.append('g')
|
||||
.attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
|
||||
|
||||
self.convertToPercentage(slices);
|
||||
path = self.addPath(width, height, svg, slices);
|
||||
self.addPathEvents(path);
|
||||
|
||||
|
|
|
@ -172,14 +172,6 @@ define(function (require) {
|
|||
};
|
||||
};
|
||||
|
||||
TileMap.prototype.addZoomEndEvent = function (element) {
|
||||
var events = this.events;
|
||||
var zoomend = events.addMapZoomEndEvent();
|
||||
var attachedEvents = element.call(zoomend);
|
||||
|
||||
return attachedEvents;
|
||||
};
|
||||
|
||||
/**
|
||||
* get min and max for all cols, rows of data
|
||||
*
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<div ng-if="vis.params.mapType === 'Heatmap'" class="form-group">
|
||||
<div>
|
||||
<label>
|
||||
|
@ -103,12 +104,9 @@
|
|||
</div>
|
||||
|
||||
<div class="vis-option-item">
|
||||
</br>
|
||||
<label>
|
||||
<input type="checkbox"
|
||||
name="isDesaturated"
|
||||
value="{{isDesaturated}}"
|
||||
ng-model="vis.params.isDesaturated"
|
||||
ng-checked="vis.params.isDesaturated">
|
||||
<input type="checkbox" value="{{isDesaturated}}" ng-model="vis.params.isDesaturated" name="isDesaturated" ng-checked="vis.params.isDesaturated">
|
||||
Desaturate map tiles
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
@ -14,7 +14,6 @@ define(function (require) {
|
|||
defaults: {
|
||||
mapType: 'Scaled Circle Markers',
|
||||
isDesaturated: true,
|
||||
autoPrecision: true,
|
||||
heatMaxZoom: 16,
|
||||
heatMinOpacity: 0.1,
|
||||
heatRadius: 25,
|
||||
|
|
|
@ -288,10 +288,6 @@ define(function (require) {
|
|||
};
|
||||
}
|
||||
|
||||
function autoPrecision(zoom, limit) {
|
||||
return Math.min(Math.round(0.02 * Math.pow(zoom, 2) + 0.24 * zoom + 0.723), limit);
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
.btn-xs {
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
navbar {
|
||||
.bitty-modal-container {
|
||||
position: relative;
|
||||
|
@ -94,6 +98,10 @@
|
|||
> .vis-edit-sidebar-buttons {
|
||||
.flex(0, 0, auto)
|
||||
}
|
||||
|
||||
label {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,6 +111,7 @@
|
|||
border: inherit !important;
|
||||
background-color: @gray-lighter;
|
||||
margin-bottom: 5px;
|
||||
padding: 2px 5px !important;
|
||||
}
|
||||
|
||||
.sidebar-item-title:hover {
|
||||
|
|
|
@ -15,19 +15,19 @@ kbn-table, .kbn-table, tbody[kbn-rows] {
|
|||
dl.source {
|
||||
margin-bottom: 0;
|
||||
line-height: 2em;
|
||||
word-break: break-all;
|
||||
|
||||
dt, dd {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
dt {
|
||||
display: inline;
|
||||
background: @gray-lighter;
|
||||
padding: @padding-xs-vertical @padding-xs-horizontal;
|
||||
margin-right: @padding-xs-horizontal;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
dd {
|
||||
display: inline;
|
||||
word-break: break-all;
|
||||
word-break: normal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,17 @@ function checkPath(path) {
|
|||
}
|
||||
}
|
||||
|
||||
// Set defaults for config file stuff
|
||||
kibana.port = kibana.port || 5601;
|
||||
kibana.host = kibana.host || '0.0.0.0';
|
||||
kibana.elasticsearch_url = kibana.elasticsearch_url || 'http://localhost:9200';
|
||||
kibana.maxSockets = kibana.maxSockets || Infinity;
|
||||
kibana.log_file = kibana.log_file || null;
|
||||
|
||||
kibana.request_timeout = kibana.startup_timeout == null ? 0 : kibana.request_timeout;
|
||||
kibana.ping_timeout = kibana.ping_timeout == null ? kibana.request_timeout : kibana.ping_timeout;
|
||||
kibana.startup_timeout = kibana.startup_timeout == null ? 5000 : kibana.startup_timeout;
|
||||
|
||||
// Check if the local public folder is present. This means we are running in
|
||||
// the NPM module. If it's not there then we are running in the git root.
|
||||
var public_folder = path.resolve(__dirname, '..', 'public');
|
||||
|
@ -33,13 +44,10 @@ try {
|
|||
packagePath = path.resolve(__dirname, '..', '..', '..', 'package.json');
|
||||
}
|
||||
|
||||
var requestTimeout = kibana.request_timeout || 0;
|
||||
var pingTimeout = kibana.ping_timeout == null ? requestTimeout : kibana.ping_timeout;
|
||||
|
||||
var config = module.exports = {
|
||||
port : kibana.port || 5601,
|
||||
host : kibana.host || '0.0.0.0',
|
||||
elasticsearch : kibana.elasticsearch_url || 'http://localhost:9200',
|
||||
port : kibana.port,
|
||||
host : kibana.host,
|
||||
elasticsearch : kibana.elasticsearch_url,
|
||||
root : path.normalize(path.join(__dirname, '..')),
|
||||
quiet : false,
|
||||
public_folder : public_folder,
|
||||
|
@ -49,10 +57,10 @@ var config = module.exports = {
|
|||
package : require(packagePath),
|
||||
htpasswd : htpasswdPath,
|
||||
buildNum : '@@buildNum',
|
||||
maxSockets : kibana.maxSockets || Infinity,
|
||||
log_file : kibana.log_file || null,
|
||||
request_timeout : requestTimeout,
|
||||
ping_timeout : pingTimeout
|
||||
maxSockets : kibana.maxSockets,
|
||||
log_file : kibana.log_file,
|
||||
request_timeout : kibana.request_timeout,
|
||||
ping_timeout : kibana.ping_timeout
|
||||
};
|
||||
|
||||
config.plugins = listPlugins(config);
|
||||
|
|
|
@ -45,6 +45,9 @@ request_timeout: 300000
|
|||
# Set to 0 to disable.
|
||||
shard_timeout: 0
|
||||
|
||||
# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
|
||||
# startup_timeout: 5000
|
||||
|
||||
# Set to false to have a complete disregard for the validity of the SSL
|
||||
# certificate.
|
||||
verify_ssl: true
|
||||
|
|
|
@ -6,7 +6,7 @@ var logger = require('./logger');
|
|||
var config = require('../config');
|
||||
|
||||
function waitForPong() {
|
||||
return client.ping()
|
||||
return client.ping({requestTimeout: config.kibana.startup_timeout})
|
||||
.catch(function (err) {
|
||||
if (!(err instanceof NoConnections)) throw err;
|
||||
|
||||
|
|
|
@ -205,6 +205,37 @@ define(function (require) {
|
|||
|
||||
});
|
||||
|
||||
describe('_removeZeroSlices', function () {
|
||||
var pieData = {
|
||||
slices: {
|
||||
children: [
|
||||
{size: 30},
|
||||
{size: 20},
|
||||
{size: 0}
|
||||
]
|
||||
}
|
||||
};
|
||||
var DataFactory;
|
||||
var data;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (Private) {
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
data = new DataFactory(pieData, {});
|
||||
data._removeZeroSlices(pieData.slices);
|
||||
});
|
||||
});
|
||||
|
||||
it('should remove zero values', function () {
|
||||
var slices = data.data.slices;
|
||||
expect(slices.children.length).to.be(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Data.flatten', function () {
|
||||
var DataFactory;
|
||||
var serIn;
|
||||
|
|
|
@ -118,6 +118,41 @@ define(function (require) {
|
|||
expect($(chart1.el).find('.y-axis-chart-title').length).to.be(1);
|
||||
expect($(chart2.el).find('.x-axis-chart-title').length).to.be(1);
|
||||
});
|
||||
|
||||
describe('_validatePieData method', function () {
|
||||
var allZeros = [
|
||||
{ slices: { children: [] } },
|
||||
{ slices: { children: [] } },
|
||||
{ slices: { children: [] } }
|
||||
];
|
||||
|
||||
var someZeros = [
|
||||
{ slices: { children: [{}] } },
|
||||
{ slices: { children: [{}] } },
|
||||
{ slices: { children: [] } }
|
||||
];
|
||||
|
||||
var noZeros = [
|
||||
{ slices: { children: [{}] } },
|
||||
{ slices: { children: [{}] } },
|
||||
{ slices: { children: [{}] } }
|
||||
];
|
||||
|
||||
it('should throw an error when all charts contain zeros', function () {
|
||||
expect(function () {
|
||||
chart1.ChartClass.prototype._validatePieData(allZeros);
|
||||
}).to.throwError();
|
||||
});
|
||||
|
||||
it('should not throw an error when only some or no charts contain zeros', function () {
|
||||
expect(function () {
|
||||
chart1.ChartClass.prototype._validatePieData(someZeros);
|
||||
}).to.not.throwError();
|
||||
expect(function () {
|
||||
chart1.ChartClass.prototype._validatePieData(noZeros);
|
||||
}).to.not.throwError();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
aggArray.forEach(function (dataAgg, i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue