mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Merge branch 'master' into fix/3959
This commit is contained in:
commit
db33d63dbe
15 changed files with 93 additions and 55 deletions
|
@ -23,7 +23,7 @@
|
|||
"angular": "1.2.28",
|
||||
"angular-bindonce": "~0.3.1",
|
||||
"angular-bootstrap": "~0.10.0",
|
||||
"angular-elastic": "~2.3.3",
|
||||
"angular-elastic": "~2.4.2",
|
||||
"angular-mocks": "~1.2.14",
|
||||
"angular-route": "~1.2.14",
|
||||
"angular-ui-ace": "~0.2.3",
|
||||
|
|
|
@ -17,24 +17,12 @@ define(function (require) {
|
|||
_(SegmentedHandle).inherits(Events);
|
||||
function SegmentedHandle(req) {
|
||||
SegmentedHandle.Super.call(this);
|
||||
this._req = req;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sort direction for the request.
|
||||
*
|
||||
* @param {string} dir - one of 'asc' or 'desc'
|
||||
*/
|
||||
SegmentedHandle.prototype.setDirection = function (dir) {
|
||||
switch (dir) {
|
||||
case 'asc':
|
||||
case 'desc':
|
||||
return (this._req._direction = dir);
|
||||
default:
|
||||
throw new TypeError('unkown sort direction "' + dir + '"');
|
||||
}
|
||||
};
|
||||
// export a couple methods from the request
|
||||
this.setDirection = _.bindKey(req, 'setDirection');
|
||||
this.setSize = _.bindKey(req, 'setSize');
|
||||
}
|
||||
|
||||
return SegmentedHandle;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -17,8 +17,8 @@ define(function (require) {
|
|||
|
||||
// segmented request specific state
|
||||
this._initFn = initFn;
|
||||
this._totalSize = false;
|
||||
this._remainingSize = false;
|
||||
this._desiredSize = false;
|
||||
this._hitsReceived = 0;
|
||||
this._direction = 'desc';
|
||||
this._handle = new SegmentedHandle(this);
|
||||
|
||||
|
@ -70,15 +70,8 @@ define(function (require) {
|
|||
var index = self._active = self._queue.shift();
|
||||
|
||||
params.index = index;
|
||||
|
||||
// Only subtract from remaining size if dealing with the indexPattern's timefield
|
||||
var timefield = self.source.get('index').timeFieldName;
|
||||
if (_.keys(params.body.sort)[0] !== timefield) {
|
||||
self._remainingSize = false;
|
||||
}
|
||||
|
||||
if (self._remainingSize !== false) {
|
||||
params.body.size = self._remainingSize;
|
||||
if (self._desiredSize !== false) {
|
||||
params.body.size = Math.max(self._desiredSize - self._hitsReceived, 0);
|
||||
}
|
||||
|
||||
return params;
|
||||
|
@ -115,6 +108,35 @@ define(function (require) {
|
|||
** SegmentedReq specific methods
|
||||
*********/
|
||||
|
||||
/**
|
||||
* Set the sort direction for the request.
|
||||
*
|
||||
* @param {string} dir - one of 'asc' or 'desc'
|
||||
*/
|
||||
SegmentedReq.prototype.setDirection = function (dir) {
|
||||
switch (dir) {
|
||||
case 'asc':
|
||||
case 'desc':
|
||||
return (this._direction = dir);
|
||||
default:
|
||||
throw new TypeError('unkown sort direction "' + dir + '"');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the sort total number of documents to
|
||||
* emit
|
||||
*
|
||||
* Setting to false will not limit the documents,
|
||||
* if a number is set the size of the request to es
|
||||
* will be updated on each new request
|
||||
*
|
||||
* @param {number|false}
|
||||
*/
|
||||
SegmentedReq.prototype.setSize = function (totalSize) {
|
||||
this._desiredSize = _.parseInt(totalSize) || false;
|
||||
};
|
||||
|
||||
SegmentedReq.prototype._createQueue = function () {
|
||||
var timeBounds = timefilter.getBounds();
|
||||
var indexPattern = this.source.get('index');
|
||||
|
@ -135,18 +157,9 @@ define(function (require) {
|
|||
hitCount: this._mergedResp.hits.hits.length
|
||||
});
|
||||
};
|
||||
|
||||
SegmentedReq.prototype._getFlattenedSource = function () {
|
||||
var self = this;
|
||||
|
||||
return self.source._flatten()
|
||||
.then(function (flatSource) {
|
||||
var size = _.parseInt(_.deepGet(flatSource, 'body.size'));
|
||||
if (_.isNumber(size)) {
|
||||
self._totalSize = self._remainingSize = size;
|
||||
}
|
||||
|
||||
return flatSource;
|
||||
});
|
||||
return this.source._flatten();
|
||||
};
|
||||
|
||||
SegmentedReq.prototype._consumeSegment = function (seg) {
|
||||
|
@ -161,10 +174,7 @@ define(function (require) {
|
|||
|
||||
this._mergeSegment(seg);
|
||||
this.resp = _.omit(this._mergedResp, '_bucketIndex');
|
||||
|
||||
if (this._remainingSize !== false) {
|
||||
this._remainingSize -= seg.hits.hits.length;
|
||||
}
|
||||
this._hitsReceived += seg.hits.hits.length;
|
||||
|
||||
if (firstHits) this._handle.emit('first', seg);
|
||||
if (gotHits) this._handle.emit('segment', seg);
|
||||
|
@ -212,4 +222,4 @@ define(function (require) {
|
|||
|
||||
return SegmentedReq;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,10 +23,11 @@ define(function (require) {
|
|||
* ```
|
||||
*/
|
||||
module.directive('kbnTableRow', function ($compile) {
|
||||
var noWhiteSpace = require('utils/no_white_space');
|
||||
var openRowHtml = require('text!components/doc_table/components/table_row/open.html');
|
||||
var detailsHtml = require('text!components/doc_table/components/table_row/details.html');
|
||||
var cellTemplate = _.template(require('text!components/doc_table/components/table_row/cell.html'));
|
||||
var truncateByHeightTemplate = _.template(require('text!partials/truncate_by_height.html'));
|
||||
var cellTemplate = _.template(noWhiteSpace(require('text!components/doc_table/components/table_row/cell.html')));
|
||||
var truncateByHeightTemplate = _.template(noWhiteSpace(require('text!partials/truncate_by_height.html')));
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
|
@ -106,6 +107,7 @@ define(function (require) {
|
|||
$scope.columns.forEach(function (column) {
|
||||
newHtmls.push(cellTemplate({
|
||||
timefield: false,
|
||||
sourcefield: (column === '_source'),
|
||||
formatted: _displayField(row, column, true)
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
<td <%= timefield ? 'class="discover-table-timefield" width="1%"' : '' %>>
|
||||
<%
|
||||
var attributes = '';
|
||||
if (timefield) {
|
||||
attributes='class="discover-table-timefield" width="1%"';
|
||||
} else if (sourcefield) {
|
||||
attributes='class="discover-table-sourcefield"';
|
||||
} else {
|
||||
attributes='class="discover-table-datafield"';
|
||||
}
|
||||
%>
|
||||
<td <%= attributes %>>
|
||||
<%= formatted %>
|
||||
</td>
|
||||
</td>
|
||||
|
|
|
@ -7,6 +7,10 @@ doc-table {
|
|||
margin: 5px;
|
||||
.flex(1, 1, 100%);
|
||||
|
||||
.discover-table-datafield {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.loading {
|
||||
opacity: @loading-opacity;
|
||||
}
|
||||
|
|
|
@ -257,5 +257,13 @@ define(function (require) {
|
|||
};
|
||||
inherits(errors.InvalidLogScaleValues, KbnError);
|
||||
|
||||
/** error thrown when wiggle chart is selected for non linear data */
|
||||
errors.InvalidWiggleSelection = function InvalidWiggleSelection() {
|
||||
KbnError.call(this,
|
||||
'In wiggle mode the area chart requires ordered values on the x-axis. Try using a Histogram or Date Histogram aggregation.',
|
||||
errors.InvalidWiggleSelection);
|
||||
};
|
||||
inherits(errors.InvalidWiggleSelection, KbnError);
|
||||
|
||||
return errors;
|
||||
});
|
||||
|
|
|
@ -82,6 +82,7 @@ define(function (require) {
|
|||
// Because we have to wait for the DOM element to initialize, we do not
|
||||
// want to throw an error when the DOM `el` is zero
|
||||
if (error instanceof errors.ContainerTooSmall ||
|
||||
error instanceof errors.InvalidWiggleSelection ||
|
||||
error instanceof errors.InvalidLogScaleValues ||
|
||||
error instanceof errors.PieContainsAllZeros ||
|
||||
error instanceof errors.NotEnoughData ||
|
||||
|
|
|
@ -249,6 +249,13 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
|
||||
AreaChart.prototype.validateWiggleSelection = function () {
|
||||
var isWiggle = this._attr.mode === 'wiggle';
|
||||
var ordered = this.handler.data.get('ordered');
|
||||
|
||||
if (isWiggle && !ordered) throw new errors.InvalidWiggleSelection();
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders d3 visualization
|
||||
*
|
||||
|
@ -294,6 +301,7 @@ define(function (require) {
|
|||
if (width < minWidth || height < minHeight) {
|
||||
throw new errors.ContainerTooSmall();
|
||||
}
|
||||
self.validateWiggleSelection();
|
||||
|
||||
// Select the current DOM element
|
||||
div = d3.select(this);
|
||||
|
|
|
@ -333,6 +333,7 @@ define(function (require) {
|
|||
$scope.updateTime();
|
||||
|
||||
segmented.setDirection(sortBy === 'time' ? (sort[1] || 'desc') : 'desc');
|
||||
segmented.setSize(sortBy === 'time' ? $scope.opts.sampleSize : false);
|
||||
|
||||
// triggered when the status updated
|
||||
segmented.on('status', function (status) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<form role="form" name="objectForm" ng-submit="submit()">
|
||||
<div class="form-group" ng-repeat="field in fields">
|
||||
<label>{{ field.name }}</label>
|
||||
<textarea rows="1" msd-elastic ng-if="field.type === 'text'" ng-model="field.value" class="form-control span12"/>
|
||||
<textarea rows="1" msd-elastic=" " ng-if="field.type === 'text'" ng-model="field.value" class="form-control span12"/>
|
||||
<input ng-if="field.type === 'number'" type="number" ng-model="field.value" class="form-control span12"/>
|
||||
<div ng-if="field.type === 'json' || field.type === 'array'" ui-ace="{ onLoad: aceLoaded, mode: 'json' }" id="{{field.name}}" ng-model="field.value" class="form-control"></div>
|
||||
<input ng-if="field.type === 'boolean'" type="checkbox" ng-model="field.value" ng-checked="field.value">
|
||||
|
|
|
@ -3,6 +3,9 @@ module.exports = function (grunt) {
|
|||
var done = this.async();
|
||||
var config = require('../src/server/config');
|
||||
config.quiet = !grunt.option('debug') && !grunt.option('verbose');
|
||||
if (grunt.option('port')) {
|
||||
config.port = config.kibana.port = grunt.option('port');
|
||||
}
|
||||
var server = require('../src/server');
|
||||
|
||||
server.start(function (err) {
|
||||
|
|
|
@ -55,7 +55,7 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask('maybe_start_kibana', maybeStartServer({
|
||||
name: 'kibana-server',
|
||||
port: config.kibana.port,
|
||||
port: grunt.option('port') || config.kibana.port,
|
||||
tasks: ['kibana_server']
|
||||
}));
|
||||
};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
define(function (require) {
|
||||
require('components/paginated_table/paginated_table');
|
||||
var _ = require('lodash');
|
||||
var $ = require('jquery');
|
||||
var sinon = require('sinon/sinon');
|
||||
|
||||
describe('paginated table', function () {
|
||||
|
@ -240,7 +241,7 @@ define(function (require) {
|
|||
it('should should have duplicate column titles', function () {
|
||||
var columns = $el.find('thead th span');
|
||||
columns.each(function () {
|
||||
expect(this.innerText).to.be(colText);
|
||||
expect($(this).text()).to.be(colText);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ define(function (require) {
|
|||
var inputValue = 'Input Text Value';
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_) {
|
||||
$compile = _$compile_;
|
||||
$rootScope = _$rootScope_;
|
||||
|
@ -31,7 +30,10 @@ define(function (require) {
|
|||
$rootScope.$digest();
|
||||
$timeout.flush();
|
||||
selectedEl = document.activeElement;
|
||||
selectedText = window.getSelection().toString();
|
||||
selectedText = selectedEl.value.slice(
|
||||
selectedEl.selectionStart,
|
||||
selectedEl.selectionEnd
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,4 +50,4 @@ define(function (require) {
|
|||
expect(selectedText).to.equal(inputValue);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue