mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
# Backport This will backport the following commits from `main` to `8.16`: - [[Discover] [Embeddable] Fix Discover session embeddable drilldown (#211678)](https://github.com/elastic/kibana/pull/211678) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Davis McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2025-02-21T17:26:22Z","message":"[Discover] [Embeddable] Fix Discover session embeddable drilldown (#211678)\n\n## Summary\n\nThis PR re-adds drilldown support to the Discover session embeddable\nafter it was accidentally removed during the refactoring in #180536\n(related PR where drilldowns / dynamic actions were refactored:\n#178896). A new functional test has also been added to prevent future\nregressions.\n\nFixes #211677.\n\n### Checklist\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>","sha":"257971d4c0f99c0da56b9b817cff731977f8891f","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:fix","Team:DataDiscovery","backport:prev-major","v9.1.0"],"title":"[Discover] [Embeddable] Fix Discover session embeddable drilldown","number":211678,"url":"https://github.com/elastic/kibana/pull/211678","mergeCommit":{"message":"[Discover] [Embeddable] Fix Discover session embeddable drilldown (#211678)\n\n## Summary\n\nThis PR re-adds drilldown support to the Discover session embeddable\nafter it was accidentally removed during the refactoring in #180536\n(related PR where drilldowns / dynamic actions were refactored:\n#178896). A new functional test has also been added to prevent future\nregressions.\n\nFixes #211677.\n\n### Checklist\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>","sha":"257971d4c0f99c0da56b9b817cff731977f8891f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211678","number":211678,"mergeCommit":{"message":"[Discover] [Embeddable] Fix Discover session embeddable drilldown (#211678)\n\n## Summary\n\nThis PR re-adds drilldown support to the Discover session embeddable\nafter it was accidentally removed during the refactoring in #180536\n(related PR where drilldowns / dynamic actions were refactored:\n#178896). A new functional test has also been added to prevent future\nregressions.\n\nFixes #211677.\n\n### Checklist\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>","sha":"257971d4c0f99c0da56b9b817cff731977f8891f"}},{"url":"https://github.com/elastic/kibana/pull/212142","number":212142,"branch":"8.17","state":"OPEN"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
4aa74a4a30
commit
2e165935ec
11 changed files with 109 additions and 16 deletions
|
@ -42,7 +42,8 @@
|
||||||
"observabilityAIAssistant",
|
"observabilityAIAssistant",
|
||||||
"aiops",
|
"aiops",
|
||||||
"fieldsMetadata",
|
"fieldsMetadata",
|
||||||
"logsDataAccess"
|
"logsDataAccess",
|
||||||
|
"embeddableEnhanced"
|
||||||
],
|
],
|
||||||
"requiredBundles": ["kibanaUtils", "kibanaReact", "unifiedSearch", "savedObjects"],
|
"requiredBundles": ["kibanaUtils", "kibanaReact", "unifiedSearch", "savedObjects"],
|
||||||
"extraPublicDirs": ["common"]
|
"extraPublicDirs": ["common"]
|
||||||
|
|
|
@ -59,6 +59,7 @@ import type { AiopsPluginStart } from '@kbn/aiops-plugin/public';
|
||||||
import type { DataVisualizerPluginStart } from '@kbn/data-visualizer-plugin/public';
|
import type { DataVisualizerPluginStart } from '@kbn/data-visualizer-plugin/public';
|
||||||
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
|
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
|
||||||
import { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
|
import { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
|
||||||
|
import type { EmbeddableEnhancedPluginStart } from '@kbn/embeddable-enhanced-plugin/public';
|
||||||
import type { DiscoverStartPlugins } from './types';
|
import type { DiscoverStartPlugins } from './types';
|
||||||
import type { DiscoverContextAppLocator } from './application/context/services/locator';
|
import type { DiscoverContextAppLocator } from './application/context/services/locator';
|
||||||
import type { DiscoverSingleDocLocator } from './application/doc/locator';
|
import type { DiscoverSingleDocLocator } from './application/doc/locator';
|
||||||
|
@ -135,6 +136,7 @@ export interface DiscoverServices {
|
||||||
ebtManager: DiscoverEBTManager;
|
ebtManager: DiscoverEBTManager;
|
||||||
fieldsMetadata?: FieldsMetadataPublicStart;
|
fieldsMetadata?: FieldsMetadataPublicStart;
|
||||||
logsDataAccess?: LogsDataAccessPluginStart;
|
logsDataAccess?: LogsDataAccessPluginStart;
|
||||||
|
embeddableEnhanced?: EmbeddableEnhancedPluginStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildServices = memoize(
|
export const buildServices = memoize(
|
||||||
|
@ -226,6 +228,7 @@ export const buildServices = memoize(
|
||||||
ebtManager,
|
ebtManager,
|
||||||
fieldsMetadata: plugins.fieldsMetadata,
|
fieldsMetadata: plugins.fieldsMetadata,
|
||||||
logsDataAccess: plugins.logsDataAccess,
|
logsDataAccess: plugins.logsDataAccess,
|
||||||
|
embeddableEnhanced: plugins.embeddableEnhanced,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SavedSearchAttributes } from '@kbn/saved-search-plugin/common';
|
import type { SavedSearchAttributes } from '@kbn/saved-search-plugin/common';
|
||||||
import type { Trigger } from '@kbn/ui-actions-plugin/public';
|
import type { Trigger } from '@kbn/ui-actions-plugin/public';
|
||||||
|
import type { SearchEmbeddableSerializedState } from './types';
|
||||||
|
|
||||||
export { SEARCH_EMBEDDABLE_TYPE } from '@kbn/discover-utils';
|
export { SEARCH_EMBEDDABLE_TYPE } from '@kbn/discover-utils';
|
||||||
|
|
||||||
|
@ -37,9 +38,10 @@ export const EDITABLE_SAVED_SEARCH_KEYS: Readonly<Array<keyof SavedSearchAttribu
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
/** This constant refers to the dashboard panel specific state */
|
/** This constant refers to the dashboard panel specific state */
|
||||||
export const EDITABLE_PANEL_KEYS = [
|
export const EDITABLE_PANEL_KEYS: Readonly<Array<keyof SearchEmbeddableSerializedState>> = [
|
||||||
'title', // panel title
|
'title', // panel title
|
||||||
'description', // panel description
|
'description', // panel description
|
||||||
'timeRange', // panel custom time range
|
'timeRange', // panel custom time range
|
||||||
'hidePanelTitles', // panel hidden title
|
'hidePanelTitles', // panel hidden title
|
||||||
|
'enhancements', // panel enhancements (e.g. drilldowns)
|
||||||
] as const;
|
] as const;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { i18n } from '@kbn/i18n';
|
||||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||||
import {
|
import {
|
||||||
FetchContext,
|
FetchContext,
|
||||||
|
getUnchangingComparator,
|
||||||
initializeTimeRange,
|
initializeTimeRange,
|
||||||
initializeTitles,
|
initializeTitles,
|
||||||
useBatchedPublishingSubjects,
|
useBatchedPublishingSubjects,
|
||||||
|
@ -89,6 +90,13 @@ export const getSearchEmbeddableFactory = ({
|
||||||
/** Build API */
|
/** Build API */
|
||||||
const { titlesApi, titleComparators, serializeTitles } = initializeTitles(initialState);
|
const { titlesApi, titleComparators, serializeTitles } = initializeTitles(initialState);
|
||||||
const timeRange = initializeTimeRange(initialState);
|
const timeRange = initializeTimeRange(initialState);
|
||||||
|
const dynamicActionsApi =
|
||||||
|
discoverServices.embeddableEnhanced?.initializeReactEmbeddableDynamicActions(
|
||||||
|
uuid,
|
||||||
|
() => titlesApi.panelTitle.getValue(),
|
||||||
|
initialState
|
||||||
|
);
|
||||||
|
const maybeStopDynamicActions = dynamicActionsApi?.startDynamicActions();
|
||||||
const searchEmbeddable = await initializeSearchEmbeddableApi(initialState, {
|
const searchEmbeddable = await initializeSearchEmbeddableApi(initialState, {
|
||||||
discoverServices,
|
discoverServices,
|
||||||
});
|
});
|
||||||
|
@ -114,6 +122,7 @@ export const getSearchEmbeddableFactory = ({
|
||||||
...titlesApi,
|
...titlesApi,
|
||||||
...searchEmbeddable.api,
|
...searchEmbeddable.api,
|
||||||
...timeRange.api,
|
...timeRange.api,
|
||||||
|
...dynamicActionsApi?.dynamicActionsApi,
|
||||||
...initializeEditApi({
|
...initializeEditApi({
|
||||||
uuid,
|
uuid,
|
||||||
parentApi,
|
parentApi,
|
||||||
|
@ -183,14 +192,23 @@ export const getSearchEmbeddableFactory = ({
|
||||||
savedSearch: searchEmbeddable.api.savedSearch$.getValue(),
|
savedSearch: searchEmbeddable.api.savedSearch$.getValue(),
|
||||||
serializeTitles,
|
serializeTitles,
|
||||||
serializeTimeRange: timeRange.serialize,
|
serializeTimeRange: timeRange.serialize,
|
||||||
|
serializeDynamicActions: dynamicActionsApi?.serializeDynamicActions,
|
||||||
savedObjectId: savedObjectId$.getValue(),
|
savedObjectId: savedObjectId$.getValue(),
|
||||||
discoverServices,
|
discoverServices,
|
||||||
}),
|
}),
|
||||||
getInspectorAdapters: () => searchEmbeddable.stateManager.inspectorAdapters.getValue(),
|
getInspectorAdapters: () => searchEmbeddable.stateManager.inspectorAdapters.getValue(),
|
||||||
|
supportedTriggers: () => {
|
||||||
|
// No triggers are supported, but this is still required to pass the drilldown
|
||||||
|
// compatibilty check and ensure top-level drilldowns (e.g. URL) work as expected
|
||||||
|
return [];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...titleComparators,
|
...titleComparators,
|
||||||
...timeRange.comparators,
|
...timeRange.comparators,
|
||||||
|
...(dynamicActionsApi?.dynamicActionsComparator ?? {
|
||||||
|
enhancements: getUnchangingComparator(),
|
||||||
|
}),
|
||||||
...searchEmbeddable.comparators,
|
...searchEmbeddable.comparators,
|
||||||
savedObjectId: [savedObjectId$, (value) => savedObjectId$.next(value)],
|
savedObjectId: [savedObjectId$, (value) => savedObjectId$.next(value)],
|
||||||
savedObjectTitle: [defaultPanelTitle$, (value) => defaultPanelTitle$.next(value)],
|
savedObjectTitle: [defaultPanelTitle$, (value) => defaultPanelTitle$.next(value)],
|
||||||
|
@ -213,6 +231,7 @@ export const getSearchEmbeddableFactory = ({
|
||||||
return () => {
|
return () => {
|
||||||
searchEmbeddable.cleanup();
|
searchEmbeddable.cleanup();
|
||||||
unsubscribeFromFetch();
|
unsubscribeFromFetch();
|
||||||
|
maybeStopDynamicActions?.stopDynamicActions();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
* License v3.0 only", or the "Server Side Public License, v 1".
|
* License v3.0 only", or the "Server Side Public License, v 1".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DataTableRecord } from '@kbn/discover-utils/types';
|
import type { DataTableRecord } from '@kbn/discover-utils/types';
|
||||||
import type { DefaultEmbeddableApi } from '@kbn/embeddable-plugin/public';
|
import type { DefaultEmbeddableApi } from '@kbn/embeddable-plugin/public';
|
||||||
import { HasInspectorAdapters } from '@kbn/inspector-plugin/public';
|
import type { HasInspectorAdapters } from '@kbn/inspector-plugin/public';
|
||||||
import {
|
import type {
|
||||||
EmbeddableApiContext,
|
EmbeddableApiContext,
|
||||||
HasEditCapabilities,
|
HasEditCapabilities,
|
||||||
HasInPlaceLibraryTransforms,
|
HasInPlaceLibraryTransforms,
|
||||||
|
HasSupportedTriggers,
|
||||||
PublishesBlockingError,
|
PublishesBlockingError,
|
||||||
PublishesDataLoading,
|
PublishesDataLoading,
|
||||||
PublishesDataViews,
|
PublishesDataViews,
|
||||||
|
@ -24,14 +25,16 @@ import {
|
||||||
SerializedTimeRange,
|
SerializedTimeRange,
|
||||||
SerializedTitles,
|
SerializedTitles,
|
||||||
} from '@kbn/presentation-publishing';
|
} from '@kbn/presentation-publishing';
|
||||||
import {
|
import type {
|
||||||
SavedSearch,
|
SavedSearch,
|
||||||
SavedSearchAttributes,
|
SavedSearchAttributes,
|
||||||
SerializableSavedSearch,
|
SerializableSavedSearch,
|
||||||
} from '@kbn/saved-search-plugin/common/types';
|
} from '@kbn/saved-search-plugin/common/types';
|
||||||
import { DataTableColumnsMeta } from '@kbn/unified-data-table';
|
import type { DataTableColumnsMeta } from '@kbn/unified-data-table';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import type { BehaviorSubject } from 'rxjs';
|
||||||
import { EDITABLE_SAVED_SEARCH_KEYS } from './constants';
|
import type { DynamicActionsSerializedState } from '@kbn/embeddable-enhanced-plugin/public/plugin';
|
||||||
|
import type { HasDynamicActions } from '@kbn/embeddable-enhanced-plugin/public';
|
||||||
|
import type { EDITABLE_SAVED_SEARCH_KEYS } from './constants';
|
||||||
|
|
||||||
export type SearchEmbeddableState = Pick<
|
export type SearchEmbeddableState = Pick<
|
||||||
SerializableSavedSearch,
|
SerializableSavedSearch,
|
||||||
|
@ -63,6 +66,7 @@ export type SearchEmbeddableSerializedAttributes = Omit<
|
||||||
|
|
||||||
export type SearchEmbeddableSerializedState = SerializedTitles &
|
export type SearchEmbeddableSerializedState = SerializedTitles &
|
||||||
SerializedTimeRange &
|
SerializedTimeRange &
|
||||||
|
Partial<DynamicActionsSerializedState> &
|
||||||
Partial<Pick<SavedSearchAttributes, (typeof EDITABLE_SAVED_SEARCH_KEYS)[number]>> & {
|
Partial<Pick<SavedSearchAttributes, (typeof EDITABLE_SAVED_SEARCH_KEYS)[number]>> & {
|
||||||
// by value
|
// by value
|
||||||
attributes?: SavedSearchAttributes & { references: SavedSearch['references'] };
|
attributes?: SavedSearchAttributes & { references: SavedSearch['references'] };
|
||||||
|
@ -72,7 +76,8 @@ export type SearchEmbeddableSerializedState = SerializedTitles &
|
||||||
|
|
||||||
export type SearchEmbeddableRuntimeState = SearchEmbeddableSerializedAttributes &
|
export type SearchEmbeddableRuntimeState = SearchEmbeddableSerializedAttributes &
|
||||||
SerializedTitles &
|
SerializedTitles &
|
||||||
SerializedTimeRange & {
|
SerializedTimeRange &
|
||||||
|
Partial<DynamicActionsSerializedState> & {
|
||||||
savedObjectTitle?: string;
|
savedObjectTitle?: string;
|
||||||
savedObjectId?: string;
|
savedObjectId?: string;
|
||||||
savedObjectDescription?: string;
|
savedObjectDescription?: string;
|
||||||
|
@ -93,7 +98,9 @@ export type SearchEmbeddableApi = DefaultEmbeddableApi<
|
||||||
HasInPlaceLibraryTransforms &
|
HasInPlaceLibraryTransforms &
|
||||||
HasTimeRange &
|
HasTimeRange &
|
||||||
HasInspectorAdapters &
|
HasInspectorAdapters &
|
||||||
Partial<HasEditCapabilities & PublishesSavedObjectId>;
|
Partial<HasEditCapabilities & PublishesSavedObjectId> &
|
||||||
|
HasDynamicActions &
|
||||||
|
HasSupportedTriggers;
|
||||||
|
|
||||||
export interface PublishesSavedSearch {
|
export interface PublishesSavedSearch {
|
||||||
savedSearch$: PublishingSubject<SavedSearch>;
|
savedSearch$: PublishingSubject<SavedSearch>;
|
||||||
|
|
|
@ -121,6 +121,7 @@ describe('Serialization utils', () => {
|
||||||
savedSearch,
|
savedSearch,
|
||||||
serializeTitles: jest.fn(),
|
serializeTitles: jest.fn(),
|
||||||
serializeTimeRange: jest.fn(),
|
serializeTimeRange: jest.fn(),
|
||||||
|
serializeDynamicActions: jest.fn(),
|
||||||
discoverServices: discoverServiceMock,
|
discoverServices: discoverServiceMock,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -159,6 +160,7 @@ describe('Serialization utils', () => {
|
||||||
savedSearch,
|
savedSearch,
|
||||||
serializeTitles: jest.fn(),
|
serializeTitles: jest.fn(),
|
||||||
serializeTimeRange: jest.fn(),
|
serializeTimeRange: jest.fn(),
|
||||||
|
serializeDynamicActions: jest.fn(),
|
||||||
savedObjectId: 'test-id',
|
savedObjectId: 'test-id',
|
||||||
discoverServices: discoverServiceMock,
|
discoverServices: discoverServiceMock,
|
||||||
});
|
});
|
||||||
|
@ -178,6 +180,7 @@ describe('Serialization utils', () => {
|
||||||
savedSearch: { ...savedSearch, sampleSize: 500, sort: [['order_date', 'asc']] },
|
savedSearch: { ...savedSearch, sampleSize: 500, sort: [['order_date', 'asc']] },
|
||||||
serializeTitles: jest.fn(),
|
serializeTitles: jest.fn(),
|
||||||
serializeTimeRange: jest.fn(),
|
serializeTimeRange: jest.fn(),
|
||||||
|
serializeDynamicActions: jest.fn(),
|
||||||
savedObjectId: 'test-id',
|
savedObjectId: 'test-id',
|
||||||
discoverServices: discoverServiceMock,
|
discoverServices: discoverServiceMock,
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
} from '@kbn/saved-search-plugin/common';
|
} from '@kbn/saved-search-plugin/common';
|
||||||
import { SavedSearchUnwrapResult } from '@kbn/saved-search-plugin/public';
|
import { SavedSearchUnwrapResult } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
|
import type { DynamicActionsSerializedState } from '@kbn/embeddable-enhanced-plugin/public/plugin';
|
||||||
import { extract, inject } from '../../../common/embeddable/search_inject_extract';
|
import { extract, inject } from '../../../common/embeddable/search_inject_extract';
|
||||||
import { DiscoverServices } from '../../build_services';
|
import { DiscoverServices } from '../../build_services';
|
||||||
import {
|
import {
|
||||||
|
@ -77,6 +78,7 @@ export const serializeState = async ({
|
||||||
savedSearch,
|
savedSearch,
|
||||||
serializeTitles,
|
serializeTitles,
|
||||||
serializeTimeRange,
|
serializeTimeRange,
|
||||||
|
serializeDynamicActions,
|
||||||
savedObjectId,
|
savedObjectId,
|
||||||
discoverServices,
|
discoverServices,
|
||||||
}: {
|
}: {
|
||||||
|
@ -85,6 +87,7 @@ export const serializeState = async ({
|
||||||
savedSearch: SavedSearch;
|
savedSearch: SavedSearch;
|
||||||
serializeTitles: () => SerializedTitles;
|
serializeTitles: () => SerializedTitles;
|
||||||
serializeTimeRange: () => SerializedTimeRange;
|
serializeTimeRange: () => SerializedTimeRange;
|
||||||
|
serializeDynamicActions: (() => DynamicActionsSerializedState) | undefined;
|
||||||
savedObjectId?: string;
|
savedObjectId?: string;
|
||||||
discoverServices: DiscoverServices;
|
discoverServices: DiscoverServices;
|
||||||
}): Promise<SerializedPanelState<SearchEmbeddableSerializedState>> => {
|
}): Promise<SerializedPanelState<SearchEmbeddableSerializedState>> => {
|
||||||
|
@ -110,6 +113,7 @@ export const serializeState = async ({
|
||||||
// Serialize the current dashboard state into the panel state **without** updating the saved object
|
// Serialize the current dashboard state into the panel state **without** updating the saved object
|
||||||
...serializeTitles(),
|
...serializeTitles(),
|
||||||
...serializeTimeRange(),
|
...serializeTimeRange(),
|
||||||
|
...serializeDynamicActions?.(),
|
||||||
...overwriteState,
|
...overwriteState,
|
||||||
},
|
},
|
||||||
// No references to extract for by-reference embeddable since all references are stored with by-reference saved object
|
// No references to extract for by-reference embeddable since all references are stored with by-reference saved object
|
||||||
|
|
|
@ -42,6 +42,7 @@ import type { AiopsPluginStart } from '@kbn/aiops-plugin/public';
|
||||||
import type { DataVisualizerPluginStart } from '@kbn/data-visualizer-plugin/public';
|
import type { DataVisualizerPluginStart } from '@kbn/data-visualizer-plugin/public';
|
||||||
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
|
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
|
||||||
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
|
import type { LogsDataAccessPluginStart } from '@kbn/logs-data-access-plugin/public';
|
||||||
|
import type { EmbeddableEnhancedPluginStart } from '@kbn/embeddable-enhanced-plugin/public';
|
||||||
import { DiscoverAppLocator } from '../common';
|
import { DiscoverAppLocator } from '../common';
|
||||||
import { DiscoverCustomizationContext } from './customizations';
|
import { DiscoverCustomizationContext } from './customizations';
|
||||||
import { type DiscoverContainerProps } from './components/discover_container';
|
import { type DiscoverContainerProps } from './components/discover_container';
|
||||||
|
@ -172,4 +173,5 @@ export interface DiscoverStartPlugins {
|
||||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||||
urlForwarding: UrlForwardingStart;
|
urlForwarding: UrlForwardingStart;
|
||||||
usageCollection?: UsageCollectionSetup;
|
usageCollection?: UsageCollectionSetup;
|
||||||
|
embeddableEnhanced?: EmbeddableEnhancedPluginStart;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,8 @@
|
||||||
"@kbn/react-hooks",
|
"@kbn/react-hooks",
|
||||||
"@kbn/logs-data-access-plugin",
|
"@kbn/logs-data-access-plugin",
|
||||||
"@kbn/core-lifecycle-browser",
|
"@kbn/core-lifecycle-browser",
|
||||||
"@kbn/esql-ast"
|
"@kbn/esql-ast",
|
||||||
|
"@kbn/embeddable-enhanced-plugin"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"target/**/*"
|
"target/**/*"
|
||||||
|
|
|
@ -78,7 +78,11 @@ export function DashboardDrilldownsManageProvider({ getService }: FtrProviderCon
|
||||||
}: {
|
}: {
|
||||||
drilldownName: string;
|
drilldownName: string;
|
||||||
destinationURLTemplate: string;
|
destinationURLTemplate: string;
|
||||||
trigger: 'VALUE_CLICK_TRIGGER' | 'SELECT_RANGE_TRIGGER' | 'IMAGE_CLICK_TRIGGER';
|
trigger:
|
||||||
|
| 'VALUE_CLICK_TRIGGER'
|
||||||
|
| 'SELECT_RANGE_TRIGGER'
|
||||||
|
| 'IMAGE_CLICK_TRIGGER'
|
||||||
|
| 'CONTEXT_MENU_TRIGGER';
|
||||||
}) {
|
}) {
|
||||||
await this.fillInDrilldownName(drilldownName);
|
await this.fillInDrilldownName(drilldownName);
|
||||||
await this.selectTriggerIfNeeded(trigger);
|
await this.selectTriggerIfNeeded(trigger);
|
||||||
|
@ -94,7 +98,11 @@ export function DashboardDrilldownsManageProvider({ getService }: FtrProviderCon
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectTriggerIfNeeded(
|
async selectTriggerIfNeeded(
|
||||||
trigger: 'VALUE_CLICK_TRIGGER' | 'SELECT_RANGE_TRIGGER' | 'IMAGE_CLICK_TRIGGER'
|
trigger:
|
||||||
|
| 'VALUE_CLICK_TRIGGER'
|
||||||
|
| 'SELECT_RANGE_TRIGGER'
|
||||||
|
| 'IMAGE_CLICK_TRIGGER'
|
||||||
|
| 'CONTEXT_MENU_TRIGGER'
|
||||||
) {
|
) {
|
||||||
if (await testSubjects.exists(`triggerPicker`)) {
|
if (await testSubjects.exists(`triggerPicker`)) {
|
||||||
const container = await testSubjects.find(`triggerPicker-${trigger}`);
|
const container = await testSubjects.find(`triggerPicker-${trigger}`);
|
||||||
|
|
|
@ -13,11 +13,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
const dataGrid = getService('dataGrid');
|
const dataGrid = getService('dataGrid');
|
||||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||||
const dashboardPanelActions = getService('dashboardPanelActions');
|
const dashboardPanelActions = getService('dashboardPanelActions');
|
||||||
|
const dashboardDrilldownPanelActions = getService('dashboardDrilldownPanelActions');
|
||||||
|
const dashboardDrilldownsManage = getService('dashboardDrilldownsManage');
|
||||||
const filterBar = getService('filterBar');
|
const filterBar = getService('filterBar');
|
||||||
const esArchiver = getService('esArchiver');
|
const esArchiver = getService('esArchiver');
|
||||||
const kibanaServer = getService('kibanaServer');
|
const kibanaServer = getService('kibanaServer');
|
||||||
const testSubjects = getService('testSubjects');
|
const testSubjects = getService('testSubjects');
|
||||||
const { common, dashboard, header } = getPageObjects(['common', 'dashboard', 'header']);
|
const find = getService('find');
|
||||||
|
const queryBar = getService('queryBar');
|
||||||
|
const { common, dashboard, header, discover } = getPageObjects([
|
||||||
|
'common',
|
||||||
|
'dashboard',
|
||||||
|
'header',
|
||||||
|
'discover',
|
||||||
|
]);
|
||||||
|
|
||||||
describe('discover saved search embeddable', () => {
|
describe('discover saved search embeddable', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
@ -106,5 +115,39 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||||
await header.waitUntilLoadingHasFinished();
|
await header.waitUntilLoadingHasFinished();
|
||||||
await testSubjects.missingOrFail('embeddableError');
|
await testSubjects.missingOrFail('embeddableError');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support URL drilldown', async () => {
|
||||||
|
await addSearchEmbeddableToDashboard();
|
||||||
|
await dashboardDrilldownPanelActions.clickCreateDrilldown();
|
||||||
|
const drilldownName = 'URL drilldown';
|
||||||
|
const urlTemplate =
|
||||||
|
"{{kibanaUrl}}/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'{{context.panel.timeRange.from}}',to:'{{context.panel.timeRange.to}}'))" +
|
||||||
|
"&_a=(columns:!(_source),filters:{{rison context.panel.filters}},index:'{{context.panel.indexPatternId}}',interval:auto," +
|
||||||
|
"query:(language:{{context.panel.query.language}},query:'clientip:239.190.189.77'),sort:!())";
|
||||||
|
await testSubjects.click('actionFactoryItem-URL_DRILLDOWN');
|
||||||
|
await dashboardDrilldownsManage.fillInDashboardToURLDrilldownWizard({
|
||||||
|
drilldownName,
|
||||||
|
destinationURLTemplate: urlTemplate,
|
||||||
|
trigger: 'CONTEXT_MENU_TRIGGER',
|
||||||
|
});
|
||||||
|
await testSubjects.click('urlDrilldownAdditionalOptions');
|
||||||
|
await testSubjects.click('urlDrilldownOpenInNewTab');
|
||||||
|
await dashboardDrilldownsManage.saveChanges();
|
||||||
|
await dashboard.saveDashboard('Dashboard with URL drilldown', {
|
||||||
|
saveAsNew: true,
|
||||||
|
waitDialogIsClosed: true,
|
||||||
|
exitFromEditMode: true,
|
||||||
|
});
|
||||||
|
await browser.refresh();
|
||||||
|
await header.waitUntilLoadingHasFinished();
|
||||||
|
await dashboard.waitForRenderComplete();
|
||||||
|
await dashboardPanelActions.openContextMenu();
|
||||||
|
await find.clickByLinkText(drilldownName);
|
||||||
|
await discover.waitForDiscoverAppOnScreen();
|
||||||
|
await header.waitUntilLoadingHasFinished();
|
||||||
|
await discover.waitForDocTableLoadingComplete();
|
||||||
|
expect(await queryBar.getQueryString()).to.be('clientip:239.190.189.77');
|
||||||
|
expect(await discover.getHitCount()).to.be('6');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue