mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge branch 'master' of github.com:elastic/kibana into implement/devLiveOptimizer
This commit is contained in:
commit
21402475f8
11 changed files with 84 additions and 32 deletions
20
src/optimize/browserTests/testBundleEntry.js.tmpl
Normal file
20
src/optimize/browserTests/testBundleEntry.js.tmpl
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Optimized application entry file
|
||||
*
|
||||
* This is programatically created and updated, do not modify
|
||||
*
|
||||
* built using: <%= optimizerTagline %>
|
||||
* includes code from:
|
||||
<%
|
||||
entry.deps.sort().forEach(function (plugin) {
|
||||
print(` * - ${plugin}\n`);
|
||||
})
|
||||
%> *
|
||||
*/
|
||||
|
||||
require('ui/testHarness');
|
||||
<%
|
||||
entry.modules.slice(0).reverse().forEach(function (id) {
|
||||
print(`require('${id.replace(/\\/g, '\\\\')}');\n`);
|
||||
});
|
||||
%>require('ui/testHarness').bootstrap();
|
|
@ -20,8 +20,8 @@ module.exports = function (kibana) {
|
|||
uiExports: {
|
||||
modules: modules,
|
||||
noParse: [
|
||||
/node_modules\/(angular|elasticsearch-browser)\//,
|
||||
/node_modules\/(angular-nvd3|mocha|moment)\//
|
||||
/node_modules[\/\\](angular|elasticsearch-browser)[\/\\]/,
|
||||
/node_modules[\/\\](angular-nvd3|mocha|moment)[\/\\]/
|
||||
]
|
||||
}
|
||||
});
|
||||
|
|
|
@ -324,6 +324,7 @@ define(function (require) {
|
|||
*/
|
||||
var sortBy = (function () {
|
||||
if (!_.isArray(sort)) return 'implicit';
|
||||
else if (sort[0] === '_score') return 'implicit';
|
||||
else if (sort[0] === timeField) return 'time';
|
||||
else return 'non-time';
|
||||
}());
|
||||
|
@ -334,6 +335,7 @@ define(function (require) {
|
|||
}
|
||||
|
||||
$scope.updateTime();
|
||||
if (sort[0] === '_score') segmented.setMaxSegments(1);
|
||||
segmented.setDirection(sortBy === 'time' ? (sort[1] || 'desc') : 'desc');
|
||||
segmented.setSize(sortBy === 'time' ? $scope.opts.sampleSize : false);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ require('ui/testHarness');
|
|||
|
||||
bundle.modules.forEach(function (id, i) {
|
||||
if (i > 0) print('\\n');
|
||||
print(\`require('\${id}');\`);
|
||||
print(\`require('\${id.replace(/\\\\/g, '\\\\\\\\')}');\`);
|
||||
});
|
||||
|
||||
%>
|
||||
|
|
|
@ -131,12 +131,24 @@ define(function () {
|
|||
},
|
||||
'timepicker:timeDefaults': {
|
||||
type: 'json',
|
||||
value: JSON.stringify({
|
||||
from: 'now-15m',
|
||||
to: 'now',
|
||||
mode: 'quick'
|
||||
}, null, 2)
|
||||
value: [
|
||||
'{',
|
||||
' "from": "now-15m",',
|
||||
' "to": "now",',
|
||||
' "mode": "quick"',
|
||||
'}'
|
||||
].join('\n')
|
||||
},
|
||||
'timepicker:refreshIntervalDefaults': {
|
||||
type: 'json',
|
||||
value: [
|
||||
'{',
|
||||
' "display": "Off",',
|
||||
' "pause": false,',
|
||||
' "value": 0',
|
||||
'}'
|
||||
].join('\n')
|
||||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
|
@ -21,6 +21,7 @@ define(function (require) {
|
|||
// export a couple methods from the request
|
||||
this.setDirection = _.bindKey(req, 'setDirection');
|
||||
this.setSize = _.bindKey(req, 'setSize');
|
||||
this.setMaxSegments = _.bindKey(req, 'setMaxSegments');
|
||||
}
|
||||
|
||||
return SegmentedHandle;
|
||||
|
|
|
@ -118,6 +118,15 @@ define(function (require) {
|
|||
** SegmentedReq specific methods
|
||||
*********/
|
||||
|
||||
/**
|
||||
* Set the sort total number of segments to emit
|
||||
*
|
||||
* @param {number}
|
||||
*/
|
||||
SegmentedReq.prototype.setMaxSegments = function (maxSegments) {
|
||||
this._maxSegments = Math.max(_.parseInt(maxSegments), 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the sort direction for the request.
|
||||
*
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
sorting="sorting">
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="row in page|limitTo:limit track by row._index+row._type+row._id"
|
||||
<tr ng-repeat="row in page|limitTo:limit track by row._index+row._type+row._id+row._score"
|
||||
kbn-table-row="row"
|
||||
columns="columns"
|
||||
sorting="sorting"
|
||||
|
@ -30,7 +30,7 @@
|
|||
sorting="sorting">
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="row in hits|limitTo:limit track by row._index+row._type+row._id"
|
||||
<tr ng-repeat="row in hits|limitTo:limit track by row._index+row._type+row._id+row._score"
|
||||
kbn-table-row="row"
|
||||
columns="columns"
|
||||
sorting="sorting"
|
||||
|
|
|
@ -4,7 +4,6 @@ var ngMock = require('ngMock');
|
|||
|
||||
describe('Timefilter service', function () {
|
||||
describe('time diff watcher', function () {
|
||||
|
||||
var fn;
|
||||
var update;
|
||||
var fetch;
|
||||
|
|
8
src/ui/public/timefilter/__tests__/index.js
Normal file
8
src/ui/public/timefilter/__tests__/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
var modules = require('ui/modules');
|
||||
|
||||
modules.get('kibana').config(function ($provide) {
|
||||
$provide.decorator('timefilter', function ($delegate) {
|
||||
$delegate.consumeDefaults();
|
||||
return $delegate;
|
||||
});
|
||||
});
|
|
@ -27,31 +27,32 @@ define(function (require) {
|
|||
|
||||
self.enabled = false;
|
||||
|
||||
var timeDefaults = config.get('timepicker:timeDefaults');
|
||||
self.init = _.once(function () {
|
||||
return config.init()
|
||||
.then(self.consumeDefaults);
|
||||
});
|
||||
|
||||
var refreshIntervalDefaults = {
|
||||
display: 'Off',
|
||||
pause: false,
|
||||
section: 0,
|
||||
value: 0
|
||||
};
|
||||
self.consumeDefaults = _.once(function () {
|
||||
var timeDefaults = config.get('timepicker:timeDefaults');
|
||||
var refreshIntervalDefaults = config.get('timepicker:refreshIntervalDefaults');
|
||||
|
||||
// These can be date math strings or moments.
|
||||
self.time = _.defaults(globalState.time || {}, timeDefaults);
|
||||
self.refreshInterval = _.defaults(globalState.refreshInterval || {}, refreshIntervalDefaults);
|
||||
// These can be date math strings or moments.
|
||||
self.time = _.defaults(globalState.time || {}, timeDefaults);
|
||||
self.refreshInterval = _.defaults(globalState.refreshInterval || {}, refreshIntervalDefaults);
|
||||
|
||||
globalState.on('fetch_with_changes', function () {
|
||||
// clone and default to {} in one
|
||||
var newTime = _.defaults({}, globalState.time, timeDefaults);
|
||||
var newRefreshInterval = _.defaults({}, globalState.refreshInterval, refreshIntervalDefaults);
|
||||
globalState.on('fetch_with_changes', function () {
|
||||
// clone and default to {} in one
|
||||
var newTime = _.defaults({}, globalState.time, timeDefaults);
|
||||
var newRefreshInterval = _.defaults({}, globalState.refreshInterval, refreshIntervalDefaults);
|
||||
|
||||
if (newTime) {
|
||||
if (newTime.to) newTime.to = convertISO8601(newTime.to);
|
||||
if (newTime.from) newTime.from = convertISO8601(newTime.from);
|
||||
}
|
||||
if (newTime) {
|
||||
if (newTime.to) newTime.to = convertISO8601(newTime.to);
|
||||
if (newTime.from) newTime.from = convertISO8601(newTime.from);
|
||||
}
|
||||
|
||||
self.time = newTime;
|
||||
self.refreshInterval = newRefreshInterval;
|
||||
self.time = newTime;
|
||||
self.refreshInterval = newRefreshInterval;
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$$timefilter = self;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue