From 2be188f88a4e182e1ffe8efe97637e4852067079 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Sun, 21 Apr 2019 13:09:35 +0300 Subject: [PATCH] load directives explicitly --- src/legacy/core_plugins/data/public/index.ts | 14 ++------------ .../data/public/search_bar/search_bar_service.ts | 3 +-- .../kibana/public/dashboard/dashboard_app.js | 3 ++- .../kibana/public/discover/controllers/discover.js | 4 ++-- .../kibana/public/visualize/editor/editor.js | 3 ++- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/legacy/core_plugins/data/public/index.ts b/src/legacy/core_plugins/data/public/index.ts index d388e70c3edd9..55988334bdbb3 100644 --- a/src/legacy/core_plugins/data/public/index.ts +++ b/src/legacy/core_plugins/data/public/index.ts @@ -25,16 +25,14 @@ class DataService { private readonly searchBar: SearchBarService; constructor() { - // debugger; this.indexPatterns = new IndexPatternsService(); this.searchBar = new SearchBarService(); } public setup() { - // debugger; return { indexPatterns: this.indexPatterns.setup(), - ...this.searchBar.setup(), + search: this.searchBar.setup(), }; } @@ -44,15 +42,7 @@ class DataService { } } -/** - * We temporarily export default here so that users importing from 'plugins/data' - * will automatically receive the response value of the `setup` contract, mimicking - * the data that will eventually be injected by the new platform. - */ -// eslint-disable-next-line import/no-default-export -// debugger; -const data = new DataService().setup(); -export { data }; +export const data = new DataService().setup(); /** @public */ export type DataSetup = ReturnType; diff --git a/src/legacy/core_plugins/data/public/search_bar/search_bar_service.ts b/src/legacy/core_plugins/data/public/search_bar/search_bar_service.ts index f212a9aa3fbd5..b2b8d9309cd18 100644 --- a/src/legacy/core_plugins/data/public/search_bar/search_bar_service.ts +++ b/src/legacy/core_plugins/data/public/search_bar/search_bar_service.ts @@ -24,14 +24,13 @@ import { setupDirective } from './directive'; /** * Search Bar Service - * * @internal */ export class SearchBarService { public setup() { - setupDirective(); return { SearchBar, + loadLegacyDirectives: _.once(setupDirective) }; } diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.js b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.js index 15787fb1b6fce..046421fe41b77 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.js +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.js @@ -58,7 +58,8 @@ import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing'; import { DashboardViewportProvider } from './viewport/dashboard_viewport_provider'; -import 'plugins/data'; +import { data } from 'plugins/data'; +data.search.loadLegacyDirectives(); const app = uiModules.get('app/dashboard', [ 'elasticsearch', 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 91cb69feb032b..ce1330308f630 100644 --- a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js @@ -69,8 +69,8 @@ import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../breadcrumbs'; import { buildVislibDimensions } from 'ui/visualize/loader/pipeline_helpers/build_pipeline'; import 'ui/capabilities/route_setup'; -import 'plugins/data'; - +import { data } from 'plugins/data'; +data.search.loadLegacyDirectives(); const fetchStatuses = { UNINITIALIZED: 'uninitialized', 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 faf16bb5dfe1d..56816f5e3851f 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/legacy/core_plugins/kibana/public/visualize/editor/editor.js @@ -54,7 +54,8 @@ import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal'; import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; import { getEditBreadcrumbs, getCreateBreadcrumbs } from '../breadcrumbs'; -import 'plugins/data'; +import { data } from 'plugins/data'; +data.search.loadLegacyDirectives(); uiRoutes .when(VisualizeConstants.CREATE_PATH, {