diff --git a/public/app/directives/metric.segment.js b/public/app/directives/metric.segment.js index 953c92b6d3a..7f4144e4530 100644 --- a/public/app/directives/metric.segment.js +++ b/public/app/directives/metric.segment.js @@ -173,11 +173,12 @@ function (angular, app, _, $) { $scope.valueToSegment = function(value) { var option = _.findWhere($scope.options, {value: value}); - if (option) { - return uiSegmentSrv.newSegment({value: option.text, cssClass: attrs.cssClass, custom: attrs.custom}); - } else { - return uiSegmentSrv.newSegment({value: value, cssClass: attrs.cssClass, custom: attrs.custom}); - } + var segment = { + cssClass: attrs.cssClass, + custom: attrs.custom, + value: option ? option.text : value, + }; + return uiSegmentSrv.newSegment(segment); }; $scope.getOptionsInternal = function() { diff --git a/public/app/plugins/datasource/elasticsearch/bucketAgg.js b/public/app/plugins/datasource/elasticsearch/bucketAgg.js index 52dce608b13..6d5ef5adc68 100644 --- a/public/app/plugins/datasource/elasticsearch/bucketAgg.js +++ b/public/app/plugins/datasource/elasticsearch/bucketAgg.js @@ -54,7 +54,7 @@ function (angular, _, queryDef) { $scope.settingsLinkText += ' (' + $scope.agg.order + ')'; } } else if ($scope.agg.type === 'date_histogram') { - delete $scope.agg.field; + $scope.agg.field = $scope.target.timeField; } return true; diff --git a/public/app/plugins/datasource/elasticsearch/partials/bucketAgg.html b/public/app/plugins/datasource/elasticsearch/partials/bucketAgg.html index fa4d5f3658f..3a16f058af0 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/bucketAgg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/bucketAgg.html @@ -7,10 +7,10 @@
  • -
  • +
  • -
  • +
  • {{settingsLinkText}}
  • @@ -27,7 +27,7 @@
    -
    +
    • diff --git a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html index bf8dba00318..e7c39e3a407 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/metricAgg.html @@ -9,7 +9,7 @@
    • -
    • +
    • {{settingsLinkText}}
    diff --git a/public/app/plugins/datasource/elasticsearch/queryCtrl.js b/public/app/plugins/datasource/elasticsearch/queryCtrl.js index 21574250625..d5f380bee3a 100644 --- a/public/app/plugins/datasource/elasticsearch/queryCtrl.js +++ b/public/app/plugins/datasource/elasticsearch/queryCtrl.js @@ -15,6 +15,7 @@ function (angular, _) { target.metrics = target.metrics || [{ type: 'count', id: '1' }]; target.bucketAggs = target.bucketAggs || [{ type: 'date_histogram', id: '2'}]; + target.timeField = $scope.datasource.timeField; }; $scope.getFields = function() { diff --git a/public/css/less/tightform.less b/public/css/less/tightform.less index 38ae5531d9d..39c788803a6 100644 --- a/public/css/less/tightform.less +++ b/public/css/less/tightform.less @@ -213,3 +213,8 @@ select.tight-form-input { .tight-form-item-large { width: 115px; } .tight-form-item-xlarge { width: 150px; } .tight-form-item-xxlarge { width: 200px; } + +.tight-form-inner-box { + margin: 20px 0 20px 148px; + display: inline-block; +}