diff --git a/src/legacy/core_plugins/kibana/public/discover/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/angular/discover.js index ed233c08e8d49..ce1419cd637b9 100644 --- a/src/legacy/core_plugins/kibana/public/discover/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/angular/discover.js @@ -65,7 +65,6 @@ const { data, docTitle, filterManager, - State, share, timefilter, toastNotifications, @@ -121,7 +120,7 @@ app.config($routeProvider => { template: indexTemplate, reloadOnSearch: false, resolve: { - savedObjects: function (redirectWhenMissing, $route, kbnUrl, Promise, $rootScope) { + savedObjects: function (redirectWhenMissing, $route, kbnUrl, Promise, $rootScope, State) { const indexPatterns = getServices().indexPatterns; const savedSearchId = $route.current.params.id; return ensureDefaultIndexPattern(core, getServices().data, $rootScope, kbnUrl).then(() => { @@ -137,7 +136,6 @@ app.config($routeProvider => { * @type {State} */ const state = new State('_a', {}); - const id = getIndexPatternId(state.index, indexPatternList, uiSettings.get('defaultIndex')); state.destroy(); return Promise.props({ diff --git a/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts b/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts index 275dfa073fecd..f6982e13d7d03 100644 --- a/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts +++ b/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts @@ -25,6 +25,8 @@ import 'ui/angular-bootstrap'; import { IPrivate } from 'ui/private'; import { EuiIcon } from '@elastic/eui'; // @ts-ignore +import { StateProvider } from 'ui/state_management/state'; +// @ts-ignore import { EventsProvider } from 'ui/events'; import { PersistedState } from 'ui/persisted_state'; // @ts-ignore @@ -277,6 +279,9 @@ function createLocalAppStateModule() { }) .service('getAppState', function(Private: any) { return Private(AppStateProvider).getAppState; + }) + .service('State', function(Private: any) { + return Private(StateProvider); }); } diff --git a/src/legacy/core_plugins/kibana/public/discover/helpers/build_services.ts b/src/legacy/core_plugins/kibana/public/discover/helpers/build_services.ts index a7f849704b5b2..b72bd27a31cf9 100644 --- a/src/legacy/core_plugins/kibana/public/discover/helpers/build_services.ts +++ b/src/legacy/core_plugins/kibana/public/discover/helpers/build_services.ts @@ -29,8 +29,6 @@ import chromeLegacy from 'ui/chrome'; import { IPrivate } from 'ui/private'; import { FilterManager, TimefilterContract, IndexPatternsContract } from 'src/plugins/data/public'; // @ts-ignore -import { StateProvider } from 'ui/state_management/state'; -// @ts-ignore import { createSavedSearchesService } from '../saved_searches/saved_searches'; // @ts-ignore import { createSavedSearchFactory } from '../saved_searches/_saved_search'; @@ -57,7 +55,6 @@ export interface DiscoverServices { // legacy getSavedSearchById: (id: string) => Promise; getSavedSearchUrlById: (id: string) => Promise; - State: unknown; uiSettings: IUiSettingsClient; } @@ -65,13 +62,11 @@ export async function buildGlobalAngularServices() { const injector = await chromeLegacy.dangerouslyGetActiveInjector(); const Private = injector.get('Private'); const kbnUrl = injector.get('kbnUrl'); - const State = Private(StateProvider); const SavedSearchFactory = createSavedSearchFactory(Private); const service = createSavedSearchesService(Private, SavedSearchFactory, kbnUrl, chromeLegacy); return { getSavedSearchById: async (id: string) => service.get(id), getSavedSearchUrlById: async (id: string) => service.urlFor(id), - State, }; }