Skip to content

Commit

Permalink
Fix broken setting of bucketInterval, remove $watch
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Apr 8, 2020
1 parent 314c4f7 commit b0c17d3
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -675,17 +675,6 @@ function discoverController(
}
});

$scope.$watch('vis.aggs', function() {
// no timefield, no vis, nothing to update
if (!getTimeField() || !$scope.vis) return;

const buckets = $scope.vis.data.aggs.byTypeName('buckets');

if (buckets && buckets.length === 1) {
$scope.bucketInterval = buckets[0].buckets.getInterval();
}
});

$scope.$watchMulti(
['rows', 'fetchStatus'],
(function updateResultState() {
Expand Down Expand Up @@ -891,6 +880,9 @@ function discoverController(
tabifiedData,
getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange)
);
if ($scope.vis.data.aggs.aggs[1]) {
$scope.bucketInterval = $scope.vis.data.aggs.aggs[1].buckets.getInterval();
}
}

$scope.hits = resp.hits.total;
Expand Down

0 comments on commit b0c17d3

Please sign in to comment.