Merge branch 'master' into issue/5728

This commit is contained in:
Shelby Sturgis 2016-03-28 16:40:33 -07:00
commit 550c233b58
13 changed files with 90 additions and 36 deletions

View file

@ -157,7 +157,7 @@
"grunt-cli": "0.1.13", "grunt-cli": "0.1.13",
"grunt-contrib-clean": "0.6.0", "grunt-contrib-clean": "0.6.0",
"grunt-contrib-copy": "0.8.1", "grunt-contrib-copy": "0.8.1",
"grunt-esvm": "3.0.4", "grunt-esvm": "3.1.1",
"grunt-karma": "0.12.0", "grunt-karma": "0.12.0",
"grunt-run": "0.5.0", "grunt-run": "0.5.0",
"grunt-s3": "0.2.0-alpha.3", "grunt-s3": "0.2.0-alpha.3",

View file

@ -16,7 +16,7 @@ function stubbedLogstashFields() {
{ name: 'extension', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: 'extension', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true },
{ name: 'machine.os', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: 'machine.os', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true },
{ name: 'geo.src', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: 'geo.src', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true },
{ name: '_type', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, { name: '_type', type: 'string', indexed: false, analyzed: true, sortable: true, filterable: true },
{ name: '_id', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: true}, { name: '_id', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: true},
{ name: '_source', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: false}, { name: '_source', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: false},
{ name: 'custom_user_field', type: 'conflict', indexed: false, analyzed: false, sortable: false, filterable: true }, { name: 'custom_user_field', type: 'conflict', indexed: false, analyzed: false, sortable: false, filterable: true },

View file

@ -481,8 +481,7 @@ app.controller('discover', function ($scope, config, courier, $route, $window, N
schema: 'segment', schema: 'segment',
params: { params: {
field: $scope.opts.timefield, field: $scope.opts.timefield,
interval: $state.interval, interval: $state.interval
min_doc_count: 0
} }
} }
]; ];

View file

@ -150,14 +150,6 @@ export default function DateHistogramAggType(timefilter, config, Private) {
return; return;
} }
var bounds = timefilter.getActiveBounds();
if (bounds) {
output.params.extended_bounds = {
min: moment(bounds.min).valueOf(),
max: moment(bounds.max).valueOf()
};
}
} }
} }
] ]

View file

@ -20,6 +20,8 @@ export default function CourierFetchCallClient(Private, Promise, es, esShardTime
const executable = statuses.filter(isRequest); const executable = statuses.filter(isRequest);
let execCount = executable.length; let execCount = executable.length;
if (!execCount) return Promise.resolve([]);
// resolved by respond() // resolved by respond()
let esPromise; let esPromise;
const defer = Promise.defer(); const defer = Promise.defer();

View file

@ -29,22 +29,26 @@ export default function FetchTheseProvider(Private, Promise) {
} }
function fetchWithStrategy(strategy, requests) { function fetchWithStrategy(strategy, requests) {
function replaceAbortedRequests() {
requests = requests.map(r => r.aborted ? ABORTED : r);
}
requests = requests.map(function (req) { replaceAbortedRequests();
return req.aborted ? ABORTED : req;
});
return startRequests(requests) return startRequests(requests)
.then(function () { .then(function () {
replaceAbortedRequests();
return callClient(strategy, requests); return callClient(strategy, requests);
}) })
.then(function (responses) { .then(function (responses) {
replaceAbortedRequests();
return callResponseHandlers(requests, responses); return callResponseHandlers(requests, responses);
}) })
.then(function (responses) { .then(function (responses) {
replaceAbortedRequests();
return continueIncomplete(strategy, requests, responses, fetchWithStrategy); return continueIncomplete(strategy, requests, responses, fetchWithStrategy);
}) })
.then(function (responses) { .then(function (responses) {
replaceAbortedRequests();
return responses.map(function (resp) { return responses.map(function (resp) {
switch (resp) { switch (resp) {
case ABORTED: case ABORTED:

View file

@ -32,9 +32,7 @@ describe('ui/courier/fetch/request/segmented', () => {
expect(returned.then).to.be.Function; expect(returned.then).to.be.Function;
}); });
it('does not call super.start() until promise is resolved', () => { it('calls super.start() synchronously', () => {
expect(searchReqStart.called).to.be(false);
$rootScope.$apply();
expect(searchReqStart.called).to.be(true); expect(searchReqStart.called).to.be(true);
}); });
}); });

View file

@ -42,6 +42,8 @@ export default function SegmentedReqProvider(es, Private, Promise, timefilter, c
*********/ *********/
start() { start() {
super.start();
this._complete = []; this._complete = [];
this._active = null; this._active = null;
this._segments = []; this._segments = [];
@ -61,12 +63,12 @@ export default function SegmentedReqProvider(es, Private, Promise, timefilter, c
// parameters via the handle // parameters via the handle
if (_.isFunction(this._initFn)) this._initFn(this._handle); if (_.isFunction(this._initFn)) this._initFn(this._handle);
return this._createQueue().then((queue) => { return this._createQueue().then((queue) => {
if (this.stopped) return;
this._all = queue.slice(0); this._all = queue.slice(0);
// Send the initial fetch status // Send the initial fetch status
this._reportStatus(); this._reportStatus();
return super.start();
}); });
} }

View file

@ -0,0 +1,61 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
import MockState from 'fixtures/mock_state';
import notify from 'ui/notify';
import AggConfigResult from 'ui/vis/agg_config_result';
import VisProvider from 'ui/vis';
import StubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler';
describe('filterBarClickHandler', function () {
let setup = null;
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
setup = function () {
const Vis = Private(VisProvider);
const createClickHandler = Private(FilterBarClickHandlerProvider);
const indexPattern = Private(StubbedLogstashIndexPatternProvider);
const vis = new Vis(indexPattern, {
type: 'histogram',
aggs: [
{ type: 'count', schema: 'metric' },
{
type: 'terms',
schema: 'segment',
params: { field: '_type' }
}
]
});
const aggConfigResult = new AggConfigResult(vis.aggs[1], void 0, 'apache', 'apache');
const $state = new MockState({ filters: [] });
const clickHandler = createClickHandler($state);
return { clickHandler, $state, aggConfigResult };
};
}));
afterEach(function () {
notify._notifs.splice(0);
});
context('on non-filterable fields', function () {
it('warns about trying to filter on a non-filterable field', function () {
const { clickHandler, aggConfigResult } = setup();
expect(notify._notifs).to.have.length(0);
clickHandler({ point: { aggConfigResult }});
expect(notify._notifs).to.have.length(1);
});
it('does not warn if the event is click is being simulated', function () {
const { clickHandler, aggConfigResult } = setup();
expect(notify._notifs).to.have.length(0);
clickHandler({ point: { aggConfigResult }}, true);
expect(notify._notifs).to.have.length(0);
});
});
});

View file

@ -39,7 +39,9 @@ export default function (Notifier) {
try { try {
return result.createFilter(); return result.createFilter();
} catch (e) { } catch (e) {
notify.warning(e.message); if (!simulate) {
notify.warning(e.message);
}
} }
}) })
.filter(Boolean) .filter(Boolean)

View file

@ -69,6 +69,7 @@
ng-model="relative.count" ng-model="relative.count"
ng-change="formatRelative()" ng-change="formatRelative()"
greater-than="-1" greater-than="-1"
min="0"
type="number" type="number"
class="form-control"> class="form-control">
</div> </div>

View file

@ -9,9 +9,6 @@ module.exports = function (grunt) {
branch: 'master', branch: 'master',
fresh: !grunt.option('esvm-no-fresh'), fresh: !grunt.option('esvm-no-fresh'),
config: { config: {
network: {
host: '127.0.0.1'
},
http: { http: {
port: 9200 port: 9200
} }

View file

@ -108,12 +108,11 @@ define(function (require) {
}); });
bdd.it('should show the correct bar chart', function () { bdd.it('should show the correct bar chart', function () {
var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '3.237', var expectedBarChartData = [ '3.237',
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449', '17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812', '2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
'118.562', '63.524', '17.587', '2.537', '0', '0', '0', '0', '0', '118.562', '63.524', '17.587', '2.537'
'0', '0'
]; ];
return common.sleep(4000) return common.sleep(4000)
.then(function () { .then(function () {
@ -142,8 +141,7 @@ define(function (require) {
bdd.it('should show correct data for chart interval Hourly', function () { bdd.it('should show correct data for chart interval Hourly', function () {
var chartInterval = 'Hourly'; var chartInterval = 'Hourly';
var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '0', '0', var expectedBarChartData = [ '1.527', '2.290',
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1.527', '2.290',
'5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8', '5.599', '7.890', '13.236', '30.290', '46.072', '55.490', '86.8',
'112', '122.181', '131.6', '132.872', '113.527', '102.581', '112', '122.181', '131.6', '132.872', '113.527', '102.581',
'81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109', '81.709', '65.672', '43.781', '24.181', '14', '9.672', '6.109',
@ -154,8 +152,7 @@ define(function (require) {
'2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945', '2.036', '1.781', '4.327', '8.654', '9.418', '26.472', '38.945',
'61.345', '79.672', '102.836', '125.236', '130.327', '128.036', '61.345', '79.672', '102.836', '125.236', '130.327', '128.036',
'120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490', '120.4', '96.472', '74.581', '70.509', '39.709', '25.199', '13.490',
'12.472', '4.072', '2.290', '1.018', '0', '0', '0', '0', '0', '0', '12.472', '4.072', '2.290', '1.018'
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'
]; ];
return discoverPage.setChartInterval(chartInterval) return discoverPage.setChartInterval(chartInterval)
.then(function () { .then(function () {
@ -170,7 +167,7 @@ define(function (require) {
bdd.it('should show correct data for chart interval Daily', function () { bdd.it('should show correct data for chart interval Daily', function () {
var chartInterval = 'Daily'; var chartInterval = 'Daily';
var expectedBarChartData = [ var expectedBarChartData = [
'0', '133.196', '129.192', '129.724', '0' '133.196', '129.192', '129.724'
]; ];
return discoverPage.setChartInterval(chartInterval) return discoverPage.setChartInterval(chartInterval)
.then(function () { .then(function () {
@ -223,12 +220,11 @@ define(function (require) {
bdd.it('should show correct data for chart interval Auto', function () { bdd.it('should show correct data for chart interval Auto', function () {
var chartInterval = 'Auto'; var chartInterval = 'Auto';
var expectedBarChartData = [ '0', '0', '0', '0', '0', '0', '3.237', var expectedBarChartData = [ '3.237',
'17.674', '64.75', '125.737', '119.962', '65.712', '16.449', '17.674', '64.75', '125.737', '119.962', '65.712', '16.449',
'2.712', '3.675', '17.674', '59.762', '119.087', '123.812', '2.712', '3.675', '17.674', '59.762', '119.087', '123.812',
'61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2', '61.862', '15.487', '2.362', '2.800', '15.312', '61.862', '123.2',
'118.562', '63.524', '17.587', '2.537', '0', '0', '0', '0', '0', '118.562', '63.524', '17.587', '2.537'
'0', '0'
]; ];
return discoverPage.setChartInterval(chartInterval) return discoverPage.setChartInterval(chartInterval)
.then(function () { .then(function () {