From 90e4013c975d907fb3f33a5c37f9c61950643360 Mon Sep 17 00:00:00 2001 From: ppisljar Date: Mon, 21 May 2018 11:57:53 -0500 Subject: [PATCH] cleaning up and removing rootSearchSource and appSearchSource concepts --- .../kibana/public/dashboard/dashboard_app.js | 3 - src/ui/public/courier/courier.js | 4 -- .../data_source/_root_search_source.js | 70 ------------------- .../courier/data_source/search_source.js | 5 +- 4 files changed, 2 insertions(+), 80 deletions(-) delete mode 100644 src/ui/public/courier/data_source/_root_search_source.js diff --git a/src/core_plugins/kibana/public/dashboard/dashboard_app.js b/src/core_plugins/kibana/public/dashboard/dashboard_app.js index 1454a108755301..302a0aec6b8d32 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard_app.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard_app.js @@ -128,9 +128,6 @@ app.directive('dashboardApp', function ($injector) { timefilter.enableAutoRefreshSelector(); timefilter.enableTimeRangeSelector(); - dash.searchSource.highlightAll(true); - dash.searchSource.version(true); - courier.setRootSearchSource(dash.searchSource); updateState(); diff --git a/src/ui/public/courier/courier.js b/src/ui/public/courier/courier.js index 4dc8cb99d8be64..2eb16f5baa3df1 100644 --- a/src/ui/public/courier/courier.js +++ b/src/ui/public/courier/courier.js @@ -10,7 +10,6 @@ import { SearchSourceProvider } from './data_source/search_source'; import { requestQueue } from './_request_queue'; import { FetchSoonProvider } from './fetch'; import { SearchLooperProvider } from './looper/search'; -import { RootSearchSourceProvider } from './data_source/_root_search_source'; import { SavedObjectProvider } from './saved_object'; import { RedirectWhenMissingProvider } from './_redirect_when_missing'; @@ -23,9 +22,6 @@ uiModules.get('kibana/courier') const fetchSoon = Private(FetchSoonProvider); const searchLooper = self.searchLooper = Private(SearchLooperProvider); - // expose some internal modules - self.setRootSearchSource = Private(RootSearchSourceProvider).set; - self.SavedObject = Private(SavedObjectProvider); self.indexPatterns = indexPatterns; self.redirectWhenMissing = Private(RedirectWhenMissingProvider); diff --git a/src/ui/public/courier/data_source/_root_search_source.js b/src/ui/public/courier/data_source/_root_search_source.js deleted file mode 100644 index 0b9a43157ae40f..00000000000000 --- a/src/ui/public/courier/data_source/_root_search_source.js +++ /dev/null @@ -1,70 +0,0 @@ -import { SearchSourceProvider } from './search_source'; - -export function RootSearchSourceProvider(Private, $rootScope, timefilter) { - const SearchSource = Private(SearchSourceProvider); - - const globalSource = new SearchSource(); - globalSource.inherits(false); // this is the final source, it has no parents - globalSource.filter(function (globalSource) { - // dynamic time filter will be called in the _flatten phase of things - const filter = timefilter.get(globalSource.get('index')); - // Attach a meta property to it, that we check inside visualizations - // to remove that timefilter again because we use our explicitly passed in one. - // This should be removed as soon as we got rid of inheritance in SearchSource - // across the boundary or visualization. - if (filter) { - filter.meta = { _globalTimefilter: true }; - } - return filter; - }); - - let appSource; // set in setAppSource() - resetAppSource(); - - // when the route changes, clear the appSource - $rootScope.$on('$routeChangeStart', resetAppSource); - - /** - * Get the current AppSource - * @return {Promise} - resolved with the current AppSource - */ - function getAppSource() { - return appSource; - } - - /** - * Set the current AppSource - * @param {SearchSource} source - The Source that represents the applications "root" search source object - */ - function setAppSource(source) { - appSource = source; - - // walk the parent chain until we get to the global source or nothing - // that's where we will attach to the globalSource - let literalRoot = source; - while (literalRoot._parent && literalRoot._parent !== globalSource) { - literalRoot = literalRoot._parent; - } - - literalRoot.inherits(globalSource); - } - - - - /** - * Sets the appSource to be a new, empty, SearchSource - * @return {undefined} - */ - function resetAppSource() { - setAppSource(new SearchSource()); - } - - return { - get: getAppSource, - set: setAppSource, - - getGlobalSource: function () { - return globalSource; - } - }; -} diff --git a/src/ui/public/courier/data_source/search_source.js b/src/ui/public/courier/data_source/search_source.js index a4d6362f50307b..68361886816940 100644 --- a/src/ui/public/courier/data_source/search_source.js +++ b/src/ui/public/courier/data_source/search_source.js @@ -56,7 +56,6 @@ import angular from 'angular'; import '../../promises'; import { NormalizeSortRequestProvider } from './_normalize_sort_request'; -import { RootSearchSourceProvider } from './_root_search_source'; import { SearchRequestProvider } from '../fetch/request'; import { SegmentedRequestProvider } from '../fetch/request/segmented'; @@ -208,11 +207,11 @@ export function SearchSourceProvider(Promise, PromiseEmitter, Private, config) { * Get the parent of this SearchSource * @return {undefined|searchSource} */ - getParent(onlyHardLinked) { + getParent() { const self = this; if (self._parent === false) return; if (self._parent) return self._parent; - return onlyHardLinked ? undefined : Private(RootSearchSourceProvider).get(); + return undefined; } /**