From efc46db61c131aebf1e44fa6cca50473f6edbf33 Mon Sep 17 00:00:00 2001 From: Matt Bargar Date: Tue, 3 Oct 2017 16:33:32 -0400 Subject: [PATCH] Show query and filter bars even when there's a linked search (#14212) The query bar used to be hidden in the presence of a linked search because unlike filters, queries didn't get merged when flattening a SearchSource hierarchy. That means a query in the query bar would override the query in the linked search. This is no longer the case. As of 6.0 we include all queries in the SearchSource hierarchy in the final request, so there's no longer any reason to hide the query bar. Since filters created via a Vis show up in the query bar when Kuery is selected, these filters now appear correctly even when there's a linked search in the vis editor. Previously when unlinking a saved search visualize would insert the query and filters from the saved search into app state before removing the SearchSource from the hierarcy. This posed a problem because combining two lucene query strings isn't as easy as combing two sets of filters. We decided this behavior was a bit counterintuitive anyway. If the user wants to unlink the saved search, they probably want to discard it, not combine it with their local changes. So I've also updated the unlinking functionality to discard the saved search. --- src/core_plugins/kibana/public/visualize/editor/editor.html | 6 ++---- src/core_plugins/kibana/public/visualize/editor/editor.js | 6 ++++-- src/ui/public/vis/request_handlers/courier.js | 4 +--- ui_framework/dist/ui_framework.css | 4 +--- ui_framework/src/components/local_nav/_local_nav.scss | 3 +-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/core_plugins/kibana/public/visualize/editor/editor.html b/src/core_plugins/kibana/public/visualize/editor/editor.html index 3193ea41387d3..f49f046a7954a 100644 --- a/src/core_plugins/kibana/public/visualize/editor/editor.html +++ b/src/core_plugins/kibana/public/visualize/editor/editor.html @@ -18,7 +18,6 @@ ng-show="chrome.getVisible()" class="fullWidth" > -
Linked to Saved Search “{{ savedVis.savedSearch.title }}”   @@ -31,8 +30,7 @@
- -
+
diff --git a/src/core_plugins/kibana/public/visualize/editor/editor.js b/src/core_plugins/kibana/public/visualize/editor/editor.js index a054beb5da277..0831d3d7317de 100644 --- a/src/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/core_plugins/kibana/public/visualize/editor/editor.js @@ -287,9 +287,9 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie delete savedVis.savedSearchId; parent.set('filter', _.union(searchSource.getOwn('filter'), parent.getOwn('filter'))); - // copy over all state except "aggs" and filter, which is already copied + // copy over all state except "aggs", "query" and "filter" _(parent.toJSON()) - .omit('aggs') + .omit(['aggs', 'filter', 'query']) .forOwn(function (val, key) { searchSource.set(key, val); }) @@ -298,6 +298,8 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie $state.query = searchSource.get('query'); $state.filters = searchSource.get('filter'); searchSource.inherits(parentsParent); + + $scope.fetch(); }; init(); diff --git a/src/ui/public/vis/request_handlers/courier.js b/src/ui/public/vis/request_handlers/courier.js index be6a6a4aaed5f..abb9b0d1c1682 100644 --- a/src/ui/public/vis/request_handlers/courier.js +++ b/src/ui/public/vis/request_handlers/courier.js @@ -10,9 +10,7 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) { if (queryFilter && vis.editorMode) { searchSource.set('filter', queryFilter.getFilters()); - if (!appState.linked) { - searchSource.set('query', appState.query); - } + searchSource.set('query', appState.query); } const shouldQuery = () => { diff --git a/ui_framework/dist/ui_framework.css b/ui_framework/dist/ui_framework.css index b121a572dfe59..a940125bd77ff 100644 --- a/ui_framework/dist/ui_framework.css +++ b/ui_framework/dist/ui_framework.css @@ -2135,9 +2135,7 @@ main { * of this container using padding. */ .kuiLocalNavRow--secondary { - height: 40px; - /* 1 */ - padding: 0 10px 0; + padding: 0 10px 10px; /* 1 */ -webkit-box-align: start; -webkit-align-items: flex-start; diff --git a/ui_framework/src/components/local_nav/_local_nav.scss b/ui_framework/src/components/local_nav/_local_nav.scss index 32f5166eac10c..d82b7f139c939 100644 --- a/ui_framework/src/components/local_nav/_local_nav.scss +++ b/ui_framework/src/components/local_nav/_local_nav.scss @@ -43,7 +43,6 @@ * of this container using padding. */ .kuiLocalNavRow--secondary { - height: 40px; /* 1 */ - padding: 0 $localNavSideSpacing 0; /* 1 */ + padding: 0 $localNavSideSpacing 10px; /* 1 */ align-items: flex-start; /* 1 */ }