diff --git a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx index d36f8f54b9365..c8ab912acc7b2 100644 --- a/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx +++ b/src/plugins/chart_expressions/expression_heatmap/public/components/heatmap_component.tsx @@ -7,6 +7,7 @@ */ import React, { memo, FC, useMemo, useState, useCallback, useRef } from 'react'; +import { ESQL_TABLE_TYPE } from '@kbn/data-plugin/common'; import { Chart, ElementClickListener, @@ -253,7 +254,9 @@ export const HeatmapComponent: FC = memo( datatables: [formattedTable.table], }); - const hasTooltipActions = interactive; + const isEsqlMode = table?.meta?.type === ESQL_TABLE_TYPE; + + const hasTooltipActions = interactive && !isEsqlMode; const onElementClick = useCallback( (e: HeatmapElementEvent[]) => { diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx index 855d32ccc312a..de0def30577a4 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx +++ b/src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx @@ -22,6 +22,7 @@ import { Tooltip, TooltipValue, } from '@elastic/charts'; +import { ESQL_TABLE_TYPE } from '@kbn/data-plugin/common'; import { i18n } from '@kbn/i18n'; import { useEuiTheme } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; @@ -409,8 +410,9 @@ const PartitionVisComponent = (props: PartitionVisComponentProps) => { ? getColumnByAccessor(splitRow[0], visData.columns) : undefined; + const isEsqlMode = originalVisData?.meta?.type === ESQL_TABLE_TYPE; const hasTooltipActions = - interactive && bucketAccessors.filter((a) => a !== 'metric-name').length > 0; + interactive && !isEsqlMode && bucketAccessors.filter((a) => a !== 'metric-name').length > 0; const tooltip: TooltipProps = { ...(fixedViewPort ? { boundary: fixedViewPort } : {}), diff --git a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx index 17eb637f77c09..58a02a1bf3215 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/xy_chart.tsx @@ -863,7 +863,7 @@ export function XYChart({ xDomain={xDomain} // enable brushing only for time charts, for both ES|QL and DSL queries onBrushEnd={interactive ? (brushHandler as BrushEndListener) : undefined} - onElementClick={interactive && !isEsqlMode ? clickHandler : undefined} + onElementClick={interactive ? clickHandler : undefined} legendAction={ interactive ? getLegendAction( diff --git a/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts b/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts index 4bb80fe64134b..fab4d18af400b 100644 --- a/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts +++ b/src/plugins/data/public/actions/filters/create_filters_from_value_click.test.ts @@ -9,7 +9,10 @@ import { DataViewsContract } from '@kbn/data-views-plugin/common'; import { dataPluginMock } from '../../mocks'; import { setIndexPatterns, setSearchService } from '../../services'; -import { createFiltersFromValueClickAction } from './create_filters_from_value_click'; +import { + createFiltersFromValueClickAction, + appendFilterToESQLQueryFromValueClickAction, +} from './create_filters_from_value_click'; import { FieldFormatsGetConfigFn, BytesFormat } from '@kbn/field-formats-plugin/common'; import { RangeFilter } from '@kbn/es-query'; @@ -17,89 +20,156 @@ const mockField = { name: 'bytes', filterable: true, }; +describe('createFiltersFromClickEvent', () => { + const dataStart = dataPluginMock.createStartContract(); + setSearchService(dataStart.search); + setIndexPatterns({ + ...dataStart.indexPatterns, + get: async () => ({ + id: 'logstash-*', + fields: { + getByName: () => mockField, + filter: () => [mockField], + }, + getFormatterForField: () => new BytesFormat({}, (() => {}) as FieldFormatsGetConfigFn), + }), + } as unknown as DataViewsContract); + describe('createFiltersFromValueClick', () => { + let dataPoints: Parameters[0]['data']; -describe('createFiltersFromValueClick', () => { - let dataPoints: Parameters[0]['data']; - - beforeEach(() => { - dataPoints = [ - { - table: { - columns: [ - { - name: 'test', - id: '1-1', - meta: { - type: 'date', - source: 'esaggs', - sourceParams: { - indexPatternId: 'logstash-*', - type: 'histogram', - params: { - field: 'bytes', - interval: 30, - otherBucket: true, + beforeEach(() => { + dataPoints = [ + { + table: { + columns: [ + { + name: 'test', + id: '1-1', + meta: { + type: 'date', + source: 'esaggs', + sourceParams: { + indexPatternId: 'logstash-*', + type: 'histogram', + params: { + field: 'bytes', + interval: 30, + otherBucket: true, + }, }, }, }, - }, - ], - rows: [ - { - '1-1': '2048', - }, - ], - }, - column: 0, - row: 0, - value: 'test', - }, - ]; - - const dataStart = dataPluginMock.createStartContract(); - setSearchService(dataStart.search); - setIndexPatterns({ - ...dataStart.indexPatterns, - get: async () => ({ - id: 'logstash-*', - fields: { - getByName: () => mockField, - filter: () => [mockField], + ], + rows: [ + { + '1-1': '2048', + }, + ], + }, + column: 0, + row: 0, + value: 'test', }, - getFormatterForField: () => new BytesFormat({}, (() => {}) as FieldFormatsGetConfigFn), - }), - } as unknown as DataViewsContract); - }); + ]; + }); + test('ignores event when value for rows is not provided', async () => { + dataPoints[0].table.rows[0]['1-1'] = null; + const filters = await createFiltersFromValueClickAction({ data: dataPoints }); - test('ignores event when value for rows is not provided', async () => { - dataPoints[0].table.rows[0]['1-1'] = null; - const filters = await createFiltersFromValueClickAction({ data: dataPoints }); + expect(filters.length).toEqual(0); + }); - expect(filters.length).toEqual(0); - }); + test('handles an event when aggregations type is a terms', async () => { + (dataPoints[0].table.columns[0].meta.sourceParams as any).type = 'terms'; + const filters = await createFiltersFromValueClickAction({ data: dataPoints }); - test('handles an event when aggregations type is a terms', async () => { - (dataPoints[0].table.columns[0].meta.sourceParams as any).type = 'terms'; - const filters = await createFiltersFromValueClickAction({ data: dataPoints }); + expect(filters.length).toEqual(1); + expect(filters[0].query?.match_phrase?.bytes).toEqual('2048'); + }); - expect(filters.length).toEqual(1); - expect(filters[0].query?.match_phrase?.bytes).toEqual('2048'); - }); + test('handles an event when aggregations type is not terms', async () => { + const filters = await createFiltersFromValueClickAction({ data: dataPoints }); - test('handles an event when aggregations type is not terms', async () => { - const filters = await createFiltersFromValueClickAction({ data: dataPoints }); + expect(filters.length).toEqual(1); - expect(filters.length).toEqual(1); + const [rangeFilter] = filters as RangeFilter[]; + expect(rangeFilter.query.range.bytes.gte).toEqual(2048); + expect(rangeFilter.query.range.bytes.lt).toEqual(2078); + }); - const [rangeFilter] = filters as RangeFilter[]; - expect(rangeFilter.query.range.bytes.gte).toEqual(2048); - expect(rangeFilter.query.range.bytes.lt).toEqual(2078); + test('handles non-unique filters', async () => { + const [point] = dataPoints; + const filters = await createFiltersFromValueClickAction({ data: [point, point] }); + + expect(filters.length).toEqual(1); + }); }); + describe('appendFilterToESQLQueryFromValueClickAction', () => { + let dataPoints: Parameters[0]['data']; + beforeEach(() => { + dataPoints = [ + { + table: { + columns: [ + { + name: 'columnA', + id: 'columnA', + meta: { + type: 'date', + }, + }, + ], + rows: [ + { + columnA: '2048', + }, + ], + }, + column: 0, + row: 0, + value: 'test', + }, + ]; + }); + test('should return null for date fields', async () => { + const queryString = await appendFilterToESQLQueryFromValueClickAction({ + data: dataPoints, + query: { esql: 'from meow' }, + }); + + expect(queryString).toBeUndefined(); + }); - test('handles non-unique filters', async () => { - const [point] = dataPoints; - const filters = await createFiltersFromValueClickAction({ data: [point, point] }); + test('should return null if no aggregate query is present', async () => { + dataPoints[0].table.columns[0] = { + name: 'test', + id: '1-1', + meta: { + type: 'string', + }, + }; + const queryString = await appendFilterToESQLQueryFromValueClickAction({ + data: dataPoints, + }); + + expect(queryString).toBeUndefined(); + }); + + test('should return the update query string', async () => { + dataPoints[0].table.columns[0] = { + name: 'columnA', + id: 'columnA', + meta: { + type: 'string', + }, + }; + const queryString = await appendFilterToESQLQueryFromValueClickAction({ + data: dataPoints, + query: { esql: 'from meow' }, + }); - expect(filters.length).toEqual(1); + expect(queryString).toEqual(`from meow +| where \`columnA\`=="2048"`); + }); }); }); diff --git a/src/plugins/data/public/actions/filters/create_filters_from_value_click.ts b/src/plugins/data/public/actions/filters/create_filters_from_value_click.ts index 5a3464d9aefea..5493937a19cbb 100644 --- a/src/plugins/data/public/actions/filters/create_filters_from_value_click.ts +++ b/src/plugins/data/public/actions/filters/create_filters_from_value_click.ts @@ -8,7 +8,14 @@ import _ from 'lodash'; import { Datatable } from '@kbn/expressions-plugin/public'; -import { compareFilters, COMPARE_ALL_OPTIONS, Filter, toggleFilterNegated } from '@kbn/es-query'; +import { + compareFilters, + COMPARE_ALL_OPTIONS, + Filter, + toggleFilterNegated, + type AggregateQuery, +} from '@kbn/es-query'; +import { appendWhereClauseToESQLQuery } from '@kbn/esql-utils'; import { getIndexPatterns, getSearchService } from '../../services'; import { AggConfigSerialized } from '../../../common/search/aggs'; import { mapAndFlattenFilters } from '../../query'; @@ -22,6 +29,7 @@ interface ValueClickDataContext { }>; timeFieldName?: string; negate?: boolean; + query?: AggregateQuery; } /** @@ -148,3 +156,32 @@ export const createFiltersFromValueClickAction = async ({ compareFilters(a, b, COMPARE_ALL_OPTIONS) ); }; + +/** @public */ +export const appendFilterToESQLQueryFromValueClickAction = ({ + data, + query, +}: ValueClickDataContext) => { + if (!query) { + return; + } + // Do not append in case of time series, for now. We need to find a way to compute the interval + // to create the time range filter correctly. The users can brush to update the time filter instead. + const dataPoints = data.filter((point) => { + return point && point.table?.columns?.[point.column]?.meta?.type !== 'date'; + }); + + if (!dataPoints.length) { + return; + } + const { table, column: columnIndex, row: rowIndex } = dataPoints[dataPoints.length - 1]; + + if (table?.columns?.[columnIndex]) { + const column = table.columns[columnIndex]; + const value: unknown = rowIndex > -1 ? table.rows[rowIndex][column.id] : null; + if (value == null) { + return; + } + return appendWhereClauseToESQLQuery(query.esql, column.name, value, '+', column.meta?.type); + } +}; diff --git a/src/plugins/data/public/actions/value_click_action.ts b/src/plugins/data/public/actions/value_click_action.ts index b229ee5b07a04..fd96f514688b8 100644 --- a/src/plugins/data/public/actions/value_click_action.ts +++ b/src/plugins/data/public/actions/value_click_action.ts @@ -6,11 +6,14 @@ * Side Public License, v 1. */ -import type { Filter } from '@kbn/es-query'; +import { Filter, AggregateQuery, isOfAggregateQueryType } from '@kbn/es-query'; import { Datatable } from '@kbn/expressions-plugin/public'; import { UiActionsActionDefinition, UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { APPLY_FILTER_TRIGGER } from '../triggers'; -import { createFiltersFromValueClickAction } from './filters/create_filters_from_value_click'; +import { + createFiltersFromValueClickAction, + appendFilterToESQLQueryFromValueClickAction, +} from './filters/create_filters_from_value_click'; export type ValueClickActionContext = ValueClickContext; export const ACTION_VALUE_CLICK = 'ACTION_VALUE_CLICK'; @@ -28,6 +31,7 @@ export interface ValueClickContext { }>; timeFieldName?: string; negate?: boolean; + query?: AggregateQuery; }; } @@ -39,18 +43,31 @@ export function createValueClickActionDefinition( id: ACTION_VALUE_CLICK, shouldAutoExecute: async () => true, isCompatible: async (context: ValueClickContext) => { + if (context.data.query && isOfAggregateQueryType(context.data.query)) { + const queryString = await appendFilterToESQLQueryFromValueClickAction(context.data); + return queryString != null; + } const filters = await createFiltersFromValueClickAction(context.data); return filters.length > 0; }, execute: async (context: ValueClickActionContext) => { try { - const filters: Filter[] = await createFiltersFromValueClickAction(context.data); - if (filters.length > 0) { - await getStartServices().uiActions.getTrigger(APPLY_FILTER_TRIGGER).exec({ - filters, - embeddable: context.embeddable, - timeFieldName: context.data.timeFieldName, + if (context.data.query && isOfAggregateQueryType(context.data.query)) { + // ES|QL charts have a different way of applying filters, + // they are appending a where clause to the query + const queryString = appendFilterToESQLQueryFromValueClickAction(context.data); + await getStartServices().uiActions.getTrigger('UPDATE_ESQL_QUERY_TRIGGER').exec({ + queryString, }); + } else { + const filters: Filter[] = await createFiltersFromValueClickAction(context.data); + if (filters.length > 0) { + await getStartServices().uiActions.getTrigger(APPLY_FILTER_TRIGGER).exec({ + filters, + embeddable: context.embeddable, + timeFieldName: context.data.timeFieldName, + }); + } } } catch (e) { // eslint-disable-next-line no-console diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json index 530d6b7325c00..ea92ad9289b13 100644 --- a/src/plugins/data/tsconfig.json +++ b/src/plugins/data/tsconfig.json @@ -56,6 +56,7 @@ "@kbn/react-kibana-mount", "@kbn/search-types", "@kbn/safer-lodash-set", + "@kbn/esql-utils", ], "exclude": [ "target/**/*", diff --git a/src/plugins/text_based_languages/kibana.jsonc b/src/plugins/text_based_languages/kibana.jsonc index 7e9aba22067e8..5bed408add15a 100644 --- a/src/plugins/text_based_languages/kibana.jsonc +++ b/src/plugins/text_based_languages/kibana.jsonc @@ -12,7 +12,8 @@ "requiredPlugins": [ "data", "expressions", - "dataViews" + "dataViews", + "uiActions", ], "requiredBundles": [ "kibanaReact", diff --git a/src/plugins/text_based_languages/public/plugin.ts b/src/plugins/text_based_languages/public/plugin.ts index dd6297750ae5b..841641c8fce25 100755 --- a/src/plugins/text_based_languages/public/plugin.ts +++ b/src/plugins/text_based_languages/public/plugin.ts @@ -9,27 +9,45 @@ import type { Plugin, CoreStart, CoreSetup } from '@kbn/core/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { ExpressionsStart } from '@kbn/expressions-plugin/public'; +import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { IndexManagementPluginSetup } from '@kbn/index-management'; +import type { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public'; +import { + updateESQLQueryTrigger, + UpdateESQLQueryAction, + UPDATE_ESQL_QUERY_TRIGGER, +} from './triggers'; import { setKibanaServices } from './kibana_services'; interface TextBasedLanguagesPluginStart { dataViews: DataViewsPublicPluginStart; expressions: ExpressionsStart; + uiActions: UiActionsStart; + data: DataPublicPluginStart; } interface TextBasedLanguagesPluginSetup { indexManagement: IndexManagementPluginSetup; + uiActions: UiActionsSetup; } export class TextBasedLanguagesPlugin implements Plugin<{}, void> { private indexManagement?: IndexManagementPluginSetup; - public setup(_: CoreSetup, { indexManagement }: TextBasedLanguagesPluginSetup) { + public setup(_: CoreSetup, { indexManagement, uiActions }: TextBasedLanguagesPluginSetup) { this.indexManagement = indexManagement; + + uiActions.registerTrigger(updateESQLQueryTrigger); + return {}; } - public start(core: CoreStart, { dataViews, expressions }: TextBasedLanguagesPluginStart): void { + public start( + core: CoreStart, + { dataViews, expressions, data, uiActions }: TextBasedLanguagesPluginStart + ): void { + const appendESQLAction = new UpdateESQLQueryAction(data); + uiActions.addTriggerAction(UPDATE_ESQL_QUERY_TRIGGER, appendESQLAction); setKibanaServices(core, dataViews, expressions, this.indexManagement); } diff --git a/src/plugins/text_based_languages/public/triggers/index.ts b/src/plugins/text_based_languages/public/triggers/index.ts new file mode 100644 index 0000000000000..091971018adf3 --- /dev/null +++ b/src/plugins/text_based_languages/public/triggers/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { updateESQLQueryTrigger, UPDATE_ESQL_QUERY_TRIGGER } from './update_esql_query_trigger'; +export { UpdateESQLQueryAction } from './update_esql_query_actions'; diff --git a/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.test.ts b/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.test.ts new file mode 100644 index 0000000000000..e1c95a3e2f5e5 --- /dev/null +++ b/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.test.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { UpdateESQLQueryAction } from './update_esql_query_actions'; + +describe('update ES|QL query action', () => { + const dataMock = dataPluginMock.createStartContract(); + describe('compatibility check', () => { + it('is incompatible if no query is applied', async () => { + const updateQueryAction = new UpdateESQLQueryAction(dataMock); + const isCompatible = await updateQueryAction.isCompatible(); + + expect(isCompatible).toBeFalsy(); + }); + + it('is incompatible if query is not ES|QL', async () => { + dataMock.query.queryString.getQuery = jest.fn().mockReturnValue({ query: 'not esql' }); + const updateQueryAction = new UpdateESQLQueryAction(dataMock); + const isCompatible = await updateQueryAction.isCompatible(); + + expect(isCompatible).toBeFalsy(); + }); + + it('is compatible if query is ES|QL', async () => { + dataMock.query.queryString.getQuery = jest.fn().mockReturnValue({ esql: 'from meow' }); + const updateQueryAction = new UpdateESQLQueryAction(dataMock); + const isCompatible = await updateQueryAction.isCompatible(); + + expect(isCompatible).toBeTruthy(); + }); + }); +}); diff --git a/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.ts b/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.ts new file mode 100644 index 0000000000000..4aa7b015b366b --- /dev/null +++ b/src/plugins/text_based_languages/public/triggers/update_esql_query_actions.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { i18n } from '@kbn/i18n'; +import type { Action } from '@kbn/ui-actions-plugin/public'; +import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; + +const ACTION_UPDATE_ESQL_QUERY = 'ACTION_UPDATE_ESQL_QUERY'; + +interface Context { + queryString: string; +} + +export const getHelpersAsync = async () => await import('./update_esql_query_helpers'); + +export class UpdateESQLQueryAction implements Action { + public type = ACTION_UPDATE_ESQL_QUERY; + public id = ACTION_UPDATE_ESQL_QUERY; + public order = 50; + + constructor(protected readonly data: DataPublicPluginStart) {} + + public getDisplayName(): string { + return i18n.translate('textBasedLanguages.updateESQLQueryLabel', { + defaultMessage: 'Update the ES|QL query in the editor', + }); + } + + public getIconType() { + return 'filter'; + } + + public async isCompatible() { + const { isActionCompatible } = await getHelpersAsync(); + return isActionCompatible(this.data); + } + + public async execute({ queryString }: Context) { + const { executeAction } = await getHelpersAsync(); + return executeAction({ + queryString, + data: this.data, + }); + } +} diff --git a/src/plugins/text_based_languages/public/triggers/update_esql_query_helpers.ts b/src/plugins/text_based_languages/public/triggers/update_esql_query_helpers.ts new file mode 100644 index 0000000000000..67276b1c0237f --- /dev/null +++ b/src/plugins/text_based_languages/public/triggers/update_esql_query_helpers.ts @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { IncompatibleActionError } from '@kbn/ui-actions-plugin/public'; +import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { isOfAggregateQueryType } from '@kbn/es-query'; + +interface Context { + data: DataPublicPluginStart; + queryString: string; +} + +export async function isActionCompatible(data: DataPublicPluginStart) { + const { query } = data; + const currentQueryString = query.queryString.getQuery(); + // we want to make sure that the current query is an ES|QL query + return currentQueryString && isOfAggregateQueryType(currentQueryString); +} + +export async function executeAction({ queryString, data }: Context) { + const isCompatibleAction = await isActionCompatible(data); + if (!isCompatibleAction) { + throw new IncompatibleActionError(); + } + + const { query } = data; + query.queryString.setQuery({ + esql: queryString, + }); +} diff --git a/src/plugins/text_based_languages/public/triggers/update_esql_query_trigger.ts b/src/plugins/text_based_languages/public/triggers/update_esql_query_trigger.ts new file mode 100644 index 0000000000000..13164647607ef --- /dev/null +++ b/src/plugins/text_based_languages/public/triggers/update_esql_query_trigger.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { i18n } from '@kbn/i18n'; +import { Trigger } from '@kbn/ui-actions-plugin/public'; + +export const UPDATE_ESQL_QUERY_TRIGGER = 'UPDATE_ESQL_QUERY_TRIGGER'; + +export const updateESQLQueryTrigger: Trigger = { + id: UPDATE_ESQL_QUERY_TRIGGER, + title: i18n.translate('textBasedLanguages.triggers.updateEsqlQueryTrigger', { + defaultMessage: 'Update ES|QL query', + }), + description: i18n.translate('textBasedLanguages.triggers.updateEsqlQueryTriggerDescription', { + defaultMessage: 'Update ES|QL query with a new one', + }), +}; diff --git a/src/plugins/text_based_languages/tsconfig.json b/src/plugins/text_based_languages/tsconfig.json index 2cb4eddcbf7a0..3c7b28567816b 100644 --- a/src/plugins/text_based_languages/tsconfig.json +++ b/src/plugins/text_based_languages/tsconfig.json @@ -18,7 +18,10 @@ "@kbn/index-management", "@kbn/i18n", "@kbn/config-schema", - "@kbn/esql-utils" + "@kbn/esql-utils", + "@kbn/ui-actions-plugin", + "@kbn/data-plugin", + "@kbn/es-query" ], "exclude": [ "target/**/*",