Merge branch 'master' into feature/vislib_documentation

This commit is contained in:
Shelby Sturgis 2014-10-15 23:22:32 +03:00
commit e545637341
7 changed files with 26 additions and 8 deletions

View file

@ -1,4 +1,6 @@
define(function (require) {
var _ = require('lodash');
require('modules')
.get('app/visualize')
.directive('visAggParamEditor', function () {
@ -12,6 +14,15 @@ define(function (require) {
},
template: function ($el, attr) {
return $el.html();
},
link: function ($scope) {
$scope.optionEnabled = function (option) {
if (option && _.isFunction(option.enabled)) {
return option.enabled($scope.aggConfig);
}
return true;
};
}
};
});

View file

@ -43,7 +43,6 @@ define(function (require) {
'kibana/courier'
])
.controller('VisEditor', function ($scope, $route, timefilter, AppState, $location, kbnUrl, $timeout, courier) {
var _ = require('lodash');
var angular = require('angular');
var ConfigTemplate = require('utils/config_template');
@ -83,6 +82,7 @@ define(function (require) {
function init() {
// export some objects
$scope.savedVis = savedVis;
$scope.searchSource = searchSource;
$scope.vis = vis;
$scope.editableVis = editableVis;
$scope.state = $state;
@ -112,6 +112,10 @@ define(function (require) {
editableVis.dirty = !angular.equals(newState, vis.getState());
}, true);
$scope.$watch('searchSource.get("index").timeFieldName', function (timeField) {
timefilter.enabled = !!timeField;
});
$scope.$listen($state, 'fetch_with_changes', function () {
vis.setState($state.vis);
@ -128,7 +132,6 @@ define(function (require) {
});
timefilter.enabled = true;
$scope.$listen(timefilter, 'update', _.bindKey($scope, 'fetch'));
$scope.$on('ready:vis', function () {

View file

@ -8,7 +8,10 @@ define(function (require) {
return [
{
display: 'Auto',
val: 'auto'
val: 'auto',
enabled: function (aggConfig) {
return !!aggConfig.vis.indexPattern.timeFieldName;
}
},
{
display: 'Second',

View file

@ -102,7 +102,7 @@ define(function (require) {
min: val.min,
max: val.max
};
} else {
} else if (aggConfig.vis.indexPattern.timeFieldName) {
var tfBounds = timefilter.getBounds();
output.params.extended_bounds = {
min: tfBounds.min,

View file

@ -4,9 +4,10 @@
ng-if="aggParam.options"
ng-model="params.interval"
required
ng-options="opt as opt.display for opt in aggParam.options"
ng-options="opt as opt.display for opt in aggParam.options.raw | filter:optionEnabled"
class="form-control"
name="interval">
<option value="">-- select a valid interval --</option>
</select>
<input
ng-if="!aggParam.options"

View file

@ -21,7 +21,7 @@ define(function (require) {
'ngRoute'
]);
configFile.elasticsearch = ('http://' + window.location.hostname + '/elasticsearch/');
configFile.elasticsearch = (window.location.protocol + '//' + window.location.hostname + '/elasticsearch/');
kibana
// This stores the Kibana revision number, @REV@ is replaced by grunt.

View file

@ -70,8 +70,8 @@ define(function (require) {
var bounds = this.getBounds();
filter = {range : {}};
filter.range[timefield.name] = {
gte: bounds.min,
lte: bounds.max
gte: bounds.min.valueOf(),
lte: bounds.max.valueOf()
};
}
return filter;