diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index d83ddab807bc5..2815b41eaba5c 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -140,7 +140,7 @@ export class SearchInterceptor { }), }, { - toastLifeTimeMs: Infinity, + toastLifeTimeMs: 1000000, } ); }; diff --git a/src/plugins/telemetry/common/telemetry_config/get_telemetry_allow_changing_opt_in_status.ts b/src/plugins/telemetry/common/telemetry_config/get_telemetry_allow_changing_opt_in_status.ts index d7dcfd606b6ac..030edf7e1c112 100644 --- a/src/plugins/telemetry/common/telemetry_config/get_telemetry_allow_changing_opt_in_status.ts +++ b/src/plugins/telemetry/common/telemetry_config/get_telemetry_allow_changing_opt_in_status.ts @@ -32,9 +32,9 @@ export function getTelemetryAllowChangingOptInStatus({ return configTelemetryAllowChangingOptInStatus; } - if (typeof telemetrySavedObject.telemetryAllowChangingOptInStatus === 'undefined') { + if (typeof telemetrySavedObject.allowChangingOptInStatus === 'undefined') { return configTelemetryAllowChangingOptInStatus; } - return telemetrySavedObject.telemetryAllowChangingOptInStatus; + return telemetrySavedObject.allowChangingOptInStatus; } diff --git a/src/plugins/telemetry/common/telemetry_config/types.ts b/src/plugins/telemetry/common/telemetry_config/types.ts index 7ab37e9544164..4deb1ab9a12f2 100644 --- a/src/plugins/telemetry/common/telemetry_config/types.ts +++ b/src/plugins/telemetry/common/telemetry_config/types.ts @@ -22,7 +22,7 @@ export interface TelemetrySavedObjectAttributes { lastVersionChecked?: string; sendUsageFrom?: 'browser' | 'server'; lastReported?: number; - telemetryAllowChangingOptInStatus?: boolean; + allowChangingOptInStatus?: boolean; userHasSeenNotice?: boolean; reportFailureCount?: number; reportFailureVersion?: string; diff --git a/src/plugins/telemetry/server/plugin.ts b/src/plugins/telemetry/server/plugin.ts index af512d234a7dc..d7a4e15968a47 100644 --- a/src/plugins/telemetry/server/plugin.ts +++ b/src/plugins/telemetry/server/plugin.ts @@ -143,6 +143,9 @@ export class TelemetryPlugin implements Plugin { reportFailureVersion: { type: 'keyword', }, + allowChangingOptInStatus: { + type: 'boolean', + }, }, }, }); diff --git a/x-pack/legacy/plugins/canvas/public/apps/export/export/export_app.js b/x-pack/legacy/plugins/canvas/public/apps/export/export/export_app.js index 9b198cee34aae..7537f8eaa9039 100644 --- a/x-pack/legacy/plugins/canvas/public/apps/export/export/export_app.js +++ b/x-pack/legacy/plugins/canvas/public/apps/export/export/export_app.js @@ -28,6 +28,7 @@ export class ExportApp extends React.PureComponent { const { workpad, selectedPageId } = this.props; const { pages, height, width } = workpad; const activePage = pages.find(page => page.id === selectedPageId); + const pageElementCount = activePage.elements.length; return (
@@ -39,7 +40,7 @@ export class ExportApp extends React.PureComponent {
{Style.it( workpad.css, -
+
(this.sharedItemRef = ref)} > diff --git a/x-pack/legacy/plugins/lens/index.ts b/x-pack/legacy/plugins/lens/index.ts index b1c67fb81ba07..e9a901c58cd90 100644 --- a/x-pack/legacy/plugins/lens/index.ts +++ b/x-pack/legacy/plugins/lens/index.ts @@ -7,12 +7,7 @@ import * as Joi from 'joi'; import { resolve } from 'path'; import { LegacyPluginInitializer } from 'src/legacy/types'; -import mappings from './mappings.json'; -import { - PLUGIN_ID, - getEditPath, - NOT_INTERNATIONALIZED_PRODUCT_NAME, -} from '../../../plugins/lens/common'; +import { PLUGIN_ID, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../../../plugins/lens/common'; export const lens: LegacyPluginInitializer = kibana => { return new kibana.Plugin({ @@ -32,18 +27,6 @@ export const lens: LegacyPluginInitializer = kibana => { visualize: [`plugins/${PLUGIN_ID}/legacy`], embeddableFactories: [`plugins/${PLUGIN_ID}/legacy`], styleSheetPaths: resolve(__dirname, 'public/index.scss'), - mappings, - savedObjectsManagement: { - lens: { - defaultSearchField: 'title', - isImportableAndExportable: true, - getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title, - getInAppUrl: (obj: { id: string }) => ({ - path: getEditPath(obj.id), - uiCapabilitiesPath: 'lens.show', - }), - }, - }, }, config: () => { diff --git a/x-pack/legacy/plugins/lens/mappings.json b/x-pack/legacy/plugins/lens/mappings.json deleted file mode 100644 index 8304cf9c9cb64..0000000000000 --- a/x-pack/legacy/plugins/lens/mappings.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "lens": { - "properties": { - "title": { - "type": "text" - }, - "visualizationType": { - "type": "keyword" - }, - "state": { - "type": "flattened" - }, - "expression": { - "index": false, - "type": "keyword" - } - } - }, - "lens-ui-telemetry": { - "properties": { - "name": { - "type": "keyword" - }, - "type": { - "type": "keyword" - }, - "date": { - "type": "date" - }, - "count": { - "type": "integer" - } - } - } -} diff --git a/x-pack/legacy/plugins/maps/common/descriptor_types.ts b/x-pack/legacy/plugins/maps/common/descriptor_types.ts new file mode 100644 index 0000000000000..1f0eda26e7f7d --- /dev/null +++ b/x-pack/legacy/plugins/maps/common/descriptor_types.ts @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ + +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +export * from '../../../../plugins/maps/common/descriptor_types'; diff --git a/x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts b/x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts index 3a61d5affd861..48ab957089361 100644 --- a/x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts +++ b/x-pack/legacy/plugins/maps/public/actions/map_actions.d.ts @@ -6,7 +6,7 @@ /* eslint-disable @typescript-eslint/consistent-type-definitions */ import { LAYER_TYPE } from '../../common/constants'; -import { DataMeta, MapFilters } from '../../common/data_request_descriptor_types'; +import { DataMeta, MapFilters } from '../../common/descriptor_types'; export type SyncContext = { startLoading(dataId: string, requestToken: symbol, meta: DataMeta): void; diff --git a/x-pack/legacy/plugins/maps/public/layers/blended_vector_layer.ts b/x-pack/legacy/plugins/maps/public/layers/blended_vector_layer.ts index 8c54720987e41..f5526ad703dd2 100644 --- a/x-pack/legacy/plugins/maps/public/layers/blended_vector_layer.ts +++ b/x-pack/legacy/plugins/maps/public/layers/blended_vector_layer.ts @@ -34,7 +34,7 @@ import { VectorStyleDescriptor, SizeDynamicOptions, DynamicStylePropertyOptions, -} from '../../common/style_property_descriptor_types'; +} from '../../common/descriptor_types'; const ACTIVE_COUNT_DATA_ID = 'ACTIVE_COUNT_DATA_ID'; diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_source.d.ts b/x-pack/legacy/plugins/maps/public/layers/sources/es_source.d.ts index b565cb9108aea..ffd1d343b59e0 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_source.d.ts +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_source.d.ts @@ -7,7 +7,7 @@ import { AbstractVectorSource } from './vector_source'; import { IVectorSource } from './vector_source'; import { IndexPattern, SearchSource } from '../../../../../../../src/plugins/data/public'; -import { VectorSourceRequestMeta } from '../../../common/data_request_descriptor_types'; +import { VectorSourceRequestMeta } from '../../../common/descriptor_types'; export interface IESSource extends IVectorSource { getId(): string; diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/vector_source.d.ts b/x-pack/legacy/plugins/maps/public/layers/sources/vector_source.d.ts index fd585e100924e..7a747da244233 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/vector_source.d.ts +++ b/x-pack/legacy/plugins/maps/public/layers/sources/vector_source.d.ts @@ -8,7 +8,7 @@ import { FeatureCollection } from 'geojson'; import { AbstractSource, ISource } from './source'; import { IField } from '../fields/field'; -import { ESSearchSourceResponseMeta } from '../../../common/data_request_descriptor_types'; +import { ESSearchSourceResponseMeta } from '../../../common/descriptor_types'; export type GeoJsonFetchMeta = ESSearchSourceResponseMeta; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/categorical_field_meta_popover.tsx b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/categorical_field_meta_popover.tsx index 9aec7ece45f36..550b3737963d5 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/categorical_field_meta_popover.tsx +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/categorical_field_meta_popover.tsx @@ -11,7 +11,7 @@ import { EuiFormRow, EuiSwitch, EuiSwitchEvent } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FieldMetaPopover } from './field_meta_popover'; import { IDynamicStyleProperty } from '../../properties/dynamic_style_property'; -import { FieldMetaOptions } from '../../../../../../common/style_property_descriptor_types'; +import { FieldMetaOptions } from '../../../../../../common/descriptor_types'; type Props = { styleProperty: IDynamicStyleProperty; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/ordinal_field_meta_popover.tsx b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/ordinal_field_meta_popover.tsx index 777f60b5075af..32a54a45ed4d7 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/ordinal_field_meta_popover.tsx +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/components/field_meta/ordinal_field_meta_popover.tsx @@ -12,7 +12,7 @@ import { i18n } from '@kbn/i18n'; import { DEFAULT_SIGMA } from '../../vector_style_defaults'; import { FieldMetaPopover } from './field_meta_popover'; import { IDynamicStyleProperty } from '../../properties/dynamic_style_property'; -import { FieldMetaOptions } from '../../../../../../common/style_property_descriptor_types'; +import { FieldMetaOptions } from '../../../../../../common/descriptor_types'; import { VECTOR_STYLES } from '../../../../../../common/constants'; function getIsEnableToggleLabel(styleName: string) { diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.d.ts b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.d.ts index a83dd55c0c175..88eb489c4996e 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.d.ts +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/dynamic_style_property.d.ts @@ -8,11 +8,12 @@ import { IStyleProperty } from './style_property'; import { FIELD_ORIGIN } from '../../../../../common/constants'; import { - FieldMetaOptions, + CategoryFieldMeta, DynamicStylePropertyOptions, -} from '../../../../../common/style_property_descriptor_types'; + FieldMetaOptions, + RangeFieldMeta, +} from '../../../../../common/descriptor_types'; import { IField } from '../../../fields/field'; -import { CategoryFieldMeta, RangeFieldMeta } from '../../../../../common/descriptor_types'; export interface IDynamicStyleProperty extends IStyleProperty { getOptions(): DynamicStylePropertyOptions; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/style_property.ts b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/style_property.ts index fef7778c5f08e..af04a95e3c3bd 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/style_property.ts +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/properties/style_property.ts @@ -8,10 +8,7 @@ import { ReactElement } from 'react'; // @ts-ignore import { getVectorStyleLabel } from '../components/get_vector_style_label'; -import { - FieldMetaOptions, - StylePropertyOptions, -} from '../../../../../common/style_property_descriptor_types'; +import { FieldMetaOptions, StylePropertyOptions } from '../../../../../common/descriptor_types'; import { VECTOR_STYLES } from '../../../../../common/constants'; type LegendProps = { diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.d.ts b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.d.ts index 37aea501f5193..77ea44ac26bf9 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.d.ts +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style.d.ts @@ -7,7 +7,7 @@ import { IStyleProperty } from './properties/style_property'; import { IDynamicStyleProperty } from './properties/dynamic_style_property'; import { IVectorLayer } from '../../vector_layer'; import { IVectorSource } from '../../sources/vector_source'; -import { VectorStyleDescriptor } from '../../../../common/style_property_descriptor_types'; +import { VectorStyleDescriptor } from '../../../../common/descriptor_types'; export interface IVectorStyle { getAllStyleProperties(): IStyleProperty[]; diff --git a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.ts b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.ts index f104afd2a7857..86602381cf615 100644 --- a/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.ts +++ b/x-pack/legacy/plugins/maps/public/layers/styles/vector/vector_style_defaults.ts @@ -18,7 +18,7 @@ import { DEFAULT_LINE_COLORS, // @ts-ignore } from '../color_utils'; -import { VectorStylePropertiesDescriptor } from '../../../../common/style_property_descriptor_types'; +import { VectorStylePropertiesDescriptor } from '../../../../common/descriptor_types'; // @ts-ignore import { getUiSettings } from '../../../kibana_services'; diff --git a/x-pack/legacy/plugins/maps/public/layers/util/can_skip_fetch.ts b/x-pack/legacy/plugins/maps/public/layers/util/can_skip_fetch.ts index 7b75bb0f21b79..758cc35f41fbb 100644 --- a/x-pack/legacy/plugins/maps/public/layers/util/can_skip_fetch.ts +++ b/x-pack/legacy/plugins/maps/public/layers/util/can_skip_fetch.ts @@ -9,7 +9,7 @@ import turf from 'turf'; import turfBooleanContains from '@turf/boolean-contains'; import { isRefreshOnlyQuery } from './is_refresh_only_query'; import { ISource } from '../sources/source'; -import { DataMeta } from '../../../common/data_request_descriptor_types'; +import { DataMeta } from '../../../common/descriptor_types'; import { DataRequest } from './data_request'; const SOURCE_UPDATE_REQUIRED = true; diff --git a/x-pack/legacy/plugins/maps/public/layers/util/data_request.ts b/x-pack/legacy/plugins/maps/public/layers/util/data_request.ts index e361574194628..eeef5c49c6ef8 100644 --- a/x-pack/legacy/plugins/maps/public/layers/util/data_request.ts +++ b/x-pack/legacy/plugins/maps/public/layers/util/data_request.ts @@ -6,7 +6,7 @@ /* eslint-disable max-classes-per-file */ import _ from 'lodash'; -import { DataRequestDescriptor, DataMeta } from '../../../common/data_request_descriptor_types'; +import { DataRequestDescriptor, DataMeta } from '../../../common/descriptor_types'; export class DataRequest { private readonly _descriptor: DataRequestDescriptor; diff --git a/x-pack/legacy/plugins/maps/public/layers/util/is_refresh_only_query.ts b/x-pack/legacy/plugins/maps/public/layers/util/is_refresh_only_query.ts index 48b1340207fd4..a56da4b23aa1e 100644 --- a/x-pack/legacy/plugins/maps/public/layers/util/is_refresh_only_query.ts +++ b/x-pack/legacy/plugins/maps/public/layers/util/is_refresh_only_query.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { Query } from '../../../common/map_descriptor'; +import { Query } from '../../../common/descriptor_types'; // Refresh only query is query where timestamps are different but query is the same. // Triggered by clicking "Refresh" button in QueryBar diff --git a/x-pack/legacy/plugins/maps/public/layers/vector_layer.d.ts b/x-pack/legacy/plugins/maps/public/layers/vector_layer.d.ts index 390374f761fc7..70fd9927b7732 100644 --- a/x-pack/legacy/plugins/maps/public/layers/vector_layer.d.ts +++ b/x-pack/legacy/plugins/maps/public/layers/vector_layer.d.ts @@ -7,8 +7,11 @@ import { AbstractLayer } from './layer'; import { IVectorSource } from './sources/vector_source'; -import { VectorLayerDescriptor } from '../../common/descriptor_types'; -import { MapFilters, VectorSourceRequestMeta } from '../../common/data_request_descriptor_types'; +import { + MapFilters, + VectorLayerDescriptor, + VectorSourceRequestMeta, +} from '../../common/descriptor_types'; import { ILayer } from './layer'; import { IJoin } from './joins/join'; import { IVectorStyle } from './styles/vector/vector_style'; diff --git a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts index 38452dee9a2da..472d39179b468 100644 --- a/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts +++ b/x-pack/plugins/data_enhanced/public/search/search_interceptor.ts @@ -49,7 +49,7 @@ export class EnhancedSearchInterceptor extends SearchInterceptor { }), }, { - toastLifeTimeMs: Infinity, + toastLifeTimeMs: 1000000, } ); }; diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/view/defs.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/view/defs.tsx index 799f67123ba26..3295ef0289235 100644 --- a/x-pack/plugins/endpoint/public/embeddables/resolver/view/defs.tsx +++ b/x-pack/plugins/endpoint/public/embeddables/resolver/view/defs.tsx @@ -133,52 +133,52 @@ const PaintServers = memo(() => ( /> - - + + - - + + - - + + - - + + )); @@ -187,8 +187,7 @@ const PaintServers = memo(() => ( * Ids of symbols to be linked by elements */ export const SymbolIds = { - processNode: idGenerator('nodeSymbol'), - solidHexagon: idGenerator('hexagon'), + processNodeLabel: idGenerator('nodeSymbol'), runningProcessCube: idGenerator('runningCube'), runningTriggerCube: idGenerator('runningTriggerCube'), terminatedProcessCube: idGenerator('terminatedCube'), @@ -200,7 +199,11 @@ export const SymbolIds = { */ const SymbolsAndShapes = memo(() => ( <> - + ( paintOrder="normal" /> - - - - - Running Process - - + + - - - - - - - + + - Running Trigger Process - - resolver_dark process running + + + - - - - - - - + + Terminated Process - - - - + + - - - + Terminated Trigger Process - - - - + + - - - + )); diff --git a/x-pack/plugins/endpoint/public/embeddables/resolver/view/process_event_dot.tsx b/x-pack/plugins/endpoint/public/embeddables/resolver/view/process_event_dot.tsx index f3086be1598a8..603521e2d9bb3 100644 --- a/x-pack/plugins/endpoint/public/embeddables/resolver/view/process_event_dot.tsx +++ b/x-pack/plugins/endpoint/public/embeddables/resolver/view/process_event_dot.tsx @@ -20,7 +20,7 @@ const nodeAssets = { runningProcessCube: { cubeSymbol: `#${SymbolIds.runningProcessCube}`, labelFill: `url(#${PaintServerIds.runningProcess})`, - descriptionFill: NamedColors.activeNoWarning, + descriptionFill: NamedColors.empty, descriptionText: i18n.translate('xpack.endpoint.resolver.runningProcess', { defaultMessage: 'Running Process', }), @@ -28,7 +28,7 @@ const nodeAssets = { runningTriggerCube: { cubeSymbol: `#${SymbolIds.runningTriggerCube}`, labelFill: `url(#${PaintServerIds.runningTrigger})`, - descriptionFill: NamedColors.activeWarning, + descriptionFill: NamedColors.empty, descriptionText: i18n.translate('xpack.endpoint.resolver.runningTrigger', { defaultMessage: 'Running Trigger', }), @@ -36,7 +36,7 @@ const nodeAssets = { terminatedProcessCube: { cubeSymbol: `#${SymbolIds.terminatedProcessCube}`, labelFill: NamedColors.fullLabelBackground, - descriptionFill: NamedColors.inertDescription, + descriptionFill: NamedColors.empty, descriptionText: i18n.translate('xpack.endpoint.resolver.terminatedProcess', { defaultMessage: 'Terminated Process', }), @@ -44,7 +44,7 @@ const nodeAssets = { terminatedTriggerCube: { cubeSymbol: `#${SymbolIds.terminatedTriggerCube}`, labelFill: NamedColors.fullLabelBackground, - descriptionFill: NamedColors.inertDescription, + descriptionFill: NamedColors.empty, descriptionText: i18n.translate('xpack.endpoint.resolver.terminatedTrigger', { defaultMessage: 'Terminated Trigger', }), @@ -207,7 +207,7 @@ export const ProcessEventDot = styled( (({ config }) => { const fullConfigRequest = useGetOneAgentConfigFull(config.id); const apiKeysRequest = useGetEnrollmentAPIKeys(); - const apiKeyRequest = useGetOneEnrollmentAPIKey(apiKeysRequest.data?.list?.[0].id as string); + const apiKeyRequest = useGetOneEnrollmentAPIKey(apiKeysRequest.data?.list?.[0]?.id as string); if (fullConfigRequest.isLoading && !fullConfigRequest.data) { return ; @@ -49,30 +49,30 @@ export const ConfigYamlView = memo<{ config: AgentConfig }>(({ config }) => { })} - - -

+ {apiKeyRequest.data && ( + + +

+ +

+
+ + -

-
- - - - - - {apiKeyRequest.data && ( + + - )} -
+ + )} ); }); diff --git a/x-pack/plugins/lens/server/plugin.tsx b/x-pack/plugins/lens/server/plugin.tsx index e805f9f7e0a92..3611658fbbcd9 100644 --- a/x-pack/plugins/lens/server/plugin.tsx +++ b/x-pack/plugins/lens/server/plugin.tsx @@ -14,6 +14,7 @@ import { initializeLensTelemetry, scheduleLensTelemetry, } from './usage'; +import { setupSavedObjects } from './saved_objects'; export interface PluginSetupContract { usageCollection?: UsageCollectionSetup; @@ -33,6 +34,7 @@ export class LensServerPlugin implements Plugin<{}, {}, {}, {}> { this.telemetryLogger = initializerContext.logger.get('telemetry'); } setup(core: CoreSetup, plugins: PluginSetupContract) { + setupSavedObjects(core); setupRoutes(core); if (plugins.usageCollection && plugins.taskManager) { registerLensUsageCollector( diff --git a/x-pack/plugins/lens/server/saved_objects.ts b/x-pack/plugins/lens/server/saved_objects.ts new file mode 100644 index 0000000000000..42dc750878f45 --- /dev/null +++ b/x-pack/plugins/lens/server/saved_objects.ts @@ -0,0 +1,65 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { CoreSetup } from 'kibana/server'; +import { getEditPath } from '../common'; + +export function setupSavedObjects(core: CoreSetup) { + core.savedObjects.registerType({ + name: 'lens', + hidden: false, + namespaceAgnostic: false, + management: { + icon: 'lensApp', + defaultSearchField: 'title', + importableAndExportable: true, + getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title, + getInAppUrl: (obj: { id: string }) => ({ + path: getEditPath(obj.id), + uiCapabilitiesPath: 'visualize.show', + }), + }, + mappings: { + properties: { + title: { + type: 'text', + }, + visualizationType: { + type: 'keyword', + }, + state: { + type: 'flattened', + }, + expression: { + index: false, + type: 'keyword', + }, + }, + }, + }); + + core.savedObjects.registerType({ + name: 'lens-ui-telemetry', + hidden: false, + namespaceAgnostic: false, + mappings: { + properties: { + name: { + type: 'keyword', + }, + type: { + type: 'keyword', + }, + date: { + type: 'date', + }, + count: { + type: 'integer', + }, + }, + }, + }); +} diff --git a/x-pack/legacy/plugins/maps/common/data_request_descriptor_types.d.ts b/x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.d.ts similarity index 100% rename from x-pack/legacy/plugins/maps/common/data_request_descriptor_types.d.ts rename to x-pack/plugins/maps/common/descriptor_types/data_request_descriptor_types.d.ts diff --git a/x-pack/legacy/plugins/maps/common/descriptor_types.d.ts b/x-pack/plugins/maps/common/descriptor_types/descriptor_types.d.ts similarity index 99% rename from x-pack/legacy/plugins/maps/common/descriptor_types.d.ts rename to x-pack/plugins/maps/common/descriptor_types/descriptor_types.d.ts index cfbcb65255ab2..fb49e1aaebe1c 100644 --- a/x-pack/legacy/plugins/maps/common/descriptor_types.d.ts +++ b/x-pack/plugins/maps/common/descriptor_types/descriptor_types.d.ts @@ -5,7 +5,7 @@ */ /* eslint-disable @typescript-eslint/consistent-type-definitions */ -import { AGG_TYPE, GRID_RESOLUTION, RENDER_AS, SORT_ORDER, SCALING_TYPES } from './constants'; +import { AGG_TYPE, GRID_RESOLUTION, RENDER_AS, SORT_ORDER, SCALING_TYPES } from '../constants'; import { VectorStyleDescriptor } from './style_property_descriptor_types'; import { DataRequestDescriptor } from './data_request_descriptor_types'; diff --git a/x-pack/plugins/maps/common/descriptor_types/index.ts b/x-pack/plugins/maps/common/descriptor_types/index.ts new file mode 100644 index 0000000000000..af0f4487f471b --- /dev/null +++ b/x-pack/plugins/maps/common/descriptor_types/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; + * you may not use this file except in compliance with the Elastic License. + */ + +export * from './data_request_descriptor_types'; +export * from './descriptor_types'; +export * from './map_descriptor'; +export * from './style_property_descriptor_types'; diff --git a/x-pack/legacy/plugins/maps/common/map_descriptor.ts b/x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts similarity index 100% rename from x-pack/legacy/plugins/maps/common/map_descriptor.ts rename to x-pack/plugins/maps/common/descriptor_types/map_descriptor.ts diff --git a/x-pack/legacy/plugins/maps/common/style_property_descriptor_types.d.ts b/x-pack/plugins/maps/common/descriptor_types/style_property_descriptor_types.d.ts similarity index 99% rename from x-pack/legacy/plugins/maps/common/style_property_descriptor_types.d.ts rename to x-pack/plugins/maps/common/descriptor_types/style_property_descriptor_types.d.ts index 2fce56339e106..47e56ff96d623 100644 --- a/x-pack/legacy/plugins/maps/common/style_property_descriptor_types.d.ts +++ b/x-pack/plugins/maps/common/descriptor_types/style_property_descriptor_types.d.ts @@ -12,7 +12,7 @@ import { VECTOR_STYLES, STYLE_TYPE, LAYER_STYLE_TYPE, -} from './constants'; +} from '../constants'; // Non-static/dynamic options export type SymbolizeAsOptions = { diff --git a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js index 5ceb9536be2ae..81eca5bbff9cb 100644 --- a/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js +++ b/x-pack/plugins/monitoring/server/lib/logstash/get_paginated_pipelines.js @@ -118,6 +118,9 @@ async function getPaginatedThroughputData(pipelines, req, lsIndexPattern, throug for (const pipeline of pipelines) { if (pipelineAggregationData.id === pipeline.id) { const dataSeries = get(pipelineAggregationData, `metrics.${throughputMetric}.data`, [[]]); + if (dataSeries.length === 0) { + continue; + } pipeline[throughputMetric] = dataSeries.pop()[1]; } } diff --git a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.test.ts b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.test.ts index 10b3dbbd9b452..7fd8b4a894989 100644 --- a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.test.ts +++ b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.test.ts @@ -124,6 +124,7 @@ describe('cluster_serialization', () => { skipUnavailable: false, transportPingSchedule: '-1', transportCompress: false, + serverName: 'localhost', }); }); @@ -155,6 +156,38 @@ describe('cluster_serialization', () => { expect(() => serializeCluster('foo')).toThrowError(); }); + it('should serialize a cluster that has a deprecated proxy setting', () => { + expect( + serializeCluster({ + name: 'test_cluster', + proxyAddress: 'localhost:9300', + mode: 'proxy', + isConnected: true, + skipUnavailable: false, + proxySocketConnections: 18, + serverName: 'localhost', + hasDeprecatedProxySetting: true, + }) + ).toEqual({ + persistent: { + cluster: { + remote: { + test_cluster: { + mode: 'proxy', + proxy_socket_connections: 18, + proxy_address: 'localhost:9300', + skip_unavailable: false, + server_name: 'localhost', + proxy: null, + seeds: null, + node_connections: null, + }, + }, + }, + }, + }); + }); + it('should serialize a complete cluster object to only dynamic properties', () => { expect( serializeCluster({ @@ -167,13 +200,14 @@ describe('cluster_serialization', () => { skipUnavailable: false, transportPingSchedule: '-1', transportCompress: false, + mode: 'sniff', }) ).toEqual({ persistent: { cluster: { remote: { test_cluster: { - mode: null, + mode: 'sniff', node_connections: null, proxy_address: null, proxy_socket_connections: null, diff --git a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts index d0898fda93a41..3d8ffa13b8218 100644 --- a/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts +++ b/x-pack/plugins/remote_clusters/common/lib/cluster_serialization.ts @@ -6,7 +6,8 @@ import { PROXY_MODE } from '../constants'; -export interface ClusterEs { +// Values returned from ES GET /_remote/info +export interface ClusterInfoEs { seeds?: string[]; mode?: 'proxy' | 'sniff'; connected?: boolean; @@ -42,19 +43,23 @@ export interface Cluster { connectedSocketsCount?: number; hasDeprecatedProxySetting?: boolean; } -export interface ClusterPayload { + +interface ClusterPayloadEs { + skip_unavailable?: boolean | null; + mode?: 'sniff' | 'proxy' | null; + proxy_address?: string | null; + proxy_socket_connections?: number | null; + server_name?: string | null; + seeds?: string[] | null; + node_connections?: number | null; + proxy?: null; +} +// Payload expected from ES PUT /_cluster/settings +export interface ClusterSettingsPayloadEs { persistent: { cluster: { remote: { - [key: string]: { - skip_unavailable?: boolean | null; - mode?: 'sniff' | 'proxy' | null; - proxy_address?: string | null; - proxy_socket_connections?: number | null; - server_name?: string | null; - seeds?: string[] | null; - node_connections?: number | null; - }; + [key: string]: ClusterPayloadEs; }; }; }; @@ -62,7 +67,7 @@ export interface ClusterPayload { export function deserializeCluster( name: string, - esClusterObject: ClusterEs, + esClusterObject: ClusterInfoEs, deprecatedProxyAddress?: string | undefined ): Cluster { if (!name || !esClusterObject || typeof esClusterObject !== 'object') { @@ -112,12 +117,16 @@ export function deserializeCluster( // If a user has a remote cluster with the deprecated proxy setting, // we transform the data to support the new implementation and also flag the deprecation if (deprecatedProxyAddress) { + // Create server name (address, without port), since field doesn't exist in deprecated implementation + const defaultServerName = deprecatedProxyAddress.split(':')[0]; + deserializedClusterObject = { ...deserializedClusterObject, proxyAddress: deprecatedProxyAddress, seeds: undefined, hasDeprecatedProxySetting: true, mode: PROXY_MODE, + serverName: defaultServerName, }; } @@ -131,7 +140,7 @@ export function deserializeCluster( return deserializedClusterObject; } -export function serializeCluster(deserializedClusterObject: Cluster): ClusterPayload { +export function serializeCluster(deserializedClusterObject: Cluster): ClusterSettingsPayloadEs { if (!deserializedClusterObject || typeof deserializedClusterObject !== 'object') { throw new Error('Unable to serialize cluster'); } @@ -145,22 +154,31 @@ export function serializeCluster(deserializedClusterObject: Cluster): ClusterPay proxyAddress, proxySocketConnections, serverName, + hasDeprecatedProxySetting, } = deserializedClusterObject; + const clusterData: ClusterPayloadEs = { + skip_unavailable: typeof skipUnavailable === 'boolean' ? skipUnavailable : null, + mode: mode || null, + proxy_address: proxyAddress || null, + proxy_socket_connections: proxySocketConnections || null, + server_name: serverName || null, + seeds: seeds || null, + node_connections: nodeConnections || null, + }; + + // This is only applicable in edit mode + // In order to "upgrade" an existing remote cluster to use the new proxy mode settings, we need to set the old proxy setting to null + if (hasDeprecatedProxySetting) { + clusterData.proxy = null; + } + return { // Background on why we only save as persistent settings detailed here: https://github.com/elastic/kibana/pull/26067#issuecomment-441848124 persistent: { cluster: { remote: { - [name]: { - skip_unavailable: typeof skipUnavailable === 'boolean' ? skipUnavailable : null, - mode: mode || null, - proxy_address: proxyAddress || null, - proxy_socket_connections: proxySocketConnections || null, - server_name: serverName || null, - seeds: seeds || null, - node_connections: nodeConnections || null, - }, + [name]: clusterData, }, }, }, diff --git a/x-pack/plugins/remote_clusters/common/lib/index.ts b/x-pack/plugins/remote_clusters/common/lib/index.ts index 52a0536bfd55b..43cf004becff9 100644 --- a/x-pack/plugins/remote_clusters/common/lib/index.ts +++ b/x-pack/plugins/remote_clusters/common/lib/index.ts @@ -4,4 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -export { deserializeCluster, serializeCluster, Cluster, ClusterEs } from './cluster_serialization'; +export { + deserializeCluster, + serializeCluster, + Cluster, + ClusterInfoEs, +} from './cluster_serialization'; diff --git a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.js b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.js index 94d6ca4ebb648..7d3ed0708ae54 100644 --- a/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.js +++ b/x-pack/plugins/remote_clusters/public/application/sections/components/remote_cluster_form/remote_cluster_form.js @@ -135,6 +135,7 @@ export class RemoteClusterForm extends Component { skipUnavailable, }, } = this.state; + const { fields } = this.props; let modeSettings; @@ -155,6 +156,7 @@ export class RemoteClusterForm extends Component { name, skipUnavailable, mode, + hasDeprecatedProxySetting: fields.hasDeprecatedProxySetting, ...modeSettings, }; } diff --git a/x-pack/plugins/remote_clusters/server/routes/api/delete_route.test.ts b/x-pack/plugins/remote_clusters/server/routes/api/delete_route.test.ts index cf14f8a67054e..ec14336da08d4 100644 --- a/x-pack/plugins/remote_clusters/server/routes/api/delete_route.test.ts +++ b/x-pack/plugins/remote_clusters/server/routes/api/delete_route.test.ts @@ -84,6 +84,20 @@ describe('DELETE remote clusters', () => { describe('success', () => { deleteRemoteClustersTest('deletes remote cluster', { apiResponses: [ + async () => ({ + persistent: { + cluster: { + remote: { + test: { + seeds: ['127.0.0.1:9300'], + skip_unavailable: false, + mode: 'sniff', + }, + }, + }, + }, + transient: {}, + }), async () => ({ test: { connected: true, @@ -143,7 +157,17 @@ describe('DELETE remote clusters', () => { deleteRemoteClustersTest( 'returns errors array with 404 error if remote cluster does not exist', { - apiResponses: [async () => ({})], + apiResponses: [ + async () => ({ + persistent: { + cluster: { + remote: {}, + }, + }, + transient: {}, + }), + async () => ({}), + ], params: { nameOrNames: 'test', }, @@ -178,6 +202,20 @@ describe('DELETE remote clusters', () => { 'returns errors array with 400 error if ES still returns cluster information', { apiResponses: [ + async () => ({ + persistent: { + cluster: { + remote: { + test: { + seeds: ['127.0.0.1:9300'], + skip_unavailable: false, + mode: 'sniff', + }, + }, + }, + }, + transient: {}, + }), async () => ({ test: { connected: true, diff --git a/x-pack/plugins/remote_clusters/server/routes/api/delete_route.ts b/x-pack/plugins/remote_clusters/server/routes/api/delete_route.ts index 742780ffed309..07b0fa3fd9cd7 100644 --- a/x-pack/plugins/remote_clusters/server/routes/api/delete_route.ts +++ b/x-pack/plugins/remote_clusters/server/routes/api/delete_route.ts @@ -37,6 +37,8 @@ export const register = (deps: RouteDependencies): void => { const itemsDeleted: any[] = []; const errors: any[] = []; + const clusterSettings = await callAsCurrentUser('cluster.getSettings'); + // Validator that returns an error if the remote cluster does not exist. const validateClusterDoesExist = async (name: string) => { try { @@ -60,9 +62,12 @@ export const register = (deps: RouteDependencies): void => { }; // Send the request to delete the cluster and return an error if it could not be deleted. - const sendRequestToDeleteCluster = async (name: string) => { + const sendRequestToDeleteCluster = async ( + name: string, + hasDeprecatedProxySetting: boolean + ) => { try { - const body = serializeCluster({ name }); + const body = serializeCluster({ name, hasDeprecatedProxySetting }); const updateClusterResponse = await callAsCurrentUser('cluster.putSettings', { body }); const acknowledged = get(updateClusterResponse, 'acknowledged'); const cluster = get(updateClusterResponse, `persistent.cluster.remote.${name}`); @@ -98,8 +103,12 @@ export const register = (deps: RouteDependencies): void => { let error: any = await validateClusterDoesExist(clusterName); if (!error) { + // Check if cluster contains deprecated proxy setting + const hasDeprecatedProxySetting = Boolean( + get(clusterSettings, `persistent.cluster.remote[${clusterName}].proxy`, undefined) + ); // Delete the cluster. - error = await sendRequestToDeleteCluster(clusterName); + error = await sendRequestToDeleteCluster(clusterName, hasDeprecatedProxySetting); } if (error) { diff --git a/x-pack/plugins/remote_clusters/server/routes/api/update_route.ts b/x-pack/plugins/remote_clusters/server/routes/api/update_route.ts index 14b161b6f26b5..47b0d4ad2def2 100644 --- a/x-pack/plugins/remote_clusters/server/routes/api/update_route.ts +++ b/x-pack/plugins/remote_clusters/server/routes/api/update_route.ts @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { RequestHandler } from 'src/core/server'; import { API_BASE_PATH, SNIFF_MODE, PROXY_MODE } from '../../../common/constants'; -import { serializeCluster, deserializeCluster, Cluster, ClusterEs } from '../../../common/lib'; +import { serializeCluster, deserializeCluster, Cluster, ClusterInfoEs } from '../../../common/lib'; import { doesClusterExist } from '../../lib/does_cluster_exist'; import { RouteDependencies } from '../../types'; import { licensePreRoutingFactory } from '../../lib/license_pre_routing_factory'; @@ -68,7 +68,10 @@ export const register = (deps: RouteDependencies): void => { }); const acknowledged = get(updateClusterResponse, 'acknowledged'); - const cluster = get(updateClusterResponse, `persistent.cluster.remote.${name}`) as ClusterEs; + const cluster = get( + updateClusterResponse, + `persistent.cluster.remote.${name}` + ) as ClusterInfoEs; if (acknowledged && cluster) { const body = { diff --git a/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js b/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js index b93f03151f6cb..fd427039d29c0 100644 --- a/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js +++ b/x-pack/test/api_integration/apis/monitoring/logstash/pipelines.js @@ -58,5 +58,27 @@ export default function({ getService }) { const ids = [...(await getIds(0)), ...(await getIds(1)), ...(await getIds(2))]; expect(ids.length).to.be(26); }); + + it('should not error out if there is missing data for part of the time series', async () => { + const customTimeRange = { + ...timeRange, + max: '2019-11-04T15:59:38.667Z', + }; + + const customSort = { + ...sort, + field: 'logstash_cluster_pipeline_throughput', + }; + + await supertest + .post('/api/monitoring/v1/clusters/TUjQLdHNTh2SB9Wy0gOtWg/logstash/pipelines') + .set('kbn-xsrf', 'xxx') + .send({ + timeRange: customTimeRange, + pagination: { ...pagination, index: 1 }, + sort: customSort, + }) + .expect(200); + }); }); } diff --git a/x-pack/test/api_integration/apis/telemetry/opt_in.ts b/x-pack/test/api_integration/apis/telemetry/opt_in.ts index d2ad2d773d692..1b443c87c267a 100644 --- a/x-pack/test/api_integration/apis/telemetry/opt_in.ts +++ b/x-pack/test/api_integration/apis/telemetry/opt_in.ts @@ -6,6 +6,7 @@ import expect from '@kbn/expect'; +import { TelemetrySavedObjectAttributes } from 'src/plugins/telemetry/server/telemetry_repository'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function optInTest({ getService }: FtrProviderContext) { @@ -13,30 +14,66 @@ export default function optInTest({ getService }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); describe('/api/telemetry/v2/optIn API', () => { + let defaultAttributes: TelemetrySavedObjectAttributes; let kibanaVersion: any; before(async () => { const kibanaVersionAccessor = kibanaServer.version; kibanaVersion = await kibanaVersionAccessor.get(); + defaultAttributes = + (await getSavedObjectAttributes(supertest).catch(err => { + if (err.message === 'expected 200 "OK", got 404 "Not Found"') { + return null; + } + throw err; + })) || {}; expect(typeof kibanaVersion).to.eql('string'); expect(kibanaVersion.length).to.be.greaterThan(0); }); - it('should support sending false', async () => { + afterEach(async () => { + await updateSavedObjectAttributes(supertest, defaultAttributes); + }); + + it('should support sending false with allowChangingOptInStatus true', async () => { + await updateSavedObjectAttributes(supertest, { + ...defaultAttributes, + allowChangingOptInStatus: true, + }); await postTelemetryV2Optin(supertest, false, 200); const { enabled, lastVersionChecked } = await getSavedObjectAttributes(supertest); expect(enabled).to.be(false); expect(lastVersionChecked).to.be(kibanaVersion); }); - it('should support sending true', async () => { + it('should support sending true with allowChangingOptInStatus true', async () => { + await updateSavedObjectAttributes(supertest, { + ...defaultAttributes, + allowChangingOptInStatus: true, + }); await postTelemetryV2Optin(supertest, true, 200); const { enabled, lastVersionChecked } = await getSavedObjectAttributes(supertest); expect(enabled).to.be(true); expect(lastVersionChecked).to.be(kibanaVersion); }); + it('should not support sending false with allowChangingOptInStatus false', async () => { + await updateSavedObjectAttributes(supertest, { + ...defaultAttributes, + allowChangingOptInStatus: false, + }); + await postTelemetryV2Optin(supertest, false, 400); + }); + + it('should not support sending true with allowChangingOptInStatus false', async () => { + await updateSavedObjectAttributes(supertest, { + ...defaultAttributes, + allowChangingOptInStatus: false, + }); + await postTelemetryV2Optin(supertest, true, 400); + }); + it('should not support sending null', async () => { await postTelemetryV2Optin(supertest, null, 400); }); @@ -57,7 +94,19 @@ async function postTelemetryV2Optin(supertest: any, value: any, statusCode: numb return body; } -async function getSavedObjectAttributes(supertest: any): Promise { +async function updateSavedObjectAttributes( + supertest: any, + attributes: TelemetrySavedObjectAttributes +): Promise { + return await supertest + .post('/api/saved_objects/telemetry/telemetry') + .query({ overwrite: true }) + .set('kbn-xsrf', 'xxx') + .send({ attributes }) + .expect(200); +} + +async function getSavedObjectAttributes(supertest: any): Promise { const { body } = await supertest.get('/api/saved_objects/telemetry/telemetry').expect(200); return body.attributes; } diff --git a/x-pack/test/api_integration/apis/telemetry/telemetry_local.js b/x-pack/test/api_integration/apis/telemetry/telemetry_local.js index db705b301a71e..70017ce424a1f 100644 --- a/x-pack/test/api_integration/apis/telemetry/telemetry_local.js +++ b/x-pack/test/api_integration/apis/telemetry/telemetry_local.js @@ -63,7 +63,7 @@ export default function({ getService }) { const stats = body[0]; expect(stats.collection).to.be('local'); - expect(stats.license.issuer).to.be('elasticsearch'); + expect(stats.license.issuer).to.be.a('string'); expect(stats.license.status).to.be('active'); expect(stats.stack_stats.kibana.count).to.be(1); diff --git a/x-pack/test/api_integration/apis/telemetry/telemetry_optin_notice_seen.ts b/x-pack/test/api_integration/apis/telemetry/telemetry_optin_notice_seen.ts index c25ea403ce364..2b6f3b9309c17 100644 --- a/x-pack/test/api_integration/apis/telemetry/telemetry_optin_notice_seen.ts +++ b/x-pack/test/api_integration/apis/telemetry/telemetry_optin_notice_seen.ts @@ -13,12 +13,18 @@ export default function optInTest({ getService }: FtrProviderContext) { const client: Client = getService('legacyEs'); const supertest = getService('supertest'); - describe('/api/telemetry/v2/optIn API Telemetry User has seen OptIn Notice', () => { + describe('/api/telemetry/v2/userHasSeenNotice API Telemetry User has seen OptIn Notice', () => { it('should update telemetry setting field via PUT', async () => { - await client.delete({ - index: '.kibana', - id: 'telemetry:telemetry', - } as DeleteDocumentParams); + try { + await client.delete({ + index: '.kibana', + id: 'telemetry:telemetry', + } as DeleteDocumentParams); + } catch (err) { + if (err.statusCode !== 404) { + throw err; + } + } await supertest .put('/api/telemetry/v2/userHasSeenNotice')