extends PersistableStateDefinition {
+ id: string;
+}
+
export type EmbeddablePersistableStateService = PersistableStateService;
export interface CommonEmbeddableStartContract {
diff --git a/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.test.ts b/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.test.ts
index 00c4de5ff426f..1dfd056bc75c0 100644
--- a/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.test.ts
+++ b/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.test.ts
@@ -20,6 +20,7 @@ const getGenericEmbeddableState = (state?: Partial): Embeddable
disableTriggers: false,
enhancements: undefined,
syncColors: false,
+ syncTooltips: false,
viewMode: ViewMode.VIEW,
title: 'So Very Generic',
id: 'soVeryGeneric',
@@ -44,6 +45,7 @@ test('Omitting generic embeddable input omits all generic input keys', () => {
'disableTriggers',
'enhancements',
'syncColors',
+ 'syncTooltips',
'viewMode',
'title',
'id',
diff --git a/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.ts b/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.ts
index a396ed324a949..a66294d08bdc4 100644
--- a/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.ts
+++ b/src/plugins/embeddable/public/lib/embeddables/diff_embeddable_input.ts
@@ -20,6 +20,7 @@ const allGenericInputKeys: Readonly> = [
'disableTriggers',
'enhancements',
'syncColors',
+ 'syncTooltips',
'viewMode',
'title',
'id',
@@ -31,6 +32,7 @@ const genericInputKeysToCompare = [
'disableTriggers',
'enhancements',
'syncColors',
+ 'syncTooltips',
'title',
'id',
] as const;
diff --git a/src/plugins/embeddable/server/index.ts b/src/plugins/embeddable/server/index.ts
index 8d88f35a4be22..4b93f0838c649 100644
--- a/src/plugins/embeddable/server/index.ts
+++ b/src/plugins/embeddable/server/index.ts
@@ -10,6 +10,8 @@ import { EmbeddableServerPlugin, EmbeddableSetup, EmbeddableStart } from './plug
export type { EmbeddableSetup, EmbeddableStart };
-export type { EnhancementRegistryDefinition, EmbeddableRegistryDefinition } from './types';
+export type { EnhancementRegistryDefinition } from './types';
+
+export type { EmbeddableRegistryDefinition } from '../common';
export const plugin = () => new EmbeddableServerPlugin();
diff --git a/src/plugins/embeddable/server/plugin.ts b/src/plugins/embeddable/server/plugin.ts
index 51fa1edb2c634..2260d6b34c8e8 100644
--- a/src/plugins/embeddable/server/plugin.ts
+++ b/src/plugins/embeddable/server/plugin.ts
@@ -19,7 +19,6 @@ import {
EnhancementsRegistry,
EnhancementRegistryDefinition,
EnhancementRegistryItem,
- EmbeddableRegistryDefinition,
} from './types';
import {
getExtractFunction,
@@ -27,7 +26,11 @@ import {
getMigrateFunction,
getTelemetryFunction,
} from '../common/lib';
-import { EmbeddableStateWithType, CommonEmbeddableStartContract } from '../common/types';
+import {
+ EmbeddableStateWithType,
+ CommonEmbeddableStartContract,
+ EmbeddableRegistryDefinition,
+} from '../common/types';
import { getAllMigrations } from '../common/lib/get_all_migrations';
export interface EmbeddableSetup extends PersistableStateService {
diff --git a/src/plugins/embeddable/server/types.ts b/src/plugins/embeddable/server/types.ts
index 9b0479d6bc25d..bd78265bea6b1 100644
--- a/src/plugins/embeddable/server/types.ts
+++ b/src/plugins/embeddable/server/types.ts
@@ -23,12 +23,6 @@ export interface EnhancementRegistryItem extends PersistableStateDefinition
{
- id: string;
-}
-
export interface EmbeddableRegistryItem
extends PersistableState
{
id: string;
diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts
index 17b6338a48f89..ef0a268ca314f 100644
--- a/src/plugins/expressions/common/execution/execution.ts
+++ b/src/plugins/expressions/common/execution/execution.ts
@@ -224,6 +224,7 @@ export class Execution<
inspectorAdapters.tables[name] = datatable;
},
isSyncColorsEnabled: () => execution.params.syncColors!,
+ isSyncTooltipsEnabled: () => execution.params.syncTooltips!,
...execution.executor.context,
getExecutionContext: () => execution.params.executionContext,
};
diff --git a/src/plugins/expressions/common/execution/types.ts b/src/plugins/expressions/common/execution/types.ts
index 44d6fef6f79a6..686ade0869171 100644
--- a/src/plugins/expressions/common/execution/types.ts
+++ b/src/plugins/expressions/common/execution/types.ts
@@ -66,6 +66,11 @@ export interface ExecutionContext<
*/
isSyncColorsEnabled?: () => boolean;
+ /**
+ * Returns the state (true|false) of the sync tooltips across panels switch.
+ */
+ isSyncTooltipsEnabled?: () => boolean;
+
/**
* Contains the meta-data about the source of the expression.
*/
diff --git a/src/plugins/expressions/common/expression_renderers/types.ts b/src/plugins/expressions/common/expression_renderers/types.ts
index 1e40ba2a65fff..06d3617d74784 100644
--- a/src/plugins/expressions/common/expression_renderers/types.ts
+++ b/src/plugins/expressions/common/expression_renderers/types.ts
@@ -91,6 +91,8 @@ export interface IInterpreterRenderHandlers {
isInteractive(): boolean;
isSyncColorsEnabled(): boolean;
+
+ isSyncTooltipsEnabled(): boolean;
/**
* This uiState interface is actually `PersistedState` from the visualizations plugin,
* but expressions cannot know about vis or it creates a mess of circular dependencies.
diff --git a/src/plugins/expressions/common/service/expressions_services.ts b/src/plugins/expressions/common/service/expressions_services.ts
index d873a1957cd1f..d4bac702bd6e0 100644
--- a/src/plugins/expressions/common/service/expressions_services.ts
+++ b/src/plugins/expressions/common/service/expressions_services.ts
@@ -152,6 +152,8 @@ export interface ExpressionExecutionParams {
syncColors?: boolean;
+ syncTooltips?: boolean;
+
inspectorAdapters?: Adapters;
executionContext?: KibanaExecutionContext;
diff --git a/src/plugins/expressions/public/loader.ts b/src/plugins/expressions/public/loader.ts
index 6482da0af21ee..7f7a96fde6f1a 100644
--- a/src/plugins/expressions/public/loader.ts
+++ b/src/plugins/expressions/public/loader.ts
@@ -58,6 +58,7 @@ export class ExpressionLoader {
onRenderError: params && params.onRenderError,
renderMode: params?.renderMode,
syncColors: params?.syncColors,
+ syncTooltips: params?.syncTooltips,
hasCompatibleActions: params?.hasCompatibleActions,
});
this.render$ = this.renderHandler.render$;
@@ -142,6 +143,7 @@ export class ExpressionLoader {
searchSessionId: params.searchSessionId,
debug: params.debug,
syncColors: params.syncColors,
+ syncTooltips: params.syncTooltips,
executionContext: params.executionContext,
});
this.subscription = this.execution
@@ -182,6 +184,7 @@ export class ExpressionLoader {
this.params.searchSessionId = params.searchSessionId;
}
this.params.syncColors = params.syncColors;
+ this.params.syncTooltips = params.syncTooltips;
this.params.debug = Boolean(params.debug);
this.params.partial = Boolean(params.partial);
this.params.throttle = Number(params.throttle ?? 1000);
diff --git a/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts b/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts
index 033d50d7faf0d..7daa4b3626fa7 100644
--- a/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts
+++ b/src/plugins/expressions/public/react_expression_renderer/use_expression_renderer.ts
@@ -111,6 +111,7 @@ export function useExpressionRenderer(
debouncedLoaderParams.interactive,
debouncedLoaderParams.renderMode,
debouncedLoaderParams.syncColors,
+ debouncedLoaderParams.syncTooltips,
]);
useEffect(() => {
diff --git a/src/plugins/expressions/public/render.ts b/src/plugins/expressions/public/render.ts
index 25bffdca089ee..1d90a795a03a4 100644
--- a/src/plugins/expressions/public/render.ts
+++ b/src/plugins/expressions/public/render.ts
@@ -28,6 +28,7 @@ export interface ExpressionRenderHandlerParams {
onRenderError?: RenderErrorHandlerFnType;
renderMode?: RenderMode;
syncColors?: boolean;
+ syncTooltips?: boolean;
interactive?: boolean;
hasCompatibleActions?: (event: ExpressionRendererEvent) => Promise;
}
@@ -54,6 +55,7 @@ export class ExpressionRenderHandler {
onRenderError,
renderMode,
syncColors,
+ syncTooltips,
interactive,
hasCompatibleActions = async () => false,
}: ExpressionRenderHandlerParams = {}
@@ -94,6 +96,9 @@ export class ExpressionRenderHandler {
isSyncColorsEnabled: () => {
return syncColors || false;
},
+ isSyncTooltipsEnabled: () => {
+ return syncTooltips || false;
+ },
isInteractive: () => {
return interactive ?? true;
},
diff --git a/src/plugins/expressions/public/types/index.ts b/src/plugins/expressions/public/types/index.ts
index 322c2895f9bb5..b035daf4deefc 100644
--- a/src/plugins/expressions/public/types/index.ts
+++ b/src/plugins/expressions/public/types/index.ts
@@ -50,6 +50,7 @@ export interface IExpressionLoaderParams {
searchSessionId?: string;
renderMode?: RenderMode;
syncColors?: boolean;
+ syncTooltips?: boolean;
hasCompatibleActions?: ExpressionRenderHandlerParams['hasCompatibleActions'];
executionContext?: KibanaExecutionContext;
diff --git a/src/plugins/presentation_util/public/__stories__/render.tsx b/src/plugins/presentation_util/public/__stories__/render.tsx
index bd6463ca254d6..7e24606ca5331 100644
--- a/src/plugins/presentation_util/public/__stories__/render.tsx
+++ b/src/plugins/presentation_util/public/__stories__/render.tsx
@@ -13,6 +13,7 @@ import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from '@kbn/exp
export const defaultHandlers: IInterpreterRenderHandlers = {
getRenderMode: () => 'view',
isSyncColorsEnabled: () => false,
+ isSyncTooltipsEnabled: () => false,
isInteractive: () => true,
done: action('done'),
onDestroy: action('onDestroy'),
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
index 139405f6af9f4..723b7e6896229 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/field.tsx
@@ -8,7 +8,6 @@
import { IFieldType, indexPatterns as indexPatternsUtils } from '@kbn/data-plugin/public';
import { flatten } from 'lodash';
-import { escapeKuery } from './lib/escape_kuery';
import { sortPrefixFirst } from './sort_prefix_first';
import { QuerySuggestionField, QuerySuggestionTypes } from '../query_suggestion_provider';
import { KqlQuerySuggestionProvider } from './types';
@@ -27,7 +26,7 @@ const keywordComparator = (first: IFieldType, second: IFieldType) => {
export const setupGetFieldSuggestions: KqlQuerySuggestionProvider = (
core
) => {
- return ({ indexPatterns }, { start, end, prefix, suffix, nestedPath = '' }) => {
+ return async ({ indexPatterns }, { start, end, prefix, suffix, nestedPath = '' }) => {
const allFields = flatten(
indexPatterns.map((indexPattern) => {
return indexPattern.fields.filter(indexPatternsUtils.isFilterable);
@@ -42,7 +41,7 @@ export const setupGetFieldSuggestions: KqlQuerySuggestionProvider {
const remainingPath =
field.subType && field.subType.nested
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
index 1002863fec7f4..cd022ec371e65 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/index.ts
@@ -9,7 +9,6 @@
import { CoreSetup } from '@kbn/core/public';
import { $Keys } from 'utility-types';
import { flatten, uniqBy } from 'lodash';
-import { fromKueryExpression } from '@kbn/es-query';
import { setupGetFieldSuggestions } from './field';
import { setupGetValueSuggestions } from './value';
import { setupGetOperatorSuggestions } from './operator';
@@ -38,11 +37,12 @@ export const setupKqlQuerySuggestionProvider = (
conjunction: setupGetConjunctionSuggestions(core),
};
- const getSuggestionsByType = (
+ const getSuggestionsByType = async (
cursoredQuery: string,
querySuggestionsArgs: QuerySuggestionGetFnArgs
- ): Array> | [] => {
+ ): Promise> | []> => {
try {
+ const { fromKueryExpression } = await import('@kbn/es-query');
const cursorNode = fromKueryExpression(cursoredQuery, {
cursorSymbol,
parseCursor: true,
@@ -56,13 +56,13 @@ export const setupKqlQuerySuggestionProvider = (
}
};
- return (querySuggestionsArgs) => {
+ return async (querySuggestionsArgs): Promise => {
const { query, selectionStart, selectionEnd } = querySuggestionsArgs;
const cursoredQuery = `${query.substr(0, selectionStart)}${cursorSymbol}${query.substr(
selectionEnd
)}`;
- return Promise.all(getSuggestionsByType(cursoredQuery, querySuggestionsArgs)).then(
+ return Promise.all(await getSuggestionsByType(cursoredQuery, querySuggestionsArgs)).then(
(suggestionsByType) => dedup(flatten(suggestionsByType))
);
};
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
index 6636f9b602687..20a20797c15e2 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/lib/escape_kuery.ts
@@ -6,8 +6,6 @@
* Side Public License, v 1.
*/
-import { escapeKuery } from '@kbn/es-query';
-
/**
* Escapes backslashes and double-quotes. (Useful when putting a string in quotes to use as a value
* in a KQL expression. See the QuotedCharacter rule in kuery.peg.)
@@ -15,6 +13,3 @@ import { escapeKuery } from '@kbn/es-query';
export function escapeQuotes(str: string) {
return str.replace(/[\\"]/g, '\\$&');
}
-
-// Re-export this function from the @kbn/es-query package to avoid refactoring
-export { escapeKuery };
diff --git a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
index e9ca34e546f0b..d7b8b3315fafd 100644
--- a/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
+++ b/src/plugins/unified_search/public/autocomplete/providers/kql_query_suggestion/types.ts
@@ -6,10 +6,10 @@
* Side Public License, v 1.
*/
-import { CoreSetup } from '@kbn/core/public';
-import { KueryNode } from '@kbn/es-query';
+import type { KueryNode } from '@kbn/es-query';
+import type { CoreSetup } from '@kbn/core/public';
import type { UnifiedSearchPublicPluginStart } from '../../../types';
-import { QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../query_suggestion_provider';
+import type { QuerySuggestionBasic, QuerySuggestionGetFnArgs } from '../query_suggestion_provider';
export type KqlQuerySuggestionProvider = (
core: CoreSetup