diff --git a/src/ui/public/visualize/visualization.html b/src/ui/public/visualize/visualization.html
index a6da0ee3dfdf5..4ae9a6dc1fe0b 100644
--- a/src/ui/public/visualize/visualization.html
+++ b/src/ui/public/visualize/visualization.html
@@ -21,4 +21,4 @@
No results found
class="visualize-chart">
-
+
diff --git a/src/ui/public/visualize/visualization.js b/src/ui/public/visualize/visualization.js
index d3f19fbf57c5a..d37f2b57b7232 100644
--- a/src/ui/public/visualize/visualization.js
+++ b/src/ui/public/visualize/visualization.js
@@ -35,10 +35,6 @@ uiModules
$scope.addLegend = false;
- $scope.shouldShowSpyPanel = () => {
- return $scope.vis.type.requiresSearch && $scope.showSpyPanel;
- };
-
// Show no results message when isZeroHits is true and it requires search
$scope.showNoResultsMessage = function () {
const requiresSearch = _.get($scope, 'vis.type.requiresSearch');
diff --git a/src/ui/public/visualize/visualize.html b/src/ui/public/visualize/visualize.html
index 32c29ec6e4b0e..5ed8fe17fc841 100644
--- a/src/ui/public/visualize/visualize.html
+++ b/src/ui/public/visualize/visualize.html
@@ -6,7 +6,7 @@
ui-state="uiState"
class="vis-editor-content"
search-source="savedObj.searchSource"
- show-spy-panel="showSpyPanel"
+ show-spy-panel="shouldShowSpyPanel()"
/>
diff --git a/src/ui/public/visualize/visualize.js b/src/ui/public/visualize/visualize.js
index 7a6c5abbf94cc..beb7ab9273709 100644
--- a/src/ui/public/visualize/visualize.js
+++ b/src/ui/public/visualize/visualize.js
@@ -68,7 +68,10 @@ uiModules
}
// spy panel is supported only with courier request handler
- if (!$scope.vis.type.requestHandler !== 'courier') $scope.showSpyPanel = false;
+ $scope.shouldShowSpyPanel = () => {
+ if ($scope.vis.type.requestHandler !== 'courier') return false;
+ return $scope.vis.type.requiresSearch && $scope.showSpyPanel;
+ };
if (!$scope.appState) $scope.appState = getAppState();