[Unified Search] Fix regress autocomplete (#140880)

* fix: refress with autocomplete

* fix: autocomplite

* feat: added usageCollection to unified search plugin

* fix: check type

* fix: jest test

* refact: move usageCollection to optionalPlugins

* cleanup

* fix: avtocomplete in lens

* fix default editro

* some cleanup

* feat: rename app name in Lens

* feat: rename app in apm

* fix: descover autocomplete
This commit is contained in:
Nodir Latipov 2022-09-21 16:29:46 +05:00 committed by GitHub
parent 64e58d2afc
commit 10211c6df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 537 additions and 109 deletions

View file

@ -0,0 +1,8 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export const STACK_ALERTS_FEATURE_ID = 'stackAlerts';

View file

@ -9,4 +9,4 @@
/* eslint-disable @kbn/eslint/no_export_all */
export * from './config';
export const STACK_ALERTS_FEATURE_ID = 'stackAlerts';
export { STACK_ALERTS_FEATURE_ID } from './constants';

View file

@ -10,14 +10,22 @@ import { EuiCallOut, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { fromKueryExpression, luceneStringToDsl } from '@kbn/es-query';
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import { DataView } from '@kbn/data-plugin/common';
import type { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import type { DataView } from '@kbn/data-plugin/common';
import type { Query } from '@kbn/es-query';
import { QueryStringInput } from '@kbn/unified-search-plugin/public';
import { GeoContainmentAlertParams } from '../types';
import { EntityIndexExpression } from './expressions/entity_index_expression';
import { EntityByExpression } from './expressions/entity_by_expression';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import type { HttpSetup } from '@kbn/core-http-browser';
import type { DocLinksStart } from '@kbn/core-doc-links-browser';
import type { IUiSettingsClient } from '@kbn/core-ui-settings-server';
import type { CoreStart } from '@kbn/core/public';
import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public';
import { STACK_ALERTS_FEATURE_ID } from '../../../../common/constants';
import { BoundaryIndexExpression } from './expressions/boundary_index_expression';
import { EntityByExpression } from './expressions/entity_by_expression';
import { EntityIndexExpression } from './expressions/entity_index_expression';
import type { GeoContainmentAlertParams } from '../types';
const DEFAULT_VALUES = {
TRACKING_EVENT: '',
@ -34,6 +42,15 @@ const DEFAULT_VALUES = {
DELAY_OFFSET_WITH_UNITS: '0m',
};
interface KibanaDeps {
http: HttpSetup;
docLinks: DocLinksStart;
uiSettings: IUiSettingsClient;
notifications: CoreStart['notifications'];
storage: IStorageWrapper;
usageCollection: UsageCollectionStart;
}
function validateQuery(query: Query) {
try {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
@ -62,6 +79,9 @@ export const GeoContainmentAlertTypeExpression: React.FunctionComponent<
boundaryNameField,
} = ruleParams;
const { http, docLinks, uiSettings, notifications, storage, usageCollection } =
useKibana<KibanaDeps>().services;
const [indexPattern, _setIndexPattern] = useState<DataView>({
id: '',
title: '',
@ -198,6 +218,17 @@ export const GeoContainmentAlertTypeExpression: React.FunctionComponent<
setIndexQueryInput(query);
}
}}
appName={STACK_ALERTS_FEATURE_ID}
deps={{
unifiedSearch,
notifications,
http,
docLinks,
uiSettings,
data,
storage,
usageCollection,
}}
/>
</EuiFlexItem>
<EuiSpacer size="l" />
@ -242,6 +273,17 @@ export const GeoContainmentAlertTypeExpression: React.FunctionComponent<
setBoundaryIndexQueryInput(query);
}
}}
appName={STACK_ALERTS_FEATURE_ID}
deps={{
unifiedSearch,
notifications,
http,
docLinks,
uiSettings,
data,
storage,
usageCollection,
}}
/>
</EuiFlexItem>
<EuiSpacer size="l" />