Skip to content

Commit

Permalink
load directives explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza Katz committed Apr 21, 2019
1 parent 57b9aab commit 2be188f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
14 changes: 2 additions & 12 deletions src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
}

Expand All @@ -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<DataService['setup']>;
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ import { setupDirective } from './directive';

/**
* Search Bar Service
*
* @internal
*/
export class SearchBarService {
public setup() {
setupDirective();
return {
SearchBar,
loadLegacyDirectives: _.once(setupDirective)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 2be188f

Please sign in to comment.