mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Merge pull request #1657 from spenceralger/fix/1656
Update visualize for non-time-based indices
This commit is contained in:
commit
1c8df7572e
5 changed files with 23 additions and 5 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -8,7 +8,10 @@ define(function (require) {
|
|||
return [
|
||||
{
|
||||
display: 'Auto',
|
||||
val: 'auto'
|
||||
val: 'auto',
|
||||
enabled: function (aggConfig) {
|
||||
return !!aggConfig.vis.indexPattern.timeFieldName;
|
||||
}
|
||||
},
|
||||
{
|
||||
display: 'Second',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue