Skip to content

Commit b51e97e

Browse files
committed
Move history to discover services
1 parent d261a0b commit b51e97e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/legacy/core_plugins/kibana/public/discover/build_services.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19+
import { createHashHistory, History } from 'history';
20+
1921
import {
2022
Capabilities,
2123
ChromeStart,
@@ -46,6 +48,7 @@ export interface DiscoverServices {
4648
data: DataPublicPluginStart;
4749
docLinks: DocLinksStart;
4850
docViewsRegistry: DocViewsRegistry;
51+
history: History;
4952
theme: ChartsPluginStart['theme'];
5053
filterManager: FilterManager;
5154
indexPatterns: IndexPatternsContract;
@@ -79,6 +82,7 @@ export async function buildServices(
7982
data: plugins.data,
8083
docLinks: core.docLinks,
8184
docViewsRegistry,
85+
history: createHashHistory(),
8286
theme: plugins.charts.theme,
8387
filterManager: plugins.data.query.filterManager,
8488
getSavedSearchById: async (id: string) => savedObjectService.get(id),

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { debounceTime } from 'rxjs/operators';
2424
import moment from 'moment';
2525
import dateMath from '@elastic/datemath';
2626
import { i18n } from '@kbn/i18n';
27-
import { createHashHistory } from 'history';
2827
import { getState, splitState } from './discover_state';
2928

3029
import { RequestAdapter } from '../../../../../../../plugins/inspector/public';
@@ -59,6 +58,7 @@ const {
5958
chrome,
6059
data,
6160
docTitle,
61+
history,
6262
indexPatterns,
6363
filterManager,
6464
share,
@@ -88,8 +88,6 @@ const fetchStatuses = {
8888

8989
const app = getAngularModule();
9090

91-
app.factory('history', () => createHashHistory());
92-
9391
app.config($routeProvider => {
9492
const defaults = {
9593
requireDefaultIndex: true,
@@ -117,7 +115,7 @@ app.config($routeProvider => {
117115
template: indexTemplate,
118116
reloadOnSearch: false,
119117
resolve: {
120-
savedObjects: function($route, kbnUrl, Promise, $rootScope, history) {
118+
savedObjects: function($route, kbnUrl, Promise, $rootScope) {
121119
const savedSearchId = $route.current.params.id;
122120
return ensureDefaultIndexPattern(core, data, $rootScope, kbnUrl).then(() => {
123121
const { appStateContainer } = getState({ history });
@@ -189,8 +187,7 @@ function discoverController(
189187
config,
190188
kbnUrl,
191189
localStorage,
192-
uiCapabilities,
193-
history
190+
uiCapabilities
194191
) {
195192
const { isDefault: isDefaultType } = indexPatternsUtils;
196193
const subscriptions = new Subscription();

0 commit comments

Comments
 (0)