diff --git a/.buildkite/scripts/steps/storybooks/build_and_upload.js b/.buildkite/scripts/steps/storybooks/build_and_upload.js index 482640b8d9cc0..becb8f1bd871f 100644 --- a/.buildkite/scripts/steps/storybooks/build_and_upload.js +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.js @@ -20,7 +20,7 @@ const STORYBOOKS = [ 'custom_integrations', 'dashboard_enhanced', 'dashboard', - 'data_enhanced', + 'data', 'embeddable', 'expression_error', 'expression_image', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 215514d58f601..7f7c048717f02 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -79,7 +79,6 @@ /src/plugins/inspector/ @elastic/kibana-app-services /src/plugins/unified_search/ @elastic/kibana-app-services /x-pack/examples/ui_actions_enhanced_examples/ @elastic/kibana-app-services -/x-pack/plugins/data_enhanced/ @elastic/kibana-app-services /x-pack/plugins/embeddable_enhanced/ @elastic/kibana-app-services /x-pack/plugins/ui_actions_enhanced/ @elastic/kibana-app-services /x-pack/plugins/runtime_fields @elastic/kibana-app-services diff --git a/dev_docs/tutorials/data/search.mdx b/dev_docs/tutorials/data/search.mdx index 0787c44b632ec..ab5c3f29ea1be 100644 --- a/dev_docs/tutorials/data/search.mdx +++ b/dev_docs/tutorials/data/search.mdx @@ -259,7 +259,7 @@ export const myEnhancedSearchStrategyProvider = ( await ese.cancel(id, options, deps); }, extend: async (id, keepAlive, options, deps) => { - // async search results are not stored indefinitely. By default, they expire after 7 days (or as defined by xpack.data_enhanced.search.sessions.defaultExpiration setting in kibana.yml). + // async search results are not stored indefinitely. By default, they expire after 7 days (or as defined by data.search.sessions.defaultExpiration setting in kibana.yml). // call the extend method of the async strategy you are using or implement your own extend function. await ese.extend(id, options, deps); }, diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 90bf3d3c29b41..63e104c44b173 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -412,10 +412,6 @@ The plugin exposes the static DefaultEditorController class to consume. |Adds drilldown capabilities to dashboard. Owned by the Kibana App team. -|{kib-repo}blob/{branch}/x-pack/plugins/data_enhanced/README.md[dataEnhanced] -|The data_enhanced plugin is the x-pack counterpart to the src/plguins/data plugin. - - |{kib-repo}blob/{branch}/x-pack/plugins/data_visualizer/README.md[dataVisualizer] |The data_visualizer plugin enables you to explore the fields in your data. diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index dc16c080306ad..4c83bc19f1cda 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -104,8 +104,7 @@ pageLoadAssetSize: fieldFormats: 65209 kibanaReact: 74422 share: 71239 - uiActions: 35121 - dataEnhanced: 24980 + uiActions: 35121 embeddable: 87309 embeddableEnhanced: 22107 uiActionsEnhanced: 38494 diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker index 7b569f8d02068..77e8e5d63bbdf 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker @@ -40,6 +40,13 @@ kibana_vars=( csp.report_to data.autocomplete.valueSuggestions.terminateAfter data.autocomplete.valueSuggestions.timeout + data.search.sessions.defaultExpiration + data.search.sessions.enabled + data.search.sessions.maxUpdateRetries + data.search.sessions.notTouchedInProgressTimeout + data.search.sessions.notTouchedTimeout + data.search.sessions.pageSize + data.search.sessions.trackingInterval unifiedSearch.autocomplete.valueSuggestions.terminateAfter unifiedSearch.autocomplete.valueSuggestions.timeout unifiedSearch.autocomplete.querySuggestions.enabled diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 8075abcdcf79b..4167719d3bb31 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -17,7 +17,7 @@ export const storybookAliases = { custom_integrations: 'src/plugins/custom_integrations/storybook', dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/.storybook', dashboard: 'src/plugins/dashboard/.storybook', - data_enhanced: 'x-pack/plugins/data_enhanced/.storybook', + data: 'src/plugins/data/.storybook', discover: 'src/plugins/discover/.storybook', embeddable: 'src/plugins/embeddable/.storybook', expression_error: 'src/plugins/expression_error/.storybook', diff --git a/x-pack/plugins/data_enhanced/.storybook/main.js b/src/plugins/data/.storybook/main.js similarity index 54% rename from x-pack/plugins/data_enhanced/.storybook/main.js rename to src/plugins/data/.storybook/main.js index 86b48c32f103e..8dc3c5d1518f4 100644 --- a/x-pack/plugins/data_enhanced/.storybook/main.js +++ b/src/plugins/data/.storybook/main.js @@ -1,8 +1,9 @@ /* * 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. + * 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. */ module.exports = require('@kbn/storybook').defaultConfig; diff --git a/src/plugins/data/config.ts b/src/plugins/data/config.ts index c419683de9868..0ec794d9bd63c 100644 --- a/src/plugins/data/config.ts +++ b/src/plugins/data/config.ts @@ -8,21 +8,6 @@ import { schema, TypeOf } from '@kbn/config-schema'; -export const configSchema = schema.object({ - search: schema.object({ - aggs: schema.object({ - shardDelay: schema.object({ - // Whether or not to register the shard_delay (which is only available in snapshot versions - // of Elasticsearch) agg type/expression function to make it available in the UI for either - // functional or manual testing - enabled: schema.boolean({ defaultValue: false }), - }), - }), - }), -}); - -export type ConfigSchema = TypeOf; - export const searchSessionsConfigSchema = schema.object({ /** * Turns the feature on \ off (incl. removing indicator and management screens) @@ -90,4 +75,20 @@ export const searchSessionsConfigSchema = schema.object({ }), }); +export const configSchema = schema.object({ + search: schema.object({ + aggs: schema.object({ + shardDelay: schema.object({ + // Whether or not to register the shard_delay (which is only available in snapshot versions + // of Elasticsearch) agg type/expression function to make it available in the UI for either + // functional or manual testing + enabled: schema.boolean({ defaultValue: false }), + }), + }), + sessions: searchSessionsConfigSchema, + }), +}); + +export type ConfigSchema = TypeOf; + export type SearchSessionsConfigSchema = TypeOf; diff --git a/src/plugins/data/kibana.json b/src/plugins/data/kibana.json index fa7453d4c5bda..9c428930bc9ab 100644 --- a/src/plugins/data/kibana.json +++ b/src/plugins/data/kibana.json @@ -3,7 +3,17 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": ["bfetch", "expressions", "uiActions", "share", "inspector", "fieldFormats", "dataViews"], + "requiredPlugins": [ + "bfetch", + "expressions", + "uiActions", + "share", + "inspector", + "fieldFormats", + "dataViews", + "screenshotMode", + "management" + ], "serviceFolders": ["search", "query", "ui"], "optionalPlugins": ["usageCollection", "taskManager", "security"], "extraPublicDirs": ["common"], diff --git a/src/plugins/data/public/plugin.ts b/src/plugins/data/public/plugin.ts index 175d05870b0c6..0790df6a95df2 100644 --- a/src/plugins/data/public/plugin.ts +++ b/src/plugins/data/public/plugin.ts @@ -73,6 +73,7 @@ export class DataPublicPlugin usageCollection, inspector, fieldFormats, + management, }: DataSetupDependencies ): DataPublicPluginSetup { const startServices = createStartServicesGetter(core.getStartServices); @@ -84,6 +85,7 @@ export class DataPublicPlugin usageCollection, expressions, nowProvider: this.nowProvider, + management, }); const queryService = this.queryService.setup({ @@ -117,7 +119,7 @@ export class DataPublicPlugin public start( core: CoreStart, - { uiActions, fieldFormats, dataViews }: DataStartDependencies + { uiActions, fieldFormats, dataViews, screenshotMode }: DataStartDependencies ): DataPublicPluginStart { const { uiSettings, notifications, overlays } = core; setNotifications(notifications); @@ -131,7 +133,11 @@ export class DataPublicPlugin uiSettings, }); - const search = this.searchService.start(core, { fieldFormats, indexPatterns: dataViews }); + const search = this.searchService.start(core, { + fieldFormats, + indexPatterns: dataViews, + screenshotMode, + }); setSearchService(search); uiActions.addTriggerAction( diff --git a/src/plugins/data/public/search/search_service.test.ts b/src/plugins/data/public/search/search_service.test.ts index 8c1fba48c7b4b..d717d275f55cd 100644 --- a/src/plugins/data/public/search/search_service.test.ts +++ b/src/plugins/data/public/search/search_service.test.ts @@ -12,6 +12,8 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import { SearchService, SearchServiceSetupDependencies } from './search_service'; import { bfetchPluginMock } from '@kbn/bfetch-plugin/public/mocks'; +import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; +import { screenshotModePluginMock } from '@kbn/screenshot-mode-plugin/public/mocks'; describe('Search service', () => { let searchService: SearchService; @@ -19,7 +21,7 @@ describe('Search service', () => { let mockCoreStart: MockedKeys; const initializerContext = coreMock.createPluginInitializerContext(); initializerContext.config.get = jest.fn().mockReturnValue({ - search: { aggs: { shardDelay: { enabled: false } } }, + search: { aggs: { shardDelay: { enabled: false } }, sessions: { enabled: true } }, }); beforeEach(() => { @@ -35,6 +37,7 @@ describe('Search service', () => { packageInfo: { version: '8' }, bfetch, expressions: { registerFunction: jest.fn(), registerType: jest.fn() }, + management: managementPluginMock.createSetupContract(), } as unknown as SearchServiceSetupDependencies); expect(setup).toHaveProperty('aggs'); expect(setup).toHaveProperty('usageCollector'); @@ -45,9 +48,18 @@ describe('Search service', () => { describe('start()', () => { it('exposes proper contract', async () => { + const bfetch = bfetchPluginMock.createSetupContract(); + searchService.setup(mockCoreSetup, { + packageInfo: { version: '8' }, + bfetch, + expressions: { registerFunction: jest.fn(), registerType: jest.fn() }, + management: managementPluginMock.createSetupContract(), + } as unknown as SearchServiceSetupDependencies); + const start = searchService.start(mockCoreStart, { fieldFormats: {}, indexPatterns: {}, + screenshotMode: screenshotModePluginMock.createStartContract(), } as any); expect(start).toHaveProperty('aggs'); expect(start).toHaveProperty('search'); diff --git a/src/plugins/data/public/search/search_service.ts b/src/plugins/data/public/search/search_service.ts index 52271426d28e1..767fcaf815927 100644 --- a/src/plugins/data/public/search/search_service.ts +++ b/src/plugins/data/public/search/search_service.ts @@ -7,62 +7,71 @@ */ import { - Plugin, CoreSetup, CoreStart, + Plugin, PluginInitializerContext, StartServicesAccessor, } from '@kbn/core/public'; import { BehaviorSubject } from 'rxjs'; +import React from 'react'; +import moment from 'moment'; import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { ExpressionsSetup } from '@kbn/expressions-plugin/public'; +import { toMountPoint } from '@kbn/kibana-react-plugin/public'; +import { Storage } from '@kbn/kibana-utils-plugin/public'; +import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; +import { ManagementSetup } from '@kbn/management-plugin/public'; import type { ISearchSetup, ISearchStart } from './types'; import { handleResponse } from './fetch'; import { - kibana, - kibanaContext, - ISearchGeneric, - SearchSourceDependencies, - SearchSourceService, - extendedBoundsFunction, - ipRangeFunction, - kibanaTimerangeFunction, - luceneFunction, - kqlFunction, - fieldFunction, - numericalRangeFunction, - rangeFunction, cidrFunction, dateRangeFunction, + esRawResponse, existsFilterFunction, + extendedBoundsFunction, + fieldFunction, geoBoundingBoxFunction, geoPointFunction, + ipRangeFunction, + ISearchGeneric, + kibana, + kibanaContext, + kibanaFilterFunction, + kibanaTimerangeFunction, + kqlFunction, + luceneFunction, + numericalRangeFunction, + phraseFilterFunction, queryFilterFunction, rangeFilterFunction, + rangeFunction, removeFilterFunction, + SearchSourceDependencies, + SearchSourceService, selectFilterFunction, - kibanaFilterFunction, - phraseFilterFunction, - esRawResponse, eqlRawResponse, } from '../../common/search'; import { AggsService, AggsStartDependencies } from './aggs'; import { IKibanaSearchResponse, IndexPatternsContract, SearchRequest } from '..'; import { ISearchInterceptor, SearchInterceptor } from './search_interceptor'; -import { SearchUsageCollector, createUsageCollector } from './collectors'; +import { createUsageCollector, SearchUsageCollector } from './collectors'; import { getEsaggs, getEsdsl, getEql } from './expressions'; import { ISessionsClient, ISessionService, SessionsClient, SessionService } from './session'; import { ConfigSchema } from '../../config'; import { - SHARD_DELAY_AGG_NAME, getShardDelayBucketAgg, + SHARD_DELAY_AGG_NAME, } from '../../common/search/aggs/buckets/shard_delay'; import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn'; import { DataPublicPluginStart, DataStartDependencies } from '../types'; import { NowProviderInternalContract } from '../now_provider'; import { getKibanaContext } from './expressions/kibana_context'; +import { createConnectedSearchSessionIndicator } from './session/session_indicator'; + +import { registerSearchSessionsMgmt } from './session/sessions_mgmt'; /** @internal */ export interface SearchServiceSetupDependencies { @@ -70,12 +79,14 @@ export interface SearchServiceSetupDependencies { expressions: ExpressionsSetup; usageCollection?: UsageCollectionSetup; nowProvider: NowProviderInternalContract; + management: ManagementSetup; } /** @internal */ export interface SearchServiceStartDependencies { fieldFormats: AggsStartDependencies['fieldFormats']; indexPatterns: IndexPatternsContract; + screenshotMode: ScreenshotModePluginStart; } export class SearchService implements Plugin { @@ -89,9 +100,16 @@ export class SearchService implements Plugin { constructor(private initializerContext: PluginInitializerContext) {} public setup( - { http, getStartServices, notifications, uiSettings, executionContext, theme }: CoreSetup, - { bfetch, expressions, usageCollection, nowProvider }: SearchServiceSetupDependencies + core: CoreSetup, + { + bfetch, + expressions, + usageCollection, + nowProvider, + management, + }: SearchServiceSetupDependencies ): ISearchSetup { + const { http, getStartServices, notifications, uiSettings, executionContext, theme } = core; this.usageCollector = createUsageCollector(getStartServices, usageCollection); this.sessionsClient = new SessionsClient({ http }); @@ -173,6 +191,21 @@ export class SearchService implements Plugin { expressions.registerFunction(aggShardDelay); } + const config = this.initializerContext.config.get(); + if (config.search.sessions.enabled) { + const sessionsConfig = config.search.sessions; + registerSearchSessionsMgmt( + core as CoreSetup, + { + searchUsageCollector: this.usageCollector!, + sessionsClient: this.sessionsClient, + management, + }, + sessionsConfig, + this.initializerContext.env.packageInfo.version + ); + } + return { aggs, usageCollector: this.usageCollector!, @@ -182,8 +215,8 @@ export class SearchService implements Plugin { } public start( - { http, theme, uiSettings }: CoreStart, - { fieldFormats, indexPatterns }: SearchServiceStartDependencies + { http, theme, uiSettings, chrome, application }: CoreStart, + { fieldFormats, indexPatterns, screenshotMode }: SearchServiceStartDependencies ): ISearchStart { const search = ((request, options = {}) => { return this.searchInterceptor.search(request, options); @@ -199,6 +232,28 @@ export class SearchService implements Plugin { handleResponse(request, response, theme), }; + const config = this.initializerContext.config.get(); + if (config.search.sessions.enabled) { + chrome.setBreadcrumbsAppendExtension({ + content: toMountPoint( + React.createElement( + createConnectedSearchSessionIndicator({ + sessionService: this.sessionService, + application, + basePath: http.basePath, + storage: new Storage(window.localStorage), + disableSaveAfterSessionCompletesTimeout: moment + .duration(config.search.sessions.notTouchedTimeout) + .asMilliseconds(), + usageCollector: this.usageCollector, + tourDisabled: screenshotMode.isScreenshotMode(), + }) + ), + { theme$: theme.theme$ } + ), + }); + } + return { aggs: this.aggsService.start({ fieldFormats, uiSettings, indexPatterns }), search, diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx similarity index 97% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx index 7c93d5cd78e68..d791cf51ddbe6 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.test.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.test.tsx @@ -1,15 +1,16 @@ /* * 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. + * 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 React, { ReactNode } from 'react'; import { StubBrowserStorage } from '@kbn/test-jest-helpers'; import { render, waitFor, screen, act } from '@testing-library/react'; import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { dataPluginMock } from '../../../../mocks'; import { createConnectedSearchSessionIndicator } from './connected_search_session_indicator'; import { BehaviorSubject } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -19,12 +20,12 @@ import { SearchSessionState, SearchUsageCollector, TimefilterContract, -} from '@kbn/data-plugin/public'; +} from '../../../..'; import { coreMock } from '@kbn/core/public/mocks'; import { TOUR_RESTORE_STEP_KEY, TOUR_TAKING_TOO_LONG_STEP_KEY } from './search_session_tour'; import userEvent from '@testing-library/user-event'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; -import { createSearchUsageCollectorMock } from '@kbn/data-plugin/public/search/collectors/mocks'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; const coreStart = coreMock.createStart(); const application = coreStart.application; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx similarity index 92% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx index 23abbf3084073..727a188fc2c00 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/connected_search_session_indicator.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/connected_search_session_indicator.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React, { useCallback, useEffect, useState } from 'react'; @@ -10,12 +11,14 @@ import { debounce, distinctUntilChanged, mapTo, switchMap, tap } from 'rxjs/oper import { merge, of, timer } from 'rxjs'; import useObservable from 'react-use/lib/useObservable'; import { i18n } from '@kbn/i18n'; -import { ISessionService, SearchSessionState, SearchUsageCollector } from '@kbn/data-plugin/public'; import { RedirectAppLinks } from '@kbn/kibana-react-plugin/public'; -import { ApplicationStart, IBasePath } from '@kbn/core/public'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; +import { ApplicationStart, IBasePath } from '@kbn/core/public'; import { SearchSessionIndicator, SearchSessionIndicatorRef } from '../search_session_indicator'; import { useSearchSessionTour } from './search_session_tour'; +import { SearchUsageCollector } from '../../../collectors'; +import { ISessionService } from '../../session_service'; +import { SearchSessionState } from '../../search_session_state'; export interface SearchSessionIndicatorDeps { sessionService: ISessionService; @@ -82,7 +85,7 @@ export const createConnectedSearchSessionIndicator = ({ if (disableSaveAfterSessionCompleteTimedOut) { saveDisabled = true; saveDisabledReasonText = i18n.translate( - 'xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage', + 'data.searchSessionIndicator.disabledDueToTimeoutMessage', { defaultMessage: 'Search session results expired.', } @@ -99,7 +102,7 @@ export const createConnectedSearchSessionIndicator = ({ if (!sessionService.hasAccess()) { managementDisabled = saveDisabled = true; managementDisabledReasonText = saveDisabledReasonText = i18n.translate( - 'xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage', + 'data.searchSessionIndicator.disabledDueToDisabledGloballyMessage', { defaultMessage: "You don't have permissions to manage search sessions", } diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts similarity index 64% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts index fec61f8115486..def7915b836c8 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 type { SearchSessionIndicatorDeps } from './connected_search_session_indicator'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx similarity index 92% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx index 2d9c29681a41c..2975ffb774b5c 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_tour.tsx +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_tour.tsx @@ -1,15 +1,17 @@ /* * 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. + * 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 { useCallback, useEffect } from 'react'; import { once } from 'lodash'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { SearchSessionState, SearchUsageCollector } from '@kbn/data-plugin/public'; import { SearchSessionIndicatorRef } from '../search_session_indicator'; +import { SearchSessionState } from '../../search_session_state'; +import { SearchUsageCollector } from '../../../collectors'; const TOUR_TAKING_TOO_LONG_TIMEOUT = 10000; export const TOUR_TAKING_TOO_LONG_STEP_KEY = `data.searchSession.tour.takingTooLong`; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts similarity index 80% rename from x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts rename to src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts index 84884115093d6..2fec31333650b 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/connected_search_session_indicator/search_session_view_state.ts +++ b/src/plugins/data/public/search/session/session_indicator/connected_search_session_indicator/search_session_view_state.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 enum SearchSessionViewState { diff --git a/x-pack/plugins/data_enhanced/public/search/ui/index.ts b/src/plugins/data/public/search/session/session_indicator/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/public/search/ui/index.ts rename to src/plugins/data/public/search/session/session_indicator/index.ts index e8f83db6ed98c..c126347a07691 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 * from './connected_search_session_indicator'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts similarity index 52% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts index 9093e1a2535e2..d0e7457b882b0 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 * from './search_session_name'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts similarity index 52% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts index 9093e1a2535e2..d0e7457b882b0 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/index.ts +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 * from './search_session_name'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx index 4cb72dcbf4554..2473b844097bf 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/components/search_session_name/search_session_name.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/components/search_session_name/search_session_name.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React, { useEffect } from 'react'; @@ -45,7 +46,7 @@ export const SearchSessionName: React.FC = ({ name, edit autoFocus={true} iconType={'pencil'} color={'text'} - aria-label={i18n.translate('xpack.data.searchSessionName.editAriaLabelText', { + aria-label={i18n.translate('data.searchSessionName.editAriaLabelText', { defaultMessage: 'Edit search session name', })} data-test-subj={'searchSessionNameEdit'} @@ -56,14 +57,14 @@ export const SearchSessionName: React.FC = ({ name, edit { setNewName(e.target.value); }} - aria-label={i18n.translate('xpack.data.searchSessionName.ariaLabelText', { + aria-label={i18n.translate('data.searchSessionName.ariaLabelText', { defaultMessage: 'Search session name', })} data-test-subj={'searchSessionNameInput'} @@ -89,10 +90,7 @@ export const SearchSessionName: React.FC = ({ name, edit isLoading={isSaving} data-test-subj={'searchSessionNameSave'} > - + } /> diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx similarity index 91% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx index 94aa1d41abd38..18acd56d9a51b 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/custom_icons.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/custom_icons.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx similarity index 82% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx index fe86ad2fb5cea..eb35ea58339e2 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/index.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/index.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiDelayRender, EuiLoadingSpinner } from '@elastic/eui'; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.scss b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.scss similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.scss rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.scss diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx similarity index 90% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx index 654dfee17c5a2..ffb77a872ec75 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.stories.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.stories.tsx @@ -1,14 +1,15 @@ /* * 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. + * 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 React from 'react'; import { storiesOf } from '@storybook/react'; -import { SearchSessionState } from '@kbn/data-plugin/public'; import { SearchSessionIndicator } from './search_session_indicator'; +import { SearchSessionState } from '../../search_session_state'; storiesOf('components/SearchSessionIndicator', module).add('default', () => { const [searchSessionName, setSearchSessionName] = React.useState('Discover session'); diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx similarity index 93% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx index 26563bfa02fa7..3fe0e1172487c 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.test.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.test.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React, { ReactNode } from 'react'; @@ -10,7 +11,7 @@ import { screen, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { SearchSessionIndicator } from './search_session_indicator'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; -import { SearchSessionState } from '@kbn/data-plugin/public'; +import { SearchSessionState } from '../../../..'; function Container({ children }: { children?: ReactNode }) { return {children}; diff --git a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx similarity index 75% rename from x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx rename to src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx index 540cb6b5bebd4..239a4ea4c2aa7 100644 --- a/x-pack/plugins/data_enhanced/public/search/ui/search_session_indicator/search_session_indicator.tsx +++ b/src/plugins/data/public/search/session/session_indicator/search_session_indicator/search_session_indicator.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React, { useCallback, useImperativeHandle } from 'react'; @@ -22,10 +23,10 @@ import { import moment from 'moment'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { SearchSessionState } from '@kbn/data-plugin/public'; import { CheckInEmptyCircle, PartialClock } from './custom_icons'; import './search_session_indicator.scss'; import { SearchSessionName } from './components'; +import { SearchSessionState } from '../../search_session_state'; export interface SearchSessionIndicatorProps { state: SearchSessionState; @@ -59,7 +60,7 @@ const CancelButton = ({ onCancel = () => {}, buttonProps = {} }: ActionButtonPro {...buttonProps} > @@ -79,7 +80,7 @@ const ContinueInBackgroundButton = ({ {...buttonProps} > @@ -103,7 +104,7 @@ const ViewAllSearchSessionsButton = ({ {...buttonProps} > @@ -124,7 +125,7 @@ const SaveButton = ({ {...buttonProps} > @@ -150,24 +151,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'text', iconType: PartialClock, - 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel', - { defaultMessage: 'Search session loading' } - ), - tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingResultsIconTooltipText', - { defaultMessage: 'Search session loading' } - ), + 'aria-label': i18n.translate('data.searchSessionIndicator.loadingResultsIconAriaLabel', { + defaultMessage: 'Search session loading', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.loadingResultsIconTooltipText', { + defaultMessage: 'Search session loading', + }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.loadingResultsTitle', { + title: i18n.translate('data.searchSessionIndicator.loadingResultsTitle', { defaultMessage: 'Your search is taking a while...', }), - description: i18n.translate('xpack.data.searchSessionIndicator.loadingResultsDescription', { + description: i18n.translate('data.searchSessionIndicator.loadingResultsDescription', { defaultMessage: 'Save your session, continue your work, and return to completed results', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.loadingResultsWhenText', { + i18n.translate('data.searchSessionIndicator.loadingResultsWhenText', { defaultMessage: 'Started {when}', values: { when: props.startedTime ? moment(props.startedTime).format(`L @ LTS`) : '', @@ -181,28 +180,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'text', iconType: 'check', - 'aria-label': i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel', { + 'aria-label': i18n.translate('data.searchSessionIndicator.resultsLoadedIconAriaLabel', { + defaultMessage: 'Search session complete', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.resultsLoadedIconTooltipText', { defaultMessage: 'Search session complete', }), - tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText', - { - defaultMessage: 'Search session complete', - } - ), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedText', { + title: i18n.translate('data.searchSessionIndicator.resultsLoadedText', { defaultMessage: 'Search session complete', }), - description: i18n.translate( - 'xpack.data.searchSessionIndicator.resultsLoadedDescriptionText', - { - defaultMessage: 'Save your session and return to it later', - } - ), + description: i18n.translate('data.searchSessionIndicator.resultsLoadedDescriptionText', { + defaultMessage: 'Save your session and return to it later', + }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.resultsLoadedWhenText', { + i18n.translate('data.searchSessionIndicator.resultsLoadedWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -216,30 +209,30 @@ const searchSessionIndicatorViewStateToProps: { button: { iconType: EuiLoadingSpinner, 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel', + 'data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel', { defaultMessage: 'Saved session in progress', } ), tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText', + 'data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText', { defaultMessage: 'Saved session in progress', } ), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText', { + title: i18n.translate('data.searchSessionIndicator.loadingInTheBackgroundTitleText', { defaultMessage: 'Saved session in progress', }), description: i18n.translate( - 'xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText', + 'data.searchSessionIndicator.loadingInTheBackgroundDescriptionText', { defaultMessage: 'You can return to completed results from Management', } ), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText', { + i18n.translate('data.searchSessionIndicator.loadingInTheBackgroundWhenText', { defaultMessage: 'Started {when}', values: { when: props.startedTime ? moment(props.startedTime).format(`L @ LTS`) : '', @@ -254,33 +247,30 @@ const searchSessionIndicatorViewStateToProps: { color: 'success', iconType: 'checkInCircleFilled', 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel', { defaultMessage: 'Saved session complete', } ), tooltipText: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText', { defaultMessage: 'Saved session complete', } ), }, popover: { - title: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText', - { - defaultMessage: 'Search session saved', - } - ), + title: i18n.translate('data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText', { + defaultMessage: 'Search session saved', + }), description: i18n.translate( - 'xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText', + 'data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText', { defaultMessage: 'You can return to these results from Management', } ), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText', { + i18n.translate('data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -293,26 +283,23 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'success', iconType: CheckInEmptyCircle, - 'aria-label': i18n.translate( - 'xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel', - { - defaultMessage: 'Saved session restored', - } - ), - tooltipText: i18n.translate('xpack.data.searchSessionIndicator.restoredResultsTooltipText', { + 'aria-label': i18n.translate('data.searchSessionIndicator.restoredResultsIconAriaLabel', { + defaultMessage: 'Saved session restored', + }), + tooltipText: i18n.translate('data.searchSessionIndicator.restoredResultsTooltipText', { defaultMessage: 'Search session restored', }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.restoredTitleText', { + title: i18n.translate('data.searchSessionIndicator.restoredTitleText', { defaultMessage: 'Search session restored', }), - description: i18n.translate('xpack.data.searchSessionIndicator.restoredDescriptionText', { + description: i18n.translate('data.searchSessionIndicator.restoredDescriptionText', { defaultMessage: 'You are viewing cached data from a specific time range. Changing the time range or filters will re-run the session', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.restoredWhenText', { + i18n.translate('data.searchSessionIndicator.restoredWhenText', { defaultMessage: 'Completed {when}', values: { when: props.completedTime ? moment(props.completedTime).format(`L @ LTS`) : '', @@ -325,22 +312,22 @@ const searchSessionIndicatorViewStateToProps: { button: { color: 'danger', iconType: 'alert', - 'aria-label': i18n.translate('xpack.data.searchSessionIndicator.canceledIconAriaLabel', { + 'aria-label': i18n.translate('data.searchSessionIndicator.canceledIconAriaLabel', { defaultMessage: 'Search session stopped', }), - tooltipText: i18n.translate('xpack.data.searchSessionIndicator.canceledTooltipText', { + tooltipText: i18n.translate('data.searchSessionIndicator.canceledTooltipText', { defaultMessage: 'Search session stopped', }), }, popover: { - title: i18n.translate('xpack.data.searchSessionIndicator.canceledTitleText', { + title: i18n.translate('data.searchSessionIndicator.canceledTitleText', { defaultMessage: 'Search session stopped', }), - description: i18n.translate('xpack.data.searchSessionIndicator.canceledDescriptionText', { + description: i18n.translate('data.searchSessionIndicator.canceledDescriptionText', { defaultMessage: 'You are viewing incomplete data', }), whenText: (props: SearchSessionIndicatorProps) => - i18n.translate('xpack.data.searchSessionIndicator.canceledWhenText', { + i18n.translate('data.searchSessionIndicator.canceledWhenText', { defaultMessage: 'Stopped {when}', values: { when: props.canceledTime ? moment(props.canceledTime).format(`L @ LTS`) : '', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx similarity index 68% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx index 7c089c8db9634..3d3592df0bb67 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/__mocks__/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/__mocks__/index.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React, { ReactNode } from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx similarity index 67% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx index d2be863170a4b..b0a15ca405743 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/application/index.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { CoreSetup } from '@kbn/core/public'; @@ -11,24 +12,24 @@ import type { AppDependencies, IManagementSectionsPluginsSetup, IManagementSectionsPluginsStart, - SessionsConfigSchema, } from '..'; import { APP } from '..'; import { SearchSessionsMgmtAPI } from '../lib/api'; import { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { renderApp } from './render'; +import { SearchSessionsConfigSchema } from '../../../../../config'; export class SearchSessionsMgmtApp { constructor( private coreSetup: CoreSetup, - private config: SessionsConfigSchema, + private setupDeps: IManagementSectionsPluginsSetup, + private config: SearchSessionsConfigSchema, private kibanaVersion: string, - private params: ManagementAppMountParams, - private pluginsSetup: IManagementSectionsPluginsSetup + private params: ManagementAppMountParams ) {} public async mountManagementSection() { - const { coreSetup, params, pluginsSetup } = this; + const { coreSetup, params, setupDeps } = this; const [coreStart, pluginsStart] = await coreSetup.getStartServices(); const { @@ -40,24 +41,21 @@ export class SearchSessionsMgmtApp { uiSettings, application, } = coreStart; - const { data, share } = pluginsStart; const pluginName = APP.getI18nName(); docTitle.change(pluginName); - params.setBreadcrumbs([{ text: pluginName }]); + this.params.setBreadcrumbs([{ text: pluginName }]); - const { sessionsClient } = data.search; - const api = new SearchSessionsMgmtAPI(sessionsClient, this.config, { + const api = new SearchSessionsMgmtAPI(setupDeps.sessionsClient, this.config, { notifications, - locators: share.url.locators, + locators: pluginsStart.share.url.locators, application, - usageCollector: pluginsSetup.data.search.usageCollector, + usageCollector: setupDeps.searchUsageCollector, }); const documentation = new AsyncSearchIntroDocumentation(docLinks); const dependencies: AppDependencies = { - plugins: pluginsSetup, config: this.config, documentation, core: coreStart, @@ -65,8 +63,9 @@ export class SearchSessionsMgmtApp { http, i18n, uiSettings, - share, + share: pluginsStart.share, kibanaVersion: this.kibanaVersion, + searchUsageCollector: setupDeps.searchUsageCollector, }; const { element } = params; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx b/src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx index 563179064062b..87ceb6ee8a942 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/application/render.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/application/render.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 React from 'react'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx similarity index 77% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx index d612aada1084a..0581af4a872ff 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/delete_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/delete_button.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiConfirmModal } from '@elastic/eui'; @@ -26,16 +27,16 @@ const DeleteConfirm = (props: DeleteButtonProps & { onActionDismiss: OnActionDis const { name, id } = searchSession; const [isLoading, setIsLoading] = useState(false); - const title = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.title', { + const title = i18n.translate('data.mgmt.searchSessions.cancelModal.title', { defaultMessage: 'Delete search session', }); - const confirm = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.deleteButton', { + const confirm = i18n.translate('data.mgmt.searchSessions.cancelModal.deleteButton', { defaultMessage: 'Delete', }); - const cancel = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.cancelButton', { + const cancel = i18n.translate('data.mgmt.searchSessions.cancelModal.cancelButton', { defaultMessage: 'Cancel', }); - const message = i18n.translate('xpack.data.mgmt.searchSessions.cancelModal.message', { + const message = i18n.translate('data.mgmt.searchSessions.cancelModal.message', { defaultMessage: `Deleting the search session \'{name}\' deletes all cached results.`, values: { name, @@ -68,9 +69,7 @@ export const createDeleteActionDescriptor = ( core: CoreStart ): IClickActionDescriptor => ({ iconType: 'crossInACircleFilled', - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx similarity index 79% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx index bb64fef09aba8..4b955e7bf93a3 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/extend_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/extend_button.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiConfirmModal } from '@elastic/eui'; @@ -31,16 +32,16 @@ const ExtendConfirm = ({ ...props }: ExtendButtonProps & { onActionDismiss: OnAc const newExpiration = moment(expires).add(extendByDuration); - const title = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.title', { + const title = i18n.translate('data.mgmt.searchSessions.extendModal.title', { defaultMessage: 'Extend search session expiration', }); - const confirm = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.extendButton', { + const confirm = i18n.translate('data.mgmt.searchSessions.extendModal.extendButton', { defaultMessage: 'Extend expiration', }); - const extend = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.dontExtendButton', { + const extend = i18n.translate('data.mgmt.searchSessions.extendModal.dontExtendButton', { defaultMessage: 'Cancel', }); - const message = i18n.translate('xpack.data.mgmt.searchSessions.extendModal.extendMessage', { + const message = i18n.translate('data.mgmt.searchSessions.extendModal.extendMessage', { defaultMessage: "The search session '{name}' expiration would be extended until {newExpires}.", values: { name, @@ -75,9 +76,7 @@ export const createExtendActionDescriptor = ( core: CoreStart ): IClickActionDescriptor => ({ iconType: extendSessionIcon, - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx similarity index 87% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx index 4ab246b5ee403..33ea4013d605e 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/get_action.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/get_action.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { CoreStart } from '@kbn/core/public'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx similarity index 56% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx index cecd50125e90e..7b01e2fb7673f 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/index.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { PopoverActionsMenu } from './popover_actions'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.scss similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.scss rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.scss diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx similarity index 88% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx index 823ab99c0213f..4ba404e708662 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/inspect_button.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/inspect_button.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiFlyoutBody, EuiFlyoutHeader, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; @@ -58,7 +59,7 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => {

@@ -69,7 +70,7 @@ const InspectFlyout = ({ uiSettings, searchSession }: InspectFlyoutProps) => {

@@ -90,7 +91,7 @@ export const createInspectActionDescriptor = ( iconType: 'document', label: ( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx similarity index 89% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx index 35661dce80da6..a335c481b1d3e 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/popover_actions.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/popover_actions.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { @@ -49,12 +50,12 @@ export const PopoverActionsMenu = ({ const renderPopoverButton = () => ( ({ iconType: 'pencil', - label: ( - - ), + label: , onClick: async () => { const ref = core.overlays.openModal( toMountPoint( diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts similarity index 65% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts rename to src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts index c808f8469cccf..645cee6725c8f 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/actions/types.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/actions/types.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 type OnActionComplete = () => void; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx index 2970c75e651d6..c9ba988e1330b 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/index.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/index.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiLinkProps, EuiText, EuiTextProps } from '@elastic/eui'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx similarity index 83% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx index fac9cda42eef2..183dc80883c57 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/main.test.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { MockedKeys } from '@kbn/utility-types/jest'; @@ -12,34 +13,30 @@ import moment from 'moment'; import React from 'react'; import { act } from 'react-dom/test-utils'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; +import { SearchUsageCollector, SessionsClient } from '../../..'; import { SearchSessionsMgmtAPI } from '../lib/api'; import { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { LocaleWrapper } from '../__mocks__'; import { SearchSessionsMgmtMain } from './main'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: MockedKeys; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; let api: SearchSessionsMgmtAPI; +let mockSearchUsageCollector: SearchUsageCollector; describe('Background Search Session Management Main', () => { beforeEach(() => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; + mockSearchUsageCollector = createSearchUsageCollectorMock(); mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -80,13 +77,13 @@ describe('Background Search Session Management Main', () => { ); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx similarity index 72% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx index e065a20003dd9..424ec701f79ad 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/main.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/main.tsx @@ -1,19 +1,20 @@ /* * 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. + * 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 { EuiButtonEmpty, EuiPageHeader, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import type { CoreStart, HttpStart } from '@kbn/core/public'; import React from 'react'; -import type { SessionsConfigSchema } from '..'; -import { IManagementSectionsPluginsSetup } from '..'; import type { SearchSessionsMgmtAPI } from '../lib/api'; import type { AsyncSearchIntroDocumentation } from '../lib/documentation'; import { SearchSessionsMgmtTable } from './table'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { SearchUsageCollector } from '../../../collectors'; interface Props { documentation: AsyncSearchIntroDocumentation; @@ -21,9 +22,9 @@ interface Props { api: SearchSessionsMgmtAPI; http: HttpStart; timezone: string; - config: SessionsConfigSchema; - plugins: IManagementSectionsPluginsSetup; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) { @@ -32,13 +33,13 @@ export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) } description={ } @@ -50,7 +51,7 @@ export function SearchSessionsMgmtMain({ documentation, ...tableProps }: Props) iconType="help" > , diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx similarity index 94% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx index 83f4494dff504..5cee810997393 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/status.test.tsx @@ -1,14 +1,15 @@ /* * 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. + * 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 { EuiTextProps, EuiToolTipProps } from '@elastic/eui'; import { mount } from 'enzyme'; import React from 'react'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../../../common'; import { UISession } from '../types'; import { LocaleWrapper } from '../__mocks__'; import { getStatusText, StatusIndicator } from './status'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx similarity index 78% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx index 577e89f2c761b..bb41ff05c1099 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/status.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/status.tsx @@ -1,14 +1,15 @@ /* * 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. + * 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 { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiLoadingSpinner, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React, { ReactElement } from 'react'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../../../common'; import { dateString } from '../lib/date_string'; import { UISession } from '../types'; import { StatusDef as StatusAttributes, TableText } from '.'; @@ -17,23 +18,23 @@ import { StatusDef as StatusAttributes, TableText } from '.'; export const getStatusText = (statusType: string): string => { switch (statusType) { case SearchSessionStatus.IN_PROGRESS: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.inProgress', { + return i18n.translate('data.mgmt.searchSessions.status.label.inProgress', { defaultMessage: 'In progress', }); case SearchSessionStatus.EXPIRED: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.expired', { + return i18n.translate('data.mgmt.searchSessions.status.label.expired', { defaultMessage: 'Expired', }); case SearchSessionStatus.CANCELLED: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.cancelled', { + return i18n.translate('data.mgmt.searchSessions.status.label.cancelled', { defaultMessage: 'Cancelled', }); case SearchSessionStatus.COMPLETE: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.complete', { + return i18n.translate('data.mgmt.searchSessions.status.label.complete', { defaultMessage: 'Complete', }); case SearchSessionStatus.ERROR: - return i18n.translate('xpack.data.mgmt.searchSessions.status.label.error', { + return i18n.translate('data.mgmt.searchSessions.status.label.error', { defaultMessage: 'Error', }); default: @@ -60,7 +61,7 @@ const getStatusAttributes = ({ if (session.expires) { expireDate = dateString(session.expires!, timezone); } else { - expireDate = i18n.translate('xpack.data.mgmt.searchSessions.status.expireDateUnknown', { + expireDate = i18n.translate('data.mgmt.searchSessions.status.expireDateUnknown', { defaultMessage: 'unknown', }); } @@ -72,13 +73,10 @@ const getStatusAttributes = ({ textColor: 'default', icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate( - 'xpack.data.mgmt.searchSessions.status.message.createdOn', - { - defaultMessage: 'Expires on {expireDate}', - values: { expireDate }, - } - ), + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.createdOn', { + defaultMessage: 'Expires on {expireDate}', + values: { expireDate }, + }), }; } catch (err) { // eslint-disable-next-line no-console @@ -88,13 +86,10 @@ const getStatusAttributes = ({ case SearchSessionStatus.EXPIRED: try { - const toolTipContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.message.expiredOn', - { - defaultMessage: 'Expired on {expireDate}', - values: { expireDate }, - } - ); + const toolTipContent = i18n.translate('data.mgmt.searchSessions.status.message.expiredOn', { + defaultMessage: 'Expired on {expireDate}', + values: { expireDate }, + }); return { icon: , @@ -111,7 +106,7 @@ const getStatusAttributes = ({ return { icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate('xpack.data.mgmt.searchSessions.status.message.cancelled', { + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.cancelled', { defaultMessage: 'Cancelled by user', }), }; @@ -121,7 +116,7 @@ const getStatusAttributes = ({ textColor: 'danger', icon: , label: {getStatusText(session.status)}, - toolTipContent: i18n.translate('xpack.data.mgmt.searchSessions.status.message.error', { + toolTipContent: i18n.translate('data.mgmt.searchSessions.status.message.error', { defaultMessage: 'Error: {error}', values: { error: (session as any).error || 'unknown' }, }), @@ -129,7 +124,7 @@ const getStatusAttributes = ({ case SearchSessionStatus.COMPLETE: try { - const toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresOn', { + const toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresOn', { defaultMessage: 'Expires on {expireDate}', values: { expireDate }, }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx similarity index 76% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx index e0988fbf80acf..48cfda93e1f91 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/app_filter.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/app_filter.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { FieldValueOptionType, SearchFilterConfig } from '@elastic/eui'; @@ -12,7 +13,7 @@ import { UISession } from '../../types'; export const getAppFilter: (tableData: UISession[]) => SearchFilterConfig = (tableData) => ({ type: 'field_value_selection', - name: i18n.translate('xpack.data.mgmt.searchSessions.search.filterApp', { + name: i18n.translate('data.mgmt.searchSessions.search.filterApp', { defaultMessage: 'App', }), field: 'appId', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts b/src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts index 361261ff65c87..84f0cfd24159d 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/index.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { SearchSessionsMgmtTable } from './table'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx similarity index 79% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx index 33e085fbb646d..25fc7dc092ab8 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/status_filter.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/status_filter.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { FieldValueOptionType, SearchFilterConfig } from '@elastic/eui'; @@ -14,7 +15,7 @@ import { getStatusText } from '../status'; export const getStatusFilter: (tableData: UISession[]) => SearchFilterConfig = (tableData) => ({ type: 'field_value_selection', - name: i18n.translate('xpack.data.mgmt.searchSessions.search.filterStatus', { + name: i18n.translate('data.mgmt.searchSessions.search.filterStatus', { defaultMessage: 'Status', }), field: 'status', diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx similarity index 87% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx index 2023aed902c9f..1e8dd423a8bf9 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.test.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { MockedKeys } from '@kbn/utility-types/jest'; @@ -12,34 +13,29 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import moment from 'moment'; import React from 'react'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '../..'; +import { SearchUsageCollector, SessionsClient } from '../../../..'; +import { SearchSessionStatus } from '../../../../../../common'; import { SearchSessionsMgmtAPI } from '../../lib/api'; import { LocaleWrapper } from '../../__mocks__'; import { SearchSessionsMgmtTable } from './table'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: CoreStart; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; let api: SearchSessionsMgmtAPI; +let mockSearchUsageCollector: SearchUsageCollector; describe('Background Search Session Management Table', () => { beforeEach(async () => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -49,6 +45,7 @@ describe('Background Search Session Management Table', () => { refreshTimeout: moment.duration(10, 'minutes'), }, } as any; + mockSearchUsageCollector = createSearchUsageCollectorMock(); sessionsClient = new SessionsClient({ http: mockCoreSetup.http }); api = new SearchSessionsMgmtAPI(sessionsClient, mockConfig, { @@ -91,11 +88,11 @@ describe('Background Search Session Management Table', () => { ); @@ -124,11 +121,11 @@ describe('Background Search Session Management Table', () => { ); @@ -168,11 +165,11 @@ describe('Background Search Session Management Table', () => { ); @@ -202,11 +199,11 @@ describe('Background Search Session Management Table', () => { ); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx similarity index 81% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx index 88ffb5ed2d749..b887d9af43f53 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/components/table/table.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/components/table/table.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiButton, EuiInMemoryTable, EuiSearchBarProps } from '@elastic/eui'; @@ -12,23 +13,24 @@ import moment from 'moment'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import useDebounce from 'react-use/lib/useDebounce'; import useInterval from 'react-use/lib/useInterval'; -import { SEARCH_SESSIONS_TABLE_ID } from '@kbn/data-plugin/common'; import { TableText } from '..'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '../..'; +import { SEARCH_SESSIONS_TABLE_ID } from '../../../../../../common'; import { SearchSessionsMgmtAPI } from '../../lib/api'; import { getColumns } from '../../lib/get_columns'; import { UISession } from '../../types'; import { OnActionComplete } from '../actions'; import { getAppFilter } from './app_filter'; import { getStatusFilter } from './status_filter'; +import { SearchUsageCollector } from '../../../../collectors'; +import { SearchSessionsConfigSchema } from '../../../../../../config'; interface Props { core: CoreStart; api: SearchSessionsMgmtAPI; timezone: string; - config: SessionsConfigSchema; - plugins: IManagementSectionsPluginsSetup; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export function SearchSessionsMgmtTable({ @@ -36,8 +38,8 @@ export function SearchSessionsMgmtTable({ api, timezone, config, - plugins, kibanaVersion, + searchUsageCollector, ...props }: Props) { const [tableData, setTableData] = useState([]); @@ -80,8 +82,8 @@ export function SearchSessionsMgmtTable({ // initial data load useEffect(() => { doRefresh(); - plugins.data.search.usageCollector?.trackSessionsListLoaded(); - }, [doRefresh, plugins]); + searchUsageCollector.trackSessionsListLoaded(); + }, [doRefresh, searchUsageCollector]); useInterval(doRefresh, refreshInterval); @@ -104,7 +106,7 @@ export function SearchSessionsMgmtTable({ data-test-subj="sessionManagementRefreshBtn" > @@ -121,7 +123,15 @@ export function SearchSessionsMgmtTable({ 'data-test-subj': `searchSessionsRow`, 'data-test-search-session-id': `id-${searchSession.id}`, })} - columns={getColumns(core, plugins, api, config, timezone, onActionComplete, kibanaVersion)} + columns={getColumns( + core, + api, + config, + timezone, + onActionComplete, + kibanaVersion, + searchUsageCollector + )} items={tableData} pagination={pagination} search={search} diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/icons/extend_session.svg b/src/plugins/data/public/search/session/sessions_mgmt/icons/extend_session.svg similarity index 100% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/icons/extend_session.svg rename to src/plugins/data/public/search/session/sessions_mgmt/icons/extend_session.svg diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts b/src/plugins/data/public/search/session/sessions_mgmt/index.ts similarity index 60% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts rename to src/plugins/data/public/search/session/sessions_mgmt/index.ts index 35eb3cb4e36a4..7b95305f6e568 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/index.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/index.ts @@ -1,34 +1,33 @@ /* * 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. + * 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 { CoreStart, HttpStart, I18nStart, IUiSettingsClient } from '@kbn/core/public'; import { CoreSetup } from '@kbn/core/public'; -import type { DataPublicPluginSetup, DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { ManagementSetup } from '@kbn/management-plugin/public'; import type { SharePluginStart } from '@kbn/share-plugin/public'; -import { SEARCH_SESSIONS_MANAGEMENT_ID } from '@kbn/data-plugin/public'; -import type { ConfigSchema } from '../../../config'; -import type { DataEnhancedStartDependencies } from '../../plugin'; +import type { ISessionsClient, SearchUsageCollector } from '../../..'; +import { SEARCH_SESSIONS_MANAGEMENT_ID } from '../constants'; import type { SearchSessionsMgmtAPI } from './lib/api'; import type { AsyncSearchIntroDocumentation } from './lib/documentation'; +import { SearchSessionsConfigSchema } from '../../../../config'; export interface IManagementSectionsPluginsSetup { - data: DataPublicPluginSetup; management: ManagementSetup; + searchUsageCollector: SearchUsageCollector; + sessionsClient: ISessionsClient; } export interface IManagementSectionsPluginsStart { - data: DataPublicPluginStart; share: SharePluginStart; } export interface AppDependencies { - plugins: IManagementSectionsPluginsSetup; share: SharePluginStart; uiSettings: IUiSettingsClient; documentation: AsyncSearchIntroDocumentation; @@ -36,33 +35,32 @@ export interface AppDependencies { api: SearchSessionsMgmtAPI; http: HttpStart; i18n: I18nStart; - config: SessionsConfigSchema; + config: SearchSessionsConfigSchema; kibanaVersion: string; + searchUsageCollector: SearchUsageCollector; } export const APP = { id: SEARCH_SESSIONS_MANAGEMENT_ID, getI18nName: (): string => - i18n.translate('xpack.data.mgmt.searchSessions.appTitle', { + i18n.translate('data.mgmt.searchSessions.appTitle', { defaultMessage: 'Search Sessions', }), }; -export type SessionsConfigSchema = ConfigSchema['search']['sessions']; - export function registerSearchSessionsMgmt( - coreSetup: CoreSetup, - config: SessionsConfigSchema, - kibanaVersion: string, - services: IManagementSectionsPluginsSetup + coreSetup: CoreSetup, + deps: IManagementSectionsPluginsSetup, + config: SearchSessionsConfigSchema, + kibanaVersion: string ) { - services.management.sections.section.kibana.registerApp({ + deps.management.sections.section.kibana.registerApp({ id: APP.id, title: APP.getI18nName(), order: 1.75, mount: async (params) => { const { SearchSessionsMgmtApp: MgmtApp } = await import('./application'); - const mgmtApp = new MgmtApp(coreSetup, config, kibanaVersion, params, services); + const mgmtApp = new MgmtApp(coreSetup, deps, config, kibanaVersion, params); return mgmtApp.mountManagementSection(); }, }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts similarity index 95% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts index 69c0d165ac6c0..a1d95a83d1ccd 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.test.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 type { MockedKeys } from '@kbn/utility-types/jest'; @@ -11,17 +12,17 @@ import moment from 'moment'; import { coreMock } from '@kbn/core/public/mocks'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import type { SavedObjectsFindResponse } from '@kbn/core/server'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import type { SessionsConfigSchema } from '..'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SessionsClient } from '../../..'; +import { SearchSessionStatus } from '../../../../../common'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { SearchSessionsMgmtAPI } from './api'; +import { SearchSessionsConfigSchema } from '../../../../../config'; let mockCoreSetup: MockedKeys; let mockCoreStart: MockedKeys; let mockShareStart: jest.Mocked; -let mockConfig: SessionsConfigSchema; +let mockConfig: SearchSessionsConfigSchema; let sessionsClient: SessionsClient; describe('Search Sessions Management API', () => { diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts index bb58efd01d957..9830cb436f7df 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/api.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/api.ts @@ -1,8 +1,9 @@ /* * 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. + * 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'; @@ -12,15 +13,16 @@ import { from, race, timer } from 'rxjs'; import { mapTo, tap } from 'rxjs/operators'; import type { SharePluginStart } from '@kbn/share-plugin/public'; import { SerializableRecord } from '@kbn/utility-types'; -import { ISessionsClient, SearchUsageCollector } from '@kbn/data-plugin/public'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; import { ACTION } from '../components/actions'; import { PersistedSearchSessionSavedObjectAttributes, UISearchSessionState, UISession, } from '../types'; -import { SessionsConfigSchema } from '..'; +import { ISessionsClient } from '../../sessions_client'; +import { SearchUsageCollector } from '../../../collectors'; +import { SearchSessionStatus } from '../../../../../common'; +import { SearchSessionsConfigSchema } from '../../../../../config'; type LocatorsStart = SharePluginStart['url']['locators']; @@ -73,7 +75,7 @@ function getUrlFromState(locators: LocatorsStart, locatorId: string, state: Seri // Helper: factory for a function to map server objects to UI objects const mapToUISession = - (locators: LocatorsStart, config: SessionsConfigSchema) => + (locators: LocatorsStart, config: SearchSessionsConfigSchema) => async ( savedObject: SavedObject ): Promise => { @@ -125,7 +127,7 @@ interface SearchSessionManagementDeps { export class SearchSessionsMgmtAPI { constructor( private sessionsClient: ISessionsClient, - private config: SessionsConfigSchema, + private config: SearchSessionsConfigSchema, private deps: SearchSessionManagementDeps ) {} @@ -147,7 +149,7 @@ export class SearchSessionsMgmtAPI { const timeout$ = timer(refreshTimeout.asMilliseconds()).pipe( tap(() => { this.deps.notifications.toasts.addDanger( - i18n.translate('xpack.data.mgmt.searchSessions.api.fetchTimeout', { + i18n.translate('data.mgmt.searchSessions.api.fetchTimeout', { defaultMessage: 'Fetching the Search Session info timed out after {timeout} seconds', values: { timeout: refreshTimeout.asSeconds() }, }) @@ -169,7 +171,7 @@ export class SearchSessionsMgmtAPI { // eslint-disable-next-line no-console console.error(err); this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.fetchError', { + title: i18n.translate('data.mgmt.searchSessions.api.fetchError', { defaultMessage: 'Failed to refresh the page!', }), }); @@ -194,13 +196,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.delete(id); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.deleted', { + title: i18n.translate('data.mgmt.searchSessions.api.deleted', { defaultMessage: 'The search session was deleted.', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.deletedError', { + title: i18n.translate('data.mgmt.searchSessions.api.deletedError', { defaultMessage: 'Failed to delete the search session!', }), }); @@ -214,13 +216,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.extend(id, expires); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.extended', { + title: i18n.translate('data.mgmt.searchSessions.api.extended', { defaultMessage: 'The search session was extended.', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.extendError', { + title: i18n.translate('data.mgmt.searchSessions.api.extendError', { defaultMessage: 'Failed to extend the search session!', }), }); @@ -233,13 +235,13 @@ export class SearchSessionsMgmtAPI { await this.sessionsClient.rename(id, newName); this.deps.notifications.toasts.addSuccess({ - title: i18n.translate('xpack.data.mgmt.searchSessions.api.rename', { + title: i18n.translate('data.mgmt.searchSessions.api.rename', { defaultMessage: 'The search session was renamed', }), }); } catch (err) { this.deps.notifications.toasts.addError(err, { - title: i18n.translate('xpack.data.mgmt.searchSessions.api.renameError', { + title: i18n.translate('data.mgmt.searchSessions.api.renameError', { defaultMessage: 'Failed to rename the search session', }), }); diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts similarity index 77% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts index 2bad2f7c3367e..89ffcb596b094 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/date_string.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/date_string.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 moment from 'moment'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts similarity index 71% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts index 03279199912c0..2af7fb5025cd9 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/documentation.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/documentation.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { DocLinksStart } from '@kbn/core/public'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx similarity index 89% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx index 35da6b995169a..5833ac516fa4b 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.test.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.test.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { EuiTableFieldDataColumnType } from '@elastic/eui'; @@ -12,23 +13,22 @@ import { CoreSetup, CoreStart } from '@kbn/core/public'; import moment from 'moment'; import { ReactElement } from 'react'; import { coreMock } from '@kbn/core/public/mocks'; -import { SessionsClient } from '@kbn/data-plugin/public/search'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchUsageCollector, SessionsClient } from '../../..'; +import { SearchSessionStatus } from '../../../../../common'; import { OnActionComplete } from '../components'; import { UISession } from '../types'; import { SearchSessionsMgmtAPI } from './api'; import { getColumns } from './get_columns'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; -import { managementPluginMock } from '@kbn/management-plugin/public/mocks'; import { SharePluginStart } from '@kbn/share-plugin/public'; import { sharePluginMock } from '@kbn/share-plugin/public/mocks'; +import { SearchSessionsConfigSchema } from '../../../../../config'; +import { createSearchUsageCollectorMock } from '../../../collectors/mocks'; let mockCoreSetup: MockedKeys; let mockCoreStart: CoreStart; let mockShareStart: jest.Mocked; -let mockPluginsSetup: IManagementSectionsPluginsSetup; -let mockConfig: SessionsConfigSchema; +let mockSearchUsageCollector: SearchUsageCollector; +let mockConfig: SearchSessionsConfigSchema; let api: SearchSessionsMgmtAPI; let sessionsClient: SessionsClient; let handleAction: OnActionComplete; @@ -41,10 +41,6 @@ describe('Search Sessions Management table column factory', () => { mockCoreSetup = coreMock.createSetup(); mockCoreStart = coreMock.createStart(); mockShareStart = sharePluginMock.createStartContract(); - mockPluginsSetup = { - data: dataPluginMock.createSetupContract(), - management: managementPluginMock.createSetupContract(), - }; mockConfig = { defaultExpiration: moment.duration('7d'), management: { @@ -55,6 +51,7 @@ describe('Search Sessions Management table column factory', () => { }, } as any; sessionsClient = new SessionsClient({ http: mockCoreSetup.http }); + mockSearchUsageCollector = createSearchUsageCollectorMock(); api = new SearchSessionsMgmtAPI(sessionsClient, mockConfig, { locators: mockShareStart.url.locators, @@ -86,12 +83,12 @@ describe('Search Sessions Management table column factory', () => { test('returns columns', () => { const columns = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ); expect(columns).toMatchInlineSnapshot(` Array [ @@ -152,12 +149,12 @@ describe('Search Sessions Management table column factory', () => { test('rendering', () => { const [, nameColumn] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const name = mount(nameColumn.render!(mockSession.name, mockSession) as ReactElement); @@ -172,12 +169,12 @@ describe('Search Sessions Management table column factory', () => { beforeEach(() => { const [, nameColumn] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - currentKibanaVersion + currentKibanaVersion, + mockSearchUsageCollector ) as Array>; hasRenderedVersionWarning = (partialSession: Partial): boolean => { @@ -235,12 +232,12 @@ describe('Search Sessions Management table column factory', () => { test('renders', () => { const [, , numOfSearches] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const numOfSearchesLine = mount( @@ -255,12 +252,12 @@ describe('Search Sessions Management table column factory', () => { test('render in_progress', () => { const [, , , status] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const statusLine = mount(status.render!(mockSession.status, mockSession) as ReactElement); @@ -272,12 +269,12 @@ describe('Search Sessions Management table column factory', () => { test('error handling', () => { const [, , , status] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; mockSession.status = 'INVALID' as SearchSessionStatus; @@ -296,12 +293,12 @@ describe('Search Sessions Management table column factory', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const date = mount(createdDateCol.render!(mockSession.created, mockSession) as ReactElement); @@ -314,12 +311,12 @@ describe('Search Sessions Management table column factory', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; const date = mount(createdDateCol.render!(mockSession.created, mockSession) as ReactElement); @@ -330,12 +327,12 @@ describe('Search Sessions Management table column factory', () => { test('error handling', () => { const [, , , , createdDateCol] = getColumns( mockCoreStart, - mockPluginsSetup, api, mockConfig, tz, handleAction, - '7.14.0' + '7.14.0', + mockSearchUsageCollector ) as Array>; mockSession.created = 'INVALID'; diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx similarity index 85% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx index d9a71639f8fe2..f6db378bb2942 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_columns.tsx +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_columns.tsx @@ -1,8 +1,9 @@ /* * 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. + * 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 { @@ -21,15 +22,15 @@ import { CoreStart } from '@kbn/core/public'; import { capitalize } from 'lodash'; import React from 'react'; import { RedirectAppLinks } from '@kbn/kibana-react-plugin/public'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; -import { IManagementSectionsPluginsSetup, SessionsConfigSchema } from '..'; -import { TableText } from '../components'; -import { OnActionComplete, PopoverActionsMenu } from '../components'; +import { SearchSessionStatus } from '../../../../../common'; +import { OnActionComplete, PopoverActionsMenu, TableText } from '../components'; import { StatusIndicator } from '../components/status'; import { dateString } from './date_string'; import { SearchSessionsMgmtAPI } from './api'; import { getExpirationStatus } from './get_expiration_status'; import { UISession } from '../types'; +import { SearchUsageCollector } from '../../../collectors'; +import { SearchSessionsConfigSchema } from '../../../../../config'; // Helper function: translate an app string to EuiIcon-friendly string const appToIcon = (app: string) => { @@ -46,7 +47,7 @@ const appToIcon = (app: string) => { // Helper function: translate an app id to user friendly string const appToTooltip = (appId: string | undefined) => { if (appId === 'ml') { - return i18n.translate('xpack.data.mgmt.searchSessions.table.mlAppName', { + return i18n.translate('data.mgmt.searchSessions.table.mlAppName', { defaultMessage: 'Machine Learning', }); } @@ -58,19 +59,19 @@ function isSessionRestorable(status: SearchSessionStatus) { export const getColumns = ( core: CoreStart, - plugins: IManagementSectionsPluginsSetup, api: SearchSessionsMgmtAPI, - config: SessionsConfigSchema, + config: SearchSessionsConfigSchema, timezone: string, onActionComplete: OnActionComplete, - kibanaVersion: string + kibanaVersion: string, + searchUsageCollector: SearchUsageCollector ): Array> => { // Use a literal array of table column definitions to detail a UISession object return [ // App { field: 'appId', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerType', { + name: i18n.translate('data.mgmt.searchSessions.table.headerType', { defaultMessage: 'App', }), sortable: true, @@ -91,7 +92,7 @@ export const getColumns = ( // Name, links to app and displays the search session data { field: 'name', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerName', { + name: i18n.translate('data.mgmt.searchSessions.table.headerName', { defaultMessage: 'Name', }), sortable: true, @@ -100,8 +101,8 @@ export const getColumns = ( const isRestorable = isSessionRestorable(status); const href = isRestorable ? restoreUrl : reloadUrl; const trackAction = isRestorable - ? plugins.data.search.usageCollector?.trackSessionViewRestored - : plugins.data.search.usageCollector?.trackSessionReloaded; + ? searchUsageCollector.trackSessionViewRestored + : searchUsageCollector.trackSessionReloaded; const notRestorableWarning = isRestorable ? null : ( <> {' '} @@ -109,7 +110,7 @@ export const getColumns = ( type="alert" content={ } @@ -130,7 +131,7 @@ export const getColumns = ( iconProps={{ 'data-test-subj': 'versionIncompatibleWarningTestSubj' }} content={ } @@ -160,7 +161,7 @@ export const getColumns = ( // # Searches { field: 'numSearches', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.numSearches', { + name: i18n.translate('data.mgmt.searchSessions.table.numSearches', { defaultMessage: '# Searches', }), sortable: true, @@ -174,7 +175,7 @@ export const getColumns = ( // Session status { field: 'status', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerStatus', { + name: i18n.translate('data.mgmt.searchSessions.table.headerStatus', { defaultMessage: 'Status', }), sortable: true, @@ -186,7 +187,7 @@ export const getColumns = ( // Started date { field: 'created', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerStarted', { + name: i18n.translate('data.mgmt.searchSessions.table.headerStarted', { defaultMessage: 'Created', }), sortable: true, @@ -209,7 +210,7 @@ export const getColumns = ( // Expiration date { field: 'expires', - name: i18n.translate('xpack.data.mgmt.searchSessions.table.headerExpiration', { + name: i18n.translate('data.mgmt.searchSessions.table.headerExpiration', { defaultMessage: 'Expiration', }), sortable: true, diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts similarity index 56% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts rename to src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts index a220b414ba659..52a1ba3b983d2 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/lib/get_expiration_status.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/lib/get_expiration_status.ts @@ -1,15 +1,16 @@ /* * 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. + * 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 moment from 'moment'; -import { SessionsConfigSchema } from '..'; +import { SearchSessionsConfigSchema } from '../../../../../config'; -export const getExpirationStatus = (config: SessionsConfigSchema, expires: string | null) => { +export const getExpirationStatus = (config: SearchSessionsConfigSchema, expires: string | null) => { const tNow = moment.utc().valueOf(); const tFuture = moment.utc(expires).valueOf(); @@ -19,27 +20,27 @@ export const getExpirationStatus = (config: SessionsConfigSchema, expires: strin const expiresInDays = Math.floor(durationToExpire.asDays()); const sufficientDays = Math.ceil(moment.duration(config.management.expiresSoonWarning).asDays()); - let toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresSoonInDays', { + let toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInDays', { defaultMessage: 'Expires in {numDays} days', values: { numDays: expiresInDays }, }); - let statusContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip', - { defaultMessage: '{numDays} days', values: { numDays: expiresInDays } } - ); + let statusContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInDaysTooltip', { + defaultMessage: '{numDays} days', + values: { numDays: expiresInDays }, + }); if (expiresInDays === 0) { // switch to show expires in hours const expiresInHours = Math.floor(durationToExpire.asHours()); - toolTipContent = i18n.translate('xpack.data.mgmt.searchSessions.status.expiresSoonInHours', { + toolTipContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInHours', { defaultMessage: 'This session expires in {numHours} hours', values: { numHours: expiresInHours }, }); - statusContent = i18n.translate( - 'xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip', - { defaultMessage: '{numHours} hours', values: { numHours: expiresInHours } } - ); + statusContent = i18n.translate('data.mgmt.searchSessions.status.expiresSoonInHoursTooltip', { + defaultMessage: '{numHours} hours', + values: { numHours: expiresInHours }, + }); } if (durationToExpire.valueOf() > 0 && expiresInDays <= sufficientDays) { diff --git a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts b/src/plugins/data/public/search/session/sessions_mgmt/types.ts similarity index 84% rename from x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts rename to src/plugins/data/public/search/session/sessions_mgmt/types.ts index c66290a968240..d21b4371099c7 100644 --- a/x-pack/plugins/data_enhanced/public/search/sessions_mgmt/types.ts +++ b/src/plugins/data/public/search/session/sessions_mgmt/types.ts @@ -1,11 +1,12 @@ /* * 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. + * 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 { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../../common'; import { ACTION } from './components/actions'; export const DATE_STRING_FORMAT = 'D MMM, YYYY, HH:mm:ss'; diff --git a/src/plugins/data/public/types.ts b/src/plugins/data/public/types.ts index b596e02e7f2ac..69c2035b28e5c 100644 --- a/src/plugins/data/public/types.ts +++ b/src/plugins/data/public/types.ts @@ -15,6 +15,9 @@ import { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { UsageCollectionSetup, UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; import { Setup as InspectorSetup } from '@kbn/inspector-plugin/public'; +import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; +import { SharePluginStart } from '@kbn/share-plugin/public'; +import { ManagementSetup } from '@kbn/management-plugin/public'; import { DatatableUtilitiesService } from '../common'; import { createFiltersFromRangeSelectAction, createFiltersFromValueClickAction } from './actions'; import type { ISearchSetup, ISearchStart } from './search'; @@ -29,12 +32,15 @@ export interface DataSetupDependencies { inspector: InspectorSetup; usageCollection?: UsageCollectionSetup; fieldFormats: FieldFormatsSetup; + management: ManagementSetup; } export interface DataStartDependencies { uiActions: UiActionsStart; fieldFormats: FieldFormatsStart; dataViews: DataViewsPublicPluginStart; + screenshotMode: ScreenshotModePluginStart; + share: SharePluginStart; } /** diff --git a/src/plugins/data/server/config_deprecations.test.ts b/src/plugins/data/server/config_deprecations.test.ts index 7da937c840560..9c54c793f661a 100644 --- a/src/plugins/data/server/config_deprecations.test.ts +++ b/src/plugins/data/server/config_deprecations.test.ts @@ -11,12 +11,12 @@ import { cloneDeep } from 'lodash'; import { applyDeprecations, configDeprecationFactory } from '@kbn/config'; import { configDeprecationsMock } from '@kbn/core/server/mocks'; -import { autocompleteConfigDeprecationProvider } from './config_deprecations'; +import { configDeprecationProvider } from './config_deprecations'; const deprecationContext = configDeprecationsMock.createContext(); const applyConfigDeprecations = (settings: Record = {}) => { - const deprecations = autocompleteConfigDeprecationProvider(configDeprecationFactory); + const deprecations = configDeprecationProvider(configDeprecationFactory); const deprecationMessages: string[] = []; const migrated = applyDeprecations( settings, @@ -37,40 +37,30 @@ const applyConfigDeprecations = (settings: Record = {}) => { describe('Config Deprecations', () => { it('does not report deprecations for default configuration', () => { - const defaultConfig = { data: { autocomplete: { valueSuggestions: {} } } }; + const defaultConfig = { data: { search: { sessions: {} } } }; const { messages, migrated } = applyConfigDeprecations(cloneDeep(defaultConfig)); expect(migrated).toEqual(defaultConfig); expect(messages).toHaveLength(0); }); - it('renames kibana.autocompleteTerminateAfter to data.autocomplete.valueSuggestions.terminateAfter', () => { + it('renames xpack.data_enhanced.search.sessions.* to data.search.sessions.*', () => { const config = { - kibana: { - autocompleteTerminateAfter: 123, + xpack: { + data_enhanced: { + search: { + sessions: { + enabled: false, + }, + }, + }, }, }; const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); - expect(migrated.kibana?.autocompleteTerminateAfter).not.toBeDefined(); - expect(migrated.data.autocomplete.valueSuggestions.terminateAfter).toEqual(123); + expect(migrated.xpack?.data_enhanced).not.toBeDefined(); + expect(migrated.data.search.sessions.enabled).toEqual(false); expect(messages).toMatchInlineSnapshot(` Array [ - "Setting \\"kibana.autocompleteTerminateAfter\\" has been replaced by \\"data.autocomplete.valueSuggestions.terminateAfter\\"", - ] - `); - }); - - it('renames kibana.autocompleteTimeout to data.autocomplete.valueSuggestions.timeout', () => { - const config = { - kibana: { - autocompleteTimeout: 123, - }, - }; - const { messages, migrated } = applyConfigDeprecations(cloneDeep(config)); - expect(migrated.kibana?.autocompleteTimeout).not.toBeDefined(); - expect(migrated.data.autocomplete.valueSuggestions.timeout).toEqual(123); - expect(messages).toMatchInlineSnapshot(` - Array [ - "Setting \\"kibana.autocompleteTimeout\\" has been replaced by \\"data.autocomplete.valueSuggestions.timeout\\"", + "Setting \\"xpack.data_enhanced.search.sessions\\" has been replaced by \\"data.search.sessions\\"", ] `); }); diff --git a/src/plugins/data/server/config_deprecations.ts b/src/plugins/data/server/config_deprecations.ts index 7f704dac1f431..dcc168f306e1e 100644 --- a/src/plugins/data/server/config_deprecations.ts +++ b/src/plugins/data/server/config_deprecations.ts @@ -8,15 +8,8 @@ import type { ConfigDeprecationProvider } from '@kbn/core/server'; -export const autocompleteConfigDeprecationProvider: ConfigDeprecationProvider = ({ - renameFromRoot, -}) => [ - renameFromRoot( - 'kibana.autocompleteTerminateAfter', - 'data.autocomplete.valueSuggestions.terminateAfter', - { level: 'warning' } - ), - renameFromRoot('kibana.autocompleteTimeout', 'data.autocomplete.valueSuggestions.timeout', { +export const configDeprecationProvider: ConfigDeprecationProvider = ({ renameFromRoot }) => [ + renameFromRoot('xpack.data_enhanced.search.sessions', 'data.search.sessions', { level: 'warning', }), ]; diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index b970221c43391..cac9f9c08209e 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -70,6 +70,7 @@ import { // tabify calcAutoIntervalLessThan, } from '../common'; +import { configDeprecationProvider } from './config_deprecations'; export type { ParsedInterval, @@ -122,6 +123,7 @@ export type { DataPluginSetup as PluginSetup, DataPluginStart as PluginStart }; export { DataServerPlugin as Plugin }; export const config: PluginConfigDescriptor = { + deprecations: configDeprecationProvider, exposeToBrowser: { search: true, }, diff --git a/src/plugins/data/server/plugin.ts b/src/plugins/data/server/plugin.ts index d1beb335dd35c..70fa72b1634cb 100644 --- a/src/plugins/data/server/plugin.ts +++ b/src/plugins/data/server/plugin.ts @@ -12,9 +12,14 @@ import { BfetchServerSetup } from '@kbn/bfetch-plugin/server'; import { PluginStart as DataViewsServerPluginStart } from '@kbn/data-views-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import type { SecurityPluginSetup } from '@kbn/security-plugin/server'; import { ConfigSchema } from '../config'; +import type { ISearchSetup, ISearchStart } from './search'; import { DatatableUtilitiesService } from './datatable_utilities'; -import type { ISearchSetup, ISearchStart, SearchEnhancements } from './search'; import { SearchService } from './search/search_service'; import { QueryService } from './query/query_service'; import { ScriptsService } from './scripts'; @@ -22,10 +27,6 @@ import { KqlTelemetryService } from './kql_telemetry'; import { getUiSettings } from './ui_settings'; import { QuerySetup } from './query'; -interface DataEnhancements { - search: SearchEnhancements; -} - export interface DataPluginSetup { search: ISearchSetup; query: QuerySetup; @@ -33,10 +34,6 @@ export interface DataPluginSetup { * @deprecated - use "fieldFormats" plugin directly instead */ fieldFormats: FieldFormatsSetup; - /** - * @internal - */ - __enhance: (enhancements: DataEnhancements) => void; } export interface DataPluginStart { @@ -58,12 +55,15 @@ export interface DataPluginSetupDependencies { expressions: ExpressionsServerSetup; usageCollection?: UsageCollectionSetup; fieldFormats: FieldFormatsSetup; + taskManager?: TaskManagerSetupContract; + security?: SecurityPluginSetup; } export interface DataPluginStartDependencies { fieldFormats: FieldFormatsStart; logger: Logger; dataViews: DataViewsServerPluginStart; + taskManager?: TaskManagerStartContract; } export class DataServerPlugin @@ -90,7 +90,14 @@ export class DataServerPlugin public setup( core: CoreSetup, - { bfetch, expressions, usageCollection, fieldFormats }: DataPluginSetupDependencies + { + bfetch, + expressions, + usageCollection, + fieldFormats, + taskManager, + security, + }: DataPluginSetupDependencies ) { this.scriptsService.setup(core); const querySetup = this.queryService.setup(core); @@ -102,20 +109,26 @@ export class DataServerPlugin bfetch, expressions, usageCollection, + security, + taskManager, }); return { - __enhance: (enhancements: DataEnhancements) => { - searchSetup.__enhance(enhancements.search); - }, search: searchSetup, query: querySetup, fieldFormats, }; } - public start(core: CoreStart, { fieldFormats, dataViews }: DataPluginStartDependencies) { - const search = this.searchService.start(core, { fieldFormats, indexPatterns: dataViews }); + public start( + core: CoreStart, + { fieldFormats, dataViews, taskManager }: DataPluginStartDependencies + ) { + const search = this.searchService.start(core, { + fieldFormats, + indexPatterns: dataViews, + taskManager, + }); const datatableUtilities = new DatatableUtilitiesService( search.aggs, dataViews, diff --git a/src/plugins/data/server/search/collectors/fetch.ts b/src/plugins/data/server/search/collectors/search/fetch.ts similarity index 100% rename from src/plugins/data/server/search/collectors/fetch.ts rename to src/plugins/data/server/search/collectors/search/fetch.ts diff --git a/src/plugins/data/server/search/collectors/index.ts b/src/plugins/data/server/search/collectors/search/index.ts similarity index 100% rename from src/plugins/data/server/search/collectors/index.ts rename to src/plugins/data/server/search/collectors/search/index.ts diff --git a/src/plugins/data/server/search/collectors/register.ts b/src/plugins/data/server/search/collectors/search/register.ts similarity index 100% rename from src/plugins/data/server/search/collectors/register.ts rename to src/plugins/data/server/search/collectors/search/register.ts diff --git a/src/plugins/data/server/search/collectors/usage.ts b/src/plugins/data/server/search/collectors/search/usage.ts similarity index 97% rename from src/plugins/data/server/search/collectors/usage.ts rename to src/plugins/data/server/search/collectors/search/usage.ts index 5b1904737b9bc..c3e09257a4628 100644 --- a/src/plugins/data/server/search/collectors/usage.ts +++ b/src/plugins/data/server/search/collectors/search/usage.ts @@ -8,8 +8,8 @@ import { once, debounce } from 'lodash'; import type { CoreSetup, Logger } from '@kbn/core/server'; -import type { IEsSearchResponse, ISearchOptions } from '../../../common'; -import { isCompleteResponse } from '../../../common'; +import type { IEsSearchResponse, ISearchOptions } from '../../../../common'; +import { isCompleteResponse } from '../../../../common'; import { CollectedUsage } from './register'; const SAVED_OBJECT_ID = 'search-telemetry'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts b/src/plugins/data/server/search/collectors/search_session/fetch.test.ts similarity index 92% rename from x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts rename to src/plugins/data/server/search/collectors/search_session/fetch.test.ts index 260577298e81b..1290b06b94ee0 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/fetch.test.ts +++ b/src/plugins/data/server/search/collectors/search_session/fetch.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { SavedObjectsErrorHelpers, Logger } from '@kbn/core/server'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/fetch.ts b/src/plugins/data/server/search/collectors/search_session/fetch.ts similarity index 89% rename from x-pack/plugins/data_enhanced/server/collectors/fetch.ts rename to src/plugins/data/server/search/collectors/search_session/fetch.ts index eb3b50b3a64e9..536ca4b168188 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/fetch.ts +++ b/src/plugins/data/server/search/collectors/search_session/fetch.ts @@ -1,14 +1,16 @@ /* * 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. + * 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 type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { Logger } from '@kbn/core/server'; import { CollectorFetchContext } from '@kbn/usage-collection-plugin/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; import { ReportedUsage } from './register'; +import { SEARCH_SESSION_TYPE } from '../../../../common'; interface SessionPersistedTermsBucket { key_as_string: 'false' | 'true'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/index.ts b/src/plugins/data/server/search/collectors/search_session/index.ts similarity index 53% rename from x-pack/plugins/data_enhanced/server/collectors/index.ts rename to src/plugins/data/server/search/collectors/search_session/index.ts index 4a82c76e96dee..c52a71b6c98f3 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/index.ts +++ b/src/plugins/data/server/search/collectors/search_session/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { registerUsageCollector } from './register'; diff --git a/x-pack/plugins/data_enhanced/server/collectors/register.ts b/src/plugins/data/server/search/collectors/search_session/register.ts similarity index 84% rename from x-pack/plugins/data_enhanced/server/collectors/register.ts rename to src/plugins/data/server/search/collectors/search_session/register.ts index 6b98627fce11f..c6ea85a2b53d3 100644 --- a/x-pack/plugins/data_enhanced/server/collectors/register.ts +++ b/src/plugins/data/server/search/collectors/search_session/register.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { Logger } from '@kbn/core/server'; diff --git a/src/plugins/data/server/search/index.ts b/src/plugins/data/server/search/index.ts index b7087e95c0a2c..a61a74609cc6f 100644 --- a/src/plugins/data/server/search/index.ts +++ b/src/plugins/data/server/search/index.ts @@ -10,8 +10,8 @@ export * from './types'; export * from './strategies/es_search'; export * from './strategies/ese_search'; export * from './strategies/eql_search'; -export type { SearchUsage } from './collectors'; -export { usageProvider, searchUsageObserver } from './collectors'; +export type { SearchUsage } from './collectors/search'; +export { usageProvider, searchUsageObserver } from './collectors/search'; export * from './aggs'; export * from './session'; export * from './errors/no_search_id_in_session'; diff --git a/src/plugins/data/server/search/mocks.ts b/src/plugins/data/server/search/mocks.ts index 740be105703a7..31944922c7b44 100644 --- a/src/plugins/data/server/search/mocks.ts +++ b/src/plugins/data/server/search/mocks.ts @@ -16,7 +16,6 @@ export function createSearchSetupMock(): jest.Mocked { return { aggs: searchAggsSetupMock(), registerSearchStrategy: jest.fn(), - __enhance: jest.fn(), searchSource: searchSourceMock.createSetupContract(), }; } diff --git a/src/plugins/data/server/search/routes/index.ts b/src/plugins/data/server/search/routes/index.ts index 0a4f5467c8fa9..f118a3bb4b6c9 100644 --- a/src/plugins/data/server/search/routes/index.ts +++ b/src/plugins/data/server/search/routes/index.ts @@ -7,3 +7,4 @@ */ export * from './search'; +export * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/routes/session.test.ts b/src/plugins/data/server/search/routes/session.test.ts similarity index 94% rename from x-pack/plugins/data_enhanced/server/routes/session.test.ts rename to src/plugins/data/server/search/routes/session.test.ts index c6625a3491886..20dbac04a7674 100644 --- a/x-pack/plugins/data_enhanced/server/routes/session.test.ts +++ b/src/plugins/data/server/search/routes/session.test.ts @@ -1,16 +1,18 @@ /* * 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. + * 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 type { MockedKeys } from '@kbn/utility-types/jest'; import type { CoreSetup, Logger } from '@kbn/core/server'; import { coreMock, httpServerMock } from '@kbn/core/server/mocks'; -import type { PluginStart as DataPluginStart } from '@kbn/data-plugin/server'; -import { dataPluginMock } from '@kbn/data-plugin/server/mocks'; +import type { PluginStart as DataPluginStart } from '../..'; +import { dataPluginMock } from '../../mocks'; + import { registerSessionRoutes } from './session'; enum PostHandlerIndex { diff --git a/x-pack/plugins/data_enhanced/server/routes/session.ts b/src/plugins/data/server/search/routes/session.ts similarity index 95% rename from x-pack/plugins/data_enhanced/server/routes/session.ts rename to src/plugins/data/server/search/routes/session.ts index a0eea258c4db5..6106a69df207a 100644 --- a/x-pack/plugins/data_enhanced/server/routes/session.ts +++ b/src/plugins/data/server/search/routes/session.ts @@ -1,18 +1,19 @@ /* * 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. + * 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 { schema } from '@kbn/config-schema'; import { Logger } from '@kbn/core/server'; import { reportServerError } from '@kbn/kibana-utils-plugin/server'; -import { DataEnhancedPluginRouter } from '../type'; +import { DataPluginRouter } from '../types'; const STORE_SEARCH_SESSIONS_ROLE_TAG = `access:store_search_session`; -export function registerSessionRoutes(router: DataEnhancedPluginRouter, logger: Logger): void { +export function registerSessionRoutes(router: DataPluginRouter, logger: Logger): void { router.post( { path: '/internal/session', diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/index.ts b/src/plugins/data/server/search/saved_objects/index.ts similarity index 51% rename from x-pack/plugins/data_enhanced/server/saved_objects/index.ts rename to src/plugins/data/server/search/saved_objects/index.ts index 3736eb7e0394b..207cd6e64ea4a 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/index.ts +++ b/src/plugins/data/server/search/saved_objects/index.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 * from './search_session'; diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts b/src/plugins/data/server/search/saved_objects/search_session.ts similarity index 85% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts rename to src/plugins/data/server/search/saved_objects/search_session.ts index 68f37e1e2adac..c77c8379af365 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session.ts +++ b/src/plugins/data/server/search/saved_objects/search_session.ts @@ -1,12 +1,13 @@ /* * 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. + * 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 { SavedObjectsType } from '@kbn/core/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; +import { SEARCH_SESSION_TYPE } from '../../../common'; import { searchSessionSavedObjectMigrations } from './search_session_migration'; export const searchSessionSavedObjectType: SavedObjectsType = { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts b/src/plugins/data/server/search/saved_objects/search_session_migration.test.ts similarity index 97% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts rename to src/plugins/data/server/search/saved_objects/search_session_migration.test.ts index a94b22de5b0ed..251d57e884ac1 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.test.ts +++ b/src/plugins/data/server/search/saved_objects/search_session_migration.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { @@ -12,7 +13,7 @@ import { SearchSessionSavedObjectAttributesPre$8$0$0, } from './search_session_migration'; import { SavedObject } from '@kbn/core/types'; -import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../common'; import { SavedObjectMigrationContext } from '@kbn/core/server'; describe('7.12.0 -> 7.13.0', () => { diff --git a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts b/src/plugins/data/server/search/saved_objects/search_session_migration.ts similarity index 93% rename from x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts rename to src/plugins/data/server/search/saved_objects/search_session_migration.ts index f2de5df91de95..314db0fb8b58f 100644 --- a/x-pack/plugins/data_enhanced/server/saved_objects/search_session_migration.ts +++ b/src/plugins/data/server/search/saved_objects/search_session_migration.ts @@ -1,15 +1,16 @@ /* * 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. + * 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 { SavedObjectMigrationMap, SavedObjectUnsanitizedDoc } from '@kbn/core/server'; import { SearchSessionSavedObjectAttributes as SearchSessionSavedObjectAttributesLatest, SearchSessionStatus, -} from '@kbn/data-plugin/common'; +} from '../../../common'; /** * Search sessions were released in 7.12.0 diff --git a/src/plugins/data/server/search/search_service.test.ts b/src/plugins/data/server/search/search_service.test.ts index 121de2e068e3c..663b28e733e29 100644 --- a/src/plugins/data/server/search/search_service.test.ts +++ b/src/plugins/data/server/search/search_service.test.ts @@ -22,7 +22,6 @@ import type { IEsSearchResponse, IScopedSearchClient, IScopedSearchSessionsClient, - ISearchSessionService, ISearchStart, ISearchStrategy, } from '.'; @@ -32,6 +31,16 @@ import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks'; import { createSearchSessionsClientMock } from './mocks'; import { ENHANCED_ES_SEARCH_STRATEGY } from '../../common'; +let mockSessionClient: jest.Mocked; +jest.mock('./session', () => { + class SearchSessionService { + asScopedProvider = () => (request: any) => mockSessionClient; + } + return { + SearchSessionService, + }; +}); + describe('Search service', () => { let plugin: SearchService; let mockCoreSetup: MockedKeys>; @@ -88,8 +97,7 @@ describe('Search service', () => { let searchPluginStart: ISearchStart>; let mockStrategy: any; let mockStrategyNoCancel: jest.Mocked; - let mockSessionService: ISearchSessionService; - let mockSessionClient: jest.Mocked; + const sessionId = '1234'; beforeEach(() => { @@ -104,9 +112,6 @@ describe('Search service', () => { }; mockSessionClient = createSearchSessionsClientMock(); - mockSessionService = { - asScopedProvider: () => (request: any) => mockSessionClient, - }; const pluginSetup = plugin.setup(mockCoreSetup, { bfetch: bfetchPluginMock.createSetupContract(), @@ -114,9 +119,6 @@ describe('Search service', () => { }); pluginSetup.registerSearchStrategy(ENHANCED_ES_SEARCH_STRATEGY, mockStrategy); pluginSetup.registerSearchStrategy('nocancel', mockStrategyNoCancel); - pluginSetup.__enhance({ - sessionService: mockSessionService, - }); searchPluginStart = plugin.start(mockCoreStart, { fieldFormats: createFieldFormatsStartMock(), diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts index c59893cdead96..36479b3c5298c 100644 --- a/src/plugins/data/server/search/search_service.ts +++ b/src/plugins/data/server/search/search_service.ts @@ -26,58 +26,63 @@ import { FieldFormatsStart } from '@kbn/field-formats-plugin/server'; import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { KbnServerError } from '@kbn/kibana-utils-plugin/server'; import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import type { SecurityPluginSetup } from '@kbn/security-plugin/server'; +import type { + DataRequestHandlerContext, IScopedSearchClient, ISearchSetup, ISearchStart, ISearchStrategy, - SearchEnhancements, SearchStrategyDependencies, - DataRequestHandlerContext, } from './types'; import { AggsService } from './aggs'; import { IndexPatternsServiceStart } from '../data_views'; -import { registerSearchRoute } from './routes'; +import { registerSearchRoute, registerSessionRoutes } from './routes'; import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './strategies/es_search'; import { DataPluginStart, DataPluginStartDependencies } from '../plugin'; -import { registerUsageCollector } from './collectors/register'; -import { usageProvider } from './collectors/usage'; +import { usageProvider } from './collectors/search/usage'; +import { registerUsageCollector as registerSearchUsageCollector } from './collectors/search/register'; +import { registerUsageCollector as registerSearchSessionUsageCollector } from './collectors/search_session/register'; import { searchTelemetry } from '../saved_objects'; import { + cidrFunction, + dateRangeFunction, + ENHANCED_ES_SEARCH_STRATEGY, + EQL_SEARCH_STRATEGY, + esRawResponse, existsFilterFunction, + extendedBoundsFunction, fieldFunction, + geoBoundingBoxFunction, + geoPointFunction, IEsSearchRequest, IEsSearchResponse, IKibanaSearchRequest, IKibanaSearchResponse, - ISearchOptions, - cidrFunction, - dateRangeFunction, - extendedBoundsFunction, - geoBoundingBoxFunction, - geoPointFunction, ipRangeFunction, + ISearchOptions, kibana, kibanaContext, - kibanaTimerangeFunction, kibanaFilterFunction, + kibanaTimerangeFunction, kqlFunction, luceneFunction, numericalRangeFunction, + phraseFilterFunction, queryFilterFunction, rangeFilterFunction, - removeFilterFunction, selectFilterFunction, rangeFunction, + removeFilterFunction, SearchSourceDependencies, searchSourceRequiredUiSettings, SearchSourceService, - phraseFilterFunction, - esRawResponse, eqlRawResponse, - ENHANCED_ES_SEARCH_STRATEGY, - EQL_SEARCH_STRATEGY, SQL_SEARCH_STRATEGY, } from '../../common/search'; import { getEsaggs, getEsdsl, getEql } from './expressions'; @@ -87,7 +92,7 @@ import { } from '../../common/search/aggs/buckets/shard_delay'; import { aggShardDelay } from '../../common/search/aggs/buckets/shard_delay_fn'; import { ConfigSchema } from '../../config'; -import { ISearchSessionService, SearchSessionService } from './session'; +import { SearchSessionService } from './session'; import { registerBsearchRoute } from './routes/bsearch'; import { getKibanaContext } from './expressions/kibana_context'; import { enhancedEsSearchStrategyProvider } from './strategies/ese_search'; @@ -95,6 +100,7 @@ import { eqlSearchStrategyProvider } from './strategies/eql_search'; import { NoSearchIdInSessionError } from './errors/no_search_id_in_session'; import { CachedUiSettingsClient } from './services'; import { sqlSearchStrategyProvider } from './strategies/sql_search'; +import { searchSessionSavedObjectType } from './saved_objects'; type StrategyMap = Record>; @@ -103,12 +109,15 @@ export interface SearchServiceSetupDependencies { bfetch: BfetchServerSetup; expressions: ExpressionsServerSetup; usageCollection?: UsageCollectionSetup; + taskManager?: TaskManagerSetupContract; + security?: SecurityPluginSetup; } /** @internal */ export interface SearchServiceStartDependencies { fieldFormats: FieldFormatsStart; indexPatterns: IndexPatternsServiceStart; + taskManager?: TaskManagerStartContract; } /** @internal */ @@ -121,7 +130,7 @@ export class SearchService implements Plugin { private readonly aggsService = new AggsService(); private readonly searchSourceService = new SearchSourceService(); private searchStrategies: StrategyMap = {}; - private sessionService: ISearchSessionService; + private sessionService: SearchSessionService; private asScoped!: ISearchStart['asScoped']; private searchAsInternalUser!: ISearchStrategy; @@ -129,17 +138,31 @@ export class SearchService implements Plugin { private initializerContext: PluginInitializerContext, private readonly logger: Logger ) { - this.sessionService = new SearchSessionService(); + this.sessionService = new SearchSessionService( + logger, + initializerContext.config.get(), + initializerContext.env.packageInfo.version + ); } public setup( core: CoreSetup, - { bfetch, expressions, usageCollection }: SearchServiceSetupDependencies + { bfetch, expressions, usageCollection, taskManager, security }: SearchServiceSetupDependencies ): ISearchSetup { + core.savedObjects.registerType(searchSessionSavedObjectType); const usage = usageCollection ? usageProvider(core) : undefined; const router = core.http.createRouter(); registerSearchRoute(router); + registerSessionRoutes(router, this.logger); + + if (taskManager) { + this.sessionService.setup(core, { taskManager, security }); + } else { + // this should never happen in real world, but + // taskManager and security are optional deps because they are in x-pack + this.logger.debug('Skipping sessionService setup because taskManager is not available'); + } core.http.registerRouteHandlerContext( 'search', @@ -188,7 +211,12 @@ export class SearchService implements Plugin { core.savedObjects.registerType(searchTelemetry); if (usageCollection) { - registerUsageCollector(usageCollection, core.savedObjects.getKibanaIndex()); + registerSearchUsageCollector(usageCollection, core.savedObjects.getKibanaIndex()); + registerSearchSessionUsageCollector( + usageCollection, + core.savedObjects.getKibanaIndex(), + this.logger + ); } expressions.registerFunction(getEsaggs({ getStartServices: core.getStartServices })); @@ -229,9 +257,6 @@ export class SearchService implements Plugin { }); return { - __enhance: (enhancements: SearchEnhancements) => { - this.sessionService = enhancements.sessionService; - }, aggs, registerSearchStrategy: this.registerSearchStrategy, usage, @@ -241,9 +266,14 @@ export class SearchService implements Plugin { public start( core: CoreStart, - { fieldFormats, indexPatterns }: SearchServiceStartDependencies + { fieldFormats, indexPatterns, taskManager }: SearchServiceStartDependencies ): ISearchStart { const { elasticsearch, savedObjects, uiSettings } = core; + + if (taskManager) { + this.sessionService.start(core, { taskManager }); + } + this.asScoped = this.asScopedProvider(core); return { aggs: this.aggsService.start({ diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts b/src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts similarity index 96% rename from x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts rename to src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts index d7e472f4b3245..edbef1938a82f 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.test.ts +++ b/src/plugins/data/server/search/session/check_non_persisted_sessions.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { checkNonPersistedSessions as checkNonPersistedSessions$ } from './check_non_persisted_sessions'; @@ -11,25 +12,28 @@ import { SearchSessionSavedObjectAttributes, ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchStatus } from './types'; +import { CheckSearchSessionsDeps, SearchStatus } from './types'; import moment from 'moment'; import { SavedObjectsBulkUpdateObject, SavedObjectsDeleteOptions, SavedObjectsClientContract, } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; jest.useFakeTimers(); -const checkNonPersistedSessions = (deps: CheckSearchSessionsDeps, config: SearchSessionsConfig) => - checkNonPersistedSessions$(deps, config).toPromise(); +const checkNonPersistedSessions = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema +) => checkNonPersistedSessions$(deps, config).toPromise(); describe('checkNonPersistedSessions', () => { let mockClient: any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, notTouchedInProgressTimeout: moment.duration(1, 'm'), diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts b/src/plugins/data/server/search/session/check_non_persisted_sessions.ts similarity index 91% rename from x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts rename to src/plugins/data/server/search/session/check_non_persisted_sessions.ts index 20903d4508bb1..86f377db57d23 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_non_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/check_non_persisted_sessions.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { SavedObjectsFindResult } from '@kbn/core/server'; @@ -16,17 +17,18 @@ import { SearchSessionSavedObjectAttributes, SearchSessionStatus, KueryNode, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchStatus } from './types'; +import { CheckSearchSessionsDeps, SearchStatus } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_CLEANUP_TASK_TYPE = 'search_sessions_cleanup'; export const SEARCH_SESSIONS_CLEANUP_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_CLEANUP_TASK_TYPE}`; function isSessionStale( session: SavedObjectsFindResult, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const curTime = moment(); // Delete cancelled sessions immediately @@ -45,7 +47,7 @@ function isSessionStale( function checkNonPersistedSessionsPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ) { @@ -118,7 +120,7 @@ function checkNonPersistedSessionsPage( export function checkNonPersistedSessions( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts b/src/plugins/data/server/search/session/check_persisted_sessions.test.ts similarity index 87% rename from x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts rename to src/plugins/data/server/search/session/check_persisted_sessions.test.ts index f27dba05d88e1..1e6de567a0d76 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.test.ts +++ b/src/plugins/data/server/search/session/check_persisted_sessions.test.ts @@ -1,20 +1,21 @@ /* * 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. + * 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 { checkPersistedSessionsProgress } from './check_persisted_sessions'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig } from './types'; import moment from 'moment'; import { SavedObjectsClientContract } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; describe('checkPersistedSessionsProgress', () => { let mockClient: any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, notTouchedInProgressTimeout: moment.duration(1, 'm'), diff --git a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts b/src/plugins/data/server/search/session/check_persisted_sessions.ts similarity index 81% rename from x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts rename to src/plugins/data/server/search/session/check_persisted_sessions.ts index 2f4cfaaa015c6..915d8af3fe80f 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/check_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/check_persisted_sessions.ts @@ -1,28 +1,25 @@ /* * 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. + * 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 { EMPTY, Observable } from 'rxjs'; import { catchError, concatMap } from 'rxjs/operators'; -import { - nodeBuilder, - SEARCH_SESSION_TYPE, - SearchSessionStatus, - KueryNode, -} from '@kbn/data-plugin/common'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus, KueryNode } from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_TASK_TYPE = 'search_sessions_monitor'; export const SEARCH_SESSIONS_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_TASK_TYPE}`; function checkPersistedSessionsPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ): Observable { @@ -50,7 +47,7 @@ function checkPersistedSessionsPage( export function checkPersistedSessionsProgress( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts b/src/plugins/data/server/search/session/expire_persisted_sessions.ts similarity index 80% rename from x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts rename to src/plugins/data/server/search/session/expire_persisted_sessions.ts index dfc77935d2275..77ae9d3f5a155 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/expire_persisted_sessions.ts +++ b/src/plugins/data/server/search/session/expire_persisted_sessions.ts @@ -1,28 +1,25 @@ /* * 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. + * 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 { EMPTY, Observable } from 'rxjs'; import { catchError, concatMap } from 'rxjs/operators'; -import { - nodeBuilder, - SEARCH_SESSION_TYPE, - SearchSessionStatus, - KueryNode, -} from '@kbn/data-plugin/common'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus, KueryNode } from '../../../common'; import { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionsConfig, CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse } from './types'; import { bulkUpdateSessions, getAllSessionsStatusUpdates } from './update_session_status'; +import { SearchSessionsConfigSchema } from '../../../config'; export const SEARCH_SESSIONS_EXPIRE_TASK_TYPE = 'search_sessions_expire'; export const SEARCH_SESSIONS_EXPIRE_TASK_ID = `data_enhanced_${SEARCH_SESSIONS_EXPIRE_TASK_TYPE}`; function checkSessionExpirationPage( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filter: KueryNode, page: number ): Observable { @@ -46,7 +43,7 @@ function checkSessionExpirationPage( export function checkPersistedCompletedSessionExpiration( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ) { const { logger } = deps; diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts b/src/plugins/data/server/search/session/get_search_session_page.test.ts similarity index 94% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts rename to src/plugins/data/server/search/session/get_search_session_page.test.ts index d78e0567eaec4..43a8f987dc8fc 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.test.ts +++ b/src/plugins/data/server/search/session/get_search_session_page.test.ts @@ -1,24 +1,27 @@ /* * 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. + * 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 { checkSearchSessionsByPage, getSearchSessionsPage$ } from './get_search_session_page'; -import { SearchSessionStatus, ENHANCED_ES_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; +import { ENHANCED_ES_SEARCH_STRATEGY, SearchSessionStatus } from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchStatus } from './types'; import moment from 'moment'; import { SavedObjectsClientContract } from '@kbn/core/server'; import { of, Subject, throwError } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { SearchSessionsConfigSchema } from '../../../config'; + jest.useFakeTimers(); describe('checkSearchSessionsByPage', () => { const mockClient = {} as any; let savedObjectsClient: jest.Mocked; - const config: SearchSessionsConfig = { + const config: SearchSessionsConfigSchema = { enabled: true, pageSize: 5, management: {} as any, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts b/src/plugins/data/server/search/session/get_search_session_page.ts similarity index 81% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts rename to src/plugins/data/server/search/session/get_search_session_page.ts index f59883350898b..30dc72eaa6813 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_session_page.ts +++ b/src/plugins/data/server/search/session/get_search_session_page.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { SavedObjectsClientContract, Logger } from '@kbn/core/server'; @@ -12,8 +13,9 @@ import { SearchSessionSavedObjectAttributes, SEARCH_SESSION_TYPE, KueryNode, -} from '@kbn/data-plugin/common'; -import { CheckSearchSessionsDeps, CheckSearchSessionsFn, SearchSessionsConfig } from './types'; +} from '../../../common'; +import { CheckSearchSessionsDeps, CheckSearchSessionsFn } from './types'; +import { SearchSessionsConfigSchema } from '../../../config'; export interface GetSessionsDeps { savedObjectsClient: SavedObjectsClientContract; @@ -43,7 +45,7 @@ export function getSearchSessionsPage$( export const checkSearchSessionsByPage = ( checkFn: CheckSearchSessionsFn, deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, filters: any, nextPage = 1 ): Observable => diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts b/src/plugins/data/server/search/session/get_search_status.test.ts similarity index 92% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts rename to src/plugins/data/server/search/session/get_search_status.test.ts index 9bb4537f331ab..20fcc6935b0d6 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.test.ts +++ b/src/plugins/data/server/search/session/get_search_status.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { SearchStatus } from './types'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts b/src/plugins/data/server/search/session/get_search_status.ts similarity index 80% rename from x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts rename to src/plugins/data/server/search/session/get_search_status.ts index 26a31fdbac20d..3ded923376b18 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_search_status.ts +++ b/src/plugins/data/server/search/session/get_search_status.ts @@ -1,15 +1,16 @@ /* * 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. + * 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 { TransportResult } from '@elastic/elasticsearch'; import { ElasticsearchClient } from '@kbn/core/server'; -import { SearchSessionRequestInfo } from '@kbn/data-plugin/common'; -import { AsyncSearchStatusResponse } from '@kbn/data-plugin/server'; +import { SearchSessionRequestInfo } from '../../../common'; +import { AsyncSearchStatusResponse } from '../..'; import { SearchStatus } from './types'; export async function getSearchStatus( @@ -30,7 +31,7 @@ export async function getSearchStatus( if ((response.is_partial && !response.is_running) || response.completion_status >= 400) { return { status: SearchStatus.ERROR, - error: i18n.translate('xpack.data.search.statusError', { + error: i18n.translate('data.search.statusError', { defaultMessage: `Search completed with a {errorCode} status`, values: { errorCode: response.completion_status }, }), @@ -49,7 +50,7 @@ export async function getSearchStatus( } catch (e) { return { status: SearchStatus.ERROR, - error: i18n.translate('xpack.data.search.statusThrow', { + error: i18n.translate('data.search.statusThrow', { defaultMessage: `Search status threw an error {message} ({errorCode}) status`, values: { message: e.message, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts b/src/plugins/data/server/search/session/get_session_status.test.ts similarity index 85% rename from x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts rename to src/plugins/data/server/search/session/get_session_status.test.ts index e15e494fdd6b9..db75e322edda5 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.test.ts +++ b/src/plugins/data/server/search/session/get_session_status.test.ts @@ -1,19 +1,21 @@ /* * 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. + * 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 { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchStatus } from './types'; import { getSessionStatus } from './get_session_status'; -import { SearchSessionStatus } from '@kbn/data-plugin/common'; +import { SearchSessionStatus } from '../../../common'; import moment from 'moment'; +import { SearchSessionsConfigSchema } from '../../../config'; describe('getSessionStatus', () => { const mockConfig = { notTouchedInProgressTimeout: moment.duration(1, 'm'), - } as unknown as SearchSessionsConfig; + } as unknown as SearchSessionsConfigSchema; test("returns an in_progress status if there's nothing inside the session", () => { const session: any = { idMapping: {}, diff --git a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts b/src/plugins/data/server/search/session/get_session_status.ts similarity index 75% rename from x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts rename to src/plugins/data/server/search/session/get_session_status.ts index d6a4670c5e396..4614ea92318e9 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/get_session_status.ts +++ b/src/plugins/data/server/search/session/get_session_status.ts @@ -1,17 +1,19 @@ /* * 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. + * 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 moment from 'moment'; -import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '@kbn/data-plugin/common'; -import { SearchSessionsConfig, SearchStatus } from './types'; +import { SearchSessionSavedObjectAttributes, SearchSessionStatus } from '../../../common'; +import { SearchStatus } from './types'; +import { SearchSessionsConfigSchema } from '../../../config'; export function getSessionStatus( session: SearchSessionSavedObjectAttributes, - config: SearchSessionsConfig + config: SearchSessionsConfigSchema ): SearchSessionStatus { const searchStatuses = Object.values(session.idMapping); const curTime = moment(); diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts b/src/plugins/data/server/search/session/session_service.test.ts similarity index 98% rename from x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts rename to src/plugins/data/server/search/session/session_service.test.ts index 0f7f4975082a6..9f780239ea023 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.test.ts +++ b/src/plugins/data/server/search/session/session_service.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { @@ -17,9 +18,9 @@ import moment from 'moment'; import { coreMock } from '@kbn/core/server/mocks'; import { ConfigSchema } from '../../../config'; import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks'; -import { AuthenticatedUser } from '@kbn/security-plugin/common/model'; -import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus } from '@kbn/data-plugin/common'; -import { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; +import type { AuthenticatedUser } from '@kbn/security-plugin/common/model'; +import { nodeBuilder, SEARCH_SESSION_TYPE, SearchSessionStatus } from '../../../common'; +import type { TaskManagerStartContract } from '@kbn/task-manager-plugin/server'; const MAX_UPDATE_RETRIES = 3; @@ -81,13 +82,14 @@ describe('SearchSessionService', () => { management: {} as any, }, }, - }; + } as unknown as ConfigSchema; const mockLogger: any = { debug: jest.fn(), warn: jest.fn(), error: jest.fn(), }; service = new SearchSessionService(mockLogger, config, '8.0.0'); + service.setup(coreMock.createSetup(), { taskManager: taskManagerMock.createSetup() }); const coreStart = coreMock.createStart(); mockTaskManager = taskManagerMock.createStart(); await flushPromises(); @@ -161,13 +163,14 @@ describe('SearchSessionService', () => { management: {} as any, }, }, - }; + } as unknown as ConfigSchema; const mockLogger: any = { debug: jest.fn(), warn: jest.fn(), error: jest.fn(), }; service = new SearchSessionService(mockLogger, config, '8.0.0'); + service.setup(coreMock.createSetup(), { taskManager: taskManagerMock.createSetup() }); const coreStart = coreMock.createStart(); mockTaskManager = taskManagerMock.createStart(); await flushPromises(); diff --git a/src/plugins/data/server/search/session/session_service.ts b/src/plugins/data/server/search/session/session_service.ts index a23b315e47211..02f12a972f8b5 100644 --- a/src/plugins/data/server/search/session/session_service.ts +++ b/src/plugins/data/server/search/session/session_service.ts @@ -6,47 +6,549 @@ * Side Public License, v 1. */ -import { ISearchSessionService } from './types'; +import { notFound } from '@hapi/boom'; +import { debounce } from 'lodash'; +import { nodeBuilder, fromKueryExpression } from '@kbn/es-query'; +import { + CoreSetup, + CoreStart, + KibanaRequest, + SavedObjectsClientContract, + Logger, + SavedObject, + SavedObjectsFindOptions, + SavedObjectsErrorHelpers, +} from '@kbn/core/server'; +import type { AuthenticatedUser, SecurityPluginSetup } from '@kbn/security-plugin/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { + IKibanaSearchRequest, + ISearchOptions, + ENHANCED_ES_SEARCH_STRATEGY, + SEARCH_SESSION_TYPE, + SearchSessionRequestInfo, + SearchSessionSavedObjectAttributes, + SearchSessionStatus, +} from '../../../common'; +import { ISearchSessionService, NoSearchIdInSessionError } from '../..'; +import { createRequestHash } from './utils'; +import { ConfigSchema, SearchSessionsConfigSchema } from '../../../config'; +import { + registerSearchSessionsTask, + scheduleSearchSessionsTask, + unscheduleSearchSessionsTask, +} from './setup_task'; +import { SearchStatus } from './types'; +import { + checkPersistedSessionsProgress, + SEARCH_SESSIONS_TASK_ID, + SEARCH_SESSIONS_TASK_TYPE, +} from './check_persisted_sessions'; +import { + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + checkNonPersistedSessions, + SEARCH_SESSIONS_CLEANUP_TASK_ID, +} from './check_non_persisted_sessions'; +import { + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + SEARCH_SESSIONS_EXPIRE_TASK_ID, + checkPersistedCompletedSessionExpiration, +} from './expire_persisted_sessions'; -/** - * The OSS session service, which leaves most search session-related logic unimplemented. - * @see x-pack/plugins/data_enhanced/server/search/session/session_service.ts - * @internal - */ -export class SearchSessionService implements ISearchSessionService { - constructor() {} +export interface SearchSessionDependencies { + savedObjectsClient: SavedObjectsClientContract; +} +interface SetupDependencies { + taskManager: TaskManagerSetupContract; + security?: SecurityPluginSetup; +} - public asScopedProvider() { - return () => ({ - getId: () => { - throw new Error('getId not implemented in OSS search session service'); - }, - trackId: async () => {}, - getSearchIdMapping: async () => new Map(), - save: async () => { - throw new Error('save not implemented in OSS search session service'); - }, - get: async () => { - throw new Error('get not implemented in OSS search session service'); - }, - find: async () => { - throw new Error('find not implemented in OSS search session service'); - }, - update: async () => { - throw new Error('update not implemented in OSS search session service'); - }, - extend: async () => { - throw new Error('extend not implemented in OSS search session service'); - }, - cancel: async () => { - throw new Error('cancel not implemented in OSS search session service'); - }, - delete: async () => { - throw new Error('delete not implemented in OSS search session service'); - }, - getConfig: () => { - return null; +interface StartDependencies { + taskManager: TaskManagerStartContract; +} + +const DEBOUNCE_UPDATE_OR_CREATE_WAIT = 1000; +const DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT = 5000; + +interface UpdateOrCreateQueueEntry { + deps: SearchSessionDependencies; + user: AuthenticatedUser | null; + sessionId: string; + attributes: Partial; + resolve: () => void; + reject: (reason?: unknown) => void; +} + +function sleep(ms: number) { + return new Promise((r) => setTimeout(r, ms)); +} +export class SearchSessionService + implements ISearchSessionService +{ + private sessionConfig: SearchSessionsConfigSchema; + private readonly updateOrCreateBatchQueue: UpdateOrCreateQueueEntry[] = []; + private security?: SecurityPluginSetup; + private setupCompleted = false; + + constructor( + private readonly logger: Logger, + private readonly config: ConfigSchema, + private readonly version: string + ) { + this.sessionConfig = this.config.search.sessions; + } + + public setup(core: CoreSetup, deps: SetupDependencies) { + this.security = deps.security; + const taskDeps = { + config: this.config, + taskManager: deps.taskManager, + logger: this.logger, + }; + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_TASK_TYPE, + 'persisted session progress', + checkPersistedSessionsProgress + ); + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + 'non persisted session cleanup', + checkNonPersistedSessions + ); + + registerSearchSessionsTask( + core, + taskDeps, + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + 'complete session expiration', + checkPersistedCompletedSessionExpiration + ); + + this.setupCompleted = true; + } + + public async start(core: CoreStart, deps: StartDependencies) { + if (!this.setupCompleted) + throw new Error('SearchSessionService setup() must be called before start()'); + + return this.setupMonitoring(core, deps); + } + + public stop() {} + + private setupMonitoring = async (core: CoreStart, deps: StartDependencies) => { + const taskDeps = { + config: this.config, + taskManager: deps.taskManager, + logger: this.logger, + }; + + if (this.sessionConfig.enabled) { + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_TASK_ID, + SEARCH_SESSIONS_TASK_TYPE, + this.sessionConfig.trackingInterval + ); + + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_CLEANUP_TASK_ID, + SEARCH_SESSIONS_CLEANUP_TASK_TYPE, + this.sessionConfig.cleanupInterval + ); + + scheduleSearchSessionsTask( + taskDeps, + SEARCH_SESSIONS_EXPIRE_TASK_ID, + SEARCH_SESSIONS_EXPIRE_TASK_TYPE, + this.sessionConfig.expireInterval + ); + } else { + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_TASK_ID); + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_CLEANUP_TASK_ID); + unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_EXPIRE_TASK_ID); + } + }; + + private processUpdateOrCreateBatchQueue = debounce( + () => { + const queue = [...this.updateOrCreateBatchQueue]; + if (queue.length === 0) return; + this.updateOrCreateBatchQueue.length = 0; + const batchedSessionAttributes = queue.reduce((res, next) => { + if (!res[next.sessionId]) { + res[next.sessionId] = next.attributes; + } else { + res[next.sessionId] = { + ...res[next.sessionId], + ...next.attributes, + idMapping: { + ...res[next.sessionId].idMapping, + ...next.attributes.idMapping, + }, + }; + } + return res; + }, {} as { [sessionId: string]: Partial }); + + Object.keys(batchedSessionAttributes).forEach((sessionId) => { + const thisSession = queue.filter((s) => s.sessionId === sessionId); + this.updateOrCreate( + thisSession[0].deps, + thisSession[0].user, + sessionId, + batchedSessionAttributes[sessionId] + ) + .then(() => { + thisSession.forEach((s) => s.resolve()); + }) + .catch((e) => { + thisSession.forEach((s) => s.reject(e)); + }); + }); + }, + DEBOUNCE_UPDATE_OR_CREATE_WAIT, + { maxWait: DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT } + ); + private scheduleUpdateOrCreate = ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ): Promise => { + return new Promise((resolve, reject) => { + this.updateOrCreateBatchQueue.push({ deps, user, sessionId, attributes, resolve, reject }); + // TODO: this would be better if we'd debounce per sessionId + this.processUpdateOrCreateBatchQueue(); + }); + }; + + private updateOrCreate = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial, + retry: number = 1 + ): Promise | undefined> => { + const retryOnConflict = async (e: any) => { + this.logger.debug(`Conflict error | ${sessionId}`); + // Randomize sleep to spread updates out in case of conflicts + await sleep(100 + Math.random() * 50); + return await this.updateOrCreate(deps, user, sessionId, attributes, retry + 1); + }; + + this.logger.debug(`updateOrCreate | ${sessionId} | ${retry}`); + try { + return (await this.update( + deps, + user, + sessionId, + attributes + )) as SavedObject; + } catch (e) { + if (SavedObjectsErrorHelpers.isNotFoundError(e)) { + try { + this.logger.debug(`Object not found | ${sessionId}`); + return await this.create(deps, user, sessionId, attributes); + } catch (createError) { + if ( + SavedObjectsErrorHelpers.isConflictError(createError) && + retry < this.sessionConfig.maxUpdateRetries + ) { + return await retryOnConflict(createError); + } else { + this.logger.error(createError); + } + } + } else if ( + SavedObjectsErrorHelpers.isConflictError(e) && + retry < this.sessionConfig.maxUpdateRetries + ) { + return await retryOnConflict(e); + } else { + this.logger.error(e); + } + } + + return undefined; + }; + + public save = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + { + name, + appId, + locatorId, + initialState = {}, + restoreState = {}, + }: Partial + ) => { + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + if (!name) throw new Error('Name is required'); + if (!appId) throw new Error('AppId is required'); + if (!locatorId) throw new Error('locatorId is required'); + + return this.updateOrCreate(deps, user, sessionId, { + name, + appId, + locatorId, + initialState, + restoreState, + persisted: true, + }); + }; + + private create = ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ) => { + this.logger.debug(`create | ${sessionId}`); + + const realmType = user?.authentication_realm.type; + const realmName = user?.authentication_realm.name; + const username = user?.username; + + return savedObjectsClient.create( + SEARCH_SESSION_TYPE, + { + sessionId, + status: SearchSessionStatus.IN_PROGRESS, + expires: new Date( + Date.now() + this.sessionConfig.defaultExpiration.asMilliseconds() + ).toISOString(), + created: new Date().toISOString(), + touched: new Date().toISOString(), + idMapping: {}, + persisted: false, + version: this.version, + realmType, + realmName, + username, + ...attributes, }, + { id: sessionId } + ); + }; + + public get = async ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + this.logger.debug(`get | ${sessionId}`); + const session = await savedObjectsClient.get( + SEARCH_SESSION_TYPE, + sessionId + ); + this.throwOnUserConflict(user, session); + return session; + }; + + public find = ( + { savedObjectsClient }: SearchSessionDependencies, + user: AuthenticatedUser | null, + options: Omit + ) => { + const userFilters = + user === null + ? [] + : [ + nodeBuilder.is( + `${SEARCH_SESSION_TYPE}.attributes.realmType`, + `${user.authentication_realm.type}` + ), + nodeBuilder.is( + `${SEARCH_SESSION_TYPE}.attributes.realmName`, + `${user.authentication_realm.name}` + ), + nodeBuilder.is(`${SEARCH_SESSION_TYPE}.attributes.username`, `${user.username}`), + ]; + const filterKueryNode = + typeof options.filter === 'string' ? fromKueryExpression(options.filter) : options.filter; + const filter = nodeBuilder.and(userFilters.concat(filterKueryNode ?? [])); + return savedObjectsClient.find({ + ...options, + filter, + type: SEARCH_SESSION_TYPE, + }); + }; + + public update = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + attributes: Partial + ) => { + this.logger.debug(`update | ${sessionId}`); + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + await this.get(deps, user, sessionId); // Verify correct user + return deps.savedObjectsClient.update( + SEARCH_SESSION_TYPE, + sessionId, + { + ...attributes, + touched: new Date().toISOString(), + } + ); + }; + + public async extend( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string, + expires: Date + ) { + this.logger.debug(`extend | ${sessionId}`); + return this.update(deps, user, sessionId, { expires: expires.toISOString() }); + } + + public cancel = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + this.logger.debug(`delete | ${sessionId}`); + return this.update(deps, user, sessionId, { + status: SearchSessionStatus.CANCELLED, + }); + }; + + public delete = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) => { + if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); + this.logger.debug(`delete | ${sessionId}`); + await this.get(deps, user, sessionId); // Verify correct user + return deps.savedObjectsClient.delete(SEARCH_SESSION_TYPE, sessionId); + }; + + /** + * Tracks the given search request/search ID in the saved session. + * @internal + */ + public trackId = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + searchRequest: IKibanaSearchRequest, + searchId: string, + { sessionId, strategy = ENHANCED_ES_SEARCH_STRATEGY }: ISearchOptions + ) => { + if (!this.sessionConfig.enabled || !sessionId || !searchId) return; + this.logger.debug(`trackId | ${sessionId} | ${searchId}`); + + let idMapping: Record = {}; + + if (searchRequest.params) { + const requestHash = createRequestHash(searchRequest.params); + const searchInfo = { + id: searchId, + strategy, + status: SearchStatus.IN_PROGRESS, + }; + idMapping = { [requestHash]: searchInfo }; + } + + await this.scheduleUpdateOrCreate(deps, user, sessionId, { idMapping }); + }; + + public async getSearchIdMapping( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + sessionId: string + ) { + const searchSession = await this.get(deps, user, sessionId); + const searchIdMapping = new Map(); + Object.values(searchSession.attributes.idMapping).forEach((requestInfo) => { + searchIdMapping.set(requestInfo.id, requestInfo.strategy); }); + return searchIdMapping; } + + /** + * Look up an existing search ID that matches the given request in the given session so that the + * request can continue rather than restart. + * @internal + */ + public getId = async ( + deps: SearchSessionDependencies, + user: AuthenticatedUser | null, + searchRequest: IKibanaSearchRequest, + { sessionId, isStored, isRestore }: ISearchOptions + ) => { + if (!this.sessionConfig.enabled) { + throw new Error('Search sessions are disabled'); + } else if (!sessionId) { + throw new Error('Session ID is required'); + } else if (!isStored) { + throw new Error('Cannot get search ID from a session that is not stored'); + } else if (!isRestore) { + throw new Error('Get search ID is only supported when restoring a session'); + } + + const session = await this.get(deps, user, sessionId); + const requestHash = createRequestHash(searchRequest.params); + if (!session.attributes.idMapping.hasOwnProperty(requestHash)) { + this.logger.error(`getId | ${sessionId} | ${requestHash} not found`); + throw new NoSearchIdInSessionError(); + } + this.logger.debug(`getId | ${sessionId} | ${requestHash}`); + + return session.attributes.idMapping[requestHash].id; + }; + + public asScopedProvider = ({ savedObjects }: CoreStart) => { + return (request: KibanaRequest) => { + const user = this.security?.authc.getCurrentUser(request) ?? null; + const savedObjectsClient = savedObjects.getScopedClient(request, { + includedHiddenTypes: [SEARCH_SESSION_TYPE], + }); + const deps = { savedObjectsClient }; + return { + getId: this.getId.bind(this, deps, user), + trackId: this.trackId.bind(this, deps, user), + getSearchIdMapping: this.getSearchIdMapping.bind(this, deps, user), + save: this.save.bind(this, deps, user), + get: this.get.bind(this, deps, user), + find: this.find.bind(this, deps, user), + update: this.update.bind(this, deps, user), + extend: this.extend.bind(this, deps, user), + cancel: this.cancel.bind(this, deps, user), + delete: this.delete.bind(this, deps, user), + getConfig: () => this.config.search.sessions, + }; + }; + }; + + private throwOnUserConflict = ( + user: AuthenticatedUser | null, + session?: SavedObject + ) => { + if (user === null || !session) return; + if ( + user.authentication_realm.type !== session.attributes.realmType || + user.authentication_realm.name !== session.attributes.realmName || + user.username !== session.attributes.username + ) { + this.logger.debug( + `User ${user.username} has no access to search session ${session.attributes.sessionId}` + ); + throw notFound(); + } + }; } diff --git a/x-pack/plugins/data_enhanced/server/search/session/setup_task.ts b/src/plugins/data/server/search/session/setup_task.ts similarity index 88% rename from x-pack/plugins/data_enhanced/server/search/session/setup_task.ts rename to src/plugins/data/server/search/session/setup_task.ts index a8d47d5babd57..5fe44b0901b79 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/setup_task.ts +++ b/src/plugins/data/server/search/session/setup_task.ts @@ -1,17 +1,17 @@ /* * 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. + * 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 { Duration } from 'moment'; import { filter, takeUntil } from 'rxjs/operators'; import { BehaviorSubject } from 'rxjs'; -import { RunContext, TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server'; +import type { RunContext, TaskRunCreatorFunction } from '@kbn/task-manager-plugin/server'; import { CoreSetup, SavedObjectsClient } from '@kbn/core/server'; -import { SEARCH_SESSION_TYPE } from '@kbn/data-plugin/common'; -import { DataEnhancedStartDependencies } from '../../type'; +import { SEARCH_SESSION_TYPE } from '../../../common'; import { SearchSessionTaskSetupDeps, SearchSessionTaskStartDeps, @@ -19,7 +19,7 @@ import { } from './types'; export function searchSessionTaskRunner( - core: CoreSetup, + core: CoreSetup, deps: SearchSessionTaskSetupDeps, title: string, checkFn: SearchSessionTaskFn @@ -68,7 +68,7 @@ export function searchSessionTaskRunner( } export function registerSearchSessionsTask( - core: CoreSetup, + core: CoreSetup, deps: SearchSessionTaskSetupDeps, taskType: string, title: string, diff --git a/src/plugins/data/server/search/session/types.ts b/src/plugins/data/server/search/session/types.ts index 76c4cff37cfa2..e564a8cef9e79 100644 --- a/src/plugins/data/server/search/session/types.ts +++ b/src/plugins/data/server/search/session/types.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { Observable } from 'rxjs'; import { CoreStart, KibanaRequest, @@ -13,9 +14,17 @@ import { SavedObjectsFindOptions, SavedObjectsFindResponse, SavedObjectsUpdateResponse, + ElasticsearchClient, + Logger, + SavedObjectsClientContract, } from '@kbn/core/server'; +import type { + TaskManagerSetupContract, + TaskManagerStartContract, +} from '@kbn/task-manager-plugin/server'; +import { KueryNode, SearchSessionSavedObjectAttributes } from '../../../common'; import { IKibanaSearchRequest, ISearchOptions } from '../../../common/search'; -import { SearchSessionsConfigSchema } from '../../../config'; +import { SearchSessionsConfigSchema, ConfigSchema } from '../../../config'; export interface IScopedSearchSessionsClient { getId: (request: IKibanaSearchRequest, options: ISearchOptions) => Promise; @@ -38,3 +47,44 @@ export interface IScopedSearchSessionsClient { export interface ISearchSessionService { asScopedProvider: (core: CoreStart) => (request: KibanaRequest) => IScopedSearchSessionsClient; } + +export enum SearchStatus { + IN_PROGRESS = 'in_progress', + ERROR = 'error', + COMPLETE = 'complete', +} + +export interface CheckSearchSessionsDeps { + savedObjectsClient: SavedObjectsClientContract; + client: ElasticsearchClient; + logger: Logger; +} + +export interface SearchSessionTaskSetupDeps { + taskManager: TaskManagerSetupContract; + logger: Logger; + config: ConfigSchema; +} + +export interface SearchSessionTaskStartDeps { + taskManager: TaskManagerStartContract; + logger: Logger; + config: ConfigSchema; +} + +export type SearchSessionTaskFn = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema +) => Observable; + +export type SearchSessionsResponse = SavedObjectsFindResponse< + SearchSessionSavedObjectAttributes, + unknown +>; + +export type CheckSearchSessionsFn = ( + deps: CheckSearchSessionsDeps, + config: SearchSessionsConfigSchema, + filter: KueryNode, + page: number +) => Observable; diff --git a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts b/src/plugins/data/server/search/session/update_session_status.test.ts similarity index 97% rename from x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts rename to src/plugins/data/server/search/session/update_session_status.test.ts index 03bdad773f647..38e8ec6cad150 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.test.ts +++ b/src/plugins/data/server/search/session/update_session_status.test.ts @@ -1,12 +1,13 @@ /* * 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. + * 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 { bulkUpdateSessions, updateSessionStatus } from './update_session_status'; -import { SearchSessionStatus, SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; +import { SearchSessionStatus, SearchSessionSavedObjectAttributes } from '../../../common'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import { SearchStatus } from './types'; import moment from 'moment'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts b/src/plugins/data/server/search/session/update_session_status.ts similarity index 90% rename from x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts rename to src/plugins/data/server/search/session/update_session_status.ts index 2f6ef6ab3fc53..e8405eb5427b0 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/update_session_status.ts +++ b/src/plugins/data/server/search/session/update_session_status.ts @@ -1,29 +1,26 @@ /* * 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. + * 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 { SavedObjectsFindResult, SavedObjectsUpdateResponse } from '@kbn/core/server'; +import { SearchSessionsConfigSchema } from '../../../config'; import { SearchSessionRequestInfo, SearchSessionSavedObjectAttributes, SearchSessionStatus, -} from '@kbn/data-plugin/common'; +} from '../../../common'; import { getSearchStatus } from './get_search_status'; import { getSessionStatus } from './get_session_status'; -import { - CheckSearchSessionsDeps, - SearchSessionsConfig, - SearchSessionsResponse, - SearchStatus, -} from './types'; +import { CheckSearchSessionsDeps, SearchSessionsResponse, SearchStatus } from './types'; import { isSearchSessionExpired } from './utils'; export async function updateSessionStatus( { logger, client }: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, session: SavedObjectsFindResult ) { let sessionUpdated = false; @@ -85,7 +82,7 @@ export async function updateSessionStatus( export async function getAllSessionsStatusUpdates( deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, + config: SearchSessionsConfigSchema, searchSessions: SearchSessionsResponse ) { const updatedSessions = new Array>(); diff --git a/x-pack/plugins/data_enhanced/server/search/session/utils.test.ts b/src/plugins/data/server/search/session/utils.test.ts similarity index 75% rename from x-pack/plugins/data_enhanced/server/search/session/utils.test.ts rename to src/plugins/data/server/search/session/utils.test.ts index 9e142bf25a56a..fea5510f860d7 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/utils.test.ts +++ b/src/plugins/data/server/search/session/utils.test.ts @@ -1,8 +1,9 @@ /* * 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. + * 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 { createRequestHash } from './utils'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/utils.ts b/src/plugins/data/server/search/session/utils.ts similarity index 78% rename from x-pack/plugins/data_enhanced/server/search/session/utils.ts rename to src/plugins/data/server/search/session/utils.ts index f7f3c3c17505b..241f8cbbfd029 100644 --- a/x-pack/plugins/data_enhanced/server/search/session/utils.ts +++ b/src/plugins/data/server/search/session/utils.ts @@ -1,15 +1,16 @@ /* * 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. + * 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 { createHash } from 'crypto'; import stringify from 'json-stable-stringify'; import { SavedObjectsFindResult } from '@kbn/core/server'; import moment from 'moment'; -import { SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; +import { SearchSessionSavedObjectAttributes } from '../../../common'; /** * Generate the hash for this request so that, in the future, this hash can be used to look up diff --git a/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts index 02ebd10f7cb07..741174ac01613 100644 --- a/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/es_search/es_search_strategy.ts @@ -11,10 +11,10 @@ import { tap } from 'rxjs/operators'; import type { Logger, SharedGlobalConfig } from '@kbn/core/server'; import { getKbnServerError, KbnServerError } from '@kbn/kibana-utils-plugin/server'; import type { ISearchStrategy } from '../../types'; -import type { SearchUsage } from '../../collectors'; +import type { SearchUsage } from '../../collectors/search'; import { getDefaultSearchParams, getShardTimeout } from './request_utils'; import { shimHitsTotal, toKibanaSearchResponse } from './response_utils'; -import { searchUsageObserver } from '../../collectors/usage'; +import { searchUsageObserver } from '../../collectors/search/usage'; export const esSearchStrategyProvider = ( config$: Observable, @@ -30,7 +30,7 @@ export const esSearchStrategyProvider = ( */ search: (request, { abortSignal, ...options }, { esClient, uiSettingsClient }) => { // Only default index pattern type is supported here. - // See data_enhanced for other type support. + // See ese for other type support. if (request.indexType) { throw new KbnServerError(`Unsupported index pattern type ${request.indexType}`, 400); } diff --git a/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts index 11229e99526db..450407800e7af 100644 --- a/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts +++ b/src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts @@ -26,7 +26,7 @@ import { getIgnoreThrottled, } from './request_utils'; import { toAsyncKibanaSearchResponse } from './response_utils'; -import { SearchUsage, searchUsageObserver } from '../../collectors'; +import { SearchUsage, searchUsageObserver } from '../../collectors/search'; import { getDefaultSearchParams, getShardTimeout, diff --git a/src/plugins/data/server/search/types.ts b/src/plugins/data/server/search/types.ts index 70e04e97ea169..2d2a10300ee69 100644 --- a/src/plugins/data/server/search/types.ts +++ b/src/plugins/data/server/search/types.ts @@ -26,12 +26,8 @@ import { SearchSourceService, } from '../../common/search'; import { AggsSetup, AggsStart } from './aggs'; -import { SearchUsage } from './collectors'; -import type { IScopedSearchSessionsClient, ISearchSessionService } from './session'; - -export interface SearchEnhancements { - sessionService: ISearchSessionService; -} +import { SearchUsage } from './collectors/search'; +import type { IScopedSearchSessionsClient } from './session'; export interface SearchStrategyDependencies { savedObjectsClient: SavedObjectsClientContract; @@ -60,11 +56,6 @@ export interface ISearchSetup { */ usage?: SearchUsage; - /** - * @internal - */ - __enhance: (enhancements: SearchEnhancements) => void; - searchSource: ReturnType; } diff --git a/src/plugins/data/tsconfig.json b/src/plugins/data/tsconfig.json index b618a047f375d..8f391fc15e871 100644 --- a/src/plugins/data/tsconfig.json +++ b/src/plugins/data/tsconfig.json @@ -13,6 +13,7 @@ "config.ts", "common/**/*.json", "public/**/*.json", + "../../../typings/index.d.ts" ], "references": [ { "path": "../../core/tsconfig.json" }, @@ -24,6 +25,9 @@ { "path": "../kibana_utils/tsconfig.json" }, { "path": "../kibana_react/tsconfig.json" }, { "path": "../field_formats/tsconfig.json" }, - { "path": "../data_views/tsconfig.json" } + { "path": "../data_views/tsconfig.json" }, + { "path": "../screenshot_mode/tsconfig.json" }, + { "path": "../../../x-pack/plugins/task_manager/tsconfig.json" }, + { "path": "../../../x-pack/plugins/security/tsconfig.json" } ] } diff --git a/src/plugins/es_ui_shared/kibana.json b/src/plugins/es_ui_shared/kibana.json index 1a4ff33674f95..c7fd36e0c1467 100644 --- a/src/plugins/es_ui_shared/kibana.json +++ b/src/plugins/es_ui_shared/kibana.json @@ -14,5 +14,5 @@ "static/forms/components", "static/forms/helpers/field_validators/types" ], - "requiredBundles": ["data", "kibanaReact"] + "requiredBundles": ["dataViews", "kibanaReact"] } diff --git a/src/plugins/es_ui_shared/public/indices/constants/index.ts b/src/plugins/es_ui_shared/public/indices/constants/index.ts index f7858c94dcab9..01bd15bedc26a 100644 --- a/src/plugins/es_ui_shared/public/indices/constants/index.ts +++ b/src/plugins/es_ui_shared/public/indices/constants/index.ts @@ -6,11 +6,11 @@ * Side Public License, v 1. */ -import { indexPatterns } from '@kbn/data-plugin/public'; +import { ILLEGAL_CHARACTERS_VISIBLE } from '@kbn/data-views-plugin/public'; -export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...indexPatterns.ILLEGAL_CHARACTERS_VISIBLE, '*']; +export const INDEX_ILLEGAL_CHARACTERS_VISIBLE = [...ILLEGAL_CHARACTERS_VISIBLE, '*']; // Insert the comma into the middle, so it doesn't look as if it has grammatical meaning when // these characters are rendered in the UI. -const insertionIndex = Math.floor(indexPatterns.ILLEGAL_CHARACTERS_VISIBLE.length / 2); +const insertionIndex = Math.floor(ILLEGAL_CHARACTERS_VISIBLE.length / 2); INDEX_ILLEGAL_CHARACTERS_VISIBLE.splice(insertionIndex, 0, ','); diff --git a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts index 52cd12b09a32e..3edb6b2c0090a 100644 --- a/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts +++ b/src/plugins/es_ui_shared/static/forms/helpers/field_validators/index_pattern_field.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { indexPatterns } from '@kbn/data-plugin/public'; +import { validateDataView } from '@kbn/data-views-plugin/public'; import { ValidationFunc } from '../../hook_form_lib'; import { containsChars } from '../../../validators/string'; import { ERROR_CODE } from './types'; @@ -34,7 +34,7 @@ export const indexPatternField = } // Validate illegal characters - const errors = indexPatterns.validate(value); + const errors = validateDataView(value); if (errors.ILLEGAL_CHARACTERS) { return { diff --git a/src/plugins/es_ui_shared/tsconfig.json b/src/plugins/es_ui_shared/tsconfig.json index 38e6cf78f8f60..90459058eec71 100644 --- a/src/plugins/es_ui_shared/tsconfig.json +++ b/src/plugins/es_ui_shared/tsconfig.json @@ -15,6 +15,6 @@ ], "references": [ { "path": "../../core/tsconfig.json" }, - { "path": "../data/tsconfig.json" } + { "path": "../data_views/tsconfig.json" } ] } diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index ca9a57bb4462a..308be959ba67a 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -215,6 +215,19 @@ } } }, + "search-session": { + "properties": { + "transientCount": { + "type": "long" + }, + "persistedCount": { + "type": "long" + }, + "totalCount": { + "type": "long" + } + } + }, "sample-data": { "properties": { "installed": { diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index c4c9d86a4df2f..32fc3be58d39c 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -91,6 +91,20 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'unifiedSearch.autocomplete.valueSuggestions.tiers (array)', 'unifiedSearch.autocomplete.valueSuggestions.timeout (duration)', 'data.search.aggs.shardDelay.enabled (boolean)', + 'data.search.sessions.cleanupInterval (duration)', + 'data.search.sessions.defaultExpiration (duration)', + 'data.search.sessions.enabled (boolean)', + 'data.search.sessions.expireInterval (duration)', + 'data.search.sessions.management.expiresSoonWarning (duration)', + 'data.search.sessions.management.maxSessions (number)', + 'data.search.sessions.management.refreshInterval (duration)', + 'data.search.sessions.management.refreshTimeout (duration)', + 'data.search.sessions.maxUpdateRetries (number)', + 'data.search.sessions.monitoringTaskTimeout (duration)', + 'data.search.sessions.notTouchedInProgressTimeout (duration)', + 'data.search.sessions.notTouchedTimeout (duration)', + 'data.search.sessions.pageSize (number)', + 'data.search.sessions.trackingInterval (duration)', 'enterpriseSearch.host (string)', 'home.disableWelcomeScreen (boolean)', 'map.emsFileApiUrl (string)', @@ -154,20 +168,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.cloud.id (string)', 'xpack.cloud.organization_url (string)', 'xpack.cloud.profile_url (string)', - 'xpack.data_enhanced.search.sessions.cleanupInterval (duration)', - 'xpack.data_enhanced.search.sessions.defaultExpiration (duration)', - 'xpack.data_enhanced.search.sessions.enabled (boolean)', - 'xpack.data_enhanced.search.sessions.expireInterval (duration)', - 'xpack.data_enhanced.search.sessions.management.expiresSoonWarning (duration)', - 'xpack.data_enhanced.search.sessions.management.maxSessions (number)', - 'xpack.data_enhanced.search.sessions.management.refreshInterval (duration)', - 'xpack.data_enhanced.search.sessions.management.refreshTimeout (duration)', - 'xpack.data_enhanced.search.sessions.maxUpdateRetries (number)', - 'xpack.data_enhanced.search.sessions.monitoringTaskTimeout (duration)', - 'xpack.data_enhanced.search.sessions.notTouchedInProgressTimeout (duration)', - 'xpack.data_enhanced.search.sessions.notTouchedTimeout (duration)', - 'xpack.data_enhanced.search.sessions.pageSize (number)', - 'xpack.data_enhanced.search.sessions.trackingInterval (duration)', 'xpack.discoverEnhanced.actions.exploreDataInChart.enabled (boolean)', 'xpack.discoverEnhanced.actions.exploreDataInContextMenu.enabled (boolean)', 'xpack.fleet.agents.enabled (boolean)', diff --git a/test/scripts/jenkins_storybook.sh b/test/scripts/jenkins_storybook.sh index e03494e13677d..a07a634d2dba2 100755 --- a/test/scripts/jenkins_storybook.sh +++ b/test/scripts/jenkins_storybook.sh @@ -10,7 +10,7 @@ yarn storybook --site ci_composite yarn storybook --site custom_integrations yarn storybook --site dashboard yarn storybook --site dashboard_enhanced -yarn storybook --site data_enhanced +yarn storybook --site data yarn storybook --site embeddable yarn storybook --site expression_error yarn storybook --site expression_image diff --git a/tsconfig.base.json b/tsconfig.base.json index ac35847201b7f..78023a603276a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -295,8 +295,6 @@ "@kbn/cross-cluster-replication-plugin/*": ["x-pack/plugins/cross_cluster_replication/*"], "@kbn/dashboard-enhanced-plugin": ["x-pack/plugins/dashboard_enhanced"], "@kbn/dashboard-enhanced-plugin/*": ["x-pack/plugins/dashboard_enhanced/*"], - "@kbn/data-enhanced-plugin": ["x-pack/plugins/data_enhanced"], - "@kbn/data-enhanced-plugin/*": ["x-pack/plugins/data_enhanced/*"], "@kbn/data-visualizer-plugin": ["x-pack/plugins/data_visualizer"], "@kbn/data-visualizer-plugin/*": ["x-pack/plugins/data_visualizer/*"], "@kbn/discover-enhanced-plugin": ["x-pack/plugins/discover_enhanced"], diff --git a/tsconfig.types.json b/tsconfig.types.json index 54a26b6aca404..0217a2cde12bb 100644 --- a/tsconfig.types.json +++ b/tsconfig.types.json @@ -7,17 +7,11 @@ "declaration": true, "emitDeclarationOnly": true, "declarationMap": true, + "rootDir": "./src" }, "include": [ "src/core/server/index.ts", "src/core/public/index.ts", - "src/plugins/data/server/index.ts", - "src/plugins/data/public/index.ts", - "src/plugins/embeddable/server/index.ts", - "src/plugins/embeddable/public/index.ts", - "src/plugins/expressions/server/index.ts", - "src/plugins/expressions/public/index.ts", - "src/plugins/ui_actions/public/index.ts", "typings" ] } diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index a632593f8b96b..b1464f5cfbe2e 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -14,7 +14,6 @@ "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.discover": "plugins/discover_enhanced", "xpack.crossClusterReplication": "plugins/cross_cluster_replication", - "xpack.data": "plugins/data_enhanced", "xpack.embeddableEnhanced": "plugins/embeddable_enhanced", "xpack.endpoint": "plugins/endpoint", "xpack.enterpriseSearch": "plugins/enterprise_search", diff --git a/x-pack/plugins/actions/tsconfig.json b/x-pack/plugins/actions/tsconfig.json index aad127a6ca94c..6fced06e2057f 100644 --- a/x-pack/plugins/actions/tsconfig.json +++ b/x-pack/plugins/actions/tsconfig.json @@ -15,6 +15,7 @@ ], "references": [ { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../spaces/tsconfig.json" }, { "path": "../security/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, diff --git a/x-pack/plugins/data_enhanced/README.md b/x-pack/plugins/data_enhanced/README.md deleted file mode 100644 index fba484261fea2..0000000000000 --- a/x-pack/plugins/data_enhanced/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# data_enhanced - -The `data_enhanced` plugin is the x-pack counterpart to the `src/plguins/data` plugin. - -It exists to provide services, or parts of services, which -enhance existing functionality from `src/plugins/data`. - -Currently, the `data_enhanced` plugin doesn't return any APIs which you can -consume directly, however it is possible that you are indirectly relying on the -enhanced functionality that it provides via the `data` plugin from `src/`. - -Here is the functionality it adds: - -## Search Sessions - -Search sessions are handy when you want to enable a user to run something asynchronously (for example, a dashboard over a long period of time), and then quickly restore the results at a later time. The Search Service transparently fetches results from the .async-search index, instead of running each request again. diff --git a/x-pack/plugins/data_enhanced/common/index.ts b/x-pack/plugins/data_enhanced/common/index.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/data_enhanced/common/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * 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. - */ diff --git a/x-pack/plugins/data_enhanced/common/search/index.ts b/x-pack/plugins/data_enhanced/common/search/index.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * 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. - */ diff --git a/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json b/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json deleted file mode 100644 index b79a396445e3d..0000000000000 --- a/x-pack/plugins/data_enhanced/common/search/test_data/search_phase_execution_exception.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "error": { - "root_cause": [ - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "parse_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]: [failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]]" - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - }, - { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - } - } - ], - "type": "search_phase_execution_exception", - "reason": "all shards failed", - "phase": "query", - "grouped": true, - "failed_shards": [ - { - "shard": 0, - "index": ".apm-agent-configuration", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".apm-custom-link", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".kibana-event-log-8.0.0-000001", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "parse_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]: [failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]]", - "caused_by": { - "type": "illegal_argument_exception", - "reason": "failed to parse date field [2021-01-19T12:2755.047Z] with format [strict_date_optional_time]", - "caused_by": { - "type": "date_time_parse_exception", - "reason": "Text '2021-01-19T12:2755.047Z' could not be parsed, unparsed text found at index 16" - } - } - } - }, - { - "shard": 0, - "index": ".kibana_1", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".kibana_task_manager_1", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - }, - { - "shard": 0, - "index": ".security-7", - "node": "DEfMVCg5R12TRG4CYIxUgQ", - "reason": { - "type": "script_exception", - "reason": "compile error", - "script_stack": [ - "invalid", - "^---- HERE" - ], - "script": "invalid", - "lang": "painless", - "position": { - "offset": 0, - "start": 0, - "end": 7 - }, - "caused_by": { - "type": "illegal_argument_exception", - "reason": "cannot resolve symbol [invalid]" - } - } - } - ] - }, - "status": 400 -} \ No newline at end of file diff --git a/x-pack/plugins/data_enhanced/config.ts b/x-pack/plugins/data_enhanced/config.ts deleted file mode 100644 index eb3ee0da41839..0000000000000 --- a/x-pack/plugins/data_enhanced/config.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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. - */ - -import { schema, TypeOf } from '@kbn/config-schema'; -import { searchSessionsConfigSchema } from '@kbn/data-plugin/config'; - -export const configSchema = schema.object({ - search: schema.object({ - sessions: searchSessionsConfigSchema, - }), -}); - -export type ConfigSchema = TypeOf; diff --git a/x-pack/plugins/data_enhanced/jest.config.js b/x-pack/plugins/data_enhanced/jest.config.js deleted file mode 100644 index e48de352c2075..0000000000000 --- a/x-pack/plugins/data_enhanced/jest.config.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../..', - roots: ['/x-pack/plugins/data_enhanced'], - coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/data_enhanced', - coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/plugins/data_enhanced/{common,public,server}/**/*.{ts,tsx}', - ], -}; diff --git a/x-pack/plugins/data_enhanced/kibana.json b/x-pack/plugins/data_enhanced/kibana.json deleted file mode 100644 index d89e76013ebd4..0000000000000 --- a/x-pack/plugins/data_enhanced/kibana.json +++ /dev/null @@ -1,29 +0,0 @@ - -{ - "id": "dataEnhanced", - "version": "8.0.0", - "kibanaVersion": "kibana", - "owner": { - "name": "App Services", - "githubTeam": "kibana-app-services" - }, - "configPath": ["xpack", "data_enhanced"], - "requiredPlugins": [ - "bfetch", - "data", - "features", - "management", - "share", - "taskManager", - "screenshotMode" - ], - "optionalPlugins": ["kibanaUtils", "usageCollection", "security"], - "server": true, - "ui": true, - "requiredBundles": ["kibanaUtils", "kibanaReact"], - "owner": { - "name": "App Services", - "githubTeam": "kibana-app-services" - }, - "description": "Enhanced data plugin. (See src/plugins/data.) Enhances the main data plugin with a search session management UI. Includes a reusable search session indicator component to use in other applications. Exposes routes for managing search sessions. Includes a service that monitors, updates, and cleans up search session saved objects." -} diff --git a/x-pack/plugins/data_enhanced/public/index.ts b/x-pack/plugins/data_enhanced/public/index.ts deleted file mode 100644 index 7af1aff1b3106..0000000000000 --- a/x-pack/plugins/data_enhanced/public/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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. - */ - -import { PluginInitializerContext } from '@kbn/core/public'; -import { DataEnhancedPlugin, DataEnhancedSetup, DataEnhancedStart } from './plugin'; -import { ConfigSchema } from '../config'; - -export const plugin = (initializerContext: PluginInitializerContext) => - new DataEnhancedPlugin(initializerContext); - -export type { DataEnhancedSetup, DataEnhancedStart }; - -export { ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; diff --git a/x-pack/plugins/data_enhanced/public/plugin.ts b/x-pack/plugins/data_enhanced/public/plugin.ts deleted file mode 100644 index f1bb9d7b4b4b6..0000000000000 --- a/x-pack/plugins/data_enhanced/public/plugin.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -import React from 'react'; -import moment from 'moment'; -import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; -import { - DataPublicPluginSetup, - DataPublicPluginStart, - SearchUsageCollector, -} from '@kbn/data-plugin/public'; -import { BfetchPublicSetup } from '@kbn/bfetch-plugin/public'; -import { ManagementSetup } from '@kbn/management-plugin/public'; -import { SharePluginStart } from '@kbn/share-plugin/public'; - -import { toMountPoint } from '@kbn/kibana-react-plugin/public'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { ScreenshotModePluginStart } from '@kbn/screenshot-mode-plugin/public'; -import { registerSearchSessionsMgmt } from './search/sessions_mgmt'; -import { createConnectedSearchSessionIndicator } from './search'; -import { ConfigSchema } from '../config'; - -export interface DataEnhancedSetupDependencies { - bfetch: BfetchPublicSetup; - data: DataPublicPluginSetup; - management: ManagementSetup; -} -export interface DataEnhancedStartDependencies { - data: DataPublicPluginStart; - share: SharePluginStart; - screenshotMode: ScreenshotModePluginStart; -} - -export type DataEnhancedSetup = ReturnType; -export type DataEnhancedStart = ReturnType; - -export class DataEnhancedPlugin - implements Plugin -{ - private config!: ConfigSchema; - private readonly storage = new Storage(window.localStorage); - private usageCollector?: SearchUsageCollector; - - constructor(private initializerContext: PluginInitializerContext) {} - - public setup( - core: CoreSetup, - { bfetch, data, management }: DataEnhancedSetupDependencies - ) { - this.config = this.initializerContext.config.get(); - if (this.config.search.sessions.enabled) { - const sessionsConfig = this.config.search.sessions; - registerSearchSessionsMgmt( - core, - sessionsConfig, - this.initializerContext.env.packageInfo.version, - { data, management } - ); - } - - this.usageCollector = data.search.usageCollector; - } - - public start(core: CoreStart, plugins: DataEnhancedStartDependencies) { - if (this.config.search.sessions.enabled) { - core.chrome.setBreadcrumbsAppendExtension({ - content: toMountPoint( - React.createElement( - createConnectedSearchSessionIndicator({ - sessionService: plugins.data.search.session, - application: core.application, - basePath: core.http.basePath, - storage: this.storage, - disableSaveAfterSessionCompletesTimeout: moment - .duration(this.config.search.sessions.notTouchedTimeout) - .asMilliseconds(), - usageCollector: this.usageCollector, - tourDisabled: plugins.screenshotMode.isScreenshotMode(), - }) - ), - { theme$: core.theme.theme$ } - ), - }); - } - } - - public stop() {} -} diff --git a/x-pack/plugins/data_enhanced/public/search/index.ts b/x-pack/plugins/data_enhanced/public/search/index.ts deleted file mode 100644 index 84e70f41d6746..0000000000000 --- a/x-pack/plugins/data_enhanced/public/search/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 * from './ui'; diff --git a/x-pack/plugins/data_enhanced/server/index.ts b/x-pack/plugins/data_enhanced/server/index.ts deleted file mode 100644 index a56f7216c4706..0000000000000 --- a/x-pack/plugins/data_enhanced/server/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ - -import { PluginConfigDescriptor, PluginInitializerContext } from '@kbn/core/server'; -import { EnhancedDataServerPlugin } from './plugin'; -import { configSchema, ConfigSchema } from '../config'; - -export const config: PluginConfigDescriptor = { - exposeToBrowser: { - search: true, - }, - schema: configSchema, -}; - -export function plugin(initializerContext: PluginInitializerContext) { - return new EnhancedDataServerPlugin(initializerContext); -} - -export { ENHANCED_ES_SEARCH_STRATEGY, EQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common'; - -export { EnhancedDataServerPlugin as Plugin }; diff --git a/x-pack/plugins/data_enhanced/server/plugin.ts b/x-pack/plugins/data_enhanced/server/plugin.ts deleted file mode 100644 index 007764ec95f0c..0000000000000 --- a/x-pack/plugins/data_enhanced/server/plugin.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from '@kbn/core/server'; -import { registerSessionRoutes } from './routes'; -import { searchSessionSavedObjectType } from './saved_objects'; -import type { - DataEnhancedRequestHandlerContext, - DataEnhancedSetupDependencies as SetupDependencies, - DataEnhancedStartDependencies as StartDependencies, -} from './type'; -import { ConfigSchema } from '../config'; -import { registerUsageCollector } from './collectors'; -import { SearchSessionService } from './search'; - -export class EnhancedDataServerPlugin - implements Plugin -{ - private readonly logger: Logger; - private sessionService!: SearchSessionService; - private config: ConfigSchema; - - constructor(private initializerContext: PluginInitializerContext) { - this.logger = initializerContext.logger.get('data_enhanced'); - this.config = this.initializerContext.config.get(); - } - - public setup(core: CoreSetup, deps: SetupDependencies) { - core.savedObjects.registerType(searchSessionSavedObjectType); - - this.sessionService = new SearchSessionService( - this.logger, - this.config, - this.initializerContext.env.packageInfo.version, - deps.security - ); - - deps.data.__enhance({ - search: { - sessionService: this.sessionService, - }, - }); - - const router = core.http.createRouter(); - registerSessionRoutes(router, this.logger); - - this.sessionService.setup(core, { - taskManager: deps.taskManager, - }); - - if (deps.usageCollection) { - registerUsageCollector(deps.usageCollection, core.savedObjects.getKibanaIndex(), this.logger); - } - } - - public start(core: CoreStart, { taskManager }: StartDependencies) { - this.sessionService.start(core, { - taskManager, - }); - } - - public stop() { - this.sessionService.stop(); - } -} - -export { EnhancedDataServerPlugin as Plugin }; diff --git a/x-pack/plugins/data_enhanced/server/routes/index.ts b/x-pack/plugins/data_enhanced/server/routes/index.ts deleted file mode 100644 index 0430d283667d0..0000000000000 --- a/x-pack/plugins/data_enhanced/server/routes/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/search/index.ts b/x-pack/plugins/data_enhanced/server/search/index.ts deleted file mode 100644 index 0430d283667d0..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 * from './session'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/index.ts b/x-pack/plugins/data_enhanced/server/search/session/index.ts deleted file mode 100644 index 1e6841211bb66..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* - * 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 * from './session_service'; diff --git a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts b/x-pack/plugins/data_enhanced/server/search/session/session_service.ts deleted file mode 100644 index a22e559ecd142..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/session_service.ts +++ /dev/null @@ -1,548 +0,0 @@ -/* - * 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. - */ - -import { notFound } from '@hapi/boom'; -import { debounce } from 'lodash'; -import { nodeBuilder, fromKueryExpression } from '@kbn/es-query'; -import { - CoreSetup, - CoreStart, - KibanaRequest, - SavedObjectsClientContract, - Logger, - SavedObject, - SavedObjectsFindOptions, - SavedObjectsErrorHelpers, -} from '@kbn/core/server'; -import { - IKibanaSearchRequest, - ISearchOptions, - ENHANCED_ES_SEARCH_STRATEGY, - SEARCH_SESSION_TYPE, -} from '@kbn/data-plugin/common'; -import { ISearchSessionService, NoSearchIdInSessionError } from '@kbn/data-plugin/server'; -import { AuthenticatedUser, SecurityPluginSetup } from '@kbn/security-plugin/server'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { - SearchSessionRequestInfo, - SearchSessionSavedObjectAttributes, - SearchSessionStatus, -} from '@kbn/data-plugin/common'; -import { createRequestHash } from './utils'; -import { ConfigSchema } from '../../../config'; -import { - registerSearchSessionsTask, - scheduleSearchSessionsTask, - unscheduleSearchSessionsTask, -} from './setup_task'; -import { SearchSessionsConfig, SearchStatus } from './types'; -import { DataEnhancedStartDependencies } from '../../type'; -import { - checkPersistedSessionsProgress, - SEARCH_SESSIONS_TASK_ID, - SEARCH_SESSIONS_TASK_TYPE, -} from './check_persisted_sessions'; -import { - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - checkNonPersistedSessions, - SEARCH_SESSIONS_CLEANUP_TASK_ID, -} from './check_non_persisted_sessions'; -import { - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - SEARCH_SESSIONS_EXPIRE_TASK_ID, - checkPersistedCompletedSessionExpiration, -} from './expire_persisted_sessions'; - -export interface SearchSessionDependencies { - savedObjectsClient: SavedObjectsClientContract; -} -interface SetupDependencies { - taskManager: TaskManagerSetupContract; -} - -interface StartDependencies { - taskManager: TaskManagerStartContract; -} - -const DEBOUNCE_UPDATE_OR_CREATE_WAIT = 1000; -const DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT = 5000; - -interface UpdateOrCreateQueueEntry { - deps: SearchSessionDependencies; - user: AuthenticatedUser | null; - sessionId: string; - attributes: Partial; - resolve: () => void; - reject: (reason?: unknown) => void; -} - -function sleep(ms: number) { - return new Promise((r) => setTimeout(r, ms)); -} -export class SearchSessionService - implements ISearchSessionService -{ - private sessionConfig: SearchSessionsConfig; - private readonly updateOrCreateBatchQueue: UpdateOrCreateQueueEntry[] = []; - - constructor( - private readonly logger: Logger, - private readonly config: ConfigSchema, - private readonly version: string, - private readonly security?: SecurityPluginSetup - ) { - this.sessionConfig = this.config.search.sessions; - } - - public setup(core: CoreSetup, deps: SetupDependencies) { - const taskDeps = { - config: this.config, - taskManager: deps.taskManager, - logger: this.logger, - }; - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_TASK_TYPE, - 'persisted session progress', - checkPersistedSessionsProgress - ); - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - 'non persisted session cleanup', - checkNonPersistedSessions - ); - - registerSearchSessionsTask( - core, - taskDeps, - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - 'complete session expiration', - checkPersistedCompletedSessionExpiration - ); - } - - public async start(core: CoreStart, deps: StartDependencies) { - return this.setupMonitoring(core, deps); - } - - public stop() {} - - private setupMonitoring = async (core: CoreStart, deps: StartDependencies) => { - const taskDeps = { - config: this.config, - taskManager: deps.taskManager, - logger: this.logger, - }; - - if (this.sessionConfig.enabled) { - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_TASK_ID, - SEARCH_SESSIONS_TASK_TYPE, - this.sessionConfig.trackingInterval - ); - - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_CLEANUP_TASK_ID, - SEARCH_SESSIONS_CLEANUP_TASK_TYPE, - this.sessionConfig.cleanupInterval - ); - - scheduleSearchSessionsTask( - taskDeps, - SEARCH_SESSIONS_EXPIRE_TASK_ID, - SEARCH_SESSIONS_EXPIRE_TASK_TYPE, - this.sessionConfig.expireInterval - ); - } else { - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_TASK_ID); - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_CLEANUP_TASK_ID); - unscheduleSearchSessionsTask(taskDeps, SEARCH_SESSIONS_EXPIRE_TASK_ID); - } - }; - - private processUpdateOrCreateBatchQueue = debounce( - () => { - const queue = [...this.updateOrCreateBatchQueue]; - if (queue.length === 0) return; - this.updateOrCreateBatchQueue.length = 0; - const batchedSessionAttributes = queue.reduce((res, next) => { - if (!res[next.sessionId]) { - res[next.sessionId] = next.attributes; - } else { - res[next.sessionId] = { - ...res[next.sessionId], - ...next.attributes, - idMapping: { - ...res[next.sessionId].idMapping, - ...next.attributes.idMapping, - }, - }; - } - return res; - }, {} as { [sessionId: string]: Partial }); - - Object.keys(batchedSessionAttributes).forEach((sessionId) => { - const thisSession = queue.filter((s) => s.sessionId === sessionId); - this.updateOrCreate( - thisSession[0].deps, - thisSession[0].user, - sessionId, - batchedSessionAttributes[sessionId] - ) - .then(() => { - thisSession.forEach((s) => s.resolve()); - }) - .catch((e) => { - thisSession.forEach((s) => s.reject(e)); - }); - }); - }, - DEBOUNCE_UPDATE_OR_CREATE_WAIT, - { maxWait: DEBOUNCE_UPDATE_OR_CREATE_MAX_WAIT } - ); - private scheduleUpdateOrCreate = ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ): Promise => { - return new Promise((resolve, reject) => { - this.updateOrCreateBatchQueue.push({ deps, user, sessionId, attributes, resolve, reject }); - // TODO: this would be better if we'd debounce per sessionId - this.processUpdateOrCreateBatchQueue(); - }); - }; - - private updateOrCreate = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial, - retry: number = 1 - ): Promise | undefined> => { - const retryOnConflict = async (e: any) => { - this.logger.debug(`Conflict error | ${sessionId}`); - // Randomize sleep to spread updates out in case of conflicts - await sleep(100 + Math.random() * 50); - return await this.updateOrCreate(deps, user, sessionId, attributes, retry + 1); - }; - - this.logger.debug(`updateOrCreate | ${sessionId} | ${retry}`); - try { - return (await this.update( - deps, - user, - sessionId, - attributes - )) as SavedObject; - } catch (e) { - if (SavedObjectsErrorHelpers.isNotFoundError(e)) { - try { - this.logger.debug(`Object not found | ${sessionId}`); - return await this.create(deps, user, sessionId, attributes); - } catch (createError) { - if ( - SavedObjectsErrorHelpers.isConflictError(createError) && - retry < this.sessionConfig.maxUpdateRetries - ) { - return await retryOnConflict(createError); - } else { - this.logger.error(createError); - } - } - } else if ( - SavedObjectsErrorHelpers.isConflictError(e) && - retry < this.sessionConfig.maxUpdateRetries - ) { - return await retryOnConflict(e); - } else { - this.logger.error(e); - } - } - - return undefined; - }; - - public save = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - { - name, - appId, - locatorId, - initialState = {}, - restoreState = {}, - }: Partial - ) => { - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - if (!name) throw new Error('Name is required'); - if (!appId) throw new Error('AppId is required'); - if (!locatorId) throw new Error('locatorId is required'); - - return this.updateOrCreate(deps, user, sessionId, { - name, - appId, - locatorId, - initialState, - restoreState, - persisted: true, - }); - }; - - private create = ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ) => { - this.logger.debug(`create | ${sessionId}`); - - const realmType = user?.authentication_realm.type; - const realmName = user?.authentication_realm.name; - const username = user?.username; - - return savedObjectsClient.create( - SEARCH_SESSION_TYPE, - { - sessionId, - status: SearchSessionStatus.IN_PROGRESS, - expires: new Date( - Date.now() + this.sessionConfig.defaultExpiration.asMilliseconds() - ).toISOString(), - created: new Date().toISOString(), - touched: new Date().toISOString(), - idMapping: {}, - persisted: false, - version: this.version, - realmType, - realmName, - username, - ...attributes, - }, - { id: sessionId } - ); - }; - - public get = async ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - this.logger.debug(`get | ${sessionId}`); - const session = await savedObjectsClient.get( - SEARCH_SESSION_TYPE, - sessionId - ); - this.throwOnUserConflict(user, session); - return session; - }; - - public find = ( - { savedObjectsClient }: SearchSessionDependencies, - user: AuthenticatedUser | null, - options: Omit - ) => { - const userFilters = - user === null - ? [] - : [ - nodeBuilder.is( - `${SEARCH_SESSION_TYPE}.attributes.realmType`, - `${user.authentication_realm.type}` - ), - nodeBuilder.is( - `${SEARCH_SESSION_TYPE}.attributes.realmName`, - `${user.authentication_realm.name}` - ), - nodeBuilder.is(`${SEARCH_SESSION_TYPE}.attributes.username`, `${user.username}`), - ]; - const filterKueryNode = - typeof options.filter === 'string' ? fromKueryExpression(options.filter) : options.filter; - const filter = nodeBuilder.and(userFilters.concat(filterKueryNode ?? [])); - return savedObjectsClient.find({ - ...options, - filter, - type: SEARCH_SESSION_TYPE, - }); - }; - - public update = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - attributes: Partial - ) => { - this.logger.debug(`update | ${sessionId}`); - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - await this.get(deps, user, sessionId); // Verify correct user - return deps.savedObjectsClient.update( - SEARCH_SESSION_TYPE, - sessionId, - { - ...attributes, - touched: new Date().toISOString(), - } - ); - }; - - public async extend( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string, - expires: Date - ) { - this.logger.debug(`extend | ${sessionId}`); - return this.update(deps, user, sessionId, { expires: expires.toISOString() }); - } - - public cancel = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - this.logger.debug(`delete | ${sessionId}`); - return this.update(deps, user, sessionId, { - status: SearchSessionStatus.CANCELLED, - }); - }; - - public delete = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) => { - if (!this.sessionConfig.enabled) throw new Error('Search sessions are disabled'); - this.logger.debug(`delete | ${sessionId}`); - await this.get(deps, user, sessionId); // Verify correct user - return deps.savedObjectsClient.delete(SEARCH_SESSION_TYPE, sessionId); - }; - - /** - * Tracks the given search request/search ID in the saved session. - * @internal - */ - public trackId = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - searchRequest: IKibanaSearchRequest, - searchId: string, - { sessionId, strategy = ENHANCED_ES_SEARCH_STRATEGY }: ISearchOptions - ) => { - if (!this.sessionConfig.enabled || !sessionId || !searchId) return; - this.logger.debug(`trackId | ${sessionId} | ${searchId}`); - - let idMapping: Record = {}; - - if (searchRequest.params) { - const requestHash = createRequestHash(searchRequest.params); - const searchInfo = { - id: searchId, - strategy, - status: SearchStatus.IN_PROGRESS, - }; - idMapping = { [requestHash]: searchInfo }; - } - - await this.scheduleUpdateOrCreate(deps, user, sessionId, { idMapping }); - }; - - public async getSearchIdMapping( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - sessionId: string - ) { - const searchSession = await this.get(deps, user, sessionId); - const searchIdMapping = new Map(); - Object.values(searchSession.attributes.idMapping).forEach((requestInfo) => { - searchIdMapping.set(requestInfo.id, requestInfo.strategy); - }); - return searchIdMapping; - } - - /** - * Look up an existing search ID that matches the given request in the given session so that the - * request can continue rather than restart. - * @internal - */ - public getId = async ( - deps: SearchSessionDependencies, - user: AuthenticatedUser | null, - searchRequest: IKibanaSearchRequest, - { sessionId, isStored, isRestore }: ISearchOptions - ) => { - if (!this.sessionConfig.enabled) { - throw new Error('Search sessions are disabled'); - } else if (!sessionId) { - throw new Error('Session ID is required'); - } else if (!isStored) { - throw new Error('Cannot get search ID from a session that is not stored'); - } else if (!isRestore) { - throw new Error('Get search ID is only supported when restoring a session'); - } - - const session = await this.get(deps, user, sessionId); - const requestHash = createRequestHash(searchRequest.params); - if (!session.attributes.idMapping.hasOwnProperty(requestHash)) { - this.logger.error(`getId | ${sessionId} | ${requestHash} not found`); - throw new NoSearchIdInSessionError(); - } - this.logger.debug(`getId | ${sessionId} | ${requestHash}`); - - return session.attributes.idMapping[requestHash].id; - }; - - public asScopedProvider = ({ savedObjects }: CoreStart) => { - return (request: KibanaRequest) => { - const user = this.security?.authc.getCurrentUser(request) ?? null; - const savedObjectsClient = savedObjects.getScopedClient(request, { - includedHiddenTypes: [SEARCH_SESSION_TYPE], - }); - const deps = { savedObjectsClient }; - return { - getId: this.getId.bind(this, deps, user), - trackId: this.trackId.bind(this, deps, user), - getSearchIdMapping: this.getSearchIdMapping.bind(this, deps, user), - save: this.save.bind(this, deps, user), - get: this.get.bind(this, deps, user), - find: this.find.bind(this, deps, user), - update: this.update.bind(this, deps, user), - extend: this.extend.bind(this, deps, user), - cancel: this.cancel.bind(this, deps, user), - delete: this.delete.bind(this, deps, user), - getConfig: () => this.config.search.sessions, - }; - }; - }; - - private throwOnUserConflict = ( - user: AuthenticatedUser | null, - session?: SavedObject - ) => { - if (user === null || !session) return; - if ( - user.authentication_realm.type !== session.attributes.realmType || - user.authentication_realm.name !== session.attributes.realmName || - user.username !== session.attributes.username - ) { - this.logger.debug( - `User ${user.username} has no access to search session ${session.attributes.sessionId}` - ); - throw notFound(); - } - }; -} diff --git a/x-pack/plugins/data_enhanced/server/search/session/types.ts b/x-pack/plugins/data_enhanced/server/search/session/types.ts deleted file mode 100644 index 37e1cb2486154..0000000000000 --- a/x-pack/plugins/data_enhanced/server/search/session/types.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -import { - ElasticsearchClient, - Logger, - SavedObjectsClientContract, - SavedObjectsFindResponse, -} from '@kbn/core/server'; -import { Observable } from 'rxjs'; -import { KueryNode, SearchSessionSavedObjectAttributes } from '@kbn/data-plugin/common'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { ConfigSchema } from '../../../config'; - -export enum SearchStatus { - IN_PROGRESS = 'in_progress', - ERROR = 'error', - COMPLETE = 'complete', -} - -export type SearchSessionsConfig = ConfigSchema['search']['sessions']; - -export interface CheckSearchSessionsDeps { - savedObjectsClient: SavedObjectsClientContract; - client: ElasticsearchClient; - logger: Logger; -} - -export interface SearchSessionTaskSetupDeps { - taskManager: TaskManagerSetupContract; - logger: Logger; - config: ConfigSchema; -} - -export interface SearchSessionTaskStartDeps { - taskManager: TaskManagerStartContract; - logger: Logger; - config: ConfigSchema; -} - -export type SearchSessionTaskFn = ( - deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig -) => Observable; - -export type SearchSessionsResponse = SavedObjectsFindResponse< - SearchSessionSavedObjectAttributes, - unknown ->; - -export type CheckSearchSessionsFn = ( - deps: CheckSearchSessionsDeps, - config: SearchSessionsConfig, - filter: KueryNode, - page: number -) => Observable; diff --git a/x-pack/plugins/data_enhanced/server/type.ts b/x-pack/plugins/data_enhanced/server/type.ts deleted file mode 100644 index df465cdbb381d..0000000000000 --- a/x-pack/plugins/data_enhanced/server/type.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ - -import type { IRouter } from '@kbn/core/server'; -import type { DataRequestHandlerContext } from '@kbn/data-plugin/server'; -import { - TaskManagerSetupContract, - TaskManagerStartContract, -} from '@kbn/task-manager-plugin/server'; -import { - PluginSetup as DataPluginSetup, - PluginStart as DataPluginStart, -} from '@kbn/data-plugin/server'; -import { SecurityPluginSetup } from '@kbn/security-plugin/server'; -import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; - -/** - * @internal - */ -export type DataEnhancedRequestHandlerContext = DataRequestHandlerContext; - -/** - * @internal - */ -export type DataEnhancedPluginRouter = IRouter; - -export interface DataEnhancedSetupDependencies { - data: DataPluginSetup; - usageCollection?: UsageCollectionSetup; - taskManager: TaskManagerSetupContract; - security?: SecurityPluginSetup; -} - -export interface DataEnhancedStartDependencies { - data: DataPluginStart; - taskManager: TaskManagerStartContract; -} diff --git a/x-pack/plugins/data_enhanced/tsconfig.json b/x-pack/plugins/data_enhanced/tsconfig.json deleted file mode 100644 index 5627951c3d9eb..0000000000000 --- a/x-pack/plugins/data_enhanced/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./target/types", - "emitDeclarationOnly": true, - "declaration": true, - "declarationMap": true, - }, - "include": [ - "common/**/*", - "public/**/*", - "server/**/*", - "config.ts", - "../../../typings/**/*", - "common/search/test_data/*.json" - ], - "references": [ - { "path": "../../../src/core/tsconfig.json" }, - { "path": "../../../src/plugins/bfetch/tsconfig.json" }, - { "path": "../../../src/plugins/data/tsconfig.json" }, - { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, - { "path": "../../../src/plugins/kibana_utils/tsconfig.json" }, - { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, - { "path": "../../../src/plugins/management/tsconfig.json" }, - { "path": "../../../src/plugins/screenshot_mode/tsconfig.json"}, - { "path": "../security/tsconfig.json" }, - { "path": "../task_manager/tsconfig.json" }, - - { "path": "../features/tsconfig.json" }, - ] -} diff --git a/x-pack/plugins/infra/kibana.json b/x-pack/plugins/infra/kibana.json index 2eec94187900f..d9d432fc702e4 100644 --- a/x-pack/plugins/infra/kibana.json +++ b/x-pack/plugins/infra/kibana.json @@ -9,7 +9,6 @@ "spaces", "embeddable", "data", - "dataEnhanced", "dataViews", "visTypeTimeseries", "alerting", diff --git a/x-pack/plugins/infra/public/types.ts b/x-pack/plugins/infra/public/types.ts index ab7df75592712..b5147f343ea5b 100644 --- a/x-pack/plugins/infra/public/types.ts +++ b/x-pack/plugins/infra/public/types.ts @@ -20,7 +20,6 @@ import type { TriggersAndActionsUIPublicPluginSetup, TriggersAndActionsUIPublicPluginStart, } from '@kbn/triggers-actions-ui-plugin/public'; -import type { DataEnhancedSetup, DataEnhancedStart } from '@kbn/data-enhanced-plugin/public'; import { MlPluginSetup, MlPluginStart } from '@kbn/ml-plugin/public'; import type { ObservabilityPublicSetup, @@ -52,7 +51,6 @@ export interface InfraClientStartExports { } export interface InfraClientSetupDeps { - dataEnhanced: DataEnhancedSetup; home?: HomePublicPluginSetup; observability: ObservabilityPublicSetup; triggersActionsUi: TriggersAndActionsUIPublicPluginSetup; @@ -64,7 +62,6 @@ export interface InfraClientSetupDeps { export interface InfraClientStartDeps { data: DataPublicPluginStart; - dataEnhanced: DataEnhancedStart; dataViews: DataViewsPublicPluginStart; observability: ObservabilityPublicStart; spaces: SpacesPluginStart; diff --git a/x-pack/plugins/infra/tsconfig.json b/x-pack/plugins/infra/tsconfig.json index b508b8fb6da80..370644367b441 100644 --- a/x-pack/plugins/infra/tsconfig.json +++ b/x-pack/plugins/infra/tsconfig.json @@ -24,7 +24,6 @@ { "path": "../../../src/plugins/kibana_react/tsconfig.json" }, { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, { "path": "../../../src/plugins/vis_types/timeseries/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../license_management/tsconfig.json" }, diff --git a/x-pack/plugins/osquery/kibana.json b/x-pack/plugins/osquery/kibana.json index 619bcbeed14f4..1ea8468529b85 100644 --- a/x-pack/plugins/osquery/kibana.json +++ b/x-pack/plugins/osquery/kibana.json @@ -12,7 +12,6 @@ "requiredPlugins": [ "actions", "data", - "dataEnhanced", "discover", "features", "navigation", diff --git a/x-pack/plugins/osquery/tsconfig.json b/x-pack/plugins/osquery/tsconfig.json index 5c70e5ffbb944..4eac1baa43d79 100644 --- a/x-pack/plugins/osquery/tsconfig.json +++ b/x-pack/plugins/osquery/tsconfig.json @@ -24,7 +24,6 @@ // requiredPlugins from ./kibana.json { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/navigation/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../fleet/tsconfig.json" }, // optionalPlugins from ./kibana.json diff --git a/x-pack/plugins/runtime_fields/public/types.ts b/x-pack/plugins/runtime_fields/public/types.ts index 3cd8506c01b10..b39e5e2ee5e6d 100644 --- a/x-pack/plugins/runtime_fields/public/types.ts +++ b/x-pack/plugins/runtime_fields/public/types.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { DataPublicPluginStart } from '@kbn/data-plugin/public'; - import { RUNTIME_FIELD_TYPES } from './constants'; import { OpenRuntimeFieldEditorProps } from './load_editor'; @@ -24,9 +22,8 @@ export interface PluginStart {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface SetupPlugins {} -export interface StartPlugins { - data: DataPublicPluginStart; -} +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface StartPlugins {} export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx index ae64ad4655ba5..72612904f1c08 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import type { Capabilities } from '@kbn/core/public'; import { coreMock, scopedHistoryMock } from '@kbn/core/public/mocks'; -import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; +import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { KibanaFeature } from '@kbn/features-plugin/public'; import type { Space } from '@kbn/spaces-plugin/public'; import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; @@ -139,7 +139,7 @@ function getProps({ const rolesAPIClient = rolesAPIClientMock.create(); rolesAPIClient.getRole.mockResolvedValue(role); - const dataViews = dataPluginMock.createStartContract().dataViews; + const dataViews = dataViewPluginMocks.createStartContract(); // `undefined` titles can technically happen via import/export or other manual manipulation dataViews.getTitles = jest.fn().mockResolvedValue(['foo*', 'bar*', undefined]); @@ -352,7 +352,7 @@ describe('', () => { }); it('can render if index patterns are not available', async () => { - const dataViews = dataPluginMock.createStartContract().dataViews; + const dataViews = dataViewPluginMocks.createStartContract(); dataViews.getTitles = jest.fn().mockRejectedValue({ response: { status: 403 } }); const wrapper = mountWithIntl( diff --git a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx index 1cda335ace204..cc9803063b860 100644 --- a/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx +++ b/x-pack/plugins/security/public/management/roles/edit_role/edit_role_page.tsx @@ -31,7 +31,7 @@ import type { NotificationsStart, ScopedHistory, } from '@kbn/core/public'; -import type { DataViewsContract } from '@kbn/data-plugin/public'; +import type { DataViewsContract } from '@kbn/data-views-plugin/public'; import type { KibanaFeature } from '@kbn/features-plugin/common'; import type { FeaturesPluginStart } from '@kbn/features-plugin/public'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/security_solution/kibana.json b/x-pack/plugins/security_solution/kibana.json index af0bd12303119..0c72f5af846d7 100644 --- a/x-pack/plugins/security_solution/kibana.json +++ b/x-pack/plugins/security_solution/kibana.json @@ -13,7 +13,6 @@ "alerting", "cases", "data", - "dataEnhanced", "embeddable", "eventLog", "features", diff --git a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts index 4addd9048a565..20a9ccbefa900 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/eql/use_eql_preview.ts @@ -17,9 +17,9 @@ import { isPartialResponse, EqlSearchStrategyRequest, EqlSearchStrategyResponse, + EQL_SEARCH_STRATEGY, } from '@kbn/data-plugin/common'; import { AbortError } from '@kbn/kibana-utils-plugin/common'; -import { EQL_SEARCH_STRATEGY } from '@kbn/data-enhanced-plugin/public'; import * as i18n from '../translations'; import { useKibana } from '../../lib/kibana'; import { formatInspect, getEqlAggsData } from './helpers'; diff --git a/x-pack/plugins/security_solution/tsconfig.json b/x-pack/plugins/security_solution/tsconfig.json index 95aaeffad7f71..cc1656ace3c65 100644 --- a/x-pack/plugins/security_solution/tsconfig.json +++ b/x-pack/plugins/security_solution/tsconfig.json @@ -32,7 +32,6 @@ { "path": "../actions/tsconfig.json" }, { "path": "../alerting/tsconfig.json" }, { "path": "../cases/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../encrypted_saved_objects/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../fleet/tsconfig.json" }, diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 0ac826d27ea7b..a361c5fef7a40 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -4557,19 +4557,6 @@ } } }, - "search-session": { - "properties": { - "transientCount": { - "type": "long" - }, - "persistedCount": { - "type": "long" - }, - "totalCount": { - "type": "long" - } - } - }, "discoverEnhanced": { "properties": { "exploreDataInChartActionEnabled": { diff --git a/x-pack/plugins/timelines/kibana.json b/x-pack/plugins/timelines/kibana.json index 11adf42b3a6b4..77a5dcc699bdc 100644 --- a/x-pack/plugins/timelines/kibana.json +++ b/x-pack/plugins/timelines/kibana.json @@ -10,6 +10,6 @@ "extraPublicDirs": ["common"], "server": true, "ui": true, - "requiredPlugins": ["alerting", "cases", "data", "dataEnhanced", "kibanaReact", "kibanaUtils"], + "requiredPlugins": ["alerting", "cases", "data", "kibanaReact", "kibanaUtils"], "optionalPlugins": ["security"] } diff --git a/x-pack/plugins/timelines/tsconfig.json b/x-pack/plugins/timelines/tsconfig.json index 9677c0e64dd88..3063c1acda545 100644 --- a/x-pack/plugins/timelines/tsconfig.json +++ b/x-pack/plugins/timelines/tsconfig.json @@ -20,7 +20,6 @@ { "path": "../../../src/core/tsconfig.json" }, { "path": "../../../src/plugins/data/tsconfig.json" }, { "path": "../../../src/plugins/home/tsconfig.json" }, - { "path": "../data_enhanced/tsconfig.json" }, { "path": "../features/tsconfig.json" }, { "path": "../cases/tsconfig.json" }, { "path": "../licensing/tsconfig.json" }, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 84fee5016b778..8179a03244e50 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -2621,6 +2621,107 @@ "data.searchSessions.sessionService.sessionObjectFetchError": "Échec de récupération des informations de la session de recherche", "data.triggers.applyFilterDescription": "Lorsque le filtre Kibana est appliqué. Peut être un filtre simple ou un filtre de plage.", "data.triggers.applyFilterTitle": "Appliquer le filtre", + "data.mgmt.searchSessions.actionDelete": "Supprimer", + "data.mgmt.searchSessions.actionExtend": "Étendre", + "data.mgmt.searchSessions.actionRename": "Modifier le nom", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "Plus d'actions", + "data.mgmt.searchSessions.api.deleted": "La session de recherche a été supprimée.", + "data.mgmt.searchSessions.api.deletedError": "Impossible de supprimer la session de recherche !", + "data.mgmt.searchSessions.api.extended": "La session de recherche a été étendue.", + "data.mgmt.searchSessions.api.extendError": "Impossible d'étendre la session de recherche !", + "data.mgmt.searchSessions.api.fetchError": "Impossible d'actualiser la page !", + "data.mgmt.searchSessions.api.fetchTimeout": "La récupération des informations de la session de recherche a expiré après {timeout} secondes", + "data.mgmt.searchSessions.api.rename": "La session de recherche a été renommée", + "data.mgmt.searchSessions.api.renameError": "Impossible de renommer la session de recherche", + "data.mgmt.searchSessions.appTitle": "Sessions de recherche", + "data.mgmt.searchSessions.ariaLabel.moreActions": "Plus d'actions", + "data.mgmt.searchSessions.cancelModal.cancelButton": "Annuler", + "data.mgmt.searchSessions.cancelModal.deleteButton": "Supprimer", + "data.mgmt.searchSessions.cancelModal.message": "La suppression de la session de recherche \"{name}\" supprime tous les résultats mis en cache.", + "data.mgmt.searchSessions.cancelModal.title": "Supprimer la session de recherche", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "Annuler", + "data.mgmt.searchSessions.extendModal.extendButton": "Étendre l'expiration", + "data.mgmt.searchSessions.extendModal.extendMessage": "L'expiration de la session de recherche \"{name}\" sera étendue jusqu'à {newExpires}.", + "data.mgmt.searchSessions.extendModal.title": "Étendre l'expiration de la session de recherche", + "data.mgmt.searchSessions.flyoutTitle": "Inspecter", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "Documentation", + "data.mgmt.searchSessions.main.sectionDescription": "Gérez vos sessions de recherche enregistrées.", + "data.mgmt.searchSessions.main.sectionTitle": "Sessions de recherche", + "data.mgmt.searchSessions.renameModal.cancelButton": "Annuler", + "data.mgmt.searchSessions.renameModal.renameButton": "Enregistrer", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "Nom de la session de recherche", + "data.mgmt.searchSessions.renameModal.title": "Modifier le nom de la session de recherche", + "data.mgmt.searchSessions.search.filterApp": "Application", + "data.mgmt.searchSessions.search.filterStatus": "Statut", + "data.mgmt.searchSessions.search.tools.refresh": "Actualiser", + "data.mgmt.searchSessions.status.expireDateUnknown": "inconnu", + "data.mgmt.searchSessions.status.expiresOn": "Expire le {expireDate}", + "data.mgmt.searchSessions.status.expiresSoonInDays": "Expire dans {numDays} jours", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} jours", + "data.mgmt.searchSessions.status.expiresSoonInHours": "Cette session expire dans {numHours} heures", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} heures", + "data.mgmt.searchSessions.status.label.cancelled": "Annulé", + "data.mgmt.searchSessions.status.label.complete": "Terminé", + "data.mgmt.searchSessions.status.label.error": "Erreur", + "data.mgmt.searchSessions.status.label.expired": "Expiré", + "data.mgmt.searchSessions.status.label.inProgress": "En cours", + "data.mgmt.searchSessions.status.message.cancelled": "Annulé par l'utilisateur", + "data.mgmt.searchSessions.status.message.createdOn": "Expire le {expireDate}", + "data.mgmt.searchSessions.status.message.error": "Erreur : {error}", + "data.mgmt.searchSessions.status.message.expiredOn": "Expiré le {expireDate}", + "data.mgmt.searchSessions.table.headerExpiration": "Expiration", + "data.mgmt.searchSessions.table.headerName": "Nom", + "data.mgmt.searchSessions.table.headerStarted": "Créé", + "data.mgmt.searchSessions.table.headerStatus": "Statut", + "data.mgmt.searchSessions.table.headerType": "Application", + "data.mgmt.searchSessions.table.notRestorableWarning": "La session de recherche va être de nouveau exécutée. Vous pouvez ensuite l'enregistrer pour une utilisation ultérieure.", + "data.mgmt.searchSessions.table.numSearches": "# recherches", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "Cette session de recherche a été créée dans une instance Kibana exécutant une version différente. Il se peut qu'elle ne soit pas correctement restaurée.", + "data.mgmt.searchSessions.table.mlAppName": "Machine Learning", + "data.search.statusError": "Recherche terminée avec un statut {errorCode}", + "data.search.statusThrow": "Le statut de la recherche a généré un statut d'erreur {message} ({errorCode})", + "data.searchSessionIndicator.cancelButtonText": "Arrêter la session", + "data.searchSessionIndicator.canceledDescriptionText": "Vous visualisez des données incomplètes", + "data.searchSessionIndicator.canceledIconAriaLabel": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledTitleText": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledTooltipText": "La session de recherche s'est arrêtée", + "data.searchSessionIndicator.canceledWhenText": "Arrêtée {when}", + "data.searchSessionIndicator.continueInBackgroundButtonText": "Enregistrer la session", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "Vous ne disposez pas d'autorisations pour gérer les sessions de recherche", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "Les résultats de la session de recherche ont expiré.", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "Vous pouvez retourner aux résultats terminés à partir de la page Gestion", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "Session enregistrée en cours", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "Débuté {when}", + "data.searchSessionIndicator.loadingResultsDescription": "Enregistrer votre session, poursuivre votre travail et retourner aux résultats terminés", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "Chargement de la session de recherche", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "Chargement de la session de recherche", + "data.searchSessionIndicator.loadingResultsTitle": "Votre recherche prend un certain temps…", + "data.searchSessionIndicator.loadingResultsWhenText": "Débuté {when}", + "data.searchSessionIndicator.restoredDescriptionText": "Vous affichez des données mises en cache d'une plage temporelle spécifique. La modification de la plage temporelle ou des filtres entraînera la réexécution de la session", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "Session enregistrée restaurée", + "data.searchSessionIndicator.restoredResultsTooltipText": "Session de recherche restaurée", + "data.searchSessionIndicator.restoredTitleText": "Session de recherche restaurée", + "data.searchSessionIndicator.restoredWhenText": "Terminé {when}", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "Vous pouvez retourner à ces résultats à partir de la page de gestion", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "Session enregistrée terminée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "Session enregistrée terminée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "Session de recherche enregistrée", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "Terminé {when}", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "Enregistrer votre session pour y revenir ultérieurement", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedText": "Session de recherche terminée", + "data.searchSessionIndicator.resultsLoadedWhenText": "Terminé {when}", + "data.searchSessionIndicator.saveButtonText": "Enregistrer la session", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "Gérer les sessions", + "data.searchSessionName.ariaLabelText": "Nom de la session de recherche", + "data.searchSessionName.editAriaLabelText": "Modifier le nom de la session de recherche", + "data.searchSessionName.placeholderText": "Entrer un nom pour la session de recherche", + "data.searchSessionName.saveButtonText": "Enregistrer", + "data.sessions.management.flyoutText": "Configuration de cette session de recherche", + "data.sessions.management.flyoutTitle": "Inspecter la session de recherche", "dataViews.deprecations.scriptedFields.manualStepOneMessage": "Accédez à Gestion de la Suite > Kibana > Vues de données.", "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "Mettez à jour les vues de données {numberOfIndexPatternsWithScriptedFields} qui ont des champs scriptés pour qu’elles utilisent des champs d’exécution. Dans la plupart des cas, pour migrer des scripts existants, vous devrez remplacer \"return ;\" par \"emit();\". Vues de données avec au moins un champ scripté : {allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "Vous avez {numberOfIndexPatternsWithScriptedFields} vues de données ({titlesPreview}...) qui utilisent des champs scriptés. Les champs scriptés sont déclassés et seront supprimés à l’avenir. Utilisez plutôt des champs d’exécution.", @@ -2633,6 +2734,121 @@ "dataViews.unableWriteLabel": "Impossible d’écrire la vue de données ! Actualisez la page pour obtenir la dernière version de cette vue de données.", "devTools.badge.betaLabel": "Bêta", "devTools.badge.betaTooltipText": "Cette fonctionnalité pourra considérablement changer dans les futures versions", + "unifiedSearch.search.unableToGetSavedQueryToastTitle": "Impossible de charger la requête enregistrée {savedQueryId}", + "unifiedSearch.noDataPopover.content": "Cette plage temporelle ne contient pas de données. Étendez ou ajustez la plage temporelle pour obtenir plus de champs et pouvoir créer des graphiques.", + "unifiedSearch.noDataPopover.dismissAction": "Ne plus afficher", + "unifiedSearch.noDataPopover.subtitle": "Conseil", + "unifiedSearch.noDataPopover.title": "Ensemble de données vide", + "unifiedSearch.query.queryBar.clearInputLabel": "Effacer l'entrée", + "unifiedSearch.query.queryBar.comboboxAriaLabel": "Rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.kqlFullLanguageName": "Langage de requête Kibana", + "unifiedSearch.query.queryBar.kqlLanguageName": "KQL", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoDocLinkText": "documents", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoOptOutText": "Ne plus afficher", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoText": "Il semblerait que votre requête porte sur un champ imbriqué. Selon le résultat visé, il existe plusieurs façons de construire une syntaxe KQL pour des requêtes imbriquées. Apprenez-en plus avec notre {link}.", + "unifiedSearch.query.queryBar.KQLNestedQuerySyntaxInfoTitle": "Syntaxe de requête imbriquée KQL", + "unifiedSearch.query.queryBar.kqlOffLabel": "Désactivé", + "unifiedSearch.query.queryBar.kqlOnLabel": "Activé", + "unifiedSearch.query.queryBar.languageSwitcher.toText": "Passer au langage de requête Kibana pour la recherche", + "unifiedSearch.query.queryBar.luceneLanguageName": "Lucene", + "unifiedSearch.query.queryBar.searchInputAriaLabel": "Commencer à taper pour rechercher et filtrer la page {pageType}", + "unifiedSearch.query.queryBar.searchInputPlaceholder": "Recherche", + "unifiedSearch.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) offre une syntaxe de requête simplifiée et la prise en charge des champs scriptés. KQL offre également une fonctionnalité de saisie semi-automatique. Si vous désactivez KQL, {nonKqlModeHelpText}.", + "unifiedSearch.query.queryBar.syntaxOptionsDescription.nonKqlModeHelpText": "Kibana utilise Lucene.", + "unifiedSearch.search.searchBar.savedQueryDescriptionLabelText": "Description", + "unifiedSearch.search.searchBar.savedQueryDescriptionText": "Enregistrez le texte et les filtres de la requête que vous souhaitez réutiliser.", + "unifiedSearch.search.searchBar.savedQueryForm.titleConflictText": "Ce nom est en conflit avec une requête enregistrée existante.", + "unifiedSearch.search.searchBar.savedQueryFormCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryFormSaveButtonText": "Enregistrer", + "unifiedSearch.search.searchBar.savedQueryFormTitle": "Enregistrer la requête", + "unifiedSearch.search.searchBar.savedQueryIncludeFiltersLabelText": "Inclure les filtres", + "unifiedSearch.search.searchBar.savedQueryIncludeTimeFilterLabelText": "Inclure le filtre temporel", + "unifiedSearch.search.searchBar.savedQueryNameHelpText": "Un nom est requis. Le nom ne peut pas contenir d'espace vide au début ou à la fin. Le nom doit être unique.", + "unifiedSearch.search.searchBar.savedQueryNameLabelText": "Nom", + "unifiedSearch.search.searchBar.savedQueryNoSavedQueriesText": "Aucune requête enregistrée.", + "unifiedSearch.search.searchBar.savedQueryPopoverButtonText": "Voir les requêtes enregistrées", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonAriaLabel": "Effacer la requête enregistrée en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverClearButtonText": "Effacer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionCancelButtonText": "Annuler", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionConfirmButtonText": "Supprimer", + "unifiedSearch.search.searchBar.savedQueryPopoverConfirmDeletionTitle": "Supprimer \"{savedQueryName}\" ?", + "unifiedSearch.search.searchBar.savedQueryPopoverDeleteButtonAriaLabel": "Supprimer la requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel": "Enregistrer en tant que nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveAsNewButtonText": "Enregistrer en tant que nouvelle", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonAriaLabel": "Enregistrer une nouvelle requête enregistrée", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveButtonText": "Enregistrer la requête en cours", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel": "Enregistrer les modifications apportées à {title}", + "unifiedSearch.search.searchBar.savedQueryPopoverSaveChangesButtonText": "Enregistrer les modifications", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemDescriptionAriaLabel": "Description de {savedQueryName}", + "unifiedSearch.search.searchBar.savedQueryPopoverSavedQueryListItemSelectedButtonAriaLabel": "Bouton de requête enregistrée {savedQueryName} sélectionné. Appuyez pour effacer les modifications.", + "unifiedSearch.search.searchBar.savedQueryPopoverTitleText": "Requêtes enregistrées", + "unifiedSearch.query.queryBar.syntaxOptionsTitle": "Options de syntaxe", + "unifiedSearch.filter.applyFilterActionTitle": "Appliquer le filtre à la vue en cours", + "unifiedSearch.filter.applyFilters.popupHeader": "Sélectionner les filtres à appliquer", + "unifiedSearch.filter.applyFiltersPopup.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.applyFiltersPopup.saveButtonLabel": "Appliquer", + "unifiedSearch.filter.filterBar.addFilterButtonLabel": "Ajouter un filtre", + "unifiedSearch.filter.filterBar.deleteFilterButtonLabel": "Supprimer", + "unifiedSearch.filter.filterBar.disabledFilterPrefix": "Désactivé", + "unifiedSearch.filter.filterBar.disableFilterButtonLabel": "Désactiver temporairement", + "unifiedSearch.filter.filterBar.editFilterButtonLabel": "Modifier le filtre", + "unifiedSearch.filter.filterBar.enableFilterButtonLabel": "Réactiver", + "unifiedSearch.filter.filterBar.excludeFilterButtonLabel": "Exclure les résultats", + "unifiedSearch.filter.filterBar.filterItemBadgeAriaLabel": "Actions de filtrage", + "unifiedSearch.filter.filterBar.filterItemBadgeIconAriaLabel": "Supprimer {filter}", + "unifiedSearch.filter.filterBar.includeFilterButtonLabel": "Inclure les résultats", + "unifiedSearch.filter.filterBar.indexPatternSelectPlaceholder": "Sélectionner un modèle d'indexation", + "unifiedSearch.filter.filterBar.labelErrorInfo": "Modèle d'indexation {indexPattern} introuvable", + "unifiedSearch.filter.filterBar.labelErrorText": "Erreur", + "unifiedSearch.filter.filterBar.labelWarningInfo": "Le champ {fieldName} n'existe pas dans la vue en cours.", + "unifiedSearch.filter.filterBar.labelWarningText": "Avertissement", + "unifiedSearch.filter.filterBar.moreFilterActionsMessage": "Filtre : {innerText}. Sélectionner pour plus d’actions de filtrage.", + "unifiedSearch.filter.filterBar.negatedFilterPrefix": "NON ", + "unifiedSearch.filter.filterBar.pinFilterButtonLabel": "Épingler dans toutes les applications", + "unifiedSearch.filter.filterBar.pinnedFilterPrefix": "Épinglé", + "unifiedSearch.filter.filterBar.unpinFilterButtonLabel": "Désépingler", + "unifiedSearch.filter.filterEditor.cancelButtonLabel": "Annuler", + "unifiedSearch.filter.filterEditor.createCustomLabelInputLabel": "Étiquette personnalisée", + "unifiedSearch.filter.filterEditor.createCustomLabelSwitchLabel": "Créer une étiquette personnalisée ?", + "unifiedSearch.filter.filterEditor.doesNotExistOperatorOptionLabel": "n'existe pas", + "unifiedSearch.filter.filterEditor.editFilterPopupTitle": "Modifier le filtre", + "unifiedSearch.filter.filterEditor.editFilterValuesButtonLabel": "Modifier les valeurs du filtre", + "unifiedSearch.filter.filterEditor.editQueryDslButtonLabel": "Modifier en tant que Query DSL", + "unifiedSearch.filter.filterEditor.existsOperatorOptionLabel": "existe", + "unifiedSearch.filter.filterEditor.falseOptionLabel": "false", + "unifiedSearch.filter.filterEditor.fieldSelectLabel": "Champ", + "unifiedSearch.filter.filterEditor.fieldSelectPlaceholder": "Sélectionner d'abord un champ", + "unifiedSearch.filter.filterEditor.indexPatternSelectLabel": "Modèle d'indexation", + "unifiedSearch.filter.filterEditor.isBetweenOperatorOptionLabel": "est entre", + "unifiedSearch.filter.filterEditor.isNotBetweenOperatorOptionLabel": "n'est pas entre", + "unifiedSearch.filter.filterEditor.isNotOneOfOperatorOptionLabel": "n'est pas l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isNotOperatorOptionLabel": "n'est pas", + "unifiedSearch.filter.filterEditor.isOneOfOperatorOptionLabel": "est l'une des options suivantes", + "unifiedSearch.filter.filterEditor.isOperatorOptionLabel": "est", + "unifiedSearch.filter.filterEditor.operatorSelectLabel": "Opérateur", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderSelect": "Sélectionner", + "unifiedSearch.filter.filterEditor.operatorSelectPlaceholderWaiting": "En attente", + "unifiedSearch.filter.filterEditor.queryDslLabel": "Query DSL d'Elasticsearch", + "unifiedSearch.filter.filterEditor.rangeEndInputPlaceholder": "Fin de la plage", + "unifiedSearch.filter.filterEditor.rangeInputLabel": "Plage", + "unifiedSearch.filter.filterEditor.rangeStartInputPlaceholder": "Début de la plage", + "unifiedSearch.filter.filterEditor.saveButtonLabel": "Enregistrer", + "unifiedSearch.filter.filterEditor.trueOptionLabel": "vrai", + "unifiedSearch.filter.filterEditor.valueInputLabel": "Valeur", + "unifiedSearch.filter.filterEditor.valueInputPlaceholder": "Saisir une valeur", + "unifiedSearch.filter.filterEditor.valueSelectPlaceholder": "Sélectionner une valeur", + "unifiedSearch.filter.filterEditor.valuesSelectLabel": "Valeurs", + "unifiedSearch.filter.filterEditor.valuesSelectPlaceholder": "Sélectionner des valeurs", + "unifiedSearch.filter.options.changeAllFiltersButtonLabel": "Changer tous les filtres", + "unifiedSearch.filter.options.deleteAllFiltersButtonLabel": "Tout supprimer", + "unifiedSearch.filter.options.disableAllFiltersButtonLabel": "Tout désactiver", + "unifiedSearch.filter.options.enableAllFiltersButtonLabel": "Tout activer", + "unifiedSearch.filter.options.invertDisabledFiltersButtonLabel": "Inverser l’activation/désactivation", + "unifiedSearch.filter.options.invertNegatedFiltersButtonLabel": "Inverser l'inclusion", + "unifiedSearch.filter.options.pinAllFiltersButtonLabel": "Tout épingler", + "unifiedSearch.filter.options.unpinAllFiltersButtonLabel": "Tout désépingler", + "unifiedSearch.filter.searchBar.changeAllFiltersTitle": "Changer tous les filtres", "devTools.badge.readOnly.text": "Lecture seule", "devTools.badge.readOnly.tooltip": "Enregistrement impossible", "devTools.breadcrumb.homeLabel": "Outils de développement", @@ -10077,107 +10293,6 @@ "xpack.dashboard.drilldown.goToDashboard": "Accéder au tableau de bord", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "Créer une recherche", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "Gérer les recherches", - "xpack.data.mgmt.searchSessions.actionDelete": "Supprimer", - "xpack.data.mgmt.searchSessions.actionExtend": "Étendre", - "xpack.data.mgmt.searchSessions.actionRename": "Modifier le nom", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "Plus d'actions", - "xpack.data.mgmt.searchSessions.api.deleted": "La session de recherche a été supprimée.", - "xpack.data.mgmt.searchSessions.api.deletedError": "Impossible de supprimer la session de recherche !", - "xpack.data.mgmt.searchSessions.api.extended": "La session de recherche a été étendue.", - "xpack.data.mgmt.searchSessions.api.extendError": "Impossible d'étendre la session de recherche !", - "xpack.data.mgmt.searchSessions.api.fetchError": "Impossible d'actualiser la page !", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "La récupération des informations de la session de recherche a expiré après {timeout} secondes", - "xpack.data.mgmt.searchSessions.api.rename": "La session de recherche a été renommée", - "xpack.data.mgmt.searchSessions.api.renameError": "Impossible de renommer la session de recherche", - "xpack.data.mgmt.searchSessions.appTitle": "Sessions de recherche", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "Plus d'actions", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "Annuler", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "Supprimer", - "xpack.data.mgmt.searchSessions.cancelModal.message": "La suppression de la session de recherche \"{name}\" supprime tous les résultats mis en cache.", - "xpack.data.mgmt.searchSessions.cancelModal.title": "Supprimer la session de recherche", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "Annuler", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "Étendre l'expiration", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "L'expiration de la session de recherche \"{name}\" sera étendue jusqu'à {newExpires}.", - "xpack.data.mgmt.searchSessions.extendModal.title": "Étendre l'expiration de la session de recherche", - "xpack.data.mgmt.searchSessions.flyoutTitle": "Inspecter", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "Documentation", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "Gérez vos sessions de recherche enregistrées.", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "Sessions de recherche", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "Annuler", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "Enregistrer", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "Nom de la session de recherche", - "xpack.data.mgmt.searchSessions.renameModal.title": "Modifier le nom de la session de recherche", - "xpack.data.mgmt.searchSessions.search.filterApp": "Application", - "xpack.data.mgmt.searchSessions.search.filterStatus": "Statut", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "Actualiser", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "inconnu", - "xpack.data.mgmt.searchSessions.status.expiresOn": "Expire le {expireDate}", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "Expire dans {numDays} jours", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} jours", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "Cette session expire dans {numHours} heures", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} heures", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "Annulé", - "xpack.data.mgmt.searchSessions.status.label.complete": "Terminé", - "xpack.data.mgmt.searchSessions.status.label.error": "Erreur", - "xpack.data.mgmt.searchSessions.status.label.expired": "Expiré", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "En cours", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "Annulé par l'utilisateur", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "Expire le {expireDate}", - "xpack.data.mgmt.searchSessions.status.message.error": "Erreur : {error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "Expiré le {expireDate}", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "Expiration", - "xpack.data.mgmt.searchSessions.table.headerName": "Nom", - "xpack.data.mgmt.searchSessions.table.headerStarted": "Créé", - "xpack.data.mgmt.searchSessions.table.headerStatus": "Statut", - "xpack.data.mgmt.searchSessions.table.headerType": "Application", - "xpack.data.mgmt.searchSessions.table.mlAppName": "Machine Learning", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "La session de recherche va être de nouveau exécutée. Vous pouvez ensuite l'enregistrer pour une utilisation ultérieure.", - "xpack.data.mgmt.searchSessions.table.numSearches": "# recherches", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "Cette session de recherche a été créée dans une instance Kibana exécutant une version différente. Il se peut qu'elle ne soit pas correctement restaurée.", - "xpack.data.search.statusError": "Recherche terminée avec un statut {errorCode}", - "xpack.data.search.statusThrow": "Le statut de la recherche a généré un statut d'erreur {message} ({errorCode})", - "xpack.data.searchSessionIndicator.cancelButtonText": "Arrêter la session", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "Vous visualisez des données incomplètes", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledTitleText": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledTooltipText": "La session de recherche s'est arrêtée", - "xpack.data.searchSessionIndicator.canceledWhenText": "Arrêtée {when}", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "Enregistrer la session", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "Vous ne disposez pas d'autorisations pour gérer les sessions de recherche", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "Les résultats de la session de recherche ont expiré.", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "Vous pouvez retourner aux résultats terminés à partir de la page Gestion", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "Session enregistrée en cours", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "Débuté {when}", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "Enregistrer votre session, poursuivre votre travail et retourner aux résultats terminés", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "Chargement de la session de recherche", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "Chargement de la session de recherche", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "Votre recherche prend un certain temps…", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "Débuté {when}", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "Vous affichez des données mises en cache d'une plage temporelle spécifique. La modification de la plage temporelle ou des filtres entraînera la réexécution de la session", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "Session enregistrée restaurée", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "Session de recherche restaurée", - "xpack.data.searchSessionIndicator.restoredTitleText": "Session de recherche restaurée", - "xpack.data.searchSessionIndicator.restoredWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "Vous pouvez retourner à ces résultats à partir de la page de gestion", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "Session enregistrée terminée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "Session enregistrée terminée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "Session de recherche enregistrée", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "Enregistrer votre session pour y revenir ultérieurement", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedText": "Session de recherche terminée", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "Terminé {when}", - "xpack.data.searchSessionIndicator.saveButtonText": "Enregistrer la session", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "Gérer les sessions", - "xpack.data.searchSessionName.ariaLabelText": "Nom de la session de recherche", - "xpack.data.searchSessionName.editAriaLabelText": "Modifier le nom de la session de recherche", - "xpack.data.searchSessionName.placeholderText": "Entrer un nom pour la session de recherche", - "xpack.data.searchSessionName.saveButtonText": "Enregistrer", - "xpack.data.sessions.management.flyoutText": "Configuration de cette session de recherche", - "xpack.data.sessions.management.flyoutTitle": "Inspecter la session de recherche", "xpack.dataVisualizer.addCombinedFieldsLabel": "Ajouter un champ combiné", "xpack.dataVisualizer.choroplethMap.topValuesCount": "Compte des valeurs les plus élevées pour {fieldName}", "xpack.dataVisualizer.chrome.help.appName": "Data Visualizer (Visualiseur de données)", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index a74c31404cedc..0a79aba689f57 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2719,6 +2719,110 @@ "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "ランタイムフィールドを使用するには、スクリプト化されたフィールドがある{numberOfIndexPatternsWithScriptedFields}データビューを更新します。ほとんどの場合、既存のスクリプトを移行するには、「return ;」から「emit();」に変更する必要があります。1つ以上のスクリプト化されたフィールドがあるデータビュー:{allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "スクリプト化されたフィールドを使用する{numberOfIndexPatternsWithScriptedFields}データビュー({titlesPreview}...)があります。スクリプト化されたフィールドは廃止予定であり、今後は削除されます。ランタイムフィールドを使用してください。", "dataViews.deprecations.scriptedFieldsTitle": "スクリプト化されたフィールドを使用しているデータビューが見つかりました。", + "data.mgmt.searchSessions.actionDelete": "削除", + "data.mgmt.searchSessions.actionExtend": "延長", + "data.mgmt.searchSessions.actionRename": "名前を編集", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "さらにアクションを表示", + "data.mgmt.searchSessions.api.deleted": "検索セッションが削除されました。", + "data.mgmt.searchSessions.api.deletedError": "検索セッションを削除できませんでした。", + "data.mgmt.searchSessions.api.extended": "検索セッションが延長されました。", + "data.mgmt.searchSessions.api.extendError": "検索セッションを延長できませんでした。", + "data.mgmt.searchSessions.api.fetchError": "ページを更新できませんでした。", + "data.mgmt.searchSessions.api.fetchTimeout": "{timeout}秒後に検索セッション情報の取得がタイムアウトしました", + "data.mgmt.searchSessions.api.rename": "検索セッション名が変更されました", + "data.mgmt.searchSessions.api.renameError": "検索セッション名を変更できませんでした", + "data.mgmt.searchSessions.appTitle": "検索セッション", + "data.mgmt.searchSessions.ariaLabel.moreActions": "さらにアクションを表示", + "data.mgmt.searchSessions.cancelModal.cancelButton": "キャンセル", + "data.mgmt.searchSessions.cancelModal.deleteButton": "削除", + "data.mgmt.searchSessions.cancelModal.message": "検索セッション'{name}'を削除すると、キャッシュに保存されているすべての結果が削除されます。", + "data.mgmt.searchSessions.cancelModal.title": "検索セッションの削除", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "キャンセル", + "data.mgmt.searchSessions.extendModal.extendButton": "有効期限を延長", + "data.mgmt.searchSessions.extendModal.extendMessage": "検索セッション'{name}'の有効期限が{newExpires}まで延長されます。", + "data.mgmt.searchSessions.extendModal.title": "検索セッションの有効期限を延長", + "data.mgmt.searchSessions.flyoutTitle": "検査", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "ドキュメント", + "data.mgmt.searchSessions.main.sectionDescription": "保存された検索セッションを管理します。", + "data.mgmt.searchSessions.main.sectionTitle": "検索セッション", + "data.mgmt.searchSessions.renameModal.cancelButton": "キャンセル", + "data.mgmt.searchSessions.renameModal.renameButton": "保存", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "検索セッション名", + "data.mgmt.searchSessions.renameModal.title": "検索セッション名を編集", + "data.mgmt.searchSessions.search.filterApp": "アプリ", + "data.mgmt.searchSessions.search.filterStatus": "ステータス", + "data.mgmt.searchSessions.search.tools.refresh": "更新", + "data.mgmt.searchSessions.status.expireDateUnknown": "不明", + "data.mgmt.searchSessions.status.expiresOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.status.expiresSoonInDays": "{numDays}日後に期限切れ", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays}日", + "data.mgmt.searchSessions.status.expiresSoonInHours": "このセッションは{numHours}時間後に期限切れになります", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours}時間", + "data.mgmt.searchSessions.status.label.cancelled": "キャンセル済み", + "data.mgmt.searchSessions.status.label.complete": "完了", + "data.mgmt.searchSessions.status.label.error": "エラー", + "data.mgmt.searchSessions.status.label.expired": "期限切れ", + "data.mgmt.searchSessions.status.label.inProgress": "進行中", + "data.mgmt.searchSessions.status.message.cancelled": "ユーザーがキャンセル", + "data.mgmt.searchSessions.status.message.createdOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.status.message.error": "エラー:{error}", + "data.mgmt.searchSessions.status.message.expiredOn": "有効期限:{expireDate}", + "data.mgmt.searchSessions.table.headerExpiration": "有効期限", + "data.mgmt.searchSessions.table.headerName": "名前", + "data.mgmt.searchSessions.table.headerStarted": "作成済み", + "data.mgmt.searchSessions.table.headerStatus": "ステータス", + "data.mgmt.searchSessions.table.headerType": "アプリ", + "data.mgmt.searchSessions.table.notRestorableWarning": "検索セッションはもう一度実行されます。今後使用するために保存できます。", + "data.mgmt.searchSessions.table.numSearches": "# 検索", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "この検索は別のバージョンを実行しているKibanaインスタンスで作成されました。正常に復元されない可能性があります。", + "data.search.statusError": "検索は{errorCode}ステータスで完了しました", + "data.search.statusThrow": "検索ステータスはエラー{message}({errorCode})ステータスを返しました", + "data.searchSessionIndicator.cancelButtonText": "セッションの停止", + "data.searchSessionIndicator.canceledDescriptionText": "不完全なデータを表示しています。", + "data.searchSessionIndicator.canceledIconAriaLabel": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledTitleText": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledTooltipText": "検索セッションが停止しました", + "data.searchSessionIndicator.canceledWhenText": "停止:{when}", + "data.searchSessionIndicator.continueInBackgroundButtonText": "セッションの保存", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "検索セッションを管理するアクセス権がありません", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "検索セッション結果が期限切れです。", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "管理から完了した結果に戻ることができます。", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "保存されたセッションを実行中です", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "開始:{when}", + "data.searchSessionIndicator.loadingResultsDescription": "セッションを保存して作業を続け、完了した結果に戻ってください。", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "検索セッションを読み込んでいます", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "検索セッションを読み込んでいます", + "data.searchSessionIndicator.loadingResultsTitle": "検索に少し時間がかかっています...", + "data.searchSessionIndicator.loadingResultsWhenText": "開始:{when}", + "data.searchSessionIndicator.restoredDescriptionText": "特定の時間範囲からキャッシュに保存されたデータを表示しています。時間範囲またはフィルターを変更すると、セッションが再実行されます。", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "保存されたセッションが復元されました", + "data.searchSessionIndicator.restoredResultsTooltipText": "検索セッションが復元されました", + "data.searchSessionIndicator.restoredTitleText": "検索セッションが復元されました", + "data.searchSessionIndicator.restoredWhenText": "完了:{when}", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "管理からこれらの結果に戻ることができます。", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "保存されたセッションが完了しました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "保存されたセッションが完了しました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "検索セッションが保存されました", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "完了:{when}", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "セッションを保存して、後から戻ります。", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedText": "検索セッションが完了しました", + "data.searchSessionIndicator.resultsLoadedWhenText": "完了:{when}", + "data.searchSessionIndicator.saveButtonText": "セッションの保存", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "セッションの管理", + "data.searchSessionName.ariaLabelText": "検索セッション名", + "data.searchSessionName.editAriaLabelText": "検索セッション名を編集", + "data.searchSessionName.placeholderText": "検索セッションの名前を入力", + "data.searchSessionName.saveButtonText": "保存", + "data.sessions.management.flyoutText": "この検索セッションの構成", + "data.sessions.management.flyoutTitle": "検索セッションの検査", + "dataViews.deprecations.scriptedFields.manualStepOneMessage": "[スタック管理]>[Kibana]>[インデックスパターン]に移動します。", + "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "ランタイムフィールドを使用するには、スクリプト化されたフィールドがある{numberOfIndexPatternsWithScriptedFields}インデックスパターンを更新します。ほとんどの場合、既存のスクリプトを移行するには、「return ;」から「emit();」に変更する必要があります。1つ以上のスクリプト化されたフィールドがあるインデックスパターン:{allTitles}", + "dataViews.deprecations.scriptedFieldsMessage": "スクリプト化されたフィールドを使用する{numberOfIndexPatternsWithScriptedFields}インデックスパターン({titlesPreview}...)があります。スクリプト化されたフィールドは廃止予定であり、今後は削除されます。ランタイムフィールドを使用してください。", + "dataViews.deprecations.scriptedFieldsTitle": "スクリプト化されたフィールドを使用しているインデックスパターンが見つかりました", "dataViews.ensureDefaultIndexPattern.bannerLabel": "Kibanaでデータの可視化と閲覧を行うには、Elasticsearchからデータを取得するためのインデックスパターンの作成が必要です。", "dataViews.fetchFieldErrorTitle": "データビューのフィールド取得中にエラーが発生 {title}(ID:{id})", "dataViews.functions.dataViewLoad.help": "データビューを読み込みます", @@ -10189,107 +10293,6 @@ "xpack.dashboard.drilldown.goToDashboard": "ダッシュボードに移動", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "ドリルダウンを作成", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "ドリルダウンを管理", - "xpack.data.mgmt.searchSessions.actionDelete": "削除", - "xpack.data.mgmt.searchSessions.actionExtend": "延長", - "xpack.data.mgmt.searchSessions.actionRename": "名前を編集", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "さらにアクションを表示", - "xpack.data.mgmt.searchSessions.api.deleted": "検索セッションが削除されました。", - "xpack.data.mgmt.searchSessions.api.deletedError": "検索セッションを削除できませんでした。", - "xpack.data.mgmt.searchSessions.api.extended": "検索セッションが延長されました。", - "xpack.data.mgmt.searchSessions.api.extendError": "検索セッションを延長できませんでした。", - "xpack.data.mgmt.searchSessions.api.fetchError": "ページを更新できませんでした。", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "{timeout}秒後に検索セッション情報の取得がタイムアウトしました", - "xpack.data.mgmt.searchSessions.api.rename": "検索セッション名が変更されました", - "xpack.data.mgmt.searchSessions.api.renameError": "検索セッション名を変更できませんでした", - "xpack.data.mgmt.searchSessions.appTitle": "検索セッション", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "さらにアクションを表示", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "キャンセル", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "削除", - "xpack.data.mgmt.searchSessions.cancelModal.message": "検索セッション'{name}'を削除すると、キャッシュに保存されているすべての結果が削除されます。", - "xpack.data.mgmt.searchSessions.cancelModal.title": "検索セッションの削除", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "キャンセル", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "有効期限を延長", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "検索セッション'{name}'の有効期限が{newExpires}まで延長されます。", - "xpack.data.mgmt.searchSessions.extendModal.title": "検索セッションの有効期限を延長", - "xpack.data.mgmt.searchSessions.flyoutTitle": "検査", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "ドキュメント", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "保存された検索セッションを管理します。", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "検索セッション", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "キャンセル", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "保存", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "検索セッション名", - "xpack.data.mgmt.searchSessions.renameModal.title": "検索セッション名を編集", - "xpack.data.mgmt.searchSessions.search.filterApp": "アプリ", - "xpack.data.mgmt.searchSessions.search.filterStatus": "ステータス", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "更新", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "不明", - "xpack.data.mgmt.searchSessions.status.expiresOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "{numDays}日後に期限切れ", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays}日", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "このセッションは{numHours}時間後に期限切れになります", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours}時間", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "キャンセル済み", - "xpack.data.mgmt.searchSessions.status.label.complete": "完了", - "xpack.data.mgmt.searchSessions.status.label.error": "エラー", - "xpack.data.mgmt.searchSessions.status.label.expired": "期限切れ", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "進行中", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "ユーザーがキャンセル", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.status.message.error": "エラー:{error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "有効期限:{expireDate}", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "有効期限", - "xpack.data.mgmt.searchSessions.table.headerName": "名前", - "xpack.data.mgmt.searchSessions.table.headerStarted": "作成済み", - "xpack.data.mgmt.searchSessions.table.headerStatus": "ステータス", - "xpack.data.mgmt.searchSessions.table.headerType": "アプリ", - "xpack.data.mgmt.searchSessions.table.mlAppName": "機械学習", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "検索セッションはもう一度実行されます。今後使用するために保存できます。", - "xpack.data.mgmt.searchSessions.table.numSearches": "# 検索", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "この検索は別のバージョンを実行しているKibanaインスタンスで作成されました。正常に復元されない可能性があります。", - "xpack.data.search.statusError": "検索は{errorCode}ステータスで完了しました", - "xpack.data.search.statusThrow": "検索ステータスはエラー{message}({errorCode})ステータスを返しました", - "xpack.data.searchSessionIndicator.cancelButtonText": "セッションの停止", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "不完全なデータを表示しています。", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledTitleText": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledTooltipText": "検索セッションが停止しました", - "xpack.data.searchSessionIndicator.canceledWhenText": "停止:{when}", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "セッションの保存", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "検索セッションを管理するアクセス権がありません", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "検索セッション結果が期限切れです。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "管理から完了した結果に戻ることができます。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "保存されたセッションを実行中です", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "開始:{when}", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "セッションを保存して作業を続け、完了した結果に戻ってください。", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "検索セッションを読み込んでいます", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "検索セッションを読み込んでいます", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "検索に少し時間がかかっています...", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "開始:{when}", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "特定の時間範囲からキャッシュに保存されたデータを表示しています。時間範囲またはフィルターを変更すると、セッションが再実行されます。", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "保存されたセッションが復元されました", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "検索セッションが復元されました", - "xpack.data.searchSessionIndicator.restoredTitleText": "検索セッションが復元されました", - "xpack.data.searchSessionIndicator.restoredWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "管理からこれらの結果に戻ることができます。", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "保存されたセッションが完了しました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "保存されたセッションが完了しました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "検索セッションが保存されました", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "セッションを保存して、後から戻ります。", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedText": "検索セッションが完了しました", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "完了:{when}", - "xpack.data.searchSessionIndicator.saveButtonText": "セッションの保存", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "セッションの管理", - "xpack.data.searchSessionName.ariaLabelText": "検索セッション名", - "xpack.data.searchSessionName.editAriaLabelText": "検索セッション名を編集", - "xpack.data.searchSessionName.placeholderText": "検索セッションの名前を入力", - "xpack.data.searchSessionName.saveButtonText": "保存", - "xpack.data.sessions.management.flyoutText": "この検索セッションの構成", - "xpack.data.sessions.management.flyoutTitle": "検索セッションの検査", "xpack.dataVisualizer.addCombinedFieldsLabel": "結合されたフィールドを追加", "xpack.dataVisualizer.choroplethMap.topValuesCount": "{fieldName}の上位の値件数", "xpack.dataVisualizer.chrome.help.appName": "データビジュアライザー", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 9f2a139a65c36..adb097d9936c8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2722,6 +2722,110 @@ "data.searchSessions.sessionService.sessionObjectFetchError": "无法提取搜索会话信息", "data.triggers.applyFilterDescription": "应用 kibana 筛选时。可能是单个值或范围筛选。", "data.triggers.applyFilterTitle": "应用筛选", + "data.mgmt.searchSessions.actionDelete": "删除", + "data.mgmt.searchSessions.actionExtend": "延长", + "data.mgmt.searchSessions.actionRename": "编辑名称", + "data.mgmt.searchSessions.actions.tooltip.moreActions": "更多操作", + "data.mgmt.searchSessions.api.deleted": "搜索会话已删除。", + "data.mgmt.searchSessions.api.deletedError": "无法删除搜索会话!", + "data.mgmt.searchSessions.api.extended": "搜索会话已延长。", + "data.mgmt.searchSessions.api.extendError": "无法延长搜索会话!", + "data.mgmt.searchSessions.api.fetchError": "无法刷新页面!", + "data.mgmt.searchSessions.api.fetchTimeout": "获取搜索会话信息在 {timeout} 秒后已超时", + "data.mgmt.searchSessions.api.rename": "搜索会话已重命名", + "data.mgmt.searchSessions.api.renameError": "无法重命名搜索会话", + "data.mgmt.searchSessions.appTitle": "搜索会话", + "data.mgmt.searchSessions.ariaLabel.moreActions": "更多操作", + "data.mgmt.searchSessions.cancelModal.cancelButton": "取消", + "data.mgmt.searchSessions.cancelModal.deleteButton": "删除", + "data.mgmt.searchSessions.cancelModal.message": "删除搜索会话“{name}”将会删除所有缓存的结果。", + "data.mgmt.searchSessions.cancelModal.title": "删除搜索会话", + "data.mgmt.searchSessions.extendModal.dontExtendButton": "取消", + "data.mgmt.searchSessions.extendModal.extendButton": "延长过期时间", + "data.mgmt.searchSessions.extendModal.extendMessage": "搜索会话“{name}”过期时间将延长至 {newExpires}。", + "data.mgmt.searchSessions.extendModal.title": "延长搜索会话过期时间", + "data.mgmt.searchSessions.flyoutTitle": "检查", + "data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "文档", + "data.mgmt.searchSessions.main.sectionDescription": "管理已保存搜索会话。", + "data.mgmt.searchSessions.main.sectionTitle": "搜索会话", + "data.mgmt.searchSessions.renameModal.cancelButton": "取消", + "data.mgmt.searchSessions.renameModal.renameButton": "保存", + "data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "搜索会话名称", + "data.mgmt.searchSessions.renameModal.title": "编辑搜索会话名称", + "data.mgmt.searchSessions.search.filterApp": "应用", + "data.mgmt.searchSessions.search.filterStatus": "状态", + "data.mgmt.searchSessions.search.tools.refresh": "刷新", + "data.mgmt.searchSessions.status.expireDateUnknown": "未知", + "data.mgmt.searchSessions.status.expiresOn": "于 {expireDate}过期", + "data.mgmt.searchSessions.status.expiresSoonInDays": "将于 {numDays} 天后过期", + "data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} 天", + "data.mgmt.searchSessions.status.expiresSoonInHours": "此会话将于 {numHours} 小时后过期", + "data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} 小时", + "data.mgmt.searchSessions.status.label.cancelled": "已取消", + "data.mgmt.searchSessions.status.label.complete": "已完成", + "data.mgmt.searchSessions.status.label.error": "错误", + "data.mgmt.searchSessions.status.label.expired": "已过期", + "data.mgmt.searchSessions.status.label.inProgress": "进行中", + "data.mgmt.searchSessions.status.message.cancelled": "用户已取消", + "data.mgmt.searchSessions.status.message.createdOn": "于 {expireDate}过期", + "data.mgmt.searchSessions.status.message.error": "错误:{error}", + "data.mgmt.searchSessions.status.message.expiredOn": "已于 {expireDate}过期", + "data.mgmt.searchSessions.table.headerExpiration": "到期", + "data.mgmt.searchSessions.table.headerName": "名称", + "data.mgmt.searchSessions.table.headerStarted": "创建时间", + "data.mgmt.searchSessions.table.headerStatus": "状态", + "data.mgmt.searchSessions.table.headerType": "应用", + "data.mgmt.searchSessions.table.notRestorableWarning": "搜索会话将重新执行。然后,您可以将其保存,供未来使用。", + "data.mgmt.searchSessions.table.numSearches": "搜索数", + "data.mgmt.searchSessions.table.versionIncompatibleWarning": "此搜索会话在运行不同版本的 Kibana 实例中已创建。其可能不会正确还原。", + "data.search.statusError": "搜索完成,状态为 {errorCode}", + "data.search.statusThrow": "搜索状态引发错误 {message} ({errorCode}) 状态", + "data.searchSessionIndicator.cancelButtonText": "停止会话", + "data.searchSessionIndicator.canceledDescriptionText": "您正查看不完整的数据", + "data.searchSessionIndicator.canceledIconAriaLabel": "搜索会话已停止", + "data.searchSessionIndicator.canceledTitleText": "搜索会话已停止", + "data.searchSessionIndicator.canceledTooltipText": "搜索会话已停止", + "data.searchSessionIndicator.canceledWhenText": "已于 {when} 停止", + "data.searchSessionIndicator.continueInBackgroundButtonText": "保存会话", + "data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "您无权管理搜索会话", + "data.searchSessionIndicator.disabledDueToTimeoutMessage": "搜索会话结果已过期。", + "data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "可以从“管理”中返回至完成的结果", + "data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundTitleText": "已保存会话正在进行中", + "data.searchSessionIndicator.loadingInTheBackgroundWhenText": "已于 {when} 启动", + "data.searchSessionIndicator.loadingResultsDescription": "保存您的会话,继续您的工作,然后返回到完成的结果", + "data.searchSessionIndicator.loadingResultsIconAriaLabel": "搜索会话正在加载", + "data.searchSessionIndicator.loadingResultsIconTooltipText": "搜索会话正在加载", + "data.searchSessionIndicator.loadingResultsTitle": "您的搜索将需要一些时间......", + "data.searchSessionIndicator.loadingResultsWhenText": "已于 {when} 启动", + "data.searchSessionIndicator.restoredDescriptionText": "您在查看特定时间范围的缓存数据。更改时间范围或筛选将会重新运行会话", + "data.searchSessionIndicator.restoredResultsIconAriaLabel": "已保存会话已还原", + "data.searchSessionIndicator.restoredResultsTooltipText": "搜索会话已还原", + "data.searchSessionIndicator.restoredTitleText": "搜索会话已还原", + "data.searchSessionIndicator.restoredWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "可以从“管理”中返回到这些结果", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "已保存会话已完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "已保存会话已完成", + "data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "搜索会话已保存", + "data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.resultsLoadedDescriptionText": "保存您的会话,之后可返回", + "data.searchSessionIndicator.resultsLoadedIconAriaLabel": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedIconTooltipText": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedText": "搜索会话已完成", + "data.searchSessionIndicator.resultsLoadedWhenText": "已于 {when} 完成", + "data.searchSessionIndicator.saveButtonText": "保存会话", + "data.searchSessionIndicator.viewSearchSessionsLinkText": "管理会话", + "data.searchSessionName.ariaLabelText": "搜索会话名称", + "data.searchSessionName.editAriaLabelText": "编辑搜索会话名称", + "data.searchSessionName.placeholderText": "为搜索会话输入名称", + "data.searchSessionName.saveButtonText": "保存", + "data.sessions.management.flyoutText": "此搜索会话的配置", + "data.sessions.management.flyoutTitle": "检查搜索会话", + "dataViews.deprecations.scriptedFields.manualStepOneMessage": "导航到“堆栈管理”>“Kibana”>“索引模式”。", + "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "更新 {numberOfIndexPatternsWithScriptedFields} 个具有脚本字段的索引模式以改为使用运行时字段。多数情况下,要迁移现有脚本,您需要将“return ;”更改为“emit();”。至少有一个脚本字段的索引模式:{allTitles}", + "dataViews.deprecations.scriptedFieldsMessage": "您具有 {numberOfIndexPatternsWithScriptedFields} 个使用脚本字段的索引模式 ({titlesPreview}...)。脚本字段已过时,将在未来移除。请改为使用运行时脚本。", + "dataViews.deprecations.scriptedFieldsTitle": "找到使用脚本字段的索引模式", "dataViews.deprecations.scriptedFields.manualStepOneMessage": "导航到“堆栈管理”>“Kibana”>“数据视图”。", "dataViews.deprecations.scriptedFields.manualStepTwoMessage": "更新 {numberOfIndexPatternsWithScriptedFields} 个具有脚本字段的数据视图以改为使用运行时字段。多数情况下,要迁移现有脚本,您需要将“return ;”更改为“emit();”。至少有一个脚本字段的数据视图:{allTitles}", "dataViews.deprecations.scriptedFieldsMessage": "您具有 {numberOfIndexPatternsWithScriptedFields} 个使用脚本字段的数据视图 ({titlesPreview}...)。脚本字段已过时,将在未来移除。请改为使用运行时脚本。", @@ -10210,107 +10314,6 @@ "xpack.dashboard.drilldown.goToDashboard": "前往仪表板", "xpack.dashboard.FlyoutCreateDrilldownAction.displayName": "创建向下钻取", "xpack.dashboard.panel.openFlyoutEditDrilldown.displayName": "管理向下钻取", - "xpack.data.mgmt.searchSessions.actionDelete": "删除", - "xpack.data.mgmt.searchSessions.actionExtend": "延长", - "xpack.data.mgmt.searchSessions.actionRename": "编辑名称", - "xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "更多操作", - "xpack.data.mgmt.searchSessions.api.deleted": "搜索会话已删除。", - "xpack.data.mgmt.searchSessions.api.deletedError": "无法删除搜索会话!", - "xpack.data.mgmt.searchSessions.api.extended": "搜索会话已延长。", - "xpack.data.mgmt.searchSessions.api.extendError": "无法延长搜索会话!", - "xpack.data.mgmt.searchSessions.api.fetchError": "无法刷新页面!", - "xpack.data.mgmt.searchSessions.api.fetchTimeout": "获取搜索会话信息在 {timeout} 秒后已超时", - "xpack.data.mgmt.searchSessions.api.rename": "搜索会话已重命名", - "xpack.data.mgmt.searchSessions.api.renameError": "无法重命名搜索会话", - "xpack.data.mgmt.searchSessions.appTitle": "搜索会话", - "xpack.data.mgmt.searchSessions.ariaLabel.moreActions": "更多操作", - "xpack.data.mgmt.searchSessions.cancelModal.cancelButton": "取消", - "xpack.data.mgmt.searchSessions.cancelModal.deleteButton": "删除", - "xpack.data.mgmt.searchSessions.cancelModal.message": "删除搜索会话“{name}”将会删除所有缓存的结果。", - "xpack.data.mgmt.searchSessions.cancelModal.title": "删除搜索会话", - "xpack.data.mgmt.searchSessions.extendModal.dontExtendButton": "取消", - "xpack.data.mgmt.searchSessions.extendModal.extendButton": "延长过期时间", - "xpack.data.mgmt.searchSessions.extendModal.extendMessage": "搜索会话“{name}”过期时间将延长至 {newExpires}。", - "xpack.data.mgmt.searchSessions.extendModal.title": "延长搜索会话过期时间", - "xpack.data.mgmt.searchSessions.flyoutTitle": "检查", - "xpack.data.mgmt.searchSessions.main.backgroundSessionsDocsLinkText": "文档", - "xpack.data.mgmt.searchSessions.main.sectionDescription": "管理已保存搜索会话。", - "xpack.data.mgmt.searchSessions.main.sectionTitle": "搜索会话", - "xpack.data.mgmt.searchSessions.renameModal.cancelButton": "取消", - "xpack.data.mgmt.searchSessions.renameModal.renameButton": "保存", - "xpack.data.mgmt.searchSessions.renameModal.searchSessionNameInputLabel": "搜索会话名称", - "xpack.data.mgmt.searchSessions.renameModal.title": "编辑搜索会话名称", - "xpack.data.mgmt.searchSessions.search.filterApp": "应用", - "xpack.data.mgmt.searchSessions.search.filterStatus": "状态", - "xpack.data.mgmt.searchSessions.search.tools.refresh": "刷新", - "xpack.data.mgmt.searchSessions.status.expireDateUnknown": "未知", - "xpack.data.mgmt.searchSessions.status.expiresOn": "于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDays": "将于 {numDays} 天后过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInDaysTooltip": "{numDays} 天", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHours": "此会话将于 {numHours} 小时后过期", - "xpack.data.mgmt.searchSessions.status.expiresSoonInHoursTooltip": "{numHours} 小时", - "xpack.data.mgmt.searchSessions.status.label.cancelled": "已取消", - "xpack.data.mgmt.searchSessions.status.label.complete": "已完成", - "xpack.data.mgmt.searchSessions.status.label.error": "错误", - "xpack.data.mgmt.searchSessions.status.label.expired": "已过期", - "xpack.data.mgmt.searchSessions.status.label.inProgress": "进行中", - "xpack.data.mgmt.searchSessions.status.message.cancelled": "用户已取消", - "xpack.data.mgmt.searchSessions.status.message.createdOn": "于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.status.message.error": "错误:{error}", - "xpack.data.mgmt.searchSessions.status.message.expiredOn": "已于 {expireDate}过期", - "xpack.data.mgmt.searchSessions.table.headerExpiration": "到期", - "xpack.data.mgmt.searchSessions.table.headerName": "名称", - "xpack.data.mgmt.searchSessions.table.headerStarted": "创建时间", - "xpack.data.mgmt.searchSessions.table.headerStatus": "状态", - "xpack.data.mgmt.searchSessions.table.headerType": "应用", - "xpack.data.mgmt.searchSessions.table.mlAppName": "Machine Learning", - "xpack.data.mgmt.searchSessions.table.notRestorableWarning": "搜索会话将重新执行。然后,您可以将其保存,供未来使用。", - "xpack.data.mgmt.searchSessions.table.numSearches": "搜索数", - "xpack.data.mgmt.searchSessions.table.versionIncompatibleWarning": "此搜索会话在运行不同版本的 Kibana 实例中已创建。其可能不会正确还原。", - "xpack.data.search.statusError": "搜索完成,状态为 {errorCode}", - "xpack.data.search.statusThrow": "搜索状态引发错误 {message} ({errorCode}) 状态", - "xpack.data.searchSessionIndicator.cancelButtonText": "停止会话", - "xpack.data.searchSessionIndicator.canceledDescriptionText": "您正查看不完整的数据", - "xpack.data.searchSessionIndicator.canceledIconAriaLabel": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledTitleText": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledTooltipText": "搜索会话已停止", - "xpack.data.searchSessionIndicator.canceledWhenText": "已于 {when} 停止", - "xpack.data.searchSessionIndicator.continueInBackgroundButtonText": "保存会话", - "xpack.data.searchSessionIndicator.disabledDueToDisabledGloballyMessage": "您无权管理搜索会话", - "xpack.data.searchSessionIndicator.disabledDueToTimeoutMessage": "搜索会话结果已过期。", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundDescriptionText": "可以从“管理”中返回至完成的结果", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconAriaLabel": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundIconTooltipText": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundTitleText": "已保存会话正在进行中", - "xpack.data.searchSessionIndicator.loadingInTheBackgroundWhenText": "已于 {when} 启动", - "xpack.data.searchSessionIndicator.loadingResultsDescription": "保存您的会话,继续您的工作,然后返回到完成的结果", - "xpack.data.searchSessionIndicator.loadingResultsIconAriaLabel": "搜索会话正在加载", - "xpack.data.searchSessionIndicator.loadingResultsIconTooltipText": "搜索会话正在加载", - "xpack.data.searchSessionIndicator.loadingResultsTitle": "您的搜索将需要一些时间......", - "xpack.data.searchSessionIndicator.loadingResultsWhenText": "已于 {when} 启动", - "xpack.data.searchSessionIndicator.restoredDescriptionText": "您在查看特定时间范围的缓存数据。更改时间范围或筛选将会重新运行会话", - "xpack.data.searchSessionIndicator.restoredResultsIconAriaLabel": "已保存会话已还原", - "xpack.data.searchSessionIndicator.restoredResultsTooltipText": "搜索会话已还原", - "xpack.data.searchSessionIndicator.restoredTitleText": "搜索会话已还原", - "xpack.data.searchSessionIndicator.restoredWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundDescriptionText": "可以从“管理”中返回到这些结果", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconAriaLabel": "已保存会话已完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundIconTooltipText": "已保存会话已完成", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundTitleText": "搜索会话已保存", - "xpack.data.searchSessionIndicator.resultLoadedInTheBackgroundWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.resultsLoadedDescriptionText": "保存您的会话,之后可返回", - "xpack.data.searchSessionIndicator.resultsLoadedIconAriaLabel": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedIconTooltipText": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedText": "搜索会话已完成", - "xpack.data.searchSessionIndicator.resultsLoadedWhenText": "已于 {when} 完成", - "xpack.data.searchSessionIndicator.saveButtonText": "保存会话", - "xpack.data.searchSessionIndicator.viewSearchSessionsLinkText": "管理会话", - "xpack.data.searchSessionName.ariaLabelText": "搜索会话名称", - "xpack.data.searchSessionName.editAriaLabelText": "编辑搜索会话名称", - "xpack.data.searchSessionName.placeholderText": "为搜索会话输入名称", - "xpack.data.searchSessionName.saveButtonText": "保存", - "xpack.data.sessions.management.flyoutText": "此搜索会话的配置", - "xpack.data.sessions.management.flyoutTitle": "检查搜索会话", "xpack.dataVisualizer.addCombinedFieldsLabel": "添加组合字段", "xpack.dataVisualizer.choroplethMap.topValuesCount": "{fieldName} 的排名最前值计数", "xpack.dataVisualizer.chrome.help.appName": "数据可视化工具", diff --git a/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json b/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json index f96e8b2bbcc23..1960c49839566 100644 --- a/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json +++ b/x-pack/test/plugin_functional/plugins/timelines_test/kibana.json @@ -4,7 +4,7 @@ "version": "1.0.0", "kibanaVersion": "kibana", "configPath": ["xpack", "timelinesTest"], - "requiredPlugins": ["timelines", "data", "dataEnhanced"], + "requiredPlugins": ["timelines", "data"], "requiredBundles": ["kibanaReact"], "server": false, "ui": true diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index d6bdf8cfaa6fd..8c6a1cb88c0ba 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -58,7 +58,6 @@ { "path": "../plugins/global_search/tsconfig.json" }, { "path": "../plugins/global_search_providers/tsconfig.json" }, { "path": "../plugins/features/tsconfig.json" }, - { "path": "../plugins/data_enhanced/tsconfig.json" }, { "path": "../plugins/drilldowns/url_drilldown/tsconfig.json" }, { "path": "../plugins/embeddable_enhanced/tsconfig.json" }, { "path": "../plugins/encrypted_saved_objects/tsconfig.json" },