Skip to content

Commit

Permalink
Move history to discover services
Browse files Browse the repository at this point in the history
  • Loading branch information
sulemanof committed Mar 16, 2020
1 parent d261a0b commit b51e97e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { createHashHistory, History } from 'history';

import {
Capabilities,
ChromeStart,
Expand Down Expand Up @@ -46,6 +48,7 @@ export interface DiscoverServices {
data: DataPublicPluginStart;
docLinks: DocLinksStart;
docViewsRegistry: DocViewsRegistry;
history: History;
theme: ChartsPluginStart['theme'];
filterManager: FilterManager;
indexPatterns: IndexPatternsContract;
Expand Down Expand Up @@ -79,6 +82,7 @@ export async function buildServices(
data: plugins.data,
docLinks: core.docLinks,
docViewsRegistry,
history: createHashHistory(),
theme: plugins.charts.theme,
filterManager: plugins.data.query.filterManager,
getSavedSearchById: async (id: string) => savedObjectService.get(id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { debounceTime } from 'rxjs/operators';
import moment from 'moment';
import dateMath from '@elastic/datemath';
import { i18n } from '@kbn/i18n';
import { createHashHistory } from 'history';
import { getState, splitState } from './discover_state';

import { RequestAdapter } from '../../../../../../../plugins/inspector/public';
Expand Down Expand Up @@ -59,6 +58,7 @@ const {
chrome,
data,
docTitle,
history,
indexPatterns,
filterManager,
share,
Expand Down Expand Up @@ -88,8 +88,6 @@ const fetchStatuses = {

const app = getAngularModule();

app.factory('history', () => createHashHistory());

app.config($routeProvider => {
const defaults = {
requireDefaultIndex: true,
Expand Down Expand Up @@ -117,7 +115,7 @@ app.config($routeProvider => {
template: indexTemplate,
reloadOnSearch: false,
resolve: {
savedObjects: function($route, kbnUrl, Promise, $rootScope, history) {
savedObjects: function($route, kbnUrl, Promise, $rootScope) {
const savedSearchId = $route.current.params.id;
return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl).then(() => {
const { appStateContainer } = getState({ history });
Expand Down Expand Up @@ -189,8 +187,7 @@ function discoverController(
config,
kbnUrl,
localStorage,
uiCapabilities,
history
uiCapabilities
) {
const { isDefault: isDefaultType } = indexPatternsUtils;
const subscriptions = new Subscription();
Expand Down

0 comments on commit b51e97e

Please sign in to comment.