diff --git a/src/plugins/discover/public/locator.test.ts b/src/plugins/discover/public/locator.test.ts index 98e0d7e853b61..edc44946edc59 100644 --- a/src/plugins/discover/public/locator.test.ts +++ b/src/plugins/discover/public/locator.test.ts @@ -58,7 +58,7 @@ describe('Discover url generator', () => { test('can specify specific data view', async () => { const { locator } = await setup(); const { path } = await locator.getLocation({ - indexPatternId: dataViewId, + dataViewId, }); const { _a, _g } = getStatesFromKbnUrl(path, ['_a', '_g']); @@ -229,7 +229,7 @@ describe('Discover url generator', () => { test('when using default, sets data view ID in the generated URL', async () => { const { locator } = await setup(); const { path } = await locator.getLocation({ - indexPatternId: dataViewId, + dataViewId, }); expect(path.indexOf(dataViewId) > -1).toBe(true); @@ -239,7 +239,7 @@ describe('Discover url generator', () => { const { locator } = await setup(); const { path } = await locator.getLocation({ useHash: true, - indexPatternId: dataViewId, + dataViewId, }); expect(path.indexOf(dataViewId) > -1).toBe(false); @@ -250,7 +250,7 @@ describe('Discover url generator', () => { test('when using default, does not set data view ID in the generated URL', async () => { const { locator } = await setup({ useHash: true }); const { path } = await locator.getLocation({ - indexPatternId: dataViewId, + dataViewId, }); expect(path.indexOf(dataViewId) > -1).toBe(false); @@ -260,7 +260,7 @@ describe('Discover url generator', () => { const { locator } = await setup({ useHash: true }); const { path } = await locator.getLocation({ useHash: false, - indexPatternId: dataViewId, + dataViewId, }); expect(path.indexOf(dataViewId) > -1).toBe(true); diff --git a/src/plugins/discover/public/locator.ts b/src/plugins/discover/public/locator.ts index 46a245c8841a2..0fa2195cc246f 100644 --- a/src/plugins/discover/public/locator.ts +++ b/src/plugins/discover/public/locator.ts @@ -25,6 +25,11 @@ export interface DiscoverAppLocatorParams extends SerializableRecord { * Optionally set index pattern / data view ID. */ dataViewId?: string; + /** + * Duplication of dataViewId + * @deprecated + */ + indexPatternId?: string; /** * Optionally set the time range in the time picker. @@ -102,6 +107,7 @@ export class DiscoverAppLocatorDefinition implements LocatorDefinition !isFilterPinned(f)); + if (indexPatternId) appState.index = indexPatternId; if (dataViewId) appState.index = dataViewId; if (columns) appState.columns = columns; if (savedQuery) appState.savedQuery = savedQuery;