From 04752cb12b5d715faddf3433e4927990177f4599 Mon Sep 17 00:00:00 2001 From: Matthew Bargar Date: Wed, 6 Feb 2019 19:09:41 -0500 Subject: [PATCH] cleanup based on review feedback --- .../kibana/public/discover/controllers/discover.js | 6 +----- .../kibana/public/visualize/editor/editor.js | 10 ++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js index 6cba8b302d09f..d6a55d14498c8 100644 --- a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js @@ -528,11 +528,7 @@ function discoverController( $scope.$listen(queryFilter, 'fetch', $scope.fetch); $scope.$watch('opts.timefield', function (timefield) { - if (!!timefield) { - $scope.enableTimeRangeSelector = true; - } else { - $scope.enableTimeRangeSelector = false; - } + $scope.enableTimeRangeSelector = !!timefield; }); $scope.$watch('state.interval', function () { diff --git a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js index c32b3380b1590..798e24c59ea31 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -347,11 +347,11 @@ function VisEditor( ], function ([index, requiresTimePicker, requiresQueryBar]) { const showTimeFilter = Boolean((!index || index.timeFieldName) && requiresTimePicker); - if (showTimeFilter && requiresQueryBar) { + if (requiresQueryBar) { timefilter.disableTimeRangeSelector(); timefilter.disableAutoRefreshSelector(); $scope.enableQueryBarTimeRangeSelector = true; - $scope.showAutoRefreshOnlyInQueryBar = false; + $scope.showAutoRefreshOnlyInQueryBar = !showTimeFilter; } else if (showTimeFilter) { timefilter.enableTimeRangeSelector(); @@ -359,12 +359,6 @@ function VisEditor( $scope.enableQueryBarTimeRangeSelector = false; $scope.showAutoRefreshOnlyInQueryBar = false; } - else if (requiresQueryBar) { - timefilter.disableTimeRangeSelector(); - timefilter.disableAutoRefreshSelector(); - $scope.enableQueryBarTimeRangeSelector = true; - $scope.showAutoRefreshOnlyInQueryBar = true; - } else { timefilter.disableTimeRangeSelector(); timefilter.enableAutoRefreshSelector();