From fe89eda140d1cc01cdc1d27f5730a9a9f6543cf4 Mon Sep 17 00:00:00 2001 From: ppisljar Date: Fri, 19 May 2017 11:03:02 +0200 Subject: [PATCH] fixing spy --- src/core_plugins/spy_modes/public/table_spy_mode.js | 6 +++--- src/ui/public/vis/editors/default/default.html | 2 +- src/ui/public/vis/editors/default/default.js | 3 ++- src/ui/public/vis/request_handlers/courier.js | 1 + src/ui/public/visualize/visualization.js | 3 ++- src/ui/public/visualize/visualization_editor.js | 5 +++-- src/ui/public/visualize/visualize.html | 3 ++- src/ui/public/visualize/visualize.js | 2 +- 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/core_plugins/spy_modes/public/table_spy_mode.js b/src/core_plugins/spy_modes/public/table_spy_mode.js index 8232c73a3741c..3251e3a113896 100644 --- a/src/core_plugins/spy_modes/public/table_spy_mode.js +++ b/src/core_plugins/spy_modes/public/table_spy_mode.js @@ -15,16 +15,16 @@ function VisSpyTableProvider(Notifier, $filter, $rootScope, config, Private) { link: function tableLinkFn($scope) { $rootScope.$watchMulti.call($scope, [ 'vis', - 'esResp' + 'visData' ], function () { - if (!$scope.vis || !$scope.esResp) { + if (!$scope.vis || !$scope.visData) { $scope.table = null; } else { if (!$scope.spy.params.spyPerPage) { $scope.spy.params.spyPerPage = PER_PAGE_DEFAULT; } - $scope.table = tabifyAggResponse($scope.vis, $scope.esResp, { + $scope.table = tabifyAggResponse($scope.vis, $scope.searchSource.rawResponse, { canSplit: false, asAggConfigResults: true, partialRows: true diff --git a/src/ui/public/vis/editors/default/default.html b/src/ui/public/vis/editors/default/default.html index 9299b1e17f407..e58ae82b0fb2b 100644 --- a/src/ui/public/vis/editors/default/default.html +++ b/src/ui/public/vis/editors/default/default.html @@ -3,5 +3,5 @@
- +
diff --git a/src/ui/public/vis/editors/default/default.js b/src/ui/public/vis/editors/default/default.js index ec4be1e7fb6c2..7c2973a56d049 100644 --- a/src/ui/public/vis/editors/default/default.js +++ b/src/ui/public/vis/editors/default/default.js @@ -14,13 +14,14 @@ const defaultEditor = function ($rootScope, $compile) { this.el = el; } - render(vis, visData) { + render(vis, visData, searchSource) { let $scope; const updateScope = function () { $scope.vis = vis; $scope.visData = visData; $scope.uiState = vis.getUiState(); + $scope.searchSource = searchSource; }; if (!this.$scope) { diff --git a/src/ui/public/vis/request_handlers/courier.js b/src/ui/public/vis/request_handlers/courier.js index 8a57f047e4cb1..03df31a972d3b 100644 --- a/src/ui/public/vis/request_handlers/courier.js +++ b/src/ui/public/vis/request_handlers/courier.js @@ -12,6 +12,7 @@ const CourierRequestHandlerProvider = function (Private, courier) { return new Promise((resolve, reject) => { searchSource.onResults().then(resp => { + searchSource.rawResponse = resp; resolve(resp); }).catch(e => reject(e)); diff --git a/src/ui/public/visualize/visualization.js b/src/ui/public/visualize/visualization.js index 1bb8434d51179..021c0fc0c483f 100644 --- a/src/ui/public/visualize/visualization.js +++ b/src/ui/public/visualize/visualization.js @@ -19,7 +19,8 @@ uiModules scope : { vis: '=', visData: '=', - uiState: '=?' + uiState: '=?', + searchSource: '=' }, template: visualizationTemplate, link: function ($scope, $el, attr, renderCounter) { diff --git a/src/ui/public/visualize/visualization_editor.js b/src/ui/public/visualize/visualization_editor.js index fd221e0a0cad2..a23da5d538a14 100644 --- a/src/ui/public/visualize/visualization_editor.js +++ b/src/ui/public/visualize/visualization_editor.js @@ -17,7 +17,8 @@ uiModules scope : { vis: '=', visData: '=', - uiState: '=?' + uiState: '=?', + searchSource: '=' }, link: function ($scope, element) { // Clone the _vis instance. @@ -27,7 +28,7 @@ uiModules const editor = new Editor(element); const renderFunction = _.debounce(() => { - editor.render(vis, $scope.visData); + editor.render(vis, $scope.visData, $scope.searchSource); $scope.$apply(); }, 200); diff --git a/src/ui/public/visualize/visualize.html b/src/ui/public/visualize/visualize.html index e4fe11a21d81a..89ec673b7abd3 100644 --- a/src/ui/public/visualize/visualize.html +++ b/src/ui/public/visualize/visualize.html @@ -5,6 +5,7 @@ vis-data="visData" ui-state="uiState" class="vis-editor-content" + search-source="savedVis.searchSource" /> - + diff --git a/src/ui/public/visualize/visualize.js b/src/ui/public/visualize/visualize.js index e604ff62fd4d0..65018cc4a82e4 100644 --- a/src/ui/public/visualize/visualize.js +++ b/src/ui/public/visualize/visualize.js @@ -37,7 +37,7 @@ uiModules link: function ($scope, $el) { $scope.vis = $scope.savedVis.vis; $scope.editorMode = $scope.editorMode || false; - $scope.showSpyPanel = $scope.showSpyPanel || false; + $scope.vis.showSpyPanel = $scope.showSpyPanel || false; const requestHandler = getHandler(requestHandlers, $scope.vis.type.requestHandler); const responseHandler = getHandler(responseHandlers, $scope.vis.type.responseHandler);