diff --git a/.github/workflows/skip-failed-test.yml b/.github/workflows/skip-failed-test.yml index 9ac9485709bd..039d0ab8aa8b 100644 --- a/.github/workflows/skip-failed-test.yml +++ b/.github/workflows/skip-failed-test.yml @@ -26,7 +26,7 @@ jobs: uses: ./actions/permission-check with: permission: admin - teams: appex-qa + teams: appex-qa, security-solution-test-skippers token: ${{secrets.KIBANAMACHINE_TOKEN}} - name: Checkout kibana-operations diff --git a/docs/management/advanced-options.asciidoc b/docs/management/advanced-options.asciidoc index 03a85d319cf5..c0307253a720 100644 --- a/docs/management/advanced-options.asciidoc +++ b/docs/management/advanced-options.asciidoc @@ -451,6 +451,9 @@ preview:[] When enabled, allows users to create Service Groups from the APM Serv [[observability-apm-trace-explorer-tab]]`observability:apmTraceExplorerTab`:: preview:[] Enable the APM Trace Explorer feature, that allows you to search and inspect traces with KQL or EQL. +[[observability-infrastructure-profiling-integration]]`observability:enableInfrastructureProfilingIntegration`:: +preview:[] Enables the Profiling view in Host details within Infrastructure. + [float] [[kibana-reporting-settings]] ==== Reporting diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts index 57ae1cc9f6e4..a259d76c6aff 100644 --- a/packages/kbn-doc-links/src/get_doc_links.ts +++ b/packages/kbn-doc-links/src/get_doc_links.ts @@ -671,6 +671,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`, executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`, indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`, + inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`, multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`, openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`, putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`, diff --git a/packages/kbn-doc-links/src/types.ts b/packages/kbn-doc-links/src/types.ts index 3b6d22a19024..910c0c218dcc 100644 --- a/packages/kbn-doc-links/src/types.ts +++ b/packages/kbn-doc-links/src/types.ts @@ -391,6 +391,7 @@ export interface DocLinks { cronExpressions: string; executeWatchActionModes: string; indexExists: string; + inferTrainedModel: string; multiSearch: string; openIndex: string; putComponentTemplate: string; diff --git a/packages/kbn-es-query/src/expressions/types.ts b/packages/kbn-es-query/src/expressions/types.ts index 42dc021c9b75..ed367adc7973 100644 --- a/packages/kbn-es-query/src/expressions/types.ts +++ b/packages/kbn-es-query/src/expressions/types.ts @@ -9,6 +9,7 @@ import { Filter, Query, TimeRange } from '../filters'; export interface ExecutionContextSearch { + now?: number; filters?: Filter[]; query?: Query | Query[]; timeRange?: TimeRange; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 1e4c82b5226d..d38e1399ed3a 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -86,7 +86,7 @@ pageLoadAssetSize: kibanaUsageCollection: 16463 kibanaUtils: 79713 kubernetesSecurity: 77234 - lens: 39000 + lens: 41000 licenseManagement: 41817 licensing: 29004 links: 44490 diff --git a/src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap b/src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap index 2400f7a1f67d..7bcf782fbbbc 100644 --- a/src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap +++ b/src/plugins/data/common/search/expressions/__snapshots__/kibana.test.ts.snap @@ -14,6 +14,7 @@ Object { }, }, ], + "now": 0, "query": Array [ Object { "language": "lucene", diff --git a/src/plugins/data/common/search/expressions/kibana.test.ts b/src/plugins/data/common/search/expressions/kibana.test.ts index c82bc0293cef..4992a345bd0d 100644 --- a/src/plugins/data/common/search/expressions/kibana.test.ts +++ b/src/plugins/data/common/search/expressions/kibana.test.ts @@ -20,6 +20,7 @@ describe('interpreter/functions#kibana', () => { beforeEach(() => { input = { timeRange: { from: '0', to: '1' } }; search = { + now: 0, type: 'kibana_context', query: { language: 'lucene', query: 'geo.src:US' }, filters: [ diff --git a/src/plugins/data/common/search/expressions/kibana.ts b/src/plugins/data/common/search/expressions/kibana.ts index 83d2cdc1c64b..ad8405a51418 100644 --- a/src/plugins/data/common/search/expressions/kibana.ts +++ b/src/plugins/data/common/search/expressions/kibana.ts @@ -41,6 +41,7 @@ export const kibana: ExpressionFunctionKibana = { // TODO: But it shouldn't be need. ...input, type: 'kibana_context', + now: getSearchContext().now ?? Date.now(), query: [...toArray(getSearchContext().query), ...toArray((input || {}).query)], filters: [...(getSearchContext().filters || []), ...((input || {}).filters || [])], timeRange: getSearchContext().timeRange || (input ? input.timeRange : undefined), diff --git a/src/plugins/discover/common/locator.test.ts b/src/plugins/discover/common/locator.test.ts index 80bc4ceebed2..93da54ad365e 100644 --- a/src/plugins/discover/common/locator.test.ts +++ b/src/plugins/discover/common/locator.test.ts @@ -218,17 +218,22 @@ describe('Discover url generator', () => { expect(path).toContain('__test__'); }); - test('can specify columns, interval, sort and savedQuery', async () => { + test('can specify columns, grid, interval, sort and savedQuery', async () => { const { locator } = await setup(); const { path } = await locator.getLocation({ columns: ['_source'], + grid: { + columns: { + _source: { width: 150 }, + }, + }, interval: 'auto', sort: [['timestamp, asc']] as string[][] & SerializableRecord, savedQuery: '__savedQueryId__', }); expect(path).toMatchInlineSnapshot( - `"#/?_a=(columns:!(_source),interval:auto,savedQuery:__savedQueryId__,sort:!(!('timestamp,%20asc')))"` + `"#/?_a=(columns:!(_source),grid:(columns:(_source:(width:150))),interval:auto,savedQuery:__savedQueryId__,sort:!(!('timestamp,%20asc')))"` ); }); diff --git a/src/plugins/discover/common/locator.ts b/src/plugins/discover/common/locator.ts index 70e60f55b5fb..9be9947e743d 100644 --- a/src/plugins/discover/common/locator.ts +++ b/src/plugins/discover/common/locator.ts @@ -10,6 +10,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import type { Filter, TimeRange, Query, AggregateQuery } from '@kbn/es-query'; import type { GlobalQueryStateFromUrl, RefreshInterval } from '@kbn/data-plugin/public'; import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public'; +import type { DiscoverGridSettings } from '@kbn/saved-search-plugin/common'; import { DataViewSpec } from '@kbn/data-views-plugin/common'; import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/common'; import { VIEW_MODE } from './constants'; @@ -70,6 +71,11 @@ export interface DiscoverAppLocatorParams extends SerializableRecord { */ columns?: string[]; + /** + * Data Grid related state + */ + grid?: DiscoverGridSettings; + /** * Used interval of the histogram */ @@ -139,6 +145,7 @@ export class DiscoverAppLocatorDefinition implements LocatorDefinition Get links -> Snapshot const params: DiscoverAppLocatorParams = { - ...otherState, + ...appState, ...(savedSearch.id ? { savedSearchId: savedSearch.id } : {}), ...(dataView?.isPersisted() ? { dataViewId: dataView?.id } diff --git a/src/plugins/discover/public/application/main/services/discover_app_state_container.ts b/src/plugins/discover/public/application/main/services/discover_app_state_container.ts index facf8e26fb85..e1614bf79639 100644 --- a/src/plugins/discover/public/application/main/services/discover_app_state_container.ts +++ b/src/plugins/discover/public/application/main/services/discover_app_state_container.ts @@ -24,7 +24,7 @@ import { SavedSearch, VIEW_MODE } from '@kbn/saved-search-plugin/public'; import { IKbnUrlStateStorage, ISyncStateRef, syncState } from '@kbn/kibana-utils-plugin/public'; import { isEqual } from 'lodash'; import { connectToQueryState, syncGlobalQueryStateWithUrl } from '@kbn/data-plugin/public'; -import type { UnifiedDataTableSettings } from '@kbn/unified-data-table'; +import type { DiscoverGridSettings } from '@kbn/saved-search-plugin/common'; import type { DiscoverServices } from '../../../build_services'; import { addLog } from '../../../utils/add_log'; import { cleanupUrlState } from '../utils/cleanup_url_state'; @@ -94,7 +94,7 @@ export interface DiscoverAppState { /** * Data Grid related state */ - grid?: UnifiedDataTableSettings; + grid?: DiscoverGridSettings; /** * Hide chart */ diff --git a/src/plugins/discover/public/application/main/services/discover_state.ts b/src/plugins/discover/public/application/main/services/discover_state.ts index 1dc58643ebdc..8994afb8a5f9 100644 --- a/src/plugins/discover/public/application/main/services/discover_state.ts +++ b/src/plugins/discover/public/application/main/services/discover_state.ts @@ -570,6 +570,7 @@ function createUrlGeneratorState({ : data.query.timefilter.timefilter.getTime(), searchSessionId: shouldRestoreSearchSession ? data.search.session.getSessionId() : undefined, columns: appState.columns, + grid: appState.grid, sort: appState.sort, savedQuery: appState.savedQuery, interval: appState.interval, diff --git a/src/plugins/expressions/common/expression_functions/specs/index.ts b/src/plugins/expressions/common/expression_functions/specs/index.ts index 0e473e4a79e5..37af3ede5ebe 100644 --- a/src/plugins/expressions/common/expression_functions/specs/index.ts +++ b/src/plugins/expressions/common/expression_functions/specs/index.ts @@ -17,6 +17,7 @@ export * from './overall_metric'; export * from './derivative'; export * from './moving_average'; export * from './ui_setting'; +export * from './math_column'; export type { MapColumnArguments } from './map_column'; export { mapColumn } from './map_column'; export type { MathArguments, MathInput } from './math'; diff --git a/src/plugins/expressions/common/expression_functions/specs/math_column.ts b/src/plugins/expressions/common/expression_functions/specs/math_column.ts index e056bc6b876e..6b75af7de4ca 100644 --- a/src/plugins/expressions/common/expression_functions/specs/math_column.ts +++ b/src/plugins/expressions/common/expression_functions/specs/math_column.ts @@ -18,12 +18,14 @@ export type MathColumnArguments = MathArguments & { copyMetaFrom?: string | null; }; -export const mathColumn: ExpressionFunctionDefinition< +export type ExpressionFunctionMathColumn = ExpressionFunctionDefinition< 'mathColumn', Datatable, MathColumnArguments, Promise -> = { +>; + +export const mathColumn: ExpressionFunctionMathColumn = { name: 'mathColumn', type: 'datatable', inputTypes: ['datatable'], diff --git a/src/plugins/expressions/common/expression_functions/types.ts b/src/plugins/expressions/common/expression_functions/types.ts index 018ee9e9fac0..c59169ccf04a 100644 --- a/src/plugins/expressions/common/expression_functions/types.ts +++ b/src/plugins/expressions/common/expression_functions/types.ts @@ -20,6 +20,7 @@ import { ExpressionFunctionDerivative, ExpressionFunctionMovingAverage, ExpressionFunctionOverallMetric, + ExpressionFunctionMathColumn, } from './specs'; import { ExpressionAstFunction } from '../ast'; @@ -132,4 +133,5 @@ export interface ExpressionFunctionDefinitions { overall_metric: ExpressionFunctionOverallMetric; derivative: ExpressionFunctionDerivative; moving_average: ExpressionFunctionMovingAverage; + math_column: ExpressionFunctionMathColumn; } diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts index 537b7739bcc0..1fa2407cdd28 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts @@ -581,6 +581,10 @@ export const stackManagementSchema: MakeSchemaFrom = { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, }, + 'observability:enableInfrastructureProfilingIntegration': { + type: 'boolean', + _meta: { description: 'Non-default value of setting.' }, + }, 'securitySolution:enableGroupedNav': { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts index 273864af2bb4..33518b5389f5 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts @@ -46,6 +46,7 @@ export interface UsageStats { 'observability:apmAWSLambdaPriceFactor': string; 'observability:apmAWSLambdaRequestCostPerMillion': number; 'observability:enableInfrastructureHostsView': boolean; + 'observability:enableInfrastructureProfilingIntegration': boolean; 'observability:apmAgentExplorerView': boolean; 'visualization:heatmap:maxBuckets': number; 'visualization:colorMapping': string; diff --git a/src/plugins/saved_search/common/types.ts b/src/plugins/saved_search/common/types.ts index c47548aebd8d..acb98d26a0d1 100644 --- a/src/plugins/saved_search/common/types.ts +++ b/src/plugins/saved_search/common/types.ts @@ -9,13 +9,14 @@ import type { ISearchSource, RefreshInterval, TimeRange } from '@kbn/data-plugin/common'; import type { SavedObjectReference } from '@kbn/core-saved-objects-server'; import type { SavedObjectsResolveResponse } from '@kbn/core/server'; +import type { SerializableRecord } from '@kbn/utility-types'; import { VIEW_MODE } from '.'; -export interface DiscoverGridSettings { +export interface DiscoverGridSettings extends SerializableRecord { columns?: Record; } -export interface DiscoverGridSettingsColumn { +export interface DiscoverGridSettingsColumn extends SerializableRecord { width?: number; } @@ -25,9 +26,7 @@ export interface SavedSearchAttributes { sort: Array<[string, string]>; columns: string[]; description: string; - grid: { - columns?: Record; - }; + grid: DiscoverGridSettings; hideChart: boolean; isTextBasedQuery: boolean; usesAdHocDataView?: boolean; @@ -59,9 +58,7 @@ export interface SavedSearch { columns?: string[]; description?: string; tags?: string[] | undefined; - grid?: { - columns?: Record; - }; + grid?: DiscoverGridSettings; hideChart?: boolean; viewMode?: VIEW_MODE; hideAggregatedPreview?: boolean; diff --git a/src/plugins/saved_search/tsconfig.json b/src/plugins/saved_search/tsconfig.json index 7ed2cb4e8211..b1aa1679469e 100644 --- a/src/plugins/saved_search/tsconfig.json +++ b/src/plugins/saved_search/tsconfig.json @@ -31,6 +31,7 @@ "@kbn/discover-utils", "@kbn/logging", "@kbn/core-plugins-server", + "@kbn/utility-types", ], "exclude": [ "target/**/*", diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index 8c2a7b13d52c..ec17c9b9d1a3 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -10061,6 +10061,12 @@ "description": "Non-default value of setting." } }, + "observability:enableInfrastructureProfilingIntegration": { + "type": "boolean", + "_meta": { + "description": "Non-default value of setting." + } + }, "securitySolution:enableGroupedNav": { "type": "boolean", "_meta": { diff --git a/test/functional/apps/discover/group1/_discover_histogram.ts b/test/functional/apps/discover/group1/_discover_histogram.ts index 43f39b417864..bdaf14fca96e 100644 --- a/test/functional/apps/discover/group1/_discover_histogram.ts +++ b/test/functional/apps/discover/group1/_discover_histogram.ts @@ -33,7 +33,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const log = getService('log'); const queryBar = getService('queryBar'); - describe('discover histogram', function describeIndexTests() { + // FLAKY: https://github.com/elastic/kibana/issues/173586 + describe.skip('discover histogram', function describeIndexTests() { before(async () => { await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); await esArchiver.load('test/functional/fixtures/es_archiver/long_window_logstash'); diff --git a/test/functional/apps/management/data_views/_data_view_create_delete.ts b/test/functional/apps/management/data_views/_data_view_create_delete.ts index e3bc2240887a..245ac88606b5 100644 --- a/test/functional/apps/management/data_views/_data_view_create_delete.ts +++ b/test/functional/apps/management/data_views/_data_view_create_delete.ts @@ -187,7 +187,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('index pattern edit', function () { + // FLAKY: https://github.com/elastic/kibana/issues/173625 + describe.skip('index pattern edit', function () { it('should update field list', async function () { await PageObjects.settings.editIndexPattern( 'kibana_sample_data_flights', diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/select_connector/select_connector.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/select_connector/select_connector.tsx index 31c4f9cc7a71..8c75fa9a4b1b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/select_connector/select_connector.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/select_connector/select_connector.tsx @@ -225,7 +225,7 @@ export const SelectConnector: React.FC = () => { 'xpack.enterpriseSearch.selectConnector.p.areAvailableDirectlyWithinLabel', { defaultMessage: - 'Are available directly within Elastic Cloud deployments No additional infrastructure is required You can also convert them as self hosted Connectors client at any moment', + 'Available directly within Elastic Cloud deployments. No additional infrastructure is required. You can also convert native connectors to self-hosted connector clients.', } )}

@@ -259,7 +259,7 @@ export const SelectConnector: React.FC = () => { 'xpack.enterpriseSearch.selectConnector.p.deployConnectorsOnYourLabel', { defaultMessage: - 'Deploy connectors on your own infrastructure You can also customize existing Connector clients or build your own using our connector framework', + 'Deploy connectors on your own infrastructure. You can also customize existing connector clients, or build your own using our connector framework.', } )}

diff --git a/x-pack/plugins/fleet/common/types/models/agent.ts b/x-pack/plugins/fleet/common/types/models/agent.ts index 120f0bc883e1..1242a6112495 100644 --- a/x-pack/plugins/fleet/common/types/models/agent.ts +++ b/x-pack/plugins/fleet/common/types/models/agent.ts @@ -446,6 +446,7 @@ export interface AgentUpgradeDetails { metadata?: { scheduled_at?: string; download_percent?: number; + download_rate?: number; // bytes per second failed_state?: AgentUpgradeStateType; error_msg?: string; }; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.test.tsx index 1518a68fd6f0..a5f3498fd0b5 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.test.tsx @@ -48,12 +48,38 @@ describe('getDownloadEstimate', () => { expect(getDownloadEstimate()).toEqual(''); }); - it('should return an empty string if the agent has a zero download percent', () => { - expect(getDownloadEstimate(0)).toEqual(''); + it('should display 0% if the agent has a zero download percent', () => { + expect(getDownloadEstimate({ download_percent: 0 })).toEqual(' (0%)'); + }); + + it('should display 0 Bps if the agent has a zero download rate', () => { + expect(getDownloadEstimate({ download_rate: 0 })).toEqual(' (at 0.0 Bps)'); }); it('should return a formatted string if the agent has a positive download percent', () => { - expect(getDownloadEstimate(16.4)).toEqual(' (16.4%)'); + expect(getDownloadEstimate({ download_percent: 16.4 })).toEqual(' (16.4%)'); + }); + + it('should return a formatted string if the agent has a kBps download rate', () => { + expect(getDownloadEstimate({ download_rate: 1024 })).toEqual(' (at 1.0 kBps)'); + }); + + it('should return a formatted string if the agent has a download rate and download percent', () => { + expect(getDownloadEstimate({ download_rate: 10, download_percent: 99 })).toEqual( + ' (99% at 10.0 Bps)' + ); + }); + + it('should return a formatted string if the agent has a MBps download rate', () => { + expect(getDownloadEstimate({ download_rate: 1200000 })).toEqual(' (at 1.1 MBps)'); + }); + + it('should return a formatted string if the agent has a GBps download rate', () => { + expect(getDownloadEstimate({ download_rate: 2400000000 })).toEqual(' (at 2.2 GBps)'); + }); + + it('should return a formatted string if the agent has a GBps download rate more than 1024', () => { + expect(getDownloadEstimate({ download_rate: 1200000000 * 1024 })).toEqual(' (at 1144.4 GBps)'); }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.tsx index 203b490f9f3e..e5cf2eb7913c 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/agent_upgrade_status.tsx @@ -35,14 +35,34 @@ export function getUpgradeStartDelay(scheduledAt?: string): string { return ` The upgrade will start in less than ${Math.ceil(timeDiffMillis / 36e5)} hours.`; } -export function getDownloadEstimate(downloadPercent?: number): string { - if (!downloadPercent || downloadPercent === 0) { +export function getDownloadEstimate(metadata?: AgentUpgradeDetails['metadata']): string { + if ( + !metadata || + (metadata.download_percent === undefined && metadata.download_rate === undefined) + ) { return ''; } + let tooltip = ''; + if (metadata.download_percent !== undefined) { + tooltip = `${metadata.download_percent}%`; + } + if (metadata.download_rate !== undefined) { + tooltip += ` at ${formatRate(metadata.download_rate)}`; + } - return ` (${downloadPercent}%)`; + return ` (${tooltip.trim()})`; } +const formatRate = (downloadRate: number) => { + let i = 0; + const byteUnits = [' Bps', ' kBps', ' MBps', ' GBps']; + for (; i < byteUnits.length - 1; i++) { + if (downloadRate < 1024) break; + downloadRate = downloadRate / 1024; + } + return downloadRate.toFixed(1) + byteUnits[i]; +}; + function getStatusComponents(agentUpgradeDetails?: AgentUpgradeDetails) { switch (agentUpgradeDetails?.state) { case 'UPG_REQUESTED': @@ -97,9 +117,7 @@ function getStatusComponents(agentUpgradeDetails?: AgentUpgradeDetails) { id="xpack.fleet.agentUpgradeStatusTooltip.upgradeDownloading" defaultMessage="Downloading the new agent artifact version{downloadEstimate}." values={{ - downloadEstimate: getDownloadEstimate( - agentUpgradeDetails?.metadata?.download_percent - ), + downloadEstimate: getDownloadEstimate(agentUpgradeDetails?.metadata), }} /> ), diff --git a/x-pack/plugins/infra/public/components/asset_details/hooks/use_page_header.tsx b/x-pack/plugins/infra/public/components/asset_details/hooks/use_page_header.tsx index 3fae1eca66a4..905def3ab0bc 100644 --- a/x-pack/plugins/infra/public/components/asset_details/hooks/use_page_header.tsx +++ b/x-pack/plugins/infra/public/components/asset_details/hooks/use_page_header.tsx @@ -5,22 +5,23 @@ * 2.0. */ import { - EuiIcon, - type EuiPageHeaderProps, - type EuiBreadcrumbsProps, EuiFlexGroup, EuiFlexItem, + EuiIcon, + type EuiBreadcrumbsProps, + type EuiPageHeaderProps, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; import { useLinkProps } from '@kbn/observability-shared-plugin/public'; -import React, { useCallback, useMemo } from 'react'; import { capitalize } from 'lodash'; +import React, { useCallback, useMemo } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { FormattedMessage } from '@kbn/i18n-react'; import { usePluginConfig } from '../../../containers/plugin_config_context'; import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; +import { useProfilingIntegrationSetting } from '../../../hooks/use_profiling_integration_setting'; import { APM_HOST_FILTER_FIELD } from '../constants'; import { LinkToAlertsRule, LinkToApmServices, LinkToNodeDetails } from '../links'; -import { ContentTabIds, type RouteState, type LinkOptions, type Tab, type TabIds } from '../types'; +import { ContentTabIds, type LinkOptions, type RouteState, type Tab, type TabIds } from '../types'; import { useAssetDetailsRenderPropsContext } from './use_asset_details_render_props'; import { useTabSwitcherContext } from './use_tab_switcher'; @@ -110,12 +111,14 @@ const useRightSideItems = (links?: LinkOptions[]) => { const useFeatureFlagTabs = () => { const { featureFlags } = usePluginConfig(); + const isProfilingEnabled = useProfilingIntegrationSetting(); + const featureFlagControlledTabs: Partial> = useMemo( () => ({ [ContentTabIds.OSQUERY]: featureFlags.osqueryEnabled, - [ContentTabIds.PROFILING]: featureFlags.profilingEnabled, + [ContentTabIds.PROFILING]: isProfilingEnabled, }), - [featureFlags.osqueryEnabled, featureFlags.profilingEnabled] + [featureFlags.osqueryEnabled, isProfilingEnabled] ); const isTabEnabled = useCallback( diff --git a/x-pack/plugins/infra/public/components/asset_details/tabs/overview/kpis/cpu_profiling_prompt.tsx b/x-pack/plugins/infra/public/components/asset_details/tabs/overview/kpis/cpu_profiling_prompt.tsx index afe39963e966..291b255e7ce3 100644 --- a/x-pack/plugins/infra/public/components/asset_details/tabs/overview/kpis/cpu_profiling_prompt.tsx +++ b/x-pack/plugins/infra/public/components/asset_details/tabs/overview/kpis/cpu_profiling_prompt.tsx @@ -10,19 +10,24 @@ import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty } from '@elastic/eui'; import { EuiBadge } from '@elastic/eui'; import { EuiFlexGroup } from '@elastic/eui'; -import { usePluginConfig } from '../../../../../containers/plugin_config_context'; +import { useProfilingIntegrationSetting } from '../../../../../hooks/use_profiling_integration_setting'; import { useTabSwitcherContext } from '../../../hooks/use_tab_switcher'; export function CpuProfilingPrompt() { const { showTab } = useTabSwitcherContext(); - const { featureFlags } = usePluginConfig(); + const isProfilingEnabled = useProfilingIntegrationSetting(); - if (!featureFlags.profilingEnabled) { + if (!isProfilingEnabled) { return null; } return ( - + {i18n.translate('xpack.infra.cpuProfilingPrompt.newBadgeLabel', { defaultMessage: 'NEW', diff --git a/x-pack/plugins/infra/public/hooks/use_profiling_integration_setting.ts b/x-pack/plugins/infra/public/hooks/use_profiling_integration_setting.ts new file mode 100644 index 000000000000..ee9101af55fc --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_profiling_integration_setting.ts @@ -0,0 +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. + */ + +import { useUiSetting } from '@kbn/kibana-react-plugin/public'; +import { enableInfrastructureProfilingIntegration } from '@kbn/observability-plugin/common'; +import { usePluginConfig } from '../containers/plugin_config_context'; + +export function useProfilingIntegrationSetting(): boolean { + const { + featureFlags: { profilingEnabled }, + } = usePluginConfig(); + const isProfilingUiSettingEnabled = useUiSetting( + enableInfrastructureProfilingIntegration + ); + + return profilingEnabled && isProfilingUiSettingEnabled; +} diff --git a/x-pack/plugins/infra/public/pages/metrics/settings/features_configuration_panel.tsx b/x-pack/plugins/infra/public/pages/metrics/settings/features_configuration_panel.tsx index 19d7392fb7ca..aa69ef543c68 100644 --- a/x-pack/plugins/infra/public/pages/metrics/settings/features_configuration_panel.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/settings/features_configuration_panel.tsx @@ -10,9 +10,13 @@ import { EuiSpacer } from '@elastic/eui'; import { EuiForm } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import React from 'react'; -import { enableInfrastructureHostsView } from '@kbn/observability-plugin/common'; +import { + enableInfrastructureHostsView, + enableInfrastructureProfilingIntegration, +} from '@kbn/observability-plugin/common'; import { useEditableSettings } from '@kbn/observability-shared-plugin/public'; import { LazyField } from '@kbn/advanced-settings-plugin/public'; +import { usePluginConfig } from '../../../containers/plugin_config_context'; import { useKibanaContextForPlugin } from '../../../hooks/use_kibana'; type Props = Pick< @@ -31,6 +35,7 @@ export function FeaturesConfigurationPanel({ const { services: { docLinks, notifications }, } = useKibanaContextForPlugin(); + const { featureFlags } = usePluginConfig(); return ( @@ -52,6 +57,17 @@ export function FeaturesConfigurationPanel({ toasts={notifications.toasts} unsavedChanges={unsavedChanges[enableInfrastructureHostsView]} /> + {featureFlags.profilingEnabled && ( + + )} ); } diff --git a/x-pack/plugins/infra/public/pages/metrics/settings/source_configuration_settings.tsx b/x-pack/plugins/infra/public/pages/metrics/settings/source_configuration_settings.tsx index 5769f861234c..a064aaf0e151 100644 --- a/x-pack/plugins/infra/public/pages/metrics/settings/source_configuration_settings.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/settings/source_configuration_settings.tsx @@ -17,7 +17,10 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import React, { useCallback } from 'react'; import { Prompt, useEditableSettings } from '@kbn/observability-shared-plugin/public'; -import { enableInfrastructureHostsView } from '@kbn/observability-plugin/common'; +import { + enableInfrastructureHostsView, + enableInfrastructureProfilingIntegration, +} from '@kbn/observability-plugin/common'; import { SourceLoadingPage } from '../../../components/source_loading_page'; import { useSourceContext } from '../../../containers/metrics_source'; import { useInfraMLCapabilitiesContext } from '../../../containers/ml/infra_ml_capabilities'; @@ -61,7 +64,10 @@ export const SourceConfigurationSettings = ({ formState, formStateChanges, } = useSourceConfigurationFormState(source && source.configuration); - const infraUiSettings = useEditableSettings('infra_metrics', [enableInfrastructureHostsView]); + const infraUiSettings = useEditableSettings('infra_metrics', [ + enableInfrastructureHostsView, + enableInfrastructureProfilingIntegration, + ]); const resetAllUnsavedChanges = useCallback(() => { resetForm(); diff --git a/x-pack/plugins/lens/common/expressions/formula_context/context_fns.test.ts b/x-pack/plugins/lens/common/expressions/formula_context/context_fns.test.ts new file mode 100644 index 000000000000..f064238992b0 --- /dev/null +++ b/x-pack/plugins/lens/common/expressions/formula_context/context_fns.test.ts @@ -0,0 +1,91 @@ +/* + * 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 { ExecutionContext } from '@kbn/expressions-plugin/common'; +import { Adapters } from '@kbn/inspector-plugin/common'; +import { formulaIntervalFn, formulaNowFn, formulaTimeRangeFn } from './context_fns'; + +describe('interval', () => { + it('should return 0 if no time range available', () => { + // (not sure if this case is actually possible) + const result = formulaIntervalFn.fn(undefined, { targetBars: 100 }, { + getSearchContext: () => ({ + /* no time range */ + }), + } as ExecutionContext); + expect(result).toEqual(0); + }); + + it('should return 0 if no targetBars is passed', () => { + const result = formulaIntervalFn.fn( + undefined, + { + /* no targetBars */ + }, + { + getSearchContext: () => ({ + timeRange: { + from: 'now-15m', + to: 'now', + }, + }), + } as ExecutionContext + ); + expect(result).toEqual(0); + }); + + it('should return a valid value > 0 if both timeRange and targetBars is passed', () => { + const result = formulaIntervalFn.fn(undefined, { targetBars: 100 }, { + getSearchContext: () => ({ + timeRange: { + from: 'now-15m', + to: 'now', + }, + }), + } as ExecutionContext); + expect(result).toEqual(10000); + }); +}); + +describe('time range', () => { + it('should return 0 if no time range is available', () => { + // (not sure if this case is actually possible) + const result = formulaTimeRangeFn.fn(undefined, {}, { + getSearchContext: () => ({ + /* no time range */ + }), + } as ExecutionContext); + expect(result).toEqual(0); + }); + + it('should return a valid value > 0 if time range is available', () => { + const result = formulaTimeRangeFn.fn(undefined, {}, { + getSearchContext: () => ({ + timeRange: { + from: 'now-15m', + to: 'now', + }, + now: 1000000, // important to provide this to make the result consistent + }), + } as ExecutionContext); + + expect(result).toBe(900000); + }); +}); + +describe('now', () => { + it('should return the now value when passed', () => { + const now = 123456789; + expect( + formulaNowFn.fn(undefined, {}, { + getSearchContext: () => ({ + now, + }), + } as ExecutionContext) + ).toEqual(now); + }); +}); diff --git a/x-pack/plugins/lens/common/expressions/formula_context/context_fns.ts b/x-pack/plugins/lens/common/expressions/formula_context/context_fns.ts new file mode 100644 index 000000000000..2f77d1142f7d --- /dev/null +++ b/x-pack/plugins/lens/common/expressions/formula_context/context_fns.ts @@ -0,0 +1,97 @@ +/* + * 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 { getAbsoluteTimeRange, calcAutoIntervalNear } from '@kbn/data-plugin/common'; +import type { TimeRange } from '@kbn/es-query'; +import type { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; +import moment from 'moment'; +import { i18n } from '@kbn/i18n'; + +export type ExpressionFunctionFormulaTimeRange = ExpressionFunctionDefinition< + 'formula_time_range', + undefined, + object, + number +>; + +const getTimeRangeAsNumber = (timeRange: TimeRange | undefined, now: number | undefined) => { + if (!timeRange) return 0; + const absoluteTimeRange = getAbsoluteTimeRange( + timeRange, + now != null ? { forceNow: new Date(now) } : {} + ); + return timeRange ? moment(absoluteTimeRange.to).diff(moment(absoluteTimeRange.from)) : 0; +}; + +export const formulaTimeRangeFn: ExpressionFunctionFormulaTimeRange = { + name: 'formula_time_range', + + help: i18n.translate('xpack.lens.formula.timeRange.help', { + defaultMessage: 'The specified time range, in milliseconds (ms).', + }), + + args: {}, + + fn(_input, _args, { getSearchContext }) { + const { timeRange, now } = getSearchContext(); + return getTimeRangeAsNumber(timeRange, now); + }, +}; + +export type ExpressionFunctionFormulaInterval = ExpressionFunctionDefinition< + 'formula_interval', + undefined, + { + targetBars?: number; + }, + number +>; + +export const formulaIntervalFn: ExpressionFunctionFormulaInterval = { + name: 'formula_interval', + + help: i18n.translate('xpack.lens.formula.interval.help', { + defaultMessage: 'The specified minimum interval for the date histogram, in milliseconds (ms).', + }), + + args: { + targetBars: { + types: ['number'], + help: i18n.translate('xpack.lens.formula.interval.targetBars.help', { + defaultMessage: 'The target number of bars for the date histogram.', + }), + }, + }, + + fn(_input, args, { getSearchContext }) { + const { timeRange, now } = getSearchContext(); + return timeRange && args.targetBars + ? calcAutoIntervalNear(args.targetBars, getTimeRangeAsNumber(timeRange, now)).asMilliseconds() + : 0; + }, +}; + +export type ExpressionFunctionFormulaNow = ExpressionFunctionDefinition< + 'formula_now', + undefined, + object, + number +>; + +export const formulaNowFn: ExpressionFunctionFormulaNow = { + name: 'formula_now', + + help: i18n.translate('xpack.lens.formula.now.help', { + defaultMessage: 'The current now moment used in Kibana expressed in milliseconds (ms).', + }), + + args: {}, + + fn(_input, _args, { getSearchContext }) { + return getSearchContext().now ?? Date.now(); + }, +}; diff --git a/x-pack/plugins/lens/common/expressions/formula_context/index.ts b/x-pack/plugins/lens/common/expressions/formula_context/index.ts new file mode 100644 index 000000000000..da8931779cfb --- /dev/null +++ b/x-pack/plugins/lens/common/expressions/formula_context/index.ts @@ -0,0 +1,8 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export * from './context_fns'; diff --git a/x-pack/plugins/lens/common/expressions/index.ts b/x-pack/plugins/lens/common/expressions/index.ts index ccb6343334d6..c3ccaddac9fd 100644 --- a/x-pack/plugins/lens/common/expressions/index.ts +++ b/x-pack/plugins/lens/common/expressions/index.ts @@ -11,3 +11,4 @@ export * from './format_column'; export * from './map_to_columns'; export * from './time_scale'; export * from './datatable'; +export * from './formula_context'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.test.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.test.ts index 407f458a11e3..db38e18d3bd1 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.test.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.test.ts @@ -34,20 +34,6 @@ function createLayer( }; } -function createExpression(type: 'interval' | 'now' | 'time_range', value: number) { - return [ - { - type: 'function', - function: 'mathColumn', - arguments: { - id: ['col1'], - name: [`Constant: ${type}`], - expression: [String(value)], - }, - }, - ]; -} - describe('context variables', () => { describe('interval', () => { describe('getErrorMessages', () => { @@ -124,53 +110,6 @@ describe('context variables', () => { ).toBeUndefined(); }); }); - describe('toExpression', () => { - it('should return 0 if no dateRange is passed', () => { - expect( - intervalOperation.toExpression( - createLayer('interval'), - 'col1', - createMockedIndexPattern(), - { now: new Date(), targetBars: 100 } - ) - ).toEqual(expect.arrayContaining(createExpression('interval', 0))); - }); - - it('should return 0 if no targetBars is passed', () => { - expect( - intervalOperation.toExpression( - createLayer('interval'), - 'col1', - createMockedIndexPattern(), - { - dateRange: { - fromDate: new Date(2022, 0, 1).toISOString(), - toDate: new Date(2023, 0, 1).toISOString(), - }, - now: new Date(), - } - ) - ).toEqual(expect.arrayContaining(createExpression('interval', 0))); - }); - - it('should return a valid value > 0 if both dateRange and targetBars is passed', () => { - expect( - intervalOperation.toExpression( - createLayer('interval'), - 'col1', - createMockedIndexPattern(), - { - dateRange: { - fromDate: new Date(2022, 0, 1).toISOString(), - toDate: new Date(2023, 0, 1).toISOString(), - }, - now: new Date(), - targetBars: 100, - } - ) - ).toEqual(expect.arrayContaining(createExpression('interval', 86400000))); - }); - }); }); describe('time_range', () => { describe('getErrorMessages', () => { @@ -202,35 +141,6 @@ describe('context variables', () => { ).toEqual(expect.arrayContaining(['The current time range interval is not available'])); }); }); - - describe('toExpression', () => { - it('should return 0 if no dateRange is passed', () => { - expect( - timeRangeOperation.toExpression( - createLayer('time_range'), - 'col1', - createMockedIndexPattern(), - { now: new Date(), targetBars: 100 } - ) - ).toEqual(expect.arrayContaining(createExpression('time_range', 0))); - }); - - it('should return a valid value > 0 if dateRange is passed', () => { - expect( - timeRangeOperation.toExpression( - createLayer('time_range'), - 'col1', - createMockedIndexPattern(), - { - dateRange: { - fromDate: new Date(2022, 0, 1).toISOString(), - toDate: new Date(2023, 0, 1).toISOString(), - }, - } - ) - ).toEqual(expect.arrayContaining(createExpression('time_range', 31536000000))); - }); - }); }); describe('now', () => { describe('getErrorMessages', () => { @@ -240,16 +150,5 @@ describe('context variables', () => { ).toBeUndefined(); }); }); - - describe('toExpression', () => { - it('should return the now value when passed', () => { - const now = new Date(); - expect( - nowOperation.toExpression(createLayer('now'), 'col1', createMockedIndexPattern(), { - now, - }) - ).toEqual(expect.arrayContaining(createExpression('now', +now))); - }); - }); }); }); diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.tsx index 4b7b5b94b493..f5f28d94ad22 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/context_variables.tsx @@ -6,9 +6,18 @@ */ import { i18n } from '@kbn/i18n'; -import moment from 'moment'; -import { calcAutoIntervalNear, UI_SETTINGS } from '@kbn/data-plugin/common'; +import { UI_SETTINGS } from '@kbn/data-plugin/common'; import { partition } from 'lodash'; +import { + buildExpressionFunction, + buildExpression, + ExpressionFunctionDefinitions, +} from '@kbn/expressions-plugin/common'; +import { + ExpressionFunctionFormulaInterval, + ExpressionFunctionFormulaNow, + ExpressionFunctionFormulaTimeRange, +} from '../../../../../../common/expressions/formula_context/context_fns'; import type { DateHistogramIndexPatternColumn, FormBasedLayer, @@ -58,13 +67,9 @@ export interface TimeRangeIndexPatternColumn extends ReferenceBasedIndexPatternC operationType: 'time_range'; } -function getTimeRangeFromContext({ dateRange }: ContextValues) { - return dateRange ? moment(dateRange.toDate).diff(moment(dateRange.fromDate)) : 0; -} - function getTimeRangeErrorMessages( - layer: FormBasedLayer, - columnId: string, + _layer: FormBasedLayer, + _columnId: string, indexPattern: IndexPattern, dateRange?: DateRange | undefined ) { @@ -89,12 +94,11 @@ function getTimeRangeErrorMessages( export const timeRangeOperation = createContextValueBasedOperation({ type: 'time_range', label: 'Time range', - description: i18n.translate('xpack.lens.indexPattern.timeRange.documentation.markdown', { - defaultMessage: ` -The specified time range, in milliseconds (ms). - `, + description: i18n.translate('xpack.lens.formula.timeRange.help', { + defaultMessage: 'The specified time range, in milliseconds (ms).', }), - getContextValue: getTimeRangeFromContext, + getExpressionFunction: (_context: ContextValues) => + buildExpressionFunction('formula_time_range', {}), getErrorMessage: getTimeRangeErrorMessages, }); @@ -102,9 +106,6 @@ export interface NowIndexPatternColumn extends ReferenceBasedIndexPatternColumn operationType: 'now'; } -function getNowFromContext({ now }: ContextValues) { - return now == null ? Date.now() : +now; -} function getNowErrorMessage() { return undefined; } @@ -112,12 +113,11 @@ function getNowErrorMessage() { export const nowOperation = createContextValueBasedOperation({ type: 'now', label: 'Current now', - description: i18n.translate('xpack.lens.indexPattern.now.documentation.markdown', { - defaultMessage: ` - The current now moment used in Kibana expressed in milliseconds (ms). - `, + description: i18n.translate('xpack.lens.formula.now.help', { + defaultMessage: 'The current now moment used in Kibana expressed in milliseconds (ms).', }), - getContextValue: getNowFromContext, + getExpressionFunction: (_context: ContextValues) => + buildExpressionFunction('formula_now', {}), getErrorMessage: getNowErrorMessage, }); @@ -125,12 +125,6 @@ export interface IntervalIndexPatternColumn extends ReferenceBasedIndexPatternCo operationType: 'interval'; } -function getIntervalFromContext(context: ContextValues) { - return context.dateRange && context.targetBars - ? calcAutoIntervalNear(context.targetBars, getTimeRangeFromContext(context)).asMilliseconds() - : 0; -} - function getIntervalErrorMessages( layer: FormBasedLayer, columnId: string, @@ -174,12 +168,13 @@ function getIntervalErrorMessages( export const intervalOperation = createContextValueBasedOperation({ type: 'interval', label: 'Date histogram interval', - description: i18n.translate('xpack.lens.indexPattern.interval.documentation.markdown', { - defaultMessage: ` -The specified minimum interval for the date histogram, in milliseconds (ms). - `, + description: i18n.translate('xpack.lens.formula.interval.help', { + defaultMessage: 'The specified minimum interval for the date histogram, in milliseconds (ms).', }), - getContextValue: getIntervalFromContext, + getExpressionFunction: ({ targetBars }: ContextValues) => + buildExpressionFunction('formula_interval', { + targetBars, + }), getErrorMessage: getIntervalErrorMessages, }); @@ -191,14 +186,14 @@ export type ConstantsIndexPatternColumn = function createContextValueBasedOperation({ label, type, - getContextValue, + getExpressionFunction, getErrorMessage, description, }: { label: string; type: ColumnType['operationType']; description: string; - getContextValue: (context: ContextValues) => number; + getExpressionFunction: (context: ContextValues) => ReturnType; getErrorMessage: OperationDefinition['getErrorMessage']; }): OperationDefinition { return { @@ -233,15 +228,11 @@ function createContextValueBasedOperation { const column = layer.columns[columnId] as ColumnType; return [ - { - type: 'function', - function: 'mathColumn', - arguments: { - id: [columnId], - name: [column.label], - expression: [String(getContextValue(context))], - }, - }, + buildExpressionFunction('mathColumn', { + id: columnId, + name: column.label, + expression: buildExpression([getExpressionFunction(context)]), + }).toAst(), ]; }, createCopy(layers, source, target) { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx index b0729cb489ba..04d69c1afc57 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/config_panel.test.tsx @@ -484,6 +484,7 @@ describe('ConfigPanel', () => { }, dateRange: expect.anything(), filters: [], + now: expect.anything(), query: undefined, }, groupId: 'a', diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx index 73a4ef853390..bc3b71c08487 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx @@ -24,7 +24,6 @@ import { } from '@elastic/eui'; import type { CoreStart } from '@kbn/core/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import type { ExecutionContextSearch } from '@kbn/es-query'; import type { ExpressionRendererEvent, ExpressionRenderError, @@ -66,7 +65,6 @@ import { editVisualizationAction, setSaveable, useLensSelector, - selectExecutionContext, selectIsFullscreenDatasource, selectVisualization, selectDatasourceStates, @@ -80,6 +78,7 @@ import { VisualizationState, DatasourceStates, DataViewsState, + selectExecutionContextSearch, } from '../../../state_management'; import type { LensInspector } from '../../../lens_inspector_service'; import { inferTimeField, DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS } from '../../../utils'; @@ -712,7 +711,7 @@ export const VisualizationWrapper = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const context = useLensSelector(selectExecutionContext); + const searchContext = useLensSelector(selectExecutionContextSearch); // Used for reporting const { isRenderComplete, hasDynamicError, setIsRenderComplete, setDynamicError, nodeRef } = useReportingState(errors); @@ -722,18 +721,6 @@ export const VisualizationWrapper = ({ onRender$(); }, [setIsRenderComplete, onRender$]); - const searchContext: ExecutionContextSearch = useMemo( - () => ({ - query: context.query, - timeRange: { - from: context.dateRange.fromDate, - to: context.dateRange.toDate, - }, - filters: context.filters, - disableWarningToasts: true, - }), - [context] - ); const searchSessionId = useLensSelector(selectSearchSessionId); if (errors.length) { diff --git a/x-pack/plugins/lens/public/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/embeddable/embeddable.tsx index 9851a10c8641..e5d34db62ba7 100644 --- a/x-pack/plugins/lens/public/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/embeddable/embeddable.tsx @@ -1253,6 +1253,7 @@ export class Embeddable const input = this.getInput(); const context: ExecutionContextSearch = { + now: this.deps.data.nowProvider.get().getTime(), timeRange: input.timeslice !== undefined ? { diff --git a/x-pack/plugins/lens/public/expressions.ts b/x-pack/plugins/lens/public/expressions.ts index ef12b43bec71..32856175db1b 100644 --- a/x-pack/plugins/lens/public/expressions.ts +++ b/x-pack/plugins/lens/public/expressions.ts @@ -14,6 +14,11 @@ import { formatColumn } from '../common/expressions/format_column'; import { counterRate } from '../common/expressions/counter_rate'; import { getTimeScale } from '../common/expressions/time_scale/time_scale'; import { collapse } from '../common/expressions/collapse'; +import { + formulaIntervalFn, + formulaNowFn, + formulaTimeRangeFn, +} from '../common/expressions/formula_context'; type TimeScaleArguments = Parameters; @@ -25,6 +30,9 @@ export const setupExpressions = ( getForceNow: TimeScaleArguments[2] ) => { [ + formulaTimeRangeFn, + formulaNowFn, + formulaIntervalFn, collapse, counterRate, formatColumn, diff --git a/x-pack/plugins/lens/public/state_management/selectors.ts b/x-pack/plugins/lens/public/state_management/selectors.ts index 7572c3128729..44121c4d064c 100644 --- a/x-pack/plugins/lens/public/state_management/selectors.ts +++ b/x-pack/plugins/lens/public/state_management/selectors.ts @@ -46,9 +46,11 @@ export const selectTriggerApplyChanges = (state: LensState) => { return shouldApply; }; +// TODO - is there any point to keeping this around since we have selectExecutionSearchContext? export const selectExecutionContext = createSelector( [selectQuery, selectFilters, selectResolvedDateRange], (query, filters, dateRange) => ({ + now: Date.now(), dateRange, query, filters, @@ -56,6 +58,7 @@ export const selectExecutionContext = createSelector( ); export const selectExecutionContextSearch = createSelector(selectExecutionContext, (res) => ({ + now: res.now, query: res.query, timeRange: { from: res.dateRange.fromDate, diff --git a/x-pack/plugins/lens/server/expressions/expressions.ts b/x-pack/plugins/lens/server/expressions/expressions.ts index 1e80fc5bb49a..b5e8fc285160 100644 --- a/x-pack/plugins/lens/server/expressions/expressions.ts +++ b/x-pack/plugins/lens/server/expressions/expressions.ts @@ -13,6 +13,9 @@ import { mapToColumns, getTimeScale, getDatatable, + formulaIntervalFn, + formulaNowFn, + formulaTimeRangeFn, } from '../../common/expressions'; import { getDatatableUtilitiesFactory, getFormatFactory, getTimeZoneFactory } from './utils'; @@ -23,6 +26,9 @@ export const setupExpressions = ( expressions: ExpressionsServerSetup ) => { [ + formulaNowFn, + formulaIntervalFn, + formulaTimeRangeFn, counterRate, formatColumn, mapToColumns, diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/add_inference_pipeline_flyout.tsx b/x-pack/plugins/ml/public/application/components/ml_inference/add_inference_pipeline_flyout.tsx index c1e612e3b08d..e1b4cc271025 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/add_inference_pipeline_flyout.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_inference/add_inference_pipeline_flyout.tsx @@ -22,14 +22,14 @@ import { extractErrorProperties } from '@kbn/ml-error-utils'; import { ModelItem } from '../../model_management/models_list'; import type { AddInferencePipelineSteps } from './types'; import { ADD_INFERENCE_PIPELINE_STEPS } from './constants'; -import { AddInferencePipelineFooter } from './components/add_inference_pipeline_footer'; -import { AddInferencePipelineHorizontalSteps } from './components/add_inference_pipeline_horizontal_steps'; +import { AddInferencePipelineFooter } from '../shared'; +import { AddInferencePipelineHorizontalSteps } from '../shared'; import { getInitialState, getModelType } from './state'; import { PipelineDetails } from './components/pipeline_details'; import { ProcessorConfiguration } from './components/processor_configuration'; -import { OnFailureConfiguration } from './components/on_failure_configuration'; +import { OnFailureConfiguration } from '../shared'; import { TestPipeline } from './components/test_pipeline'; -import { ReviewAndCreatePipeline } from './components/review_and_create_pipeline'; +import { ReviewAndCreatePipeline } from '../shared'; import { useMlApiContext } from '../../contexts/kibana'; import { getPipelineConfig } from './get_pipeline_config'; import { validateInferencePipelineConfigurationStep } from './validation'; @@ -122,6 +122,8 @@ export const AddInferencePipelineFlyout: FC = ( setStep={setStep} isDetailsStepValid={pipelineNameError === undefined && targetFieldError === undefined} isConfigureProcessorStepValid={hasUnsavedChanges === false} + hasProcessorStep + pipelineCreated={formState.pipelineCreated} /> {step === ADD_INFERENCE_PIPELINE_STEPS.DETAILS && ( @@ -184,6 +186,7 @@ export const AddInferencePipelineFlyout: FC = ( isConfigureProcessorStepValid={hasUnsavedChanges === false} pipelineCreated={formState.pipelineCreated} creatingPipeline={formState.creatingPipeline} + hasProcessorStep /> diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/components/pipeline_details.tsx b/x-pack/plugins/ml/public/application/components/ml_inference/components/pipeline_details.tsx index bd36ee4bf6c4..034c6ed5468e 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/components/pipeline_details.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_inference/components/pipeline_details.tsx @@ -14,18 +14,14 @@ import { EuiFlexItem, EuiForm, EuiFormRow, - EuiLink, - EuiSpacer, - EuiTitle, - EuiText, - EuiTextArea, EuiPanel, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useMlKibana } from '../../../contexts/kibana'; import type { MlInferenceState } from '../types'; +import { PipelineDetailsTitle } from '../../shared'; +import { PipelineNameAndDescription } from '../../shared'; interface Props { handlePipelineConfigUpdate: (configUpdate: Partial) => void; @@ -47,12 +43,6 @@ export const PipelineDetails: FC = memo( targetField, targetFieldError, }) => { - const { - services: { - docLinks: { links }, - }, - } = useMlKibana(); - const handleConfigChange = (value: string, type: string) => { handlePipelineConfigUpdate({ [type]: value }); }; @@ -60,133 +50,18 @@ export const PipelineDetails: FC = memo( return ( - -

- {i18n.translate( - 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.title', - { defaultMessage: 'Create a pipeline' } - )} -

-
- - -

- {modelId}, - pipeline: ( - - pipeline - - ), - }} - /> -

-

- - _reindex API - - ), - pipelineSimulateLink: ( - - pipeline/_simulate - - ), - }} - /> -

-
+
- {/* NAME */} - - {i18n.translate( - 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.name.helpText', - { - defaultMessage: - 'Pipeline names are unique within a deployment and can only contain letters, numbers, underscores, and hyphens.', - } - )} - - ) - } - error={pipelineNameError} - isInvalid={pipelineNameError !== undefined} - > - ) => - handleConfigChange(e.target.value, 'pipelineName') - } - /> - - {/* DESCRIPTION */} - - {i18n.translate( - 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.description.helpText', - { - defaultMessage: 'A description of what this pipeline does.', - } - )} - - } - > - ) => - handleConfigChange(e.target.value, 'pipelineDescription') - } - /> - + {/* NAME and DESCRIPTION */} + {/* TARGET FIELD */} = ({ pipelineName, sourceIndex }) => { - const [selectedIndex, setSelectedIndex] = useState([ - { label: sourceIndex }, - ]); + const [selectedIndex, setSelectedIndex] = useState( + sourceIndex ? [{ label: sourceIndex }] : [] + ); const [options, setOptions] = useState([]); const [destinationIndex, setDestinationIndex] = useState(''); const [destinationIndexExists, setDestinationIndexExists] = useState(false); @@ -205,7 +205,7 @@ export const ReindexWithPipeline: FC = ({ pipelineName, sourceIndex }) => setCanReindexError(errorMessage); } } - if (hasPrivileges !== undefined) { + if (hasPrivileges !== undefined && selectedIndex.length) { checkPrivileges(); } }, @@ -264,6 +264,7 @@ export const ReindexWithPipeline: FC = ({ pipelineName, sourceIndex }) => 0) || !canReindex || destinationIndexExists @@ -395,7 +396,7 @@ export const ReindexWithPipeline: FC = ({ pipelineName, sourceIndex }) => 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.reindexStartedMessage', { defaultMessage: 'Reindexing of {sourceIndex} to {destinationIndex} has started.', - values: { sourceIndex, destinationIndex }, + values: { sourceIndex: selectedIndex[0].label, destinationIndex }, } )} color="success" diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/get_steps.ts b/x-pack/plugins/ml/public/application/components/ml_inference/get_steps.ts index a7d3ea17de09..3f7c9ff2255f 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/get_steps.ts +++ b/x-pack/plugins/ml/public/application/components/ml_inference/get_steps.ts @@ -11,7 +11,8 @@ import { ADD_INFERENCE_PIPELINE_STEPS } from './constants'; export function getSteps( step: AddInferencePipelineSteps, isConfigureStepValid: boolean, - isPipelineDataValid: boolean + isPipelineDataValid: boolean, + hasProcessorStep: boolean ) { let nextStep: AddInferencePipelineSteps | undefined; let previousStep: AddInferencePipelineSteps | undefined; @@ -19,7 +20,9 @@ export function getSteps( switch (step) { case ADD_INFERENCE_PIPELINE_STEPS.DETAILS: - nextStep = ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR; + nextStep = hasProcessorStep + ? ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR + : ADD_INFERENCE_PIPELINE_STEPS.ON_FAILURE; isContinueButtonEnabled = isConfigureStepValid; break; case ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR: @@ -29,7 +32,9 @@ export function getSteps( break; case ADD_INFERENCE_PIPELINE_STEPS.ON_FAILURE: nextStep = ADD_INFERENCE_PIPELINE_STEPS.TEST; - previousStep = ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR; + previousStep = hasProcessorStep + ? ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR + : ADD_INFERENCE_PIPELINE_STEPS.DETAILS; isContinueButtonEnabled = isPipelineDataValid; break; case ADD_INFERENCE_PIPELINE_STEPS.TEST: diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/validation.ts b/x-pack/plugins/ml/public/application/components/ml_inference/validation.ts index f6326669cf55..8c2e567b1c4f 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/validation.ts +++ b/x-pack/plugins/ml/public/application/components/ml_inference/validation.ts @@ -5,8 +5,10 @@ * 2.0. */ +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { i18n } from '@kbn/i18n'; import { IngestInferenceProcessor } from '@elastic/elasticsearch/lib/api/types'; +import type { SupportedPytorchTasksType } from '@kbn/ml-trained-models-utils'; import { InferenceModelTypes } from './types'; import type { AddInferencePipelineFormErrors } from './types'; @@ -46,6 +48,18 @@ const INFERENCE_CONFIG_MODEL_TYPE_ERROR = i18n.translate( defaultMessage: 'Inference configuration inference type must match model type.', } ); +const PROCESSOR_REQUIRED = i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.processorRequiredError', + { + defaultMessage: 'At least one processor is required to create the pipeline.', + } +); +const INFERENCE_PROCESSOR_REQUIRED = i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.inferenceProcessorRequiredError', + { + defaultMessage: "An inference processor specifying 'model_id' is required.", + } +); const VALID_PIPELINE_NAME_REGEX = /^[\w\-]+$/; export const isValidPipelineName = (input: string): boolean => { @@ -75,7 +89,7 @@ export const validateInferencePipelineConfigurationStep = ( export const validateInferenceConfig = ( inferenceConfig: IngestInferenceProcessor['inference_config'], - modelType?: InferenceModelTypes + modelType?: InferenceModelTypes | SupportedPytorchTasksType ) => { const inferenceConfigKeys = Object.keys(inferenceConfig ?? {}); let error; @@ -116,3 +130,31 @@ export const validateFieldMap = ( return error; }; + +export const validatePipelineProcessors = ( + pipelineProcessors: estypes.IngestPipeline, + taskType?: SupportedPytorchTasksType +) => { + const { processors } = pipelineProcessors; + let error; + // Must have at least one processor + if (!Array.isArray(processors) || (Array.isArray(processors) && processors.length < 1)) { + error = PROCESSOR_REQUIRED; + } + + const inferenceProcessor = processors?.find( + (processor) => processor.inference && processor.inference.model_id + ); + + if (inferenceProcessor === undefined) { + error = INFERENCE_PROCESSOR_REQUIRED; + } else { + // If populated, inference config must have the correct model type + const inferenceConfig = inferenceProcessor.inference?.inference_config; + if (taskType && inferenceConfig) { + error = validateInferenceConfig(inferenceConfig, taskType); + } + } + + return error; +}; diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_footer.tsx b/x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_footer.tsx similarity index 88% rename from x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_footer.tsx rename to x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_footer.tsx index 04ea2ea21737..e6d000c4e953 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_footer.tsx +++ b/x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_footer.tsx @@ -9,14 +9,14 @@ import React, { FC, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { AddInferencePipelineSteps } from '../types'; +import type { AddInferencePipelineSteps } from '../ml_inference/types'; import { BACK_BUTTON_LABEL, CANCEL_BUTTON_LABEL, CLOSE_BUTTON_LABEL, CONTINUE_BUTTON_LABEL, -} from '../constants'; -import { getSteps } from '../get_steps'; +} from '../ml_inference/constants'; +import { getSteps } from '../ml_inference/get_steps'; interface Props { isDetailsStepValid: boolean; @@ -26,7 +26,8 @@ interface Props { step: AddInferencePipelineSteps; onClose: () => void; onCreate: () => void; - setStep: React.Dispatch>; + setStep: (step: AddInferencePipelineSteps) => void; + hasProcessorStep: boolean; } export const AddInferencePipelineFooter: FC = ({ @@ -38,10 +39,11 @@ export const AddInferencePipelineFooter: FC = ({ onCreate, step, setStep, + hasProcessorStep, }) => { const { nextStep, previousStep, isContinueButtonEnabled } = useMemo( - () => getSteps(step, isDetailsStepValid, isConfigureProcessorStepValid), - [isDetailsStepValid, isConfigureProcessorStepValid, step] + () => getSteps(step, isDetailsStepValid, isConfigureProcessorStepValid, hasProcessorStep), + [isDetailsStepValid, isConfigureProcessorStepValid, step, hasProcessorStep] ); return ( diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_horizontal_steps.tsx b/x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_horizontal_steps.tsx similarity index 58% rename from x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_horizontal_steps.tsx rename to x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_horizontal_steps.tsx index 2a34f6483c24..c8cdf387c84c 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/components/add_inference_pipeline_horizontal_steps.tsx +++ b/x-pack/plugins/ml/public/application/components/shared/add_inference_pipeline_horizontal_steps.tsx @@ -8,58 +8,58 @@ import React, { FC, memo } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiStepsHorizontal, EuiStepsHorizontalProps } from '@elastic/eui'; -import type { AddInferencePipelineSteps } from '../types'; -import { ADD_INFERENCE_PIPELINE_STEPS } from '../constants'; +import { EuiStepsHorizontal, type EuiStepsHorizontalProps } from '@elastic/eui'; +import type { AddInferencePipelineSteps } from '../ml_inference/types'; +import { ADD_INFERENCE_PIPELINE_STEPS } from '../ml_inference/constants'; const steps = Object.values(ADD_INFERENCE_PIPELINE_STEPS); interface Props { step: AddInferencePipelineSteps; - setStep: React.Dispatch>; + setStep: (step: AddInferencePipelineSteps) => void; isDetailsStepValid: boolean; - isConfigureProcessorStepValid: boolean; + isConfigureProcessorStepValid?: boolean; + hasProcessorStep: boolean; + pipelineCreated: boolean; } +const DISABLED = 'disabled'; +const COMPLETE = 'complete'; +const INCOMPLETE = 'incomplete'; + export const AddInferencePipelineHorizontalSteps: FC = memo( - ({ step, setStep, isDetailsStepValid, isConfigureProcessorStepValid }) => { + ({ + step, + setStep, + isDetailsStepValid, + isConfigureProcessorStepValid, + hasProcessorStep, + pipelineCreated, + }) => { const currentStepIndex = steps.findIndex((s) => s === step); + const navSteps: EuiStepsHorizontalProps['steps'] = [ { // Details - onClick: () => setStep(ADD_INFERENCE_PIPELINE_STEPS.DETAILS), - status: isDetailsStepValid ? 'complete' : 'incomplete', - title: i18n.translate( - 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.details.title', - { - defaultMessage: 'Details', - } - ), - }, - { - // Processor configuration onClick: () => { - if (!isDetailsStepValid) return; - setStep(ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR); + if (pipelineCreated) return; + setStep(ADD_INFERENCE_PIPELINE_STEPS.DETAILS); }, - status: - isDetailsStepValid && isConfigureProcessorStepValid && currentStepIndex > 1 - ? 'complete' - : 'incomplete', + status: isDetailsStepValid ? COMPLETE : INCOMPLETE, title: i18n.translate( - 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.configureProcessor.title', + 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.details.title', { - defaultMessage: 'Configure processor', + defaultMessage: 'Details', } ), }, { - // handle failures + // Handle failures onClick: () => { - if (!isDetailsStepValid) return; + if (!isDetailsStepValid || pipelineCreated) return; setStep(ADD_INFERENCE_PIPELINE_STEPS.ON_FAILURE); }, - status: currentStepIndex > 2 ? 'complete' : 'incomplete', + status: currentStepIndex > 2 ? COMPLETE : INCOMPLETE, title: i18n.translate( 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.handleFailures.title', { @@ -70,10 +70,10 @@ export const AddInferencePipelineHorizontalSteps: FC = memo( { // Test onClick: () => { - if (!isConfigureProcessorStepValid || !isDetailsStepValid) return; + if (!isConfigureProcessorStepValid || !isDetailsStepValid || pipelineCreated) return; setStep(ADD_INFERENCE_PIPELINE_STEPS.TEST); }, - status: currentStepIndex > 3 ? 'complete' : 'incomplete', + status: currentStepIndex > 3 ? COMPLETE : INCOMPLETE, title: i18n.translate( 'xpack.ml.trainedModels.content.indices.transforms.addInferencePipelineModal.steps.test.title', { @@ -84,10 +84,10 @@ export const AddInferencePipelineHorizontalSteps: FC = memo( { // Review and Create onClick: () => { - if (!isConfigureProcessorStepValid) return; + if (!isConfigureProcessorStepValid || pipelineCreated) return; setStep(ADD_INFERENCE_PIPELINE_STEPS.CREATE); }, - status: isDetailsStepValid && isConfigureProcessorStepValid ? 'incomplete' : 'disabled', + status: isDetailsStepValid && isConfigureProcessorStepValid ? INCOMPLETE : DISABLED, title: i18n.translate( 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.create.title', { @@ -96,23 +96,60 @@ export const AddInferencePipelineHorizontalSteps: FC = memo( ), }, ]; + + if (hasProcessorStep === true) { + navSteps.splice(1, 0, { + // Processor configuration + onClick: () => { + if (!isDetailsStepValid || pipelineCreated) return; + setStep(ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR); + }, + status: + isDetailsStepValid && isConfigureProcessorStepValid && currentStepIndex > 1 + ? COMPLETE + : INCOMPLETE, + title: i18n.translate( + 'xpack.ml.inferencePipeline.content.indices.transforms.addInferencePipelineModal.steps.configureProcessor.title', + { + defaultMessage: 'Configure processor', + } + ), + }); + } + let DETAILS_INDEX: number; + let CONFIGURE_INDEX: number | undefined; + let ON_FAILURE_INDEX: number; + let TEST_INDEX: number; + let CREATE_INDEX: number; + + if (hasProcessorStep) { + [DETAILS_INDEX, CONFIGURE_INDEX, ON_FAILURE_INDEX, TEST_INDEX, CREATE_INDEX] = [ + 0, 1, 2, 3, 4, 5, + ]; + } else { + [DETAILS_INDEX, ON_FAILURE_INDEX, TEST_INDEX, CREATE_INDEX] = [0, 1, 2, 3, 4]; + } + switch (step) { case ADD_INFERENCE_PIPELINE_STEPS.DETAILS: - navSteps[0].status = 'current'; + navSteps[DETAILS_INDEX].status = 'current'; break; case ADD_INFERENCE_PIPELINE_STEPS.CONFIGURE_PROCESSOR: - navSteps[1].status = 'current'; + if (CONFIGURE_INDEX !== undefined) { + navSteps[CONFIGURE_INDEX].status = 'current'; + } break; case ADD_INFERENCE_PIPELINE_STEPS.ON_FAILURE: - navSteps[2].status = 'current'; + navSteps[ON_FAILURE_INDEX].status = 'current'; break; case ADD_INFERENCE_PIPELINE_STEPS.TEST: - navSteps[3].status = 'current'; + navSteps[TEST_INDEX].status = 'current'; break; case ADD_INFERENCE_PIPELINE_STEPS.CREATE: - navSteps[4].status = 'current'; + navSteps[CREATE_INDEX].status = 'current'; break; } + return ; } ); diff --git a/x-pack/plugins/ml/public/application/components/shared/index.ts b/x-pack/plugins/ml/public/application/components/shared/index.ts new file mode 100644 index 000000000000..573c13257a46 --- /dev/null +++ b/x-pack/plugins/ml/public/application/components/shared/index.ts @@ -0,0 +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. + */ + +export { AddInferencePipelineHorizontalSteps } from './add_inference_pipeline_horizontal_steps'; +export { AddInferencePipelineFooter } from './add_inference_pipeline_footer'; +export { ReviewAndCreatePipeline } from './review_and_create_pipeline'; +export { OnFailureConfiguration } from './on_failure_configuration'; +export { PipelineDetailsTitle } from './pipeline_details_title'; +export { PipelineNameAndDescription } from './pipeline_name_and_description'; diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/components/on_failure_configuration.tsx b/x-pack/plugins/ml/public/application/components/shared/on_failure_configuration.tsx similarity index 96% rename from x-pack/plugins/ml/public/application/components/ml_inference/components/on_failure_configuration.tsx rename to x-pack/plugins/ml/public/application/components/shared/on_failure_configuration.tsx index f53e80b122f5..10ab5a46a632 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/components/on_failure_configuration.tsx +++ b/x-pack/plugins/ml/public/application/components/shared/on_failure_configuration.tsx @@ -25,12 +25,12 @@ import { CodeEditor } from '@kbn/kibana-react-plugin/public'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { SaveChangesButton } from './save_changes_button'; -import type { MlInferenceState } from '../types'; -import { getDefaultOnFailureConfiguration } from '../state'; -import { CANCEL_EDIT_MESSAGE, EDIT_MESSAGE } from '../constants'; -import { useMlKibana } from '../../../contexts/kibana'; -import { isValidJson } from '../../../../../common/util/validation_utils'; +import { SaveChangesButton } from '../ml_inference/components/save_changes_button'; +import type { MlInferenceState } from '../ml_inference/types'; +import { getDefaultOnFailureConfiguration } from '../ml_inference/state'; +import { CANCEL_EDIT_MESSAGE, EDIT_MESSAGE } from '../ml_inference/constants'; +import { useMlKibana } from '../../contexts/kibana'; +import { isValidJson } from '../../../../common/util/validation_utils'; interface Props { handleAdvancedConfigUpdate: (configUpdate: Partial) => void; diff --git a/x-pack/plugins/ml/public/application/components/shared/pipeline_details_title.tsx b/x-pack/plugins/ml/public/application/components/shared/pipeline_details_title.tsx new file mode 100644 index 000000000000..ce7ef231256c --- /dev/null +++ b/x-pack/plugins/ml/public/application/components/shared/pipeline_details_title.tsx @@ -0,0 +1,73 @@ +/* + * 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, { FC } from 'react'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiCode, EuiLink, EuiSpacer, EuiTitle, EuiText } from '@elastic/eui'; + +import { useMlKibana } from '../../contexts/kibana'; + +interface Props { + modelId: string; +} + +export const PipelineDetailsTitle: FC = ({ modelId }) => { + const { + services: { + docLinks: { links }, + }, + } = useMlKibana(); + + return ( + <> + +

+ {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.title', + { defaultMessage: 'Create a pipeline' } + )} +

+
+ + +

+ {modelId}, + pipeline: ( + + pipeline + + ), + }} + /> +

+

+ + _reindex API + + ), + pipelineSimulateLink: ( + + pipeline/_simulate + + ), + }} + /> +

+
+ + ); +}; diff --git a/x-pack/plugins/ml/public/application/components/shared/pipeline_name_and_description.tsx b/x-pack/plugins/ml/public/application/components/shared/pipeline_name_and_description.tsx new file mode 100644 index 000000000000..c64fbca93903 --- /dev/null +++ b/x-pack/plugins/ml/public/application/components/shared/pipeline_name_and_description.tsx @@ -0,0 +1,115 @@ +/* + * 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. + */ + +/* + * 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, { FC } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiFieldText, EuiFormRow, EuiText, EuiTextArea } from '@elastic/eui'; + +interface Props { + handlePipelineConfigUpdate: (configUpdate: Partial) => void; + pipelineNameError: string | undefined; + pipelineDescription: string; + pipelineName: string; +} + +export const PipelineNameAndDescription: FC = ({ + pipelineName, + pipelineNameError, + pipelineDescription, + handlePipelineConfigUpdate, +}) => { + const handleConfigChange = (value: string, type: string) => { + handlePipelineConfigUpdate({ [type]: value }); + }; + + return ( + <> + + {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.name.helpText', + { + defaultMessage: + 'Pipeline names are unique within a deployment and can only contain letters, numbers, underscores, and hyphens.', + } + )} + + ) + } + error={pipelineNameError} + isInvalid={pipelineNameError !== undefined} + > + ) => + handleConfigChange(e.target.value, 'pipelineName') + } + /> + + {/* DESCRIPTION */} + + {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.configure.description.helpText', + { + defaultMessage: 'A description of the pipeline.', + } + )} + + } + > + ) => + handleConfigChange(e.target.value, 'pipelineDescription') + } + /> + + + ); +}; diff --git a/x-pack/plugins/ml/public/application/components/ml_inference/components/review_and_create_pipeline.tsx b/x-pack/plugins/ml/public/application/components/shared/review_and_create_pipeline.tsx similarity index 86% rename from x-pack/plugins/ml/public/application/components/ml_inference/components/review_and_create_pipeline.tsx rename to x-pack/plugins/ml/public/application/components/shared/review_and_create_pipeline.tsx index d80e678bafb0..7cb3066436af 100644 --- a/x-pack/plugins/ml/public/application/components/ml_inference/components/review_and_create_pipeline.tsx +++ b/x-pack/plugins/ml/public/application/components/shared/review_and_create_pipeline.tsx @@ -7,6 +7,7 @@ import React, { FC, useMemo, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { EuiAccordion, @@ -18,17 +19,28 @@ import { EuiSpacer, EuiTitle, EuiText, + EuiTextColor, htmlIdGenerator, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { IngestPipeline } from '@elastic/elasticsearch/lib/api/types'; -import { useMlKibana } from '../../../contexts/kibana'; -import { ReindexWithPipeline } from './reindex_with_pipeline'; +import { useMlKibana } from '../../contexts/kibana'; +import { ReindexWithPipeline } from '../ml_inference/components/reindex_with_pipeline'; const MANAGEMENT_APP_ID = 'management'; +function getFieldFromPipelineConfig(config: estypes.IngestPipeline) { + const { processors } = config; + let field = ''; + if (processors?.length) { + field = Object.keys(processors[0].inference?.field_map ?? {})[0]; + } + return field; +} + interface Props { + highlightTargetField?: boolean; inferencePipeline: IngestPipeline; modelType?: string; pipelineName: string; @@ -38,6 +50,7 @@ interface Props { } export const ReviewAndCreatePipeline: FC = ({ + highlightTargetField = false, inferencePipeline, modelType, pipelineName, @@ -62,6 +75,10 @@ export const ReviewAndCreatePipeline: FC = ({ : links.ingest.inferenceClassification; const accordionId = useMemo(() => htmlIdGenerator()(), []); + const targetedField = useMemo( + () => getFieldFromPipelineConfig(inferencePipeline), + [inferencePipeline] + ); const configCodeBlock = useMemo( () => ( @@ -84,7 +101,7 @@ export const ReviewAndCreatePipeline: FC = ({ gutterSize="s" data-test-subj="mlTrainedModelsInferenceReviewAndCreateStep" > - + {pipelineCreated === false ? (

@@ -189,20 +206,19 @@ export const ReviewAndCreatePipeline: FC = ({ ) : null} - - -

- {!pipelineCreated ? ( - - ) : null} -

-
-
+ {highlightTargetField ? ( + + + {targetedField} }} + /> + + + ) : null} - {pipelineCreated && sourceIndex ? ( + {pipelineCreated ? ( <> void; + model: ModelItem; +} + +export const CreatePipelineForModelFlyout: FC = ({ + onClose, + model, +}) => { + const { + currentContext: { pipelineConfig }, + } = useTestTrainedModelsContext(); + + const initialState = useMemo( + () => getInitialState(model, pipelineConfig), + // eslint-disable-next-line react-hooks/exhaustive-deps + [model.model_id, pipelineConfig] + ); + const [formState, setFormState] = useState(initialState); + const [step, setStep] = useState(ADD_INFERENCE_PIPELINE_STEPS.DETAILS); + const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false); + const taskType = useMemo( + () => Object.keys(model.inference_config ?? {})[0], + // eslint-disable-next-line react-hooks/exhaustive-deps + [model.model_id] + ) as SupportedPytorchTasksType; + + const { + trainedModels: { createInferencePipeline }, + } = useMlApiContext(); + + const createPipeline = async () => { + setFormState({ ...formState, creatingPipeline: true }); + try { + const config = getPipelineConfig(formState); + await createInferencePipeline(formState.pipelineName, config); + setFormState({ + ...formState, + pipelineCreated: true, + creatingPipeline: false, + pipelineError: undefined, + }); + } catch (e) { + // eslint-disable-next-line no-console + console.error(e); + const errorProperties = extractErrorProperties(e); + setFormState({ + ...formState, + creatingPipeline: false, + pipelineError: errorProperties.message ?? e.message, + }); + } + }; + + const pipelineNames = useFetchPipelines(); + + const handleConfigUpdate = (configUpdate: Partial) => { + const updatedState = { ...formState, ...configUpdate }; + setFormState(updatedState); + }; + + const handleSetStep = (currentStep: AddInferencePipelineSteps) => { + setStep(currentStep); + }; + + const { pipelineName: pipelineNameError } = useMemo(() => { + const errors = validateInferencePipelineConfigurationStep( + formState.pipelineName, + pipelineNames + ); + return errors; + }, [pipelineNames, formState.pipelineName]); + + return ( + + + +

+ {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.createInferencePipeline.title', + { + defaultMessage: 'Create inference pipeline', + } + )} +

+
+
+ + + + {step === ADD_INFERENCE_PIPELINE_STEPS.DETAILS && ( + + )} + {step === ADD_INFERENCE_PIPELINE_STEPS.ON_FAILURE && ( + + )} + {step === ADD_INFERENCE_PIPELINE_STEPS.TEST && ( + + )} + {step === ADD_INFERENCE_PIPELINE_STEPS.CREATE && ( + + )} + + + + +
+ ); +}; diff --git a/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_inference_properties_from_pipeline_config.ts b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_inference_properties_from_pipeline_config.ts new file mode 100644 index 000000000000..68b7dcda61a7 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_inference_properties_from_pipeline_config.ts @@ -0,0 +1,118 @@ +/* + * 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 * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { + IngestInferenceProcessor, + IngestInferenceConfig, +} from '@elastic/elasticsearch/lib/api/types'; +import { isPopulatedObject } from '@kbn/ml-is-populated-object'; +import { SUPPORTED_PYTORCH_TASKS } from '@kbn/ml-trained-models-utils'; +import { DEFAULT_INPUT_FIELD } from '../test_models/models/inference_base'; + +const INPUT_FIELD = 'inputField'; +const ZERO_SHOT_CLASSIFICATION_PROPERTIES = ['labels', 'multi_label'] as const; +const QUESTION_ANSWERING_PROPERTIES = ['question'] as const; + +const MODEL_INFERENCE_CONFIG_PROPERTIES = { + [SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING]: QUESTION_ANSWERING_PROPERTIES, + [SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION]: ZERO_SHOT_CLASSIFICATION_PROPERTIES, +} as const; + +type SupportedModelInferenceConfigPropertiesType = keyof typeof MODEL_INFERENCE_CONFIG_PROPERTIES; + +interface MLIngestInferenceProcessor extends IngestInferenceProcessor { + inference_config: MLInferencePipelineInferenceConfig; +} + +// Currently, estypes doesn't include pipeline processor types with the trained model processors +type MLInferencePipelineInferenceConfig = IngestInferenceConfig & { + zero_shot_classification?: estypes.MlZeroShotClassificationInferenceOptions; + question_answering?: estypes.MlQuestionAnsweringInferenceUpdateOptions; +}; + +interface GetInferencePropertiesFromPipelineConfigReturnType { + inputField: string; + inferenceConfig?: MLInferencePipelineInferenceConfig; + inferenceObj?: IngestInferenceProcessor | MLIngestInferenceProcessor; + fieldMap?: IngestInferenceProcessor['field_map']; + labels?: string[]; + multi_label?: boolean; + question?: string; +} + +function isSupportedInferenceConfigPropertyType( + arg: unknown +): arg is SupportedModelInferenceConfigPropertiesType { + return typeof arg === 'string' && Object.keys(MODEL_INFERENCE_CONFIG_PROPERTIES).includes(arg); +} + +export function isMlInferencePipelineInferenceConfig( + arg: unknown +): arg is MLInferencePipelineInferenceConfig { + return ( + isPopulatedObject(arg, [SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING]) || + isPopulatedObject(arg, [SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION]) + ); +} + +export function isMlIngestInferenceProcessor(arg: unknown): arg is MLIngestInferenceProcessor { + return ( + isPopulatedObject(arg) && + arg.hasOwnProperty('inference_config') && + (isPopulatedObject(arg.inference_config, [SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING]) || + isPopulatedObject(arg.inference_config, [SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION])) + ); +} + +export function getInferencePropertiesFromPipelineConfig( + type: string, + pipelineConfig: estypes.IngestPipeline +): GetInferencePropertiesFromPipelineConfigReturnType { + const propertiesToReturn: GetInferencePropertiesFromPipelineConfigReturnType = { + [INPUT_FIELD]: '', + }; + + pipelineConfig.processors?.forEach((processor) => { + const { inference } = processor; + if (inference) { + propertiesToReturn.inferenceObj = inference; + // Get the input field + if (inference.field_map) { + propertiesToReturn.fieldMap = inference.field_map; + + for (const [key, value] of Object.entries(inference.field_map)) { + if (value === DEFAULT_INPUT_FIELD) { + propertiesToReturn[INPUT_FIELD] = key; + } + } + if (propertiesToReturn[INPUT_FIELD] === '') { + // If not found, set to the first field in the field map + propertiesToReturn[INPUT_FIELD] = Object.keys(inference.field_map)[0]; + } + } + propertiesToReturn.inferenceConfig = inference.inference_config; + // Get the properties associated with the type of model/task + if ( + isMlInferencePipelineInferenceConfig(propertiesToReturn.inferenceConfig) && + isSupportedInferenceConfigPropertyType(type) + ) { + MODEL_INFERENCE_CONFIG_PROPERTIES[type]?.forEach((property) => { + const configSettings = + propertiesToReturn.inferenceConfig && propertiesToReturn.inferenceConfig[type]; + propertiesToReturn[property] = + configSettings && configSettings.hasOwnProperty(property) + ? // @ts-ignore + configSettings[property] + : undefined; + }); + } + } + }); + + return propertiesToReturn; +} diff --git a/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_pipeline_config.ts b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_pipeline_config.ts new file mode 100644 index 000000000000..10c405090f05 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/get_pipeline_config.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { InferecePipelineCreationState } from './state'; + +export function getPipelineConfig(state: InferecePipelineCreationState): estypes.IngestPipeline { + const { ignoreFailure, modelId, onFailure, pipelineDescription, initialPipelineConfig } = state; + const processor = + initialPipelineConfig?.processors && initialPipelineConfig.processors?.length + ? initialPipelineConfig?.processors[0] + : {}; + + return { + description: pipelineDescription, + processors: [ + { + inference: { + ...(processor?.inference + ? { + ...processor.inference, + ignore_failure: ignoreFailure, + ...(onFailure && Object.keys(onFailure).length > 0 + ? { on_failure: onFailure } + : { on_failure: undefined }), + } + : {}), + model_id: modelId, + }, + }, + ], + }; +} diff --git a/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/pipeline_details.tsx b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/pipeline_details.tsx new file mode 100644 index 000000000000..ef474ce3b434 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/pipeline_details.tsx @@ -0,0 +1,183 @@ +/* + * 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, { FC, memo, useState } from 'react'; + +import { + EuiButtonEmpty, + EuiCodeBlock, + EuiFlexGroup, + EuiFlexItem, + EuiForm, + EuiFormRow, + EuiPanel, +} from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; +import { CodeEditor } from '@kbn/kibana-react-plugin/public'; +import type { SupportedPytorchTasksType } from '@kbn/ml-trained-models-utils'; +import { type InferecePipelineCreationState } from './state'; +import { EDIT_MESSAGE, CANCEL_EDIT_MESSAGE } from '../../components/ml_inference/constants'; +import { isValidJson } from '../../../../common/util/validation_utils'; +import { useTestTrainedModelsContext } from '../test_models/test_trained_models_context'; +import { SaveChangesButton } from '../../components/ml_inference/components/save_changes_button'; +import { validatePipelineProcessors } from '../../components/ml_inference/validation'; +import { PipelineDetailsTitle, PipelineNameAndDescription } from '../../components/shared'; + +interface Props { + handlePipelineConfigUpdate: (configUpdate: Partial) => void; + modelId: string; + pipelineNameError: string | undefined; + pipelineName: string; + pipelineDescription: string; + initialPipelineConfig?: InferecePipelineCreationState['initialPipelineConfig']; + setHasUnsavedChanges: React.Dispatch>; + taskType?: SupportedPytorchTasksType; +} + +export const PipelineDetails: FC = memo( + ({ + handlePipelineConfigUpdate, + modelId, + pipelineName, + pipelineNameError, + pipelineDescription, + initialPipelineConfig, + setHasUnsavedChanges, + taskType, + }) => { + const [isProcessorConfigValid, setIsProcessorConfigValid] = useState(true); + const [processorConfigError, setProcessorConfigError] = useState(); + + const { + currentContext: { pipelineConfig }, + } = useTestTrainedModelsContext(); + const [processorConfigString, setProcessorConfigString] = useState( + JSON.stringify(initialPipelineConfig ?? {}, null, 2) + ); + const [editProcessorConfig, setEditProcessorConfig] = useState(false); + + const updateProcessorConfig = () => { + const invalidProcessorConfigMessage = validatePipelineProcessors( + JSON.parse(processorConfigString), + taskType + ); + if (invalidProcessorConfigMessage === undefined) { + handlePipelineConfigUpdate({ initialPipelineConfig: JSON.parse(processorConfigString) }); + setHasUnsavedChanges(false); + setEditProcessorConfig(false); + setProcessorConfigError(undefined); + } else { + setHasUnsavedChanges(true); + setIsProcessorConfigValid(false); + setProcessorConfigError(invalidProcessorConfigMessage); + } + }; + + const handleProcessorConfigChange = (json: string) => { + setProcessorConfigString(json); + const valid = isValidJson(json); + setIsProcessorConfigValid(valid); + }; + + const resetProcessorConfig = () => { + setProcessorConfigString(JSON.stringify(pipelineConfig, null, 2)); + setIsProcessorConfigValid(true); + setProcessorConfigError(undefined); + }; + + return ( + + + + + + + {/* NAME */} + + {/* NAME and DESCRIPTION */} + + {/* PROCESSOR CONFIGURATION */} + + + { + const editingState = !editProcessorConfig; + if (editingState === false) { + setProcessorConfigError(undefined); + setIsProcessorConfigValid(true); + setHasUnsavedChanges(false); + } + setEditProcessorConfig(editingState); + }} + > + {editProcessorConfig ? CANCEL_EDIT_MESSAGE : EDIT_MESSAGE} + + + + {editProcessorConfig ? ( + + ) : null} + + + {editProcessorConfig ? ( + + {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.advanced.resetInferenceConfigButton', + { defaultMessage: 'Reset' } + )} + + ) : null} + + + } + error={processorConfigError} + isInvalid={processorConfigError !== undefined} + data-test-subj="mlTrainedModelsInferencePipelineInferenceConfigEditor" + > + {editProcessorConfig ? ( + + ) : ( + + {processorConfigString} + + )} + + + +
+ + ); + } +); diff --git a/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/state.ts b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/state.ts new file mode 100644 index 000000000000..9edcb19e61e3 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/state.ts @@ -0,0 +1,42 @@ +/* + * 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 * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { IngestInferenceProcessor } from '@elastic/elasticsearch/lib/api/types'; +import { getDefaultOnFailureConfiguration } from '../../components/ml_inference/state'; +import type { ModelItem } from '../models_list'; + +export interface InferecePipelineCreationState { + creatingPipeline: boolean; + error: boolean; + ignoreFailure: boolean; + modelId: string; + onFailure?: IngestInferenceProcessor['on_failure']; + pipelineName: string; + pipelineNameError?: string; + pipelineDescription: string; + pipelineCreated: boolean; + pipelineError?: string; + initialPipelineConfig?: estypes.IngestPipeline; + takeActionOnFailure: boolean; +} + +export const getInitialState = ( + model: ModelItem, + initialPipelineConfig: estypes.IngestPipeline | undefined +): InferecePipelineCreationState => ({ + creatingPipeline: false, + error: false, + ignoreFailure: false, + modelId: model.model_id, + onFailure: getDefaultOnFailureConfiguration(), + pipelineDescription: `Uses the pre-trained model ${model.model_id} to infer against the data that is being ingested in the pipeline`, + pipelineName: `ml-inference-${model.model_id}`, + pipelineCreated: false, + initialPipelineConfig, + takeActionOnFailure: true, +}); diff --git a/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/test_trained_model.tsx b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/test_trained_model.tsx new file mode 100644 index 000000000000..5f793fa84801 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/create_pipeline_for_model/test_trained_model.tsx @@ -0,0 +1,79 @@ +/* + * 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, { FC } from 'react'; +import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; + +import { ModelItem } from '../models_list'; +import { TestTrainedModelContent } from '../test_models/test_trained_model_content'; +import { useMlKibana } from '../../contexts/kibana'; +import { type InferecePipelineCreationState } from './state'; + +interface ContentProps { + model: ModelItem; + handlePipelineConfigUpdate: (configUpdate: Partial) => void; + externalPipelineConfig?: estypes.IngestPipeline; +} + +export const TestTrainedModel: FC = ({ + model, + handlePipelineConfigUpdate, + externalPipelineConfig, +}) => { + const { + services: { + docLinks: { links }, + }, + } = useMlKibana(); + + return ( + + + +

+ {i18n.translate( + 'xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.advanced.testTrainedModelTitle', + { defaultMessage: 'Try it out' } + )} +

+
+ + +

+ +

+

+ + Learn more. + + ), + }} + /> +

+
+
+ + + +
+ ); +}; diff --git a/x-pack/plugins/ml/public/application/model_management/models_list.tsx b/x-pack/plugins/ml/public/application/model_management/models_list.tsx index 0aebca5c1673..dd766d10c36d 100644 --- a/x-pack/plugins/ml/public/application/model_management/models_list.tsx +++ b/x-pack/plugins/ml/public/application/model_management/models_list.tsx @@ -69,7 +69,7 @@ import { useToastNotificationService } from '../services/toast_notification_serv import { useFieldFormatter } from '../contexts/kibana/use_field_formatter'; import { useRefresh } from '../routing/use_refresh'; import { SavedObjectsWarning } from '../components/saved_objects_warning'; -import { TestTrainedModelFlyout } from './test_models'; +import { TestModelAndPipelineCreationFlyout } from './test_models'; import { TestDfaModelsFlyout } from './test_dfa_models_flyout'; import { AddInferencePipelineFlyout } from '../components/ml_inference'; import { useEnabledFeatures } from '../contexts/ml'; @@ -819,7 +819,15 @@ export const ModelsList: FC = ({ /> )} {modelToTest === null ? null : ( - + { + setModelToTest(null); + if (refreshList) { + fetchModelsData(); + } + }} + /> )} {dfaModelToTest === null ? null : ( diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/index.ts b/x-pack/plugins/ml/public/application/model_management/test_models/index.ts index 25078a40d420..4b238f477092 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/index.ts +++ b/x-pack/plugins/ml/public/application/model_management/test_models/index.ts @@ -5,5 +5,5 @@ * 2.0. */ -export { TestTrainedModelFlyout } from './test_flyout'; +export { TestModelAndPipelineCreationFlyout } from './test_model_and_pipeline_creation_flyout'; export { isTestable, isDfaTrainedModel } from './utils'; diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/models/index_input.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/models/index_input.tsx index 03466cd87a16..3ae11845646a 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/models/index_input.tsx +++ b/x-pack/plugins/ml/public/application/model_management/test_models/models/index_input.tsx @@ -10,7 +10,15 @@ import React, { FC, useState, useMemo, useEffect, useCallback } from 'react'; import useObservable from 'react-use/lib/useObservable'; import { firstValueFrom } from 'rxjs'; import { DataView } from '@kbn/data-views-plugin/common'; -import { EuiSpacer, EuiSelect, EuiFormRow, EuiAccordion, EuiCodeBlock } from '@elastic/eui'; +import { + EuiAccordion, + EuiCode, + EuiCodeBlock, + EuiFormRow, + EuiSpacer, + EuiSelect, + EuiText, +} from '@elastic/eui'; import { isPopulatedObject } from '@kbn/ml-is-populated-object'; import { i18n } from '@kbn/i18n'; @@ -21,9 +29,14 @@ import type { InferrerType } from '.'; interface Props { inferrer: InferrerType; data: ReturnType; + disableIndexSelection: boolean; } -export const InferenceInputFormIndexControls: FC = ({ inferrer, data }) => { +export const InferenceInputFormIndexControls: FC = ({ + inferrer, + data, + disableIndexSelection, +}) => { const { dataViewListItems, fieldNames, @@ -40,14 +53,25 @@ export const InferenceInputFormIndexControls: FC = ({ inferrer, data }) = return ( <> - setSelectedDataViewId(e.target.value)} - hasNoInitialSelection={true} - disabled={runningState === RUNNING_STATE.RUNNING} - fullWidth - /> + {disableIndexSelection ? ( + + + {dataViewListItems.find((item) => item.value === selectedDataViewId)?.text} + + + ) : ( + { + inferrer.setSelectedDataViewId(e.target.value); + setSelectedDataViewId(e.target.value); + }} + hasNoInitialSelection={true} + disabled={runningState === RUNNING_STATE.RUNNING} + fullWidth + /> + )} = ({ inferrer, data }) = setSelectedField(e.target.value)} + onChange={(e) => { + setSelectedField(e.target.value); + }} hasNoInitialSelection={true} disabled={runningState === RUNNING_STATE.RUNNING} fullWidth @@ -79,7 +105,14 @@ export const InferenceInputFormIndexControls: FC = ({ inferrer, data }) = } )} > - + {JSON.stringify(pipeline, null, 2)} @@ -87,7 +120,13 @@ export const InferenceInputFormIndexControls: FC = ({ inferrer, data }) = ); }; -export function useIndexInput({ inferrer }: { inferrer: InferrerType }) { +export function useIndexInput({ + inferrer, + defaultSelectedDataViewId, +}: { + inferrer: InferrerType; + defaultSelectedDataViewId?: string; +}) { const { services: { data: { @@ -100,7 +139,9 @@ export function useIndexInput({ inferrer }: { inferrer: InferrerType }) { const [dataViewListItems, setDataViewListItems] = useState< Array<{ value: string; text: string }> >([]); - const [selectedDataViewId, setSelectedDataViewId] = useState(undefined); + const [selectedDataViewId, setSelectedDataViewId] = useState( + defaultSelectedDataViewId + ); const [selectedDataView, setSelectedDataView] = useState(null); const [fieldNames, setFieldNames] = useState>([]); const selectedField = useObservable(inferrer.getInputField$(), inferrer.getInputField()); @@ -197,11 +238,20 @@ export function useIndexInput({ inferrer }: { inferrer: InferrerType }) { })); setFieldNames(tempFieldNames); - const fieldName = tempFieldNames.length === 1 ? tempFieldNames[0].value : undefined; + const defaultSelectedField = inferrer.getInputField(); + + const fieldName = + defaultSelectedField && + tempFieldNames.find((field) => field.value === defaultSelectedField) + ? defaultSelectedField + : tempFieldNames[0].value; + // Only set a field if it's the default field + // if (inferrer.getInputField() === DEFAULT_INPUT_FIELD) { inferrer.setInputField(fieldName); + // } } }, - [selectedDataView, inferrer] + [selectedDataView, inferrer] // defaultSelectedField ); useEffect( diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_base.ts b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_base.ts index 8dc0bf6b8881..bdd082cf8ca0 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_base.ts +++ b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_base.ts @@ -31,7 +31,7 @@ export type InferenceOptions = | estypes.MlTextEmbeddingInferenceOptions | estypes.MlQuestionAnsweringInferenceUpdateOptions; -const DEFAULT_INPUT_FIELD = 'text_field'; +export const DEFAULT_INPUT_FIELD = 'text_field'; export const DEFAULT_INFERENCE_TIME_OUT = '30s'; export type FormattedNerResponse = Array<{ @@ -72,8 +72,10 @@ export abstract class InferenceBase { private isValid$ = new BehaviorSubject(false); private pipeline$ = new BehaviorSubject({}); private supportedFieldTypes: ES_FIELD_TYPES[] = [ES_FIELD_TYPES.TEXT]; + private selectedDataViewId: string | undefined; protected readonly info: string[] = []; + public switchToCreationMode?: () => void; private subscriptions$: Subscription = new Subscription(); @@ -87,8 +89,13 @@ export abstract class InferenceBase { this.inputField$.next(this.modelInputField); } + public setSwitchtoCreationMode(callback: () => void) { + this.switchToCreationMode = callback; + } + public destroy() { this.subscriptions$.unsubscribe(); + this.pipeline$.unsubscribe(); } protected initialize( @@ -162,6 +169,15 @@ export abstract class InferenceBase { this.runningState$.next(RUNNING_STATE.STOPPED); } + public setSelectedDataViewId(dataViewId: string) { + // Data view selected for testing + this.selectedDataViewId = dataViewId; + } + + public getSelectedDataViewId() { + return this.selectedDataViewId; + } + public setInputField(field: string | undefined) { // if the field is not set, change to be the same as the model input field this.inputField$.next(field === undefined ? this.modelInputField : field); diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/index_input.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/index_input.tsx index 4dbe90028365..4b87ddccfb4b 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/index_input.tsx +++ b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/index_input.tsx @@ -11,7 +11,6 @@ import useObservable from 'react-use/lib/useObservable'; import { EuiSpacer, - EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, @@ -28,13 +27,22 @@ import { ErrorMessage } from '../../inference_error'; import type { InferrerType } from '..'; import { useIndexInput, InferenceInputFormIndexControls } from '../index_input'; import { RUNNING_STATE } from '../inference_base'; +import { InputFormControls } from './input_form_controls'; +import { useTestTrainedModelsContext } from '../../test_trained_models_context'; interface Props { inferrer: InferrerType; } export const IndexInputForm: FC = ({ inferrer }) => { - const data = useIndexInput({ inferrer }); + const { + currentContext: { defaultSelectedDataViewId, createPipelineFlyoutOpen }, + } = useTestTrainedModelsContext(); + + const data = useIndexInput({ + inferrer, + defaultSelectedDataViewId, + }); const { reloadExamples, selectedField } = data; const [errorText, setErrorText] = useState(null); @@ -60,23 +68,26 @@ export const IndexInputForm: FC = ({ inferrer }) => { return ( <>{infoComponent} - + - - + - + {runningState === RUNNING_STATE.RUNNING ? : null} diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/input_form_controls.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/input_form_controls.tsx new file mode 100644 index 000000000000..18cacbb74550 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/input_form_controls.tsx @@ -0,0 +1,63 @@ +/* + * 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, { FC } from 'react'; + +import { EuiButton, EuiButtonEmpty, EuiFlexItem } from '@elastic/eui'; + +import { FormattedMessage } from '@kbn/i18n-react'; +import type { InferrerType } from '..'; + +interface Props { + testButtonDisabled: boolean; + createPipelineButtonDisabled: boolean; + inferrer: InferrerType; + showCreatePipelineButton?: boolean; +} + +export const InputFormControls: FC = ({ + testButtonDisabled, + createPipelineButtonDisabled, + inferrer, + showCreatePipelineButton, +}) => { + return ( + <> + + + + + + {showCreatePipelineButton ? ( + + { + if (inferrer.switchToCreationMode) { + inferrer.switchToCreationMode(); + } + }} + > + + + + ) : null} + + ); +}; diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/text_input.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/text_input.tsx index fc162a305c32..ae5a4c72cac6 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/text_input.tsx +++ b/x-pack/plugins/ml/public/application/model_management/test_models/models/inference_input_form/text_input.tsx @@ -8,7 +8,7 @@ import React, { FC, useState, useMemo, useCallback, FormEventHandler } from 'react'; import useObservable from 'react-use/lib/useObservable'; -import { EuiSpacer, EuiButton, EuiTabs, EuiTab, EuiForm } from '@elastic/eui'; +import { EuiFlexGroup, EuiSpacer, EuiTabs, EuiTab, EuiForm } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { extractErrorMessage } from '@kbn/ml-error-utils'; @@ -18,6 +18,7 @@ import type { InferrerType } from '..'; import { OutputLoadingContent } from '../../output_loading'; import { RUNNING_STATE } from '../inference_base'; import { RawOutput } from '../raw_output'; +import { InputFormControls } from './input_form_controls'; interface Props { inferrer: InferrerType; @@ -57,17 +58,15 @@ export const TextInputForm: FC = ({ inferrer }) => { <>{inputComponent}
- - + - +
{runningState !== RUNNING_STATE.STOPPED ? ( <> diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/selected_model.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/selected_model.tsx index 4747d9c14918..80ee311d533a 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/selected_model.tsx +++ b/x-pack/plugins/ml/public/application/model_management/test_models/selected_model.tsx @@ -7,6 +7,7 @@ import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import React, { FC, useMemo, useEffect } from 'react'; +import { cloneDeep } from 'lodash'; import { TRAINED_MODEL_TYPE, SUPPORTED_PYTORCH_TASKS } from '@kbn/ml-trained-models-utils'; import { NerInference } from './models/ner'; @@ -22,52 +23,182 @@ import { import { TextEmbeddingInference } from './models/text_embedding'; import { useMlApiContext } from '../../contexts/kibana'; +import { type TestTrainedModelsContextType } from './test_trained_models_context'; import { InferenceInputForm } from './models/inference_input_form'; import { InferrerType } from './models'; import { INPUT_TYPE } from './models/inference_base'; import { TextExpansionInference } from './models/text_expansion'; +import { type InferecePipelineCreationState } from '../create_pipeline_for_model/state'; +import { + getInferencePropertiesFromPipelineConfig, + isMlIngestInferenceProcessor, + isMlInferencePipelineInferenceConfig, +} from '../create_pipeline_for_model/get_inference_properties_from_pipeline_config'; interface Props { model: estypes.MlTrainedModelConfig; inputType: INPUT_TYPE; deploymentId: string; + handlePipelineConfigUpdate?: (configUpdate: Partial) => void; + externalPipelineConfig?: estypes.IngestPipeline; + setCurrentContext?: React.Dispatch; } -export const SelectedModel: FC = ({ model, inputType, deploymentId }) => { +export const SelectedModel: FC = ({ + model, + inputType, + deploymentId, + handlePipelineConfigUpdate, + externalPipelineConfig, + setCurrentContext, +}) => { const { trainedModels } = useMlApiContext(); const inferrer = useMemo(() => { - if (model.model_type === TRAINED_MODEL_TYPE.PYTORCH) { - const taskType = Object.keys(model.inference_config ?? {})[0]; + const taskType = Object.keys(model.inference_config ?? {})[0]; + let tempInferrer: InferrerType | undefined; + const pipelineConfigValues = externalPipelineConfig + ? getInferencePropertiesFromPipelineConfig(taskType, externalPipelineConfig) + : null; + if (model.model_type === TRAINED_MODEL_TYPE.PYTORCH) { switch (taskType) { case SUPPORTED_PYTORCH_TASKS.NER: - return new NerInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new NerInference(trainedModels, model, inputType, deploymentId); + break; case SUPPORTED_PYTORCH_TASKS.TEXT_CLASSIFICATION: - return new TextClassificationInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new TextClassificationInference( + trainedModels, + model, + inputType, + deploymentId + ); + break; case SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION: - return new ZeroShotClassificationInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new ZeroShotClassificationInference( + trainedModels, + model, + inputType, + deploymentId + ); + if (pipelineConfigValues) { + const { labels, multi_label: multiLabel } = pipelineConfigValues; + if (labels && multiLabel !== undefined) { + tempInferrer.setLabelsText(Array.isArray(labels) ? labels.join(',') : labels); + tempInferrer.setMultiLabel(Boolean(multiLabel)); + } + } + break; case SUPPORTED_PYTORCH_TASKS.TEXT_EMBEDDING: - return new TextEmbeddingInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new TextEmbeddingInference(trainedModels, model, inputType, deploymentId); + break; case SUPPORTED_PYTORCH_TASKS.FILL_MASK: - return new FillMaskInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new FillMaskInference(trainedModels, model, inputType, deploymentId); + break; case SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING: - return new QuestionAnsweringInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new QuestionAnsweringInference( + trainedModels, + model, + inputType, + deploymentId + ); + if (pipelineConfigValues?.question) { + tempInferrer.setQuestionText(pipelineConfigValues.question); + } + break; case SUPPORTED_PYTORCH_TASKS.TEXT_EXPANSION: - return new TextExpansionInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new TextExpansionInference(trainedModels, model, inputType, deploymentId); + break; default: break; } } else if (model.model_type === TRAINED_MODEL_TYPE.LANG_IDENT) { - return new LangIdentInference(trainedModels, model, inputType, deploymentId); + tempInferrer = new LangIdentInference(trainedModels, model, inputType, deploymentId); + } + if (tempInferrer) { + if (pipelineConfigValues) { + tempInferrer.setInputField(pipelineConfigValues.inputField); + } + if (externalPipelineConfig === undefined) { + tempInferrer.setSwitchtoCreationMode(() => { + if (tempInferrer && setCurrentContext) { + setCurrentContext({ + pipelineConfig: tempInferrer.getPipeline(), + defaultSelectedDataViewId: tempInferrer.getSelectedDataViewId(), + createPipelineFlyoutOpen: true, + }); + } + }); + } else { + tempInferrer?.getPipeline$().subscribe((testPipeline) => { + if (handlePipelineConfigUpdate && testPipeline && externalPipelineConfig) { + const { + fieldMap: testFieldMap, + inferenceConfig: testInferenceConfig, + labels, + multi_label: multiLabel, + question, + } = getInferencePropertiesFromPipelineConfig(taskType, testPipeline); + + const updatedPipeline = cloneDeep(externalPipelineConfig); + const { inferenceObj: externalInference, inferenceConfig: externalInferenceConfig } = + getInferencePropertiesFromPipelineConfig(taskType, updatedPipeline); + + if (externalInference) { + // Always update target field change + externalInference.field_map = testFieldMap; + + if (externalInferenceConfig === undefined) { + externalInference.inference_config = testInferenceConfig; + } else if ( + isMlIngestInferenceProcessor(externalInference) && + isMlInferencePipelineInferenceConfig(externalInference.inference_config) + ) { + // Only update the properties that change in the test step to avoid overwriting user edits + if ( + taskType === SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION && + labels && + multiLabel !== undefined + ) { + const external = + externalInference.inference_config[ + SUPPORTED_PYTORCH_TASKS.ZERO_SHOT_CLASSIFICATION + ]; + + if (external) { + external.multi_label = multiLabel; + external.labels = labels; + } + } else if ( + taskType === SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING && + question !== undefined + ) { + const external = + externalInference.inference_config[SUPPORTED_PYTORCH_TASKS.QUESTION_ANSWERING]; + + if (external) { + external.question = question; + } + } + } + } + + handlePipelineConfigUpdate({ + initialPipelineConfig: updatedPipeline, + }); + } + }); + } } - }, [inputType, model, trainedModels, deploymentId]); + return tempInferrer; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [inputType, model, trainedModels, deploymentId, setCurrentContext]); useEffect(() => { return () => { inferrer?.destroy(); }; - }, [inferrer]); + }, [inferrer, model.model_id]); if (inferrer !== undefined) { return ; diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/test_flyout.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/test_flyout.tsx index 434621d11773..f595fd1de35d 100644 --- a/x-pack/plugins/ml/public/application/model_management/test_models/test_flyout.tsx +++ b/x-pack/plugins/ml/public/application/model_management/test_models/test_flyout.tsx @@ -5,126 +5,36 @@ * 2.0. */ -import React, { FC, useState, useMemo } from 'react'; +import React, { FC } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import { - EuiFlyout, - EuiFlyoutBody, - EuiFlyoutHeader, - EuiFormRow, - EuiSelect, - EuiSpacer, - EuiTab, - EuiTabs, - EuiTitle, - useEuiPaddingSize, -} from '@elastic/eui'; +import { EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader, EuiSpacer, EuiTitle } from '@elastic/eui'; -import { SUPPORTED_PYTORCH_TASKS } from '@kbn/ml-trained-models-utils'; -import { SelectedModel } from './selected_model'; -import { INPUT_TYPE } from './models/inference_base'; import { type ModelItem } from '../models_list'; +import { TestTrainedModelContent } from './test_trained_model_content'; interface Props { model: ModelItem; onClose: () => void; } -export const TestTrainedModelFlyout: FC = ({ model, onClose }) => { - const [deploymentId, setDeploymentId] = useState(model.deployment_ids[0]); - const mediumPadding = useEuiPaddingSize('m'); - - const [inputType, setInputType] = useState(INPUT_TYPE.TEXT); - - const onlyShowTab: INPUT_TYPE | undefined = useMemo(() => { - return (model.type ?? []).includes(SUPPORTED_PYTORCH_TASKS.TEXT_EXPANSION) - ? INPUT_TYPE.INDEX - : undefined; - }, [model]); - - return ( - <> - - - -

- -

-
- - -

{model.model_id}

-
-
- - {model.deployment_ids.length > 1 ? ( - <> - - } - > - { - return { text: v, value: v }; - })} - value={deploymentId} - onChange={(e) => { - setDeploymentId(e.target.value); - }} - /> - - - - ) : null} - - {onlyShowTab === undefined ? ( - <> - - setInputType(INPUT_TYPE.TEXT)} - > - - - setInputType(INPUT_TYPE.INDEX)} - > - - - - - - - ) : null} - - = ({ model, onClose }) => ( + + + +

+ - - - - ); -}; +

+
+ + +

{model.model_id}

+
+
+ + + +
+); diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/test_model_and_pipeline_creation_flyout.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/test_model_and_pipeline_creation_flyout.tsx new file mode 100644 index 000000000000..33c4e69df59b --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/test_models/test_model_and_pipeline_creation_flyout.tsx @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FC, useState } from 'react'; + +import { + type TestTrainedModelsContextType, + TestTrainedModelsContext, +} from './test_trained_models_context'; +import type { ModelItem } from '../models_list'; +import { TestTrainedModelFlyout } from './test_flyout'; +import { CreatePipelineForModelFlyout } from '../create_pipeline_for_model/create_pipeline_for_model_flyout'; + +interface Props { + model: ModelItem; + onClose: (refreshList?: boolean) => void; +} +export const TestModelAndPipelineCreationFlyout: FC = ({ model, onClose }) => { + const [currentContext, setCurrentContext] = useState({ + pipelineConfig: undefined, + createPipelineFlyoutOpen: false, + }); + + return ( + + {currentContext.createPipelineFlyoutOpen === false ? ( + + ) : ( + + )} + + ); +}; diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_model_content.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_model_content.tsx new file mode 100644 index 000000000000..52665343cb35 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_model_content.tsx @@ -0,0 +1,115 @@ +/* + * 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, { FC, useState, useMemo } from 'react'; + +import { SUPPORTED_PYTORCH_TASKS } from '@kbn/ml-trained-models-utils'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiFormRow, EuiSelect, EuiSpacer, EuiTab, EuiTabs, useEuiPaddingSize } from '@elastic/eui'; +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { SelectedModel } from './selected_model'; +import { type ModelItem } from '../models_list'; +import { INPUT_TYPE } from './models/inference_base'; +import { useTestTrainedModelsContext } from './test_trained_models_context'; +import { type InferecePipelineCreationState } from '../create_pipeline_for_model/state'; + +interface ContentProps { + model: ModelItem; + handlePipelineConfigUpdate?: (configUpdate: Partial) => void; + externalPipelineConfig?: estypes.IngestPipeline; +} + +export const TestTrainedModelContent: FC = ({ + model, + handlePipelineConfigUpdate, + externalPipelineConfig, +}) => { + const [deploymentId, setDeploymentId] = useState(model.deployment_ids[0]); + const mediumPadding = useEuiPaddingSize('m'); + + const [inputType, setInputType] = useState(INPUT_TYPE.TEXT); + const { + currentContext: { createPipelineFlyoutOpen }, + setCurrentContext, + } = useTestTrainedModelsContext(); + + const onlyShowTab: INPUT_TYPE | undefined = useMemo(() => { + return (model.type ?? []).includes(SUPPORTED_PYTORCH_TASKS.TEXT_EXPANSION) || + createPipelineFlyoutOpen + ? INPUT_TYPE.INDEX + : undefined; + }, [model, createPipelineFlyoutOpen]); + return ( + <> + {' '} + {model.deployment_ids.length > 1 ? ( + <> + + } + > + { + return { text: v, value: v }; + })} + value={deploymentId} + onChange={(e) => { + setDeploymentId(e.target.value); + }} + /> + + + + ) : null} + {onlyShowTab === undefined ? ( + <> + + setInputType(INPUT_TYPE.TEXT)} + > + + + setInputType(INPUT_TYPE.INDEX)} + > + + + + + + + ) : null} + + + ); +}; diff --git a/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_models_context.tsx b/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_models_context.tsx new file mode 100644 index 000000000000..5db45a334b16 --- /dev/null +++ b/x-pack/plugins/ml/public/application/model_management/test_models/test_trained_models_context.tsx @@ -0,0 +1,32 @@ +/* + * 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 { createContext, Dispatch, useContext } from 'react'; +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; + +export interface TestTrainedModelsContextType { + pipelineConfig?: estypes.IngestPipeline; + createPipelineFlyoutOpen: boolean; + defaultSelectedDataViewId?: string; +} +export const TestTrainedModelsContext = createContext< + | { + currentContext: TestTrainedModelsContextType; + setCurrentContext: Dispatch; + } + | undefined +>(undefined); + +export function useTestTrainedModelsContext() { + const testTrainedModelsContext = useContext(TestTrainedModelsContext); + + if (testTrainedModelsContext === undefined) { + throw new Error('TestTrainedModelsContext has not been initialized.'); + } + + return testTrainedModelsContext; +} diff --git a/x-pack/plugins/observability/common/index.ts b/x-pack/plugins/observability/common/index.ts index 3a86e264095b..143bf77a1b0c 100644 --- a/x-pack/plugins/observability/common/index.ts +++ b/x-pack/plugins/observability/common/index.ts @@ -32,6 +32,7 @@ export { apmTraceExplorerTab, apmLabsButton, enableInfrastructureHostsView, + enableInfrastructureProfilingIntegration, enableAwsLambdaMetrics, enableAgentExplorerView, apmAWSLambdaPriceFactor, diff --git a/x-pack/plugins/observability/common/ui_settings_keys.ts b/x-pack/plugins/observability/common/ui_settings_keys.ts index 5745882055ca..bcc2f0451caa 100644 --- a/x-pack/plugins/observability/common/ui_settings_keys.ts +++ b/x-pack/plugins/observability/common/ui_settings_keys.ts @@ -17,6 +17,8 @@ export const apmServiceGroupMaxNumberOfServices = export const apmTraceExplorerTab = 'observability:apmTraceExplorerTab'; export const apmLabsButton = 'observability:apmLabsButton'; export const enableInfrastructureHostsView = 'observability:enableInfrastructureHostsView'; +export const enableInfrastructureProfilingIntegration = + 'observability:enableInfrastructureProfilingIntegration'; export const enableAwsLambdaMetrics = 'observability:enableAwsLambdaMetrics'; export const enableAgentExplorerView = 'observability:apmAgentExplorerView'; export const apmAWSLambdaPriceFactor = 'observability:apmAWSLambdaPriceFactor'; diff --git a/x-pack/plugins/observability/kibana.jsonc b/x-pack/plugins/observability/kibana.jsonc index 690fd2146212..d5633ad9f36f 100644 --- a/x-pack/plugins/observability/kibana.jsonc +++ b/x-pack/plugins/observability/kibana.jsonc @@ -21,6 +21,7 @@ "dataViewEditor", "embeddable", "uiActions", + "presentationUtil", "exploratoryView", "features", "files", @@ -55,7 +56,8 @@ "kibanaUtils", "unifiedSearch", "stackAlerts", - "spaces" + "spaces", + "embeddable" ], "extraPublicDirs": [ "common" diff --git a/x-pack/plugins/observability/public/application/index.tsx b/x-pack/plugins/observability/public/application/index.tsx index 7081005487fc..7b01bc1f8eeb 100644 --- a/x-pack/plugins/observability/public/application/index.tsx +++ b/x-pack/plugins/observability/public/application/index.tsx @@ -84,51 +84,54 @@ export const renderApp = ({ const ApplicationUsageTrackingProvider = usageCollection?.components.ApplicationUsageTrackingProvider ?? React.Fragment; const CloudProvider = plugins.cloud?.CloudContextProvider ?? React.Fragment; + const PresentationContextProvider = plugins.presentationUtil?.ContextProvider ?? React.Fragment; ReactDOM.render( - - - - - - + + + + + - - - - - - - - - - - - - - - - - - , + + + + + + + + + + + + + + + + + + + + , element ); return () => { diff --git a/x-pack/plugins/observability/public/pages/overview/components/sections/ux/core_web_vitals/translations.ts b/x-pack/plugins/observability/public/pages/overview/components/sections/ux/core_web_vitals/translations.ts index d6445320a797..bded2fd67cca 100644 --- a/x-pack/plugins/observability/public/pages/overview/components/sections/ux/core_web_vitals/translations.ts +++ b/x-pack/plugins/observability/public/pages/overview/components/sections/ux/core_web_vitals/translations.ts @@ -16,7 +16,7 @@ export const LCP_LABEL = i18n.translate('xpack.observability.ux.coreVitals.lcp', }); export const INP_LABEL = i18n.translate('xpack.observability.ux.coreVitals.inp', { - defaultMessage: 'Interaction to Next Paint', + defaultMessage: 'Interaction to next paint', }); export const CLS_LABEL = i18n.translate('xpack.observability.ux.coreVitals.cls', { diff --git a/x-pack/plugins/observability/public/pages/slo_details/components/error_budget_chart_panel.tsx b/x-pack/plugins/observability/public/pages/slo_details/components/error_budget_chart_panel.tsx index b460e3e2a942..a053e39fae34 100644 --- a/x-pack/plugins/observability/public/pages/slo_details/components/error_budget_chart_panel.tsx +++ b/x-pack/plugins/observability/public/pages/slo_details/components/error_budget_chart_panel.tsx @@ -10,6 +10,7 @@ import numeral from '@elastic/numeral'; import { i18n } from '@kbn/i18n'; import { rollingTimeWindowTypeSchema, SLOWithSummaryResponse } from '@kbn/slo-schema'; import React from 'react'; +import { toDuration, toMinutes } from '../../../utils/slo/duration'; import { ChartData } from '../../../typings/slo'; import { useKibana } from '../../../utils/kibana_react'; import { toDurationAdverbLabel, toDurationLabel } from '../../../utils/slo/labels'; @@ -27,6 +28,24 @@ export function ErrorBudgetChartPanel({ data, isLoading, slo }: Props) { const isSloFailed = slo.summary.status === 'DEGRADING' || slo.summary.status === 'VIOLATED'; + let remainingBudgetFormatted; + if (slo.budgetingMethod === 'timeslices' && slo.timeWindow.type === 'calendarAligned') { + const totalSlices = + toMinutes(toDuration(slo.timeWindow.duration)) / + toMinutes(toDuration(slo.objective.timesliceWindow!)); + const remainingBudgetInTimeUnit = + slo.summary.errorBudget.remaining * (slo.summary.errorBudget.initial * totalSlices); + + if (remainingBudgetInTimeUnit <= 0) { + remainingBudgetFormatted = '0min'; + } else { + if (remainingBudgetInTimeUnit / 60 >= 1) { + remainingBudgetFormatted = `${Math.trunc(remainingBudgetInTimeUnit / 60)}h`; + } + remainingBudgetFormatted += `${Math.trunc(remainingBudgetInTimeUnit % 60)}min`; + } + } + return ( @@ -68,6 +87,20 @@ export function ErrorBudgetChartPanel({ data, isLoading, slo }: Props) { reverse />
+ {!!remainingBudgetFormatted && ( + + + + )} diff --git a/x-pack/plugins/observability/public/pages/slo_details/components/header_control.tsx b/x-pack/plugins/observability/public/pages/slo_details/components/header_control.tsx index 34eb1f278e7a..b8bad5b98c4c 100644 --- a/x-pack/plugins/observability/public/pages/slo_details/components/header_control.tsx +++ b/x-pack/plugins/observability/public/pages/slo_details/components/header_control.tsx @@ -5,22 +5,22 @@ * 2.0. */ -import React, { useCallback, useState } from 'react'; -import { i18n } from '@kbn/i18n'; import { EuiButton, EuiContextMenuItem, EuiContextMenuPanel, EuiPopover } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import { SLOWithSummaryResponse } from '@kbn/slo-schema'; +import React, { useCallback, useState } from 'react'; -import { useCloneSlo } from '../../../hooks/slo/use_clone_slo'; +import { rulesLocatorID, sloFeatureId } from '../../../../common'; +import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../../../common/constants'; +import { paths } from '../../../../common/locators/paths'; import { SloDeleteConfirmationModal } from '../../../components/slo/delete_confirmation_modal/slo_delete_confirmation_modal'; import { useCapabilities } from '../../../hooks/slo/use_capabilities'; -import { useKibana } from '../../../utils/kibana_react'; +import { useCloneSlo } from '../../../hooks/slo/use_clone_slo'; import { useDeleteSlo } from '../../../hooks/slo/use_delete_slo'; -import { isApmIndicatorType } from '../../../utils/slo/indicator'; -import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url'; -import { SLO_BURN_RATE_RULE_TYPE_ID } from '../../../../common/constants'; -import { rulesLocatorID, sloFeatureId } from '../../../../common'; -import { paths } from '../../../../common/locators/paths'; import type { RulesParams } from '../../../locators/rules'; +import { useKibana } from '../../../utils/kibana_react'; +import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url'; +import { isApmIndicatorType } from '../../../utils/slo/indicator'; export interface Props { slo: SLOWithSummaryResponse | undefined; @@ -72,27 +72,13 @@ export function HeaderControl({ isLoading, slo }: Props) { }; const handleNavigateToApm = () => { - if ( - slo?.indicator.type === 'sli.apm.transactionDuration' || - slo?.indicator.type === 'sli.apm.transactionErrorRate' - ) { - const { - indicator: { - params: { environment, filter, service, transactionName, transactionType }, - }, - timeWindow: { duration }, - } = slo; - - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - duration, - environment, - filter, - service, - transactionName, - transactionType, - }); + if (!slo) { + return undefined; + } - navigate(basePath.prepend(url)); + const url = convertSliApmParamsToApmAppDeeplinkUrl(slo); + if (url) { + navigateToUrl(basePath.prepend(url)); } }; @@ -189,7 +175,7 @@ export function HeaderControl({ isLoading, slo }: Props) { , ] .concat( - !!slo && isApmIndicatorType(slo.indicator.type) ? ( + !!slo && isApmIndicatorType(slo.indicator) ? ( ; + IndicatorOverview = ; break; } diff --git a/x-pack/plugins/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx b/x-pack/plugins/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx index 316298cd8d44..60fceb4481b9 100644 --- a/x-pack/plugins/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx +++ b/x-pack/plugins/observability/public/pages/slos/components/badges/slo_indicator_type_badge.tsx @@ -5,14 +5,18 @@ * 2.0. */ -import React from 'react'; -import { EuiBadge, EuiFlexItem, EuiToolTip, EuiBadgeProps } from '@elastic/eui'; -import { SLOResponse, SLOWithSummaryResponse } from '@kbn/slo-schema'; -import { euiLightVars } from '@kbn/ui-theme'; +import { EuiBadge, EuiBadgeProps, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { + apmTransactionDurationIndicatorSchema, + apmTransactionErrorRateIndicatorSchema, + SLOResponse, + SLOWithSummaryResponse, +} from '@kbn/slo-schema'; +import { euiLightVars } from '@kbn/ui-theme'; +import React from 'react'; import { useKibana } from '../../../../utils/kibana_react'; import { convertSliApmParamsToApmAppDeeplinkUrl } from '../../../../utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url'; -import { isApmIndicatorType } from '../../../../utils/slo/indicator'; import { toIndicatorTypeLabel } from '../../../../utils/slo/labels'; export interface Props { @@ -27,26 +31,8 @@ export function SloIndicatorTypeBadge({ slo, color }: Props) { } = useKibana().services; const handleNavigateToApm = () => { - if ( - slo.indicator.type === 'sli.apm.transactionDuration' || - slo.indicator.type === 'sli.apm.transactionErrorRate' - ) { - const { - indicator: { - params: { environment, filter, service, transactionName, transactionType }, - }, - timeWindow: { duration }, - } = slo; - - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - duration, - environment, - filter, - service, - transactionName, - transactionType, - }); - + const url = convertSliApmParamsToApmAppDeeplinkUrl(slo); + if (url) { navigateToUrl(basePath.prepend(url)); } }; @@ -58,7 +44,8 @@ export function SloIndicatorTypeBadge({ slo, color }: Props) { {toIndicatorTypeLabel(slo.indicator.type)} - {isApmIndicatorType(slo.indicator.type) && 'service' in slo.indicator.params && ( + {(apmTransactionDurationIndicatorSchema.is(slo.indicator) || + apmTransactionErrorRateIndicatorSchema.is(slo.indicator)) && ( > | undefined; @@ -64,15 +68,17 @@ export function SloCardItem({ slo, rules, activeAlerts, historicalSummary, cards const [isActionsPopoverOpen, setIsActionsPopoverOpen] = useState(false); const [isAddRuleFlyoutOpen, setIsAddRuleFlyoutOpen] = useState(false); const [isDeleteConfirmationModalOpen, setDeleteConfirmationModalOpen] = useState(false); - + const [isDashboardAttachmentReady, setDashboardAttachmentReady] = useState(false); const historicalSliData = formatHistoricalData(historicalSummary, 'sli_value'); - const { handleCreateRule, handleDeleteCancel, handleDeleteConfirm } = useSloListActions({ - slo, - setDeleteConfirmationModalOpen, - setIsActionsPopoverOpen, - setIsAddRuleFlyoutOpen, - }); + const { handleCreateRule, handleDeleteCancel, handleDeleteConfirm, handleAttachToDashboardSave } = + useSloListActions({ + slo, + setDeleteConfirmationModalOpen, + setIsActionsPopoverOpen, + setIsAddRuleFlyoutOpen, + setDashboardAttachmentReady, + }); return ( <> @@ -104,6 +110,7 @@ export function SloCardItem({ slo, rules, activeAlerts, historicalSummary, cards setIsActionsPopoverOpen={setIsActionsPopoverOpen} setIsAddRuleFlyoutOpen={setIsAddRuleFlyoutOpen} setDeleteConfirmationModalOpen={setDeleteConfirmationModalOpen} + setDashboardAttachmentReady={setDashboardAttachmentReady} /> )} @@ -130,6 +137,25 @@ export function SloCardItem({ slo, rules, activeAlerts, historicalSummary, cards onConfirm={handleDeleteConfirm} /> ) : null} + {isDashboardAttachmentReady ? ( + { + setDashboardAttachmentReady(false); + }} + onSave={handleAttachToDashboardSave} + /> + ) : null} ); } diff --git a/x-pack/plugins/observability/public/pages/slos/components/card_view/slo_card_item_actions.tsx b/x-pack/plugins/observability/public/pages/slos/components/card_view/slo_card_item_actions.tsx index 51d1887d433f..ff4d7f363cae 100644 --- a/x-pack/plugins/observability/public/pages/slos/components/card_view/slo_card_item_actions.tsx +++ b/x-pack/plugins/observability/public/pages/slos/components/card_view/slo_card_item_actions.tsx @@ -41,6 +41,7 @@ interface Props { setIsActionsPopoverOpen: (value: boolean) => void; setDeleteConfirmationModalOpen: (value: boolean) => void; setIsAddRuleFlyoutOpen: (value: boolean) => void; + setDashboardAttachmentReady: (value: boolean) => void; } export function SloCardItemActions(props: Props) { diff --git a/x-pack/plugins/observability/public/pages/slos/components/slo_item_actions.tsx b/x-pack/plugins/observability/public/pages/slos/components/slo_item_actions.tsx index 51652abe1354..8bda3b98bd51 100644 --- a/x-pack/plugins/observability/public/pages/slos/components/slo_item_actions.tsx +++ b/x-pack/plugins/observability/public/pages/slos/components/slo_item_actions.tsx @@ -30,6 +30,7 @@ interface Props { setIsActionsPopoverOpen: (value: boolean) => void; setDeleteConfirmationModalOpen: (value: boolean) => void; setIsAddRuleFlyoutOpen: (value: boolean) => void; + setDashboardAttachmentReady?: (value: boolean) => void; btnProps?: Partial; } const CustomShadowPanel = styled(EuiPanel)<{ shadow: string }>` @@ -59,6 +60,7 @@ export function SloItemActions({ setIsActionsPopoverOpen, setIsAddRuleFlyoutOpen, setDeleteConfirmationModalOpen, + setDashboardAttachmentReady, btnProps, }: Props) { const { @@ -110,6 +112,13 @@ export function SloItemActions({ setIsAddRuleFlyoutOpen(true); }; + const handleAttachToDashboard = () => { + setIsActionsPopoverOpen(false); + if (setDashboardAttachmentReady) { + setDashboardAttachmentReady(true); + } + }; + const btn = ( , + + {i18n.translate('xpack.observability.slo.item.actions.attachToDashboard', { + defaultMessage: 'Attach to Dashboard', + })} + , ]} /> diff --git a/x-pack/plugins/observability/public/pages/slos/components/slo_list_item.tsx b/x-pack/plugins/observability/public/pages/slos/components/slo_list_item.tsx index 31455cea0190..dc3865af0005 100644 --- a/x-pack/plugins/observability/public/pages/slos/components/slo_list_item.tsx +++ b/x-pack/plugins/observability/public/pages/slos/components/slo_list_item.tsx @@ -9,6 +9,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui'; import { HistoricalSummaryResponse, SLOWithSummaryResponse } from '@kbn/slo-schema'; import type { Rule } from '@kbn/triggers-actions-ui-plugin/public'; import React, { useState } from 'react'; + import { SloDeleteConfirmationModal } from '../../../components/slo/delete_confirmation_modal/slo_delete_confirmation_modal'; import { useSloFormattedSummary } from '../hooks/use_slo_summary'; import { BurnRateRuleFlyout } from './common/burn_rate_rule_flyout'; diff --git a/x-pack/plugins/observability/public/pages/slos/hooks/use_slo_list_actions.ts b/x-pack/plugins/observability/public/pages/slos/hooks/use_slo_list_actions.ts index 169e1e54c522..bdc6cf3a4c49 100644 --- a/x-pack/plugins/observability/public/pages/slos/hooks/use_slo_list_actions.ts +++ b/x-pack/plugins/observability/public/pages/slos/hooks/use_slo_list_actions.ts @@ -6,19 +6,26 @@ */ import { SLOWithSummaryResponse } from '@kbn/slo-schema'; +import { SaveModalDashboardProps } from '@kbn/presentation-util-plugin/public'; +import { useCallback } from 'react'; import { useDeleteSlo } from '../../../hooks/slo/use_delete_slo'; +import { SLO_EMBEDDABLE } from '../../../embeddable/slo/overview/slo_embeddable'; +import { useKibana } from '../../../utils/kibana_react'; export function useSloListActions({ slo, setIsAddRuleFlyoutOpen, setIsActionsPopoverOpen, setDeleteConfirmationModalOpen, + setDashboardAttachmentReady, }: { slo: SLOWithSummaryResponse; setIsActionsPopoverOpen: (val: boolean) => void; setIsAddRuleFlyoutOpen: (val: boolean) => void; setDeleteConfirmationModalOpen: (val: boolean) => void; + setDashboardAttachmentReady?: (val: boolean) => void; }) { + const { embeddable } = useKibana().services; const { mutate: deleteSlo } = useDeleteSlo(); const handleDeleteConfirm = () => { @@ -34,9 +41,35 @@ export function useSloListActions({ setIsAddRuleFlyoutOpen(true); }; + const handleAttachToDashboardSave: SaveModalDashboardProps['onSave'] = useCallback( + ({ dashboardId, newTitle, newDescription }) => { + const stateTransfer = embeddable!.getStateTransfer(); + const embeddableInput = { + title: newTitle, + description: newDescription, + sloId: slo.id, + sloInstanceId: slo.instanceId, + }; + + const state = { + input: embeddableInput, + type: SLO_EMBEDDABLE, + }; + + const path = dashboardId === 'new' ? '#/create' : `#/view/${dashboardId}`; + + stateTransfer.navigateToWithEmbeddablePackage('dashboards', { + state, + path, + }); + }, + [embeddable, slo.id, slo.instanceId] + ); + return { handleDeleteConfirm, handleDeleteCancel, handleCreateRule, + handleAttachToDashboardSave, }; } diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 2e716f42d071..808573579cb9 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -67,6 +67,7 @@ import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/pu import type { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/public'; import { firstValueFrom } from 'rxjs'; +import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public'; import { observabilityAppId, observabilityFeatureId } from '../common'; import { ALERTS_PATH, @@ -123,6 +124,7 @@ export interface ObservabilityPublicPluginsSetup { uiActions: UiActionsSetup; licensing: LicensingPluginSetup; serverless?: ServerlessPluginSetup; + presentationUtil?: PresentationUtilPluginStart; } export interface ObservabilityPublicPluginsStart { actionTypeRegistry: ActionTypeRegistryContract; @@ -153,6 +155,7 @@ export interface ObservabilityPublicPluginsStart { serverless?: ServerlessPluginStart; uiSettings: IUiSettingsClient; uiActions: UiActionsStart; + presentationUtil?: PresentationUtilPluginStart; } export type ObservabilityPublicStart = ReturnType; diff --git a/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts b/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts index 11236c3d6bbd..5efea5009ed8 100644 --- a/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts +++ b/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.test.ts @@ -6,9 +6,11 @@ */ import { convertSliApmParamsToApmAppDeeplinkUrl } from './convert_sli_apm_params_to_apm_app_deeplink_url'; +import { buildSlo } from '../../data/slo/slo'; +import { buildApmLatencyIndicator } from '../../data/slo/indicator'; +import { ALL_VALUE } from '@kbn/slo-schema'; -const SLI_APM_PARAMS = { - duration: '30-d', +const DEFAULT_PARAMS = { environment: 'fooEnvironment', filter: 'agent.name : "beats" and agent.version : 3.4.12 ', service: 'barService', @@ -18,74 +20,88 @@ const SLI_APM_PARAMS = { describe('convertSliApmParamsToApmAppDeeplinkUrl', () => { it('should return a correct APM deeplink when all params have a value', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl(SLI_APM_PARAMS); + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator(DEFAULT_PARAMS), + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30-d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` ); }); - it('should return a correct APM deeplink when empty duration is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - duration: '', - }); + it('should return a correct APM deeplink when all environment is passed', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator({ ...DEFAULT_PARAMS, environment: ALL_VALUE }), + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=ENVIRONMENT_ALL&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` ); }); - it('should return a correct APM deeplink when empty environment is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - environment: '', - }); + it('should return a correct APM deeplink when empty filter is passed', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator({ ...DEFAULT_PARAMS, filter: '' }), + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&transactionType=blarfType&rangeFrom=now-30-d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22"` ); }); - it('should return a correct APM deeplink when empty filter is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - filter: '', - }); + it('should return an empty string if all service is passed', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator({ ...DEFAULT_PARAMS, service: ALL_VALUE }), + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30-d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22"` + `"/app/apm/services/*/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` ); }); - it('should return an empty string if an empty service is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - service: '', - }); + it('should return a correct APM deeplink when all transactionName is passed', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator({ ...DEFAULT_PARAMS, transactionName: ALL_VALUE }), + }) + ); - expect(url).toMatchInlineSnapshot(`""`); + expect(url).toMatchInlineSnapshot( + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + ); }); - it('should return a correct APM deeplink when empty transactionName is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - transactionName: '', - }); + it('should return a correct APM deeplink when all transactionType is passed', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator({ ...DEFAULT_PARAMS, transactionType: ALL_VALUE }), + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30-d&rangeTo=now&kuery=agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` ); }); - it('should return a correct APM deeplink when empty transactionType is passed', () => { - const url = convertSliApmParamsToApmAppDeeplinkUrl({ - ...SLI_APM_PARAMS, - transactionType: '', - }); + it('should return a correct APM deeplink when groupBy and instanceId are provided', () => { + const url = convertSliApmParamsToApmAppDeeplinkUrl( + buildSlo({ + indicator: buildApmLatencyIndicator(DEFAULT_PARAMS), + groupBy: 'label.project_id', + instanceId: 'bf6689b383749812f35c7a408f57d113', + }) + ); expect(url).toMatchInlineSnapshot( - `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&rangeFrom=now-30-d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12+"` + `"/app/apm/services/barService/overview?comparisonEnabled=true&environment=fooEnvironment&transactionType=blarfType&rangeFrom=now-30d&rangeTo=now&kuery=transaction.name+%3A+%22bazName%22+and+agent.name+%3A+%22beats%22+and+agent.version+%3A+3.4.12++and+label.project_id+%3A+%22bf6689b383749812f35c7a408f57d113%22"` ); }); }); diff --git a/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts b/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts index a36a6f8c70b2..4cf2f8865233 100644 --- a/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts +++ b/x-pack/plugins/observability/public/utils/slo/convert_sli_apm_params_to_apm_app_deeplink_url.ts @@ -5,29 +5,30 @@ * 2.0. */ -import { ALL_VALUE } from '@kbn/slo-schema'; - -interface Props { - duration?: string; - environment: string; - filter: string | undefined; - service: string; - transactionName: string; - transactionType: string; -} - -export function convertSliApmParamsToApmAppDeeplinkUrl({ - duration, - environment, - filter, - service, - transactionName, - transactionType, -}: Props) { - if (!service) { - return ''; +import { + ALL_VALUE, + apmTransactionDurationIndicatorSchema, + apmTransactionErrorRateIndicatorSchema, + SLOResponse, +} from '@kbn/slo-schema'; + +export function convertSliApmParamsToApmAppDeeplinkUrl(slo: SLOResponse): string | undefined { + if ( + !apmTransactionDurationIndicatorSchema.is(slo.indicator) && + !apmTransactionErrorRateIndicatorSchema.is(slo.indicator) + ) { + return undefined; } + const { + indicator: { + params: { environment, filter, service, transactionName, transactionType }, + }, + timeWindow: { duration }, + groupBy, + instanceId, + } = slo; + const qs = new URLSearchParams('comparisonEnabled=true'); if (environment) { @@ -50,6 +51,9 @@ export function convertSliApmParamsToApmAppDeeplinkUrl({ if (filter && filter.length > 0) { kueryParams.push(filter); } + if (groupBy !== ALL_VALUE && instanceId !== ALL_VALUE) { + kueryParams.push(`${groupBy} : "${instanceId}"`); + } if (kueryParams.length > 0) { qs.append('kuery', kueryParams.join(' and ')); diff --git a/x-pack/plugins/observability/public/utils/slo/indicator.ts b/x-pack/plugins/observability/public/utils/slo/indicator.ts index 955eab9e3329..ece808ddc033 100644 --- a/x-pack/plugins/observability/public/utils/slo/indicator.ts +++ b/x-pack/plugins/observability/public/utils/slo/indicator.ts @@ -5,7 +5,12 @@ * 2.0. */ -import { SLOWithSummaryResponse } from '@kbn/slo-schema'; +import { + apmTransactionDurationIndicatorSchema, + apmTransactionErrorRateIndicatorSchema, + Indicator, +} from '@kbn/slo-schema'; -export const isApmIndicatorType = (indicatorType: SLOWithSummaryResponse['indicator']['type']) => - ['sli.apm.transactionDuration', 'sli.apm.transactionErrorRate'].includes(indicatorType); +export const isApmIndicatorType = (indicator: Indicator): boolean => + apmTransactionDurationIndicatorSchema.is(indicator) || + apmTransactionErrorRateIndicatorSchema.is(indicator); diff --git a/x-pack/plugins/observability/server/ui_settings.ts b/x-pack/plugins/observability/server/ui_settings.ts index 98260fff5f4c..8029b412ebb6 100644 --- a/x-pack/plugins/observability/server/ui_settings.ts +++ b/x-pack/plugins/observability/server/ui_settings.ts @@ -37,6 +37,7 @@ import { profilingPervCPUWattArm64, profilingAWSCostDiscountRate, profilingCostPervCPUPerHour, + enableInfrastructureProfilingIntegration, } from '../common/ui_settings_keys'; const betaLabel = i18n.translate('xpack.observability.uiSettings.betaLabel', { @@ -236,6 +237,24 @@ export const uiSettings: Record = { }), schema: schema.boolean(), }, + [enableInfrastructureProfilingIntegration]: { + category: [observabilityFeatureId], + name: i18n.translate('xpack.observability.enableInfrastructureProfilingIntegration', { + defaultMessage: 'Universal Profiling integration in Infrastructure', + }), + value: true, + description: i18n.translate( + 'xpack.observability.enableInfrastructureProfilingIntegrationDescription', + { + defaultMessage: + '{betaLabel} Enable Universal Profiling integration in the Infrastructure app.', + values: { + betaLabel: `[${betaLabel}]`, + }, + } + ), + schema: schema.boolean(), + }, [enableAwsLambdaMetrics]: { category: [observabilityFeatureId], name: i18n.translate('xpack.observability.enableAwsLambdaMetrics', { @@ -415,9 +434,9 @@ export const uiSettings: Record = { }), value: 1.7, description: i18n.translate('xpack.observability.profilingDatacenterPUEUiSettingDescription', { - defaultMessage: `Data center power usage effectiveness (PUE) measures how efficiently a data center uses energy. Defaults to 1.7, the average on-premise data center PUE according to the {uptimeLink} survey + defaultMessage: `Data center power usage effectiveness (PUE) measures how efficiently a data center uses energy. Defaults to 1.7, the average on-premise data center PUE according to the {uptimeLink} survey

- You can also use the PUE that corresponds with your cloud provider: + You can also use the PUE that corresponds with your cloud provider:
  • AWS: 1.135
  • GCP: 1.1
  • @@ -444,7 +463,7 @@ export const uiSettings: Record = { }), value: 0.000379069, description: i18n.translate('xpack.observability.profilingCo2PerKWHUiSettingDescription', { - defaultMessage: `Carbon intensity measures how clean your data center electricity is. + defaultMessage: `Carbon intensity measures how clean your data center electricity is. Specifically, it measures the average amount of CO2 emitted per kilowatt-hour (kWh) of electricity consumed in a particular region. Use the cloud carbon footprint {datasheetLink} to update this value according to your region. Defaults to US East (N. Virginia).`, values: { diff --git a/x-pack/plugins/observability/tsconfig.json b/x-pack/plugins/observability/tsconfig.json index 6cc8bbfef132..61762322f9ee 100644 --- a/x-pack/plugins/observability/tsconfig.json +++ b/x-pack/plugins/observability/tsconfig.json @@ -97,6 +97,7 @@ "@kbn/serverless", "@kbn/dashboard-plugin", "@kbn/calculate-auto", + "@kbn/presentation-util-plugin", "@kbn/task-manager-plugin", "@kbn/core-elasticsearch-client-server-mocks", "@kbn/core-saved-objects-api-server-mocks" diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.test.ts index dade311fa6b4..3a47134531d3 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.test.ts @@ -7,7 +7,7 @@ import type { SecurityAppStore } from '../../../common/store/types'; import { TimelineId } from '../../../../common/types'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import { createAddToTimelineCellActionFactory } from './add_to_timeline'; import type { CellActionExecutionContext } from '@kbn/cell-actions'; import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants'; diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.ts index 9ce248701a75..1b40784dcec4 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/add_to_timeline.ts @@ -15,7 +15,7 @@ import { } from '@kbn/cell-actions/src/actions/utils'; import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations'; import type { KBN_FIELD_TYPES } from '@kbn/field-types'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import { TimelineId } from '../../../../common/types'; import type { SecurityAppStore } from '../../../common/store'; import { fieldHasCellActions } from '../../utils'; diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.test.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.test.ts index d8c83e6a336d..ee1d1ec579f1 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.test.ts @@ -7,12 +7,12 @@ import type { SecurityAppStore } from '../../../common/store/types'; import { TimelineId } from '../../../../common/types'; -import { addProvider, showTimeline } from '../../../timelines/store/timeline/actions'; +import { addProvider, showTimeline } from '../../../timelines/store/actions'; import { createInvestigateInNewTimelineCellActionFactory } from './investigate_in_new_timeline'; import type { CellActionExecutionContext } from '@kbn/cell-actions'; import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants'; import { createStartServicesMock } from '../../../common/lib/kibana/kibana_react.mock'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; const services = createStartServicesMock(); diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.ts index 0ba3cf3ffc8a..2c9dd401d415 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/cell_action/investigate_in_new_timeline.ts @@ -14,8 +14,8 @@ import { filterOutNullableValues, } from '@kbn/cell-actions/src/actions/utils'; import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations'; -import { timelineActions } from '../../../timelines/store/timeline'; -import { addProvider, showTimeline } from '../../../timelines/store/timeline/actions'; +import { timelineActions } from '../../../timelines/store'; +import { addProvider, showTimeline } from '../../../timelines/store/actions'; import { TimelineId } from '../../../../common/types'; import type { SecurityAppStore } from '../../../common/store'; import { fieldHasCellActions } from '../../utils'; @@ -29,7 +29,7 @@ import { createDataProviders, isValidDataProviderField } from '../data_provider' import { SecurityCellActionType } from '../../constants'; import type { StartServices } from '../../../types'; import type { SecurityCellAction } from '../../types'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; export const createInvestigateInNewTimelineCellActionFactory = createCellActionFactory( ({ diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/discover/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/discover/add_to_timeline.test.ts index f8c62857e3e2..4374bf70b19b 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/discover/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/discover/add_to_timeline.test.ts @@ -7,7 +7,7 @@ import type { SecurityAppStore } from '../../../common/store/types'; import { TimelineId } from '../../../../common/types'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import { createAddToTimelineDiscoverCellActionFactory } from './add_to_timeline'; import type { CellActionExecutionContext } from '@kbn/cell-actions'; import { GEO_FIELD_TYPE } from '../../../timelines/components/timeline/body/renderers/constants'; diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.test.ts index ebb1f40061a7..976d0f13efab 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.test.ts @@ -14,7 +14,7 @@ import { KibanaServices } from '../../../common/lib/kibana'; import { APP_UI_ID } from '../../../../common/constants'; import type { DataProvider } from '../../../../common/types'; import { TimelineId, EXISTS_OPERATOR } from '../../../../common/types'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import type { ActionExecutionContext } from '@kbn/ui-actions-plugin/public'; jest.mock('../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.ts b/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.ts index 4032a2fe1fe8..1a536c34d77a 100644 --- a/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.ts +++ b/x-pack/plugins/security_solution/public/actions/add_to_timeline/lens/add_to_timeline.ts @@ -10,7 +10,7 @@ import { isErrorEmbeddable, isFilterableEmbeddable } from '@kbn/embeddable-plugi import { createAction } from '@kbn/ui-actions-plugin/public'; import { KibanaServices } from '../../../common/lib/kibana'; import type { SecurityAppStore } from '../../../common/store/types'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import type { DataProvider } from '../../../../common/types'; import { EXISTS_OPERATOR, TimelineId } from '../../../../common/types'; import { fieldHasCellActions, isInSecurityApp, isLensEmbeddable } from '../../utils'; diff --git a/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_in.ts b/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_in.ts index 905da379d01f..1b65b608f43a 100644 --- a/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_in.ts +++ b/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_in.ts @@ -15,7 +15,7 @@ import { import type { KBN_FIELD_TYPES } from '@kbn/field-types'; import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations'; import type { SecurityAppStore } from '../../../common/store'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { fieldHasCellActions } from '../../utils'; import { TimelineId } from '../../../../common/types'; import { isTimelineScope } from '../../../helpers'; diff --git a/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_out.ts b/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_out.ts index 38c2e52b7c7c..56eb27433fee 100644 --- a/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_out.ts +++ b/x-pack/plugins/security_solution/public/actions/filter/cell_action/filter_out.ts @@ -17,7 +17,7 @@ import type { KBN_FIELD_TYPES } from '@kbn/field-types'; import { fieldHasCellActions } from '../../utils'; import type { SecurityAppStore } from '../../../common/store'; import type { StartServices } from '../../../types'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { TimelineId } from '../../../../common/types'; import { isTimelineScope } from '../../../helpers'; import type { SecurityCellAction } from '../../types'; diff --git a/x-pack/plugins/security_solution/public/actions/filter/lens/create_action.ts b/x-pack/plugins/security_solution/public/actions/filter/lens/create_action.ts index 78a0a9d46ff2..461356dc7224 100644 --- a/x-pack/plugins/security_solution/public/actions/filter/lens/create_action.ts +++ b/x-pack/plugins/security_solution/public/actions/filter/lens/create_action.ts @@ -16,7 +16,7 @@ import type { CellValueContext } from '@kbn/embeddable-plugin/public'; import { createAction } from '@kbn/ui-actions-plugin/public'; import { ACTION_INCOMPATIBLE_VALUE_WARNING } from '@kbn/cell-actions/src/actions/translations'; import { i18n } from '@kbn/i18n'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { fieldHasCellActions, isInSecurityApp, isLensEmbeddable } from '../../utils'; import { TimelineId } from '../../../../common/types'; import { DefaultCellActionTypes } from '../../constants'; diff --git a/x-pack/plugins/security_solution/public/actions/toggle_column/cell_action/toggle_column.ts b/x-pack/plugins/security_solution/public/actions/toggle_column/cell_action/toggle_column.ts index 6a1d73ffa131..2a2926f3f6a2 100644 --- a/x-pack/plugins/security_solution/public/actions/toggle_column/cell_action/toggle_column.ts +++ b/x-pack/plugins/security_solution/public/actions/toggle_column/cell_action/toggle_column.ts @@ -15,8 +15,8 @@ import { import { fieldHasCellActions } from '../../utils'; import type { SecurityAppStore } from '../../../common/store'; import { getScopedActions, isInTableScope, isTimelineScope } from '../../../helpers'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineDefaults } from '../../../timelines/store/defaults'; +import { timelineSelectors } from '../../../timelines/store'; import { DEFAULT_COLUMN_MIN_WIDTH } from '../../../timelines/components/timeline/body/constants'; import type { SecurityCellAction } from '../../types'; import { SecurityCellActionType } from '../../constants'; diff --git a/x-pack/plugins/security_solution/public/app/home/global_header/index.tsx b/x-pack/plugins/security_solution/public/app/home/global_header/index.tsx index e5a12721a629..d02eb41605e3 100644 --- a/x-pack/plugins/security_solution/public/app/home/global_header/index.tsx +++ b/x-pack/plugins/security_solution/public/app/home/global_header/index.tsx @@ -21,8 +21,8 @@ import { useKibana } from '../../../common/lib/kibana'; import { isDetectionsPath, isDashboardViewPath } from '../../../helpers'; import { Sourcerer } from '../../../common/components/sourcerer'; import { TimelineId } from '../../../../common/types/timeline'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineDefaults } from '../../../timelines/store/defaults'; +import { timelineSelectors } from '../../../timelines/store'; import { useShallowEqualSelector } from '../../../common/hooks/use_selector'; import { getScopeFromPath, showSourcererByPath } from '../../../common/containers/sourcerer'; import { useAddIntegrationsUrl } from '../../../common/hooks/use_add_integrations_url'; diff --git a/x-pack/plugins/security_solution/public/app/home/index.test.tsx b/x-pack/plugins/security_solution/public/app/home/index.test.tsx index fc62a8236f9c..8fce33967e15 100644 --- a/x-pack/plugins/security_solution/public/app/home/index.test.tsx +++ b/x-pack/plugins/security_solution/public/app/home/index.test.tsx @@ -29,8 +29,8 @@ import type { Filter } from '@kbn/es-query'; import { createStore } from '../../common/store'; import type { TimeRange, UrlInputsModel } from '../../common/store/inputs/model'; import { SecurityPageName } from '../types'; -import type { TimelineUrl } from '../../timelines/store/timeline/model'; -import { timelineDefaults } from '../../timelines/store/timeline/defaults'; +import type { TimelineUrl } from '../../timelines/store/model'; +import { timelineDefaults } from '../../timelines/store/defaults'; import { URL_PARAM_KEY } from '../../common/hooks/use_url_state'; import { InputsModelId } from '../../common/store/inputs/constants'; import { TopValuesPopoverService } from '../components/top_values_popover/top_values_popover_service'; @@ -98,7 +98,7 @@ jest.mock('../../timelines/components/open_timeline/helpers', () => { const mockGetTimeline = jest.fn(); -jest.mock('../../timelines/store/timeline', () => ({ +jest.mock('../../timelines/store', () => ({ timelineSelectors: { getTimelineByIdSelector: () => mockGetTimeline, }, diff --git a/x-pack/plugins/security_solution/public/assistant/comment_actions/index.tsx b/x-pack/plugins/security_solution/public/assistant/comment_actions/index.tsx index 6059ef63ae6f..1804c837c4f1 100644 --- a/x-pack/plugins/security_solution/public/assistant/comment_actions/index.tsx +++ b/x-pack/plugins/security_solution/public/assistant/comment_actions/index.tsx @@ -17,7 +17,7 @@ import type { Note } from '../../common/lib/note'; import { appActions } from '../../common/store/actions'; import { TimelineId } from '../../../common/types'; import { updateAndAssociateNode } from '../../timelines/components/notes/helpers'; -import { timelineActions } from '../../timelines/store/timeline'; +import { timelineActions } from '../../timelines/store'; import * as i18n from './translations'; import { useIsExperimentalFeatureEnabled } from '../../common/hooks/use_experimental_features'; diff --git a/x-pack/plugins/security_solution/public/assistant/send_to_timeline/index.tsx b/x-pack/plugins/security_solution/public/assistant/send_to_timeline/index.tsx index 114d5deb5f3e..fe2c23b8f60b 100644 --- a/x-pack/plugins/security_solution/public/assistant/send_to_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/assistant/send_to_timeline/index.tsx @@ -33,7 +33,7 @@ import { showTimeline, updateDataView, updateEqlOptions, -} from '../../timelines/store/timeline/actions'; +} from '../../timelines/store/actions'; import { useDiscoverInTimelineContext } from '../../common/components/discover_in_timeline/use_discover_in_timeline_context'; import { useShowTimeline } from '../../common/utils/timeline/use_show_timeline'; diff --git a/x-pack/plugins/security_solution/public/cases/components/use_insert_timeline/index.tsx b/x-pack/plugins/security_solution/public/cases/components/use_insert_timeline/index.tsx index e12d973d0be6..cd5b4bcde782 100644 --- a/x-pack/plugins/security_solution/public/cases/components/use_insert_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/use_insert_timeline/index.tsx @@ -11,9 +11,9 @@ import { isEmpty } from 'lodash/fp'; import { getTimelineUrl, useFormatUrl } from '../../../common/components/link_to'; import { useShallowEqualSelector } from '../../../common/hooks/use_selector'; -import { timelineSelectors, timelineActions } from '../../../timelines/store/timeline'; +import { timelineSelectors, timelineActions } from '../../../timelines/store'; import { SecurityPageName } from '../../../app/types'; -import { setInsertTimeline } from '../../../timelines/store/timeline/actions'; +import { setInsertTimeline } from '../../../timelines/store/actions'; export interface UseInsertTimelineReturn { handleOnTimelineChange: (title: string, id: string | null, graphEventId?: string) => void; diff --git a/x-pack/plugins/security_solution/public/cases/pages/index.tsx b/x-pack/plugins/security_solution/public/cases/pages/index.tsx index ab5b170e423c..ba920046837f 100644 --- a/x-pack/plugins/security_solution/public/cases/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/pages/index.tsx @@ -28,7 +28,7 @@ import { ENABLE_EXPANDABLE_FLYOUT_SETTING, SecurityPageName, } from '../../../common/constants'; -import { timelineActions } from '../../timelines/store/timeline'; +import { timelineActions } from '../../timelines/store'; import { useSourcererDataView } from '../../common/containers/sourcerer'; import { SourcererScopeName } from '../../common/store/sourcerer/model'; import { CaseDetailsRefreshContext } from '../../common/components/endpoint/host_isolation/endpoint_host_isolation_cases_context'; diff --git a/x-pack/plugins/security_solution/public/common/components/control_columns/row_action/index.tsx b/x-pack/plugins/security_solution/public/common/components/control_columns/row_action/index.tsx index 93a29b9ea443..e729ccce9257 100644 --- a/x-pack/plugins/security_solution/public/common/components/control_columns/row_action/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/control_columns/row_action/index.tsx @@ -11,7 +11,7 @@ import { useDispatch } from 'react-redux'; import { useExpandableFlyoutContext } from '@kbn/expandable-flyout'; import { dataTableActions, TableId } from '@kbn/securitysolution-data-table'; import { useUiSetting$ } from '@kbn/kibana-react-plugin/public'; -import { timelineActions } from '../../../../timelines/store/timeline'; +import { timelineActions } from '../../../../timelines/store'; import { ENABLE_EXPANDABLE_FLYOUT_SETTING } from '../../../../../common/constants'; import { DocumentDetailsRightPanelKey } from '../../../../flyout/document_details/right'; import type { diff --git a/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.test.tsx b/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.test.tsx index fddf6a1afc6e..b2d1ac052a1e 100644 --- a/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.test.tsx @@ -23,7 +23,7 @@ import { useKibana } from '../../lib/kibana'; import type { State } from '../../store'; import { createStore } from '../../store'; import { TimelineId } from '../../../../common/types'; -import * as timelineActions from '../../../timelines/store/timeline/actions'; +import * as timelineActions from '../../../timelines/store/actions'; import type { ComponentType, FC, PropsWithChildren } from 'react'; import React from 'react'; import type { DataView } from '@kbn/data-views-plugin/common'; diff --git a/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.tsx b/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.tsx index cde218b6e450..3c8ab819527b 100644 --- a/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/discover_in_timeline/use_discover_in_timeline_actions.tsx @@ -15,9 +15,9 @@ import type { DiscoverAppState } from '@kbn/discover-plugin/public/application/m import type { TimeRange } from '@kbn/es-query'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { defaultHeaders } from '@kbn/securitysolution-data-table'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { TimelineId } from '../../../../common/types'; -import { timelineActions, timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineActions, timelineSelectors } from '../../../timelines/store'; import { useAppToasts } from '../../hooks/use_app_toasts'; import { useShallowEqualSelector } from '../../hooks/use_selector'; import { useKibana } from '../../lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx index a1455f7e5cc0..437309762732 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/drag_drop_context_wrapper.tsx @@ -16,7 +16,7 @@ import { IS_DRAGGING_CLASS_NAME } from '@kbn/securitysolution-t-grid'; import type { BrowserFields } from '../../containers/source'; import { dragAndDropSelectors } from '../../store'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import type { IdToDataProvider } from '../../store/drag_and_drop/model'; import type { DataProvider } from '../../../timelines/components/timeline/data_providers/data_provider'; import { reArrangeProviders } from '../../../timelines/components/timeline/data_providers/helpers'; @@ -39,7 +39,7 @@ import { } from './helpers'; import { useDeepEqualSelector } from '../../hooks/use_selector'; import { useKibana } from '../../lib/kibana'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { defaultAlertsHeaders } from '../events_viewer/default_alert_headers'; // @ts-expect-error diff --git a/x-pack/plugins/security_solution/public/common/components/endpoint/route_capture.tsx b/x-pack/plugins/security_solution/public/common/components/endpoint/route_capture.tsx index 1fd12db245fc..e1d0751337fb 100644 --- a/x-pack/plugins/security_solution/public/common/components/endpoint/route_capture.tsx +++ b/x-pack/plugins/security_solution/public/common/components/endpoint/route_capture.tsx @@ -10,7 +10,7 @@ import { useLocation } from 'react-router-dom'; import { useDispatch } from 'react-redux'; import { TimelineId } from '../../../../common/types'; import type { AppLocation } from '../../../../common/endpoint/types'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; /** * This component should be used above all routes, but below the Provider. diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx index 8f5fdf54efdc..7d3f5feb93f3 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx @@ -22,12 +22,12 @@ import { import { dataTableSelectors, tableDefaults } from '@kbn/securitysolution-data-table'; import { isInTableScope, isTimelineScope } from '../../../helpers'; import { ADD_TIMELINE_BUTTON_CLASS_NAME } from '../../../timelines/components/flyout/add_timeline_button'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import type { BrowserFields } from '../../containers/source'; import { getAllFieldsByName } from '../../containers/source'; import type { TimelineEventsDetailsItem } from '../../../../common/search_strategy/timeline'; import { getColumnHeaders } from '../../../timelines/components/timeline/body/column_headers/helpers'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { getColumns } from './columns'; import { EVENT_FIELDS_TABLE_CLASS_NAME, onEventDetailsTabKeyPressed, search } from './helpers'; import { useDeepEqualSelector } from '../../hooks/use_selector'; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/overview/index.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/overview/index.tsx index b33f777dcff4..762671896b36 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/overview/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/overview/index.tsx @@ -30,7 +30,7 @@ import { OverviewCardWithActions, OverviewCard } from './overview_card'; import { StatusPopoverButton } from './status_popover_button'; import { SeverityBadge } from '../../../../detections/components/rules/severity_badge'; import { useThrottledResizeObserver } from '../../utils'; -import { isNotNull } from '../../../../timelines/store/timeline/helpers'; +import { isNotNull } from '../../../../timelines/store/helpers'; export const NotGrowingFlexGroup = euiStyled(EuiFlexGroup)` flex-grow: 0; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx index ad464585ec68..86f005e720f4 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/investigate_in_timeline_button.tsx @@ -15,7 +15,7 @@ import { sourcererSelectors } from '../../../store'; import { InputsModelId } from '../../../store/inputs/constants'; import type { TimeRange } from '../../../store/inputs/model'; import { inputsActions } from '../../../store/inputs'; -import { updateProviders, setFilters } from '../../../../timelines/store/timeline/actions'; +import { updateProviders, setFilters } from '../../../../timelines/store/actions'; import { sourcererActions } from '../../../store/actions'; import { SourcererScopeName } from '../../../store/sourcerer/model'; import type { DataProvider } from '../../../../../common/types'; diff --git a/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_step.tsx b/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_step.tsx index 12cfa2467f3f..156604160be7 100644 --- a/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_step.tsx +++ b/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_step.tsx @@ -14,8 +14,8 @@ import { FormattedMessage } from '@kbn/i18n-react'; import styled from 'styled-components'; import { useShallowEqualSelector } from '../../hooks/use_selector'; import { TimelineId } from '../../../../common/types'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineDefaults } from '../../../timelines/store/defaults'; +import { timelineSelectors } from '../../../timelines/store'; import { useTourContext } from './tour'; import { AlertsCasesTourSteps, SecurityStepId, securityTourConfig } from './tour_config'; diff --git a/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx b/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx index e5c3dc383295..881658c521a8 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_actions/actions.tsx @@ -18,18 +18,18 @@ import { } from '../../../timelines/components/timeline/body/helpers'; import { getScopedActions, isTimelineScope } from '../../../helpers'; import { useIsInvestigateInResolverActionEnabled } from '../../../detections/components/alerts_table/timeline_actions/investigate_in_resolver'; -import { timelineActions, timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineActions, timelineSelectors } from '../../../timelines/store'; import type { ActionProps, OnPinEvent } from '../../../../common/types'; import { TimelineId } from '../../../../common/types'; import { AddEventNoteAction } from './add_note_icon_item'; import { PinEventAction } from './pin_event_action'; import { useShallowEqualSelector } from '../../hooks/use_selector'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { useStartTransaction } from '../../lib/apm/use_start_transaction'; import { useLicense } from '../../hooks/use_license'; import { useGlobalFullScreen, useTimelineFullScreen } from '../../containers/use_full_screen'; import { ALERTS_ACTIONS } from '../../lib/apm/user_actions'; -import { setActiveTabTimeline } from '../../../timelines/store/timeline/actions'; +import { setActiveTabTimeline } from '../../../timelines/store/actions'; import { EventsTdContent } from '../../../timelines/components/timeline/styles'; import { useIsExperimentalFeatureEnabled } from '../../hooks/use_experimental_features'; import { AlertContextMenu } from '../../../detections/components/alerts_table/timeline_actions/alert_context_menu'; diff --git a/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.test.tsx b/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.test.tsx index 6a8f06696bad..c8ab77c05fdb 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.test.tsx @@ -12,7 +12,7 @@ import { mockTriggersActionsUi } from '../../mock/mock_triggers_actions_ui_plugi import type { ColumnHeaderOptions, HeaderActionProps } from '../../../../common/types'; import { TimelineTabs } from '../../../../common/types'; import { HeaderActions } from './header_actions'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; import { getColumnHeader } from '../../../timelines/components/timeline/body/column_headers/helpers'; jest.mock('../../../timelines/components/row_renderers_browser', () => ({ diff --git a/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.tsx b/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.tsx index 231ed8f8b4e6..cbac23af4120 100644 --- a/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/header_actions/header_actions.tsx @@ -16,7 +16,7 @@ import { TimelineTabs, TimelineId } from '../../../../common/types'; import { isFullScreen } from '../../../timelines/components/timeline/body/column_headers'; import { isActiveTimeline } from '../../../helpers'; import { getColumnHeader } from '../../../timelines/components/timeline/body/column_headers/helpers'; -import { timelineActions, timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineActions, timelineSelectors } from '../../../timelines/store'; import { useDeepEqualSelector } from '../../hooks/use_selector'; import { useGlobalFullScreen, useTimelineFullScreen } from '../../containers/use_full_screen'; import { useKibana } from '../../lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx index 4acebe2d3a12..95c69b4e5c4a 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx @@ -14,13 +14,13 @@ import { isEmpty } from 'lodash'; import { FilterManager } from '@kbn/data-plugin/public'; import { useDispatch } from 'react-redux'; import { isActiveTimeline } from '../../../helpers'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { useKibana } from '../../lib/kibana'; import { allowTopN } from '../drag_and_drop/helpers'; import type { ColumnHeaderOptions, DataProvider } from '../../../../common/types/timeline'; import { TimelineId } from '../../../../common/types/timeline'; import { ShowTopNButton } from './actions/show_top_n'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; import { useDeepEqualSelector } from '../../hooks/use_selector'; export interface UseHoverActionItemsProps { dataProvider?: DataProvider | DataProvider[]; diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/use_breadcrumbs_nav.ts b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/use_breadcrumbs_nav.ts index 5a467464670a..7825435fafca 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/use_breadcrumbs_nav.ts +++ b/x-pack/plugins/security_solution/public/common/components/navigation/breadcrumbs/use_breadcrumbs_nav.ts @@ -12,7 +12,7 @@ import type { ChromeBreadcrumb } from '@kbn/core/public'; import type { Dispatch } from 'redux'; import { SecurityPageName } from '../../../../app/types'; import type { RouteSpyState } from '../../../utils/route/types'; -import { timelineActions } from '../../../../timelines/store/timeline'; +import { timelineActions } from '../../../../timelines/store'; import { TimelineId } from '../../../../../common/types/timeline'; import type { GetSecuritySolutionUrl } from '../../link_to'; import { useGetSecuritySolutionUrl } from '../../link_to'; diff --git a/x-pack/plugins/security_solution/public/common/components/search_bar/index.tsx b/x-pack/plugins/security_solution/public/common/components/search_bar/index.tsx index c9906c6e70ea..af4c0aa7b0c1 100644 --- a/x-pack/plugins/security_solution/public/common/components/search_bar/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/search_bar/index.tsx @@ -35,7 +35,7 @@ import { startSelector, toStrSelector, } from './selectors'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; import { useKibana } from '../../lib/kibana'; import { usersActions } from '../../../explore/users/store'; import { hostsActions } from '../../../explore/hosts/store'; diff --git a/x-pack/plugins/security_solution/public/common/components/sourcerer/temporary.tsx b/x-pack/plugins/security_solution/public/common/components/sourcerer/temporary.tsx index 1c2c73abcc04..63bdd4507320 100644 --- a/x-pack/plugins/security_solution/public/common/components/sourcerer/temporary.tsx +++ b/x-pack/plugins/security_solution/public/common/components/sourcerer/temporary.tsx @@ -22,9 +22,9 @@ import { Blockquote, ResetButton } from './helpers'; import { UpdateDefaultDataViewModal } from './update_default_data_view_modal'; import { TimelineId } from '../../../../common/types'; import { TimelineType } from '../../../../common/api/timeline'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { useDeepEqualSelector } from '../../hooks/use_selector'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { BadCurrentPatternsMessage, CurrentPatternsMessage, diff --git a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.tsx b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.tsx index b79f9c736f5c..d37e0c0515ae 100644 --- a/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/super_date_picker/index.tsx @@ -24,7 +24,7 @@ import deepEqual from 'fast-deep-equal'; import { isQueryInput } from '../../store/inputs/helpers'; import { DEFAULT_TIMEPICKER_QUICK_RANGES } from '../../../../common/constants'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; import { useUiSetting$ } from '../../lib/kibana'; import type { inputsModel, State } from '../../store'; import { inputsActions } from '../../store/actions'; diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx index eed95e5caa9c..9a329d369e7e 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/index.test.tsx @@ -42,7 +42,7 @@ jest.mock('react-router-dom', () => { jest.mock('../link_to'); jest.mock('../../lib/kibana'); -jest.mock('../../../timelines/store/timeline/actions'); +jest.mock('../../../timelines/store/actions'); jest.mock('../visualization_actions/actions'); jest.mock('../visualization_actions/lens_embeddable'); const field = 'process.name'; diff --git a/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx b/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx index 45cb33aa199b..d845f2604c69 100644 --- a/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/top_n/index.tsx @@ -19,9 +19,9 @@ import { useKibana } from '../../lib/kibana'; import { combineQueries } from '../../lib/kuery'; import type { inputsModel, State } from '../../store'; import { inputsSelectors } from '../../store'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; -import { timelineSelectors } from '../../../timelines/store/timeline'; -import type { TimelineModel } from '../../../timelines/store/timeline/model'; +import { timelineDefaults } from '../../../timelines/store/defaults'; +import { timelineSelectors } from '../../../timelines/store'; +import type { TimelineModel } from '../../../timelines/store/model'; import { getOptions, isDetectionsAlertsTable } from './helpers'; import { TopN } from './top_n'; diff --git a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx index de784c876fd6..2e9c6cf796e5 100644 --- a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx @@ -18,7 +18,7 @@ import type { } from '../../store/sourcerer/model'; import { SourcererScopeName } from '../../store/sourcerer/model'; import { useUserInfo } from '../../../detections/components/user_info'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import { timelineSelectors } from '../../../timelines/store'; import { ALERTS_PATH, HOSTS_PATH, diff --git a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_init_timeline_url_param.ts b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_init_timeline_url_param.ts index 4d6ef73c643d..1a3058cb138e 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_init_timeline_url_param.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_init_timeline_url_param.ts @@ -15,8 +15,8 @@ import { dispatchUpdateTimeline, queryTimelineById, } from '../../../timelines/components/open_timeline/helpers'; -import type { TimelineUrl } from '../../../timelines/store/timeline/model'; -import { timelineActions } from '../../../timelines/store/timeline'; +import type { TimelineUrl } from '../../../timelines/store/model'; +import { timelineActions } from '../../../timelines/store'; import { URL_PARAM_KEY } from '../use_url_state'; export const useInitTimelineFromUrlParam = () => { diff --git a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.test.ts b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.test.ts index 3966ebc6697b..ef5fe57f16e9 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.test.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.test.ts @@ -8,7 +8,7 @@ import { queryTimelineById } from '../../../timelines/components/open_timeline/helpers'; import { useQueryTimelineByIdOnUrlChange } from './use_query_timeline_by_id_on_url_change'; import { renderHook } from '@testing-library/react-hooks'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; jest.mock('../../../timelines/components/open_timeline/helpers'); diff --git a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.ts b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.ts index e56131cd2603..a7ecab2d5bb5 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_query_timeline_by_id_on_url_change.ts @@ -11,8 +11,8 @@ import { useLocation } from 'react-router-dom'; import usePrevious from 'react-use/lib/usePrevious'; import { useDispatch } from 'react-redux'; import { safeDecode } from '@kbn/rison'; -import type { TimelineUrl } from '../../../timelines/store/timeline/model'; -import { timelineActions, timelineSelectors } from '../../../timelines/store/timeline'; +import type { TimelineUrl } from '../../../timelines/store/model'; +import { timelineActions, timelineSelectors } from '../../../timelines/store'; import { TimelineId, TimelineTabs } from '../../../../common/types'; import { useShallowEqualSelector } from '../use_selector'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_sync_timeline_url_param.ts b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_sync_timeline_url_param.ts index f016cbfd57cc..4d3aa88c4eaf 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_sync_timeline_url_param.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_sync_timeline_url_param.ts @@ -8,8 +8,8 @@ import { useEffect, useMemo } from 'react'; import { useUpdateUrlParam } from '../../utils/global_query_string'; -import type { TimelineUrl } from '../../../timelines/store/timeline/model'; -import { timelineSelectors } from '../../../timelines/store/timeline'; +import type { TimelineUrl } from '../../../timelines/store/model'; +import { timelineSelectors } from '../../../timelines/store'; import { TimelineId } from '../../../../common/types'; import { useShallowEqualSelector } from '../use_selector'; import { URL_PARAM_KEY } from '../use_url_state'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_timeline_save_prompt.ts b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_timeline_save_prompt.ts index 54422da6fe03..4eb7adf15f52 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/timeline/use_timeline_save_prompt.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/timeline/use_timeline_save_prompt.ts @@ -17,7 +17,7 @@ import { useKibana } from '../../lib/kibana'; import { useDeepEqualSelector } from '../use_selector'; import { APP_ID, APP_PATH } from '../../../../common/constants'; import { getTimelineShowStatusByIdSelector } from '../../../timelines/components/flyout/selectors'; -import { timelineActions } from '../../../timelines/store/timeline'; +import { timelineActions } from '../../../timelines/store'; import { UNSAVED_TIMELINE_SAVE_PROMPT, UNSAVED_TIMELINE_SAVE_PROMPT_TITLE, diff --git a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.test.tsx b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.test.tsx index e69f70234153..3e3b28cd028f 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.test.tsx +++ b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.test.tsx @@ -20,7 +20,7 @@ jest.mock('react-router-dom', () => { }); jest.mock('../lib/kibana'); jest.mock('./use_selector'); -jest.mock('../../timelines/store/timeline', () => ({ +jest.mock('../../timelines/store', () => ({ timelineSelectors: { getTimelineByIdSelector: () => jest.fn(), }, diff --git a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.tsx b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.tsx index 40eace1bd6e6..c73b21c3b841 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.tsx +++ b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_conflict.tsx @@ -11,9 +11,9 @@ import { EuiSpacer } from '@elastic/eui'; import { safeDecode, encode } from '@kbn/rison'; import { useDeepEqualSelector } from './use_selector'; import { TimelineId } from '../../../common/types/timeline'; -import { timelineSelectors } from '../../timelines/store/timeline'; -import type { TimelineUrl } from '../../timelines/store/timeline/model'; -import { timelineDefaults } from '../../timelines/store/timeline/defaults'; +import { timelineSelectors } from '../../timelines/store'; +import type { TimelineUrl } from '../../timelines/store/model'; +import { timelineDefaults } from '../../timelines/store/defaults'; import { useKibana } from '../lib/kibana'; import { URL_PARAM_KEY } from './use_url_state'; diff --git a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.test.ts b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.test.ts index 6aeb2a8b42d8..113a18dad705 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.test.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.test.ts @@ -21,7 +21,7 @@ jest.mock('react-router-dom', () => { }); jest.mock('../lib/kibana'); jest.mock('./use_selector'); -jest.mock('../../timelines/store/timeline', () => ({ +jest.mock('../../timelines/store', () => ({ timelineSelectors: { getTimelineByIdSelector: () => jest.fn(), }, diff --git a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.ts b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.ts index e771995e2503..35d9b4a365f1 100644 --- a/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.ts +++ b/x-pack/plugins/security_solution/public/common/hooks/use_resolve_redirect.ts @@ -10,10 +10,10 @@ import { useLocation } from 'react-router-dom'; import { safeDecode, encode } from '@kbn/rison'; import { useDeepEqualSelector } from './use_selector'; import { TimelineId } from '../../../common/types/timeline'; -import { timelineSelectors } from '../../timelines/store/timeline'; -import { timelineDefaults } from '../../timelines/store/timeline/defaults'; +import { timelineSelectors } from '../../timelines/store'; +import { timelineDefaults } from '../../timelines/store/defaults'; import { useKibana } from '../lib/kibana'; -import type { TimelineUrl } from '../../timelines/store/timeline/model'; +import type { TimelineUrl } from '../../timelines/store/model'; import { URL_PARAM_KEY } from './use_url_state'; /** diff --git a/x-pack/plugins/security_solution/public/common/lib/cell_actions/add_to_timeline.tsx b/x-pack/plugins/security_solution/public/common/lib/cell_actions/add_to_timeline.tsx index 3686a33814d7..9e970bea2e63 100644 --- a/x-pack/plugins/security_solution/public/common/lib/cell_actions/add_to_timeline.tsx +++ b/x-pack/plugins/security_solution/public/common/lib/cell_actions/add_to_timeline.tsx @@ -20,7 +20,7 @@ import { } from '../../../timelines/components/timeline/data_providers/data_provider'; import { escapeDataProviderId } from '../../components/drag_and_drop/helpers'; import { EmptyComponent, useKibanaServices } from './helpers'; -import { addProvider } from '../../../timelines/store/timeline/actions'; +import { addProvider } from '../../../timelines/store/actions'; export const getAddToTimelineCellAction = ({ data, diff --git a/x-pack/plugins/security_solution/public/common/lib/telemetry/middleware.ts b/x-pack/plugins/security_solution/public/common/lib/telemetry/middleware.ts index 0085cdc999ac..658f5b170d58 100644 --- a/x-pack/plugins/security_solution/public/common/lib/telemetry/middleware.ts +++ b/x-pack/plugins/security_solution/public/common/lib/telemetry/middleware.ts @@ -8,7 +8,7 @@ import type { Action, Dispatch, MiddlewareAPI } from 'redux'; import { track, METRIC_TYPE, TELEMETRY_EVENT } from '.'; -import * as timelineActions from '../../../timelines/store/timeline/actions'; +import * as timelineActions from '../../../timelines/store/actions'; export const telemetryMiddleware = (api: MiddlewareAPI) => (next: Dispatch) => (action: Action) => { if (timelineActions.endTimelineSaving.match(action)) { diff --git a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts index ba567b623ab5..732097aedbc2 100644 --- a/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts +++ b/x-pack/plugins/security_solution/public/common/mock/timeline_results.ts @@ -17,8 +17,8 @@ import type { OpenTimelineResult } from '../../timelines/components/open_timelin import type { TimelineEventsDetailsItem } from '../../../common/search_strategy'; import { Direction } from '../../../common/search_strategy'; import type { CreateTimelineProps } from '../../detections/components/alerts_table/types'; -import type { TimelineModel } from '../../timelines/store/timeline/model'; -import { timelineDefaults } from '../../timelines/store/timeline/defaults'; +import type { TimelineModel } from '../../timelines/store/model'; +import { timelineDefaults } from '../../timelines/store/defaults'; export const mockOpenTimelineQueryResults = { totalCount: 11, diff --git a/x-pack/plugins/security_solution/public/common/mock/utils.ts b/x-pack/plugins/security_solution/public/common/mock/utils.ts index 3816d72e2586..c8a1cacf2b48 100644 --- a/x-pack/plugins/security_solution/public/common/mock/utils.ts +++ b/x-pack/plugins/security_solution/public/common/mock/utils.ts @@ -8,7 +8,7 @@ import { hostsReducer } from '../../explore/hosts/store'; import { networkReducer } from '../../explore/network/store'; import { makeUsersReducer } from '../../explore/users/store'; -import { timelineReducer } from '../../timelines/store/timeline/reducer'; +import { timelineReducer } from '../../timelines/store/reducer'; import { managementReducer } from '../../management/store/reducer'; import type { ManagementPluginReducer } from '../../management'; import type { SubPluginsInitReducer } from '../store'; diff --git a/x-pack/plugins/security_solution/public/common/store/data_table/epic_local_storage.ts b/x-pack/plugins/security_solution/public/common/store/data_table/epic_local_storage.ts index aea4c18e8b1f..f84b29341b71 100644 --- a/x-pack/plugins/security_solution/public/common/store/data_table/epic_local_storage.ts +++ b/x-pack/plugins/security_solution/public/common/store/data_table/epic_local_storage.ts @@ -12,10 +12,10 @@ import { get } from 'lodash/fp'; import { dataTableActions } from '@kbn/securitysolution-data-table'; import type { TableIdLiteral } from '@kbn/securitysolution-data-table'; -import { updateTotalCount } from '../../../timelines/store/timeline/actions'; +import { updateTotalCount } from '../../../timelines/store/actions'; import { addTableInStorage } from '../../../timelines/containers/local_storage'; -import type { TimelineEpicDependencies } from '../../../timelines/store/timeline/types'; +import type { TimelineEpicDependencies } from '../../../timelines/store/types'; const { applyDeltaToColumnWidth, diff --git a/x-pack/plugins/security_solution/public/common/store/epic.ts b/x-pack/plugins/security_solution/public/common/store/epic.ts index 7659b3542f5d..20311d6c4a16 100644 --- a/x-pack/plugins/security_solution/public/common/store/epic.ts +++ b/x-pack/plugins/security_solution/public/common/store/epic.ts @@ -8,16 +8,15 @@ import type { Epic } from 'redux-observable'; import { combineEpics } from 'redux-observable'; import type { Action } from 'redux'; - import type { Observable } from 'rxjs'; import type { Storage } from '@kbn/kibana-utils-plugin/public'; import type { CoreStart } from '@kbn/core/public'; -import { createTimelineEpic } from '../../timelines/store/timeline/epic'; -import { createTimelineChangedEpic } from '../../timelines/store/timeline/epic_changed'; -import { createTimelineFavoriteEpic } from '../../timelines/store/timeline/epic_favorite'; -import { createTimelineNoteEpic } from '../../timelines/store/timeline/epic_note'; -import { createTimelinePinnedEventEpic } from '../../timelines/store/timeline/epic_pinned_event'; -import type { TimelineEpicDependencies } from '../../timelines/store/timeline/types'; +import { createTimelineEpic } from '../../timelines/store/epic'; +import { createTimelineChangedEpic } from '../../timelines/store/epic_changed'; +import { createTimelineFavoriteEpic } from '../../timelines/store/epic_favorite'; +import { createTimelineNoteEpic } from '../../timelines/store/epic_note'; +import { createTimelinePinnedEventEpic } from '../../timelines/store/epic_pinned_event'; +import type { TimelineEpicDependencies } from '../../timelines/store/types'; import { createDataTableLocalStorageEpic } from './data_table/epic_local_storage'; import { createUserAssetTableLocalStorageEpic } from '../../explore/users/store/epic_storage'; import type { State } from './types'; diff --git a/x-pack/plugins/security_solution/public/common/store/reducer.ts b/x-pack/plugins/security_solution/public/common/store/reducer.ts index e60f801537f4..d7b13a93caa7 100644 --- a/x-pack/plugins/security_solution/public/common/store/reducer.ts +++ b/x-pack/plugins/security_solution/public/common/store/reducer.ts @@ -19,7 +19,7 @@ import { sourcererReducer, sourcererModel } from './sourcerer'; import type { HostsPluginReducer } from '../../explore/hosts/store'; import type { NetworkPluginReducer } from '../../explore/network/store'; import type { UsersPluginReducer } from '../../explore/users/store'; -import type { TimelinePluginReducer } from '../../timelines/store/timeline'; +import type { TimelinePluginReducer } from '../../timelines/store'; import type { SecuritySubPlugins } from '../../app/types'; import type { ManagementPluginReducer } from '../../management'; diff --git a/x-pack/plugins/security_solution/public/common/store/store.ts b/x-pack/plugins/security_solution/public/common/store/store.ts index cf53e2f795ea..b9f29867a32b 100644 --- a/x-pack/plugins/security_solution/public/common/store/store.ts +++ b/x-pack/plugins/security_solution/public/common/store/store.ts @@ -35,9 +35,9 @@ import { } from '../../../common/constants'; import { telemetryMiddleware } from '../lib/telemetry'; import { appSelectors } from './app'; -import { timelineSelectors } from '../../timelines/store/timeline'; -import * as timelineActions from '../../timelines/store/timeline/actions'; -import type { TimelineModel } from '../../timelines/store/timeline/model'; +import { timelineSelectors } from '../../timelines/store'; +import * as timelineActions from '../../timelines/store/actions'; +import type { TimelineModel } from '../../timelines/store/model'; import { inputsSelectors } from './inputs'; import type { SubPluginsInitReducer } from './reducer'; import { createInitialState, createReducer } from './reducer'; @@ -45,7 +45,7 @@ import { createRootEpic } from './epic'; import type { AppAction } from './actions'; import type { Immutable } from '../../../common/endpoint/types'; import type { State } from './types'; -import type { TimelineEpicDependencies, TimelineState } from '../../timelines/store/timeline/types'; +import type { TimelineEpicDependencies, TimelineState } from '../../timelines/store/types'; import type { KibanaDataView, SourcererModel, SourcererDataView } from './sourcerer/model'; import { initDataView } from './sourcerer/model'; import type { AppObservableLibs, StartedSubPlugins, StartPlugins } from '../../types'; diff --git a/x-pack/plugins/security_solution/public/common/store/types.ts b/x-pack/plugins/security_solution/public/common/store/types.ts index ec41cdda85ef..359a65d4fb12 100644 --- a/x-pack/plugins/security_solution/public/common/store/types.ts +++ b/x-pack/plugins/security_solution/public/common/store/types.ts @@ -17,7 +17,7 @@ import type { InputsState } from './inputs/reducer'; import type { SourcererState } from './sourcerer/reducer'; import type { HostsPluginState } from '../../explore/hosts/store'; import type { DragAndDropState } from './drag_and_drop/reducer'; -import type { TimelinePluginState } from '../../timelines/store/timeline'; +import type { TimelinePluginState } from '../../timelines/store'; import type { NetworkPluginState } from '../../explore/network/store'; import type { ManagementPluginState } from '../../management'; import type { UsersPluginState } from '../../explore/users/store'; diff --git a/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx b/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx index 2b0bb060d7d9..dca72a31414b 100644 --- a/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/timeline/use_timeline_click.tsx @@ -12,7 +12,7 @@ import { queryTimelineById, } from '../../../timelines/components/open_timeline/helpers'; import type { TimelineErrorCallback } from '../../../timelines/components/open_timeline/types'; -import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/store/timeline/actions'; +import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/store/actions'; export const useTimelineClick = () => { const dispatch = useDispatch(); diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx index 6f7521c3c1d6..ea44819dae5e 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.test.tsx @@ -57,7 +57,7 @@ import { USER, } from '@kbn/lists-plugin/common/constants.mock'; import { of } from 'rxjs'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; jest.mock('../../../timelines/containers/api', () => ({ getTimelineTemplate: jest.fn(), diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx index 364b521c1ec3..a9a84eb0231a 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/actions.tsx @@ -58,7 +58,7 @@ import type { TimelineEventsDetailsStrategyResponse, } from '../../../../common/search_strategy/timeline'; import { TimelineEventsQueries } from '../../../../common/search_strategy/timeline'; -import { timelineDefaults } from '../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../timelines/store/defaults'; import { omitTypenameInTimeline, formatTimelineResultToModel, diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_bulk_to_timeline.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_bulk_to_timeline.tsx index 304049fff9a7..e1841709c17b 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_bulk_to_timeline.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_add_bulk_to_timeline.tsx @@ -22,7 +22,7 @@ import { useTimelineEventsHandler } from '../../../../timelines/containers'; import { eventsViewerSelector } from '../../../../common/components/events_viewer/selectors'; import type { State } from '../../../../common/store/types'; import { dispatchUpdateTimeline } from '../../../../timelines/components/open_timeline/helpers'; -import { timelineActions } from '../../../../timelines/store/timeline'; +import { timelineActions } from '../../../../timelines/store'; import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline'; import { INVESTIGATE_BULK_IN_TIMELINE } from '../translations'; import { TimelineId } from '../../../../../common/types/timeline'; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx index 02d149860c1b..8adcf707c98d 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/use_investigate_in_timeline.tsx @@ -19,11 +19,11 @@ import { useApi } from '@kbn/securitysolution-list-hooks'; import type { Filter } from '@kbn/es-query'; import type { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs'; import { createHistoryEntry } from '../../../../common/utils/global_query_string/helpers'; -import { timelineDefaults } from '../../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../../timelines/store/defaults'; import { useKibana } from '../../../../common/lib/kibana'; import { TimelineId } from '../../../../../common/types/timeline'; import { TimelineType } from '../../../../../common/api/timeline'; -import { timelineActions, timelineSelectors } from '../../../../timelines/store/timeline'; +import { timelineActions, timelineSelectors } from '../../../../timelines/store'; import { sendAlertToTimelineAction } from '../actions'; import { dispatchUpdateTimeline } from '../../../../timelines/components/open_timeline/helpers'; import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline'; diff --git a/x-pack/plugins/security_solution/public/detections/components/alerts_table/types.ts b/x-pack/plugins/security_solution/public/detections/components/alerts_table/types.ts index b226ad81b977..55616b5aefc2 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/types.ts +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/types.ts @@ -12,7 +12,7 @@ import type { EuiContextMenuPanelItemDescriptorEntry } from '@elastic/eui/src/co import type { Status } from '../../../../common/api/detection_engine'; import type { Note } from '../../../../common/api/timeline'; import type { DataProvider } from '../../../timelines/components/timeline/data_providers/data_provider'; -import type { TimelineModel } from '../../../timelines/store/timeline/model'; +import type { TimelineModel } from '../../../timelines/store/model'; import type { inputsModel } from '../../../common/store'; export interface SetEventsLoadingProps { diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx index c68194187e4b..0a293955d0f7 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/query_bar/index.tsx @@ -18,7 +18,7 @@ import { OpenTimelineModal } from '../../../../timelines/components/open_timelin import type { ActionTimelineToShow } from '../../../../timelines/components/open_timeline/types'; import { QueryBar } from '../../../../common/components/query_bar'; import { useKibana } from '../../../../common/lib/kibana'; -import type { TimelineModel } from '../../../../timelines/store/timeline/model'; +import type { TimelineModel } from '../../../../timelines/store/model'; import { useSavedQueryServices } from '../../../../common/utils/saved_query_services'; import type { FieldHook } from '../../../../shared_imports'; import { getFieldValidityAndErrorMessage } from '../../../../shared_imports'; diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_from_timeline.tsx b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_from_timeline.tsx index 4818a8c8f1ac..c5b2036efd70 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_from_timeline.tsx +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules/use_rule_from_timeline.tsx @@ -11,7 +11,7 @@ import { useDispatch } from 'react-redux'; import { i18n } from '@kbn/i18n'; import type { EqlOptionsSelected } from '@kbn/timelines-plugin/common'; import { convertKueryToElasticSearchQuery } from '../../../../common/lib/kuery'; -import { updateIsLoading } from '../../../../timelines/store/timeline/actions'; +import { updateIsLoading } from '../../../../timelines/store/actions'; import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import type { TimelineModel } from '../../../..'; diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/details/index.tsx b/x-pack/plugins/security_solution/public/explore/users/pages/details/index.tsx index 2e5fc3b3dbba..28e432a126a2 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/details/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/pages/details/index.tsx @@ -44,7 +44,7 @@ import type { UsersDetailsProps } from './types'; import { getUsersDetailsPageFilters } from './helpers'; import { showGlobalFilters } from '../../../../timelines/components/timeline/helpers'; import { useGlobalFullScreen } from '../../../../common/containers/use_full_screen'; -import { timelineDefaults } from '../../../../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../../../../timelines/store/defaults'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useDeepEqualSelector, diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx index e0500a1847cc..40c3b513114e 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/analyzer_preview_container.tsx @@ -14,7 +14,7 @@ import { useStartTransaction } from '../../../../common/lib/apm/use_start_transa import { useInvestigateInTimeline } from '../../../../detections/components/alerts_table/timeline_actions/use_investigate_in_timeline'; import { ALERTS_ACTIONS } from '../../../../common/lib/apm/user_actions'; import { getScopedActions } from '../../../../helpers'; -import { setActiveTabTimeline } from '../../../../timelines/store/timeline/actions'; +import { setActiveTabTimeline } from '../../../../timelines/store/actions'; import { useRightPanelContext } from '../context'; import { useIsInvestigateInResolverActionEnabled } from '../../../../detections/components/alerts_table/timeline_actions/investigate_in_resolver'; import { AnalyzerPreview } from './analyzer_preview'; diff --git a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx index d0214b725a44..5b5f964a8fdc 100644 --- a/x-pack/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx +++ b/x-pack/plugins/security_solution/public/flyout/document_details/right/components/session_preview_container.tsx @@ -20,7 +20,7 @@ import { ALERTS_ACTIONS } from '../../../../common/lib/apm/user_actions'; import { ExpandablePanel } from '../../../shared/components/expandable_panel'; import { SESSION_PREVIEW_TEST_ID } from './test_ids'; import { useStartTransaction } from '../../../../common/lib/apm/use_start_transaction'; -import { setActiveTabTimeline } from '../../../../timelines/store/timeline/actions'; +import { setActiveTabTimeline } from '../../../../timelines/store/actions'; import { getScopedActions } from '../../../../helpers'; const timelineId = 'timeline-1'; diff --git a/x-pack/plugins/security_solution/public/helpers.tsx b/x-pack/plugins/security_solution/public/helpers.tsx index b245a6ae2f6b..09ad6612bdb0 100644 --- a/x-pack/plugins/security_solution/public/helpers.tsx +++ b/x-pack/plugins/security_solution/public/helpers.tsx @@ -36,7 +36,7 @@ import { NoPrivilegesPage } from './common/components/no_privileges'; import { SecurityPageName } from './app/types'; import type { InspectResponse, StartedSubPlugins, StartServices } from './types'; import { CASES_SUB_PLUGIN_KEY } from './types'; -import { timelineActions } from './timelines/store/timeline'; +import { timelineActions } from './timelines/store'; import { TimelineId } from '../common/types'; import { SourcererScopeName } from './common/store/sourcerer/model'; diff --git a/x-pack/plugins/security_solution/public/index.ts b/x-pack/plugins/security_solution/public/index.ts index 3af2b724b014..92fcf14ace69 100644 --- a/x-pack/plugins/security_solution/public/index.ts +++ b/x-pack/plugins/security_solution/public/index.ts @@ -8,7 +8,7 @@ import type { PluginInitializerContext } from '@kbn/core/public'; import { Plugin } from './plugin'; import type { PluginSetup, PluginStart } from './types'; -export type { TimelineModel } from './timelines/store/timeline/model'; +export type { TimelineModel } from './timelines/store/model'; export type { LinkItem } from './common/links'; export type { FetchRulesResponse } from './detection_engine/rule_management/logic/types'; diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/artifacts_mocked_data.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/artifacts_mocked_data.cy.ts index e7f32820c00d..55a1035ca896 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/artifacts_mocked_data.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/artifacts_mocked_data.cy.ts @@ -31,7 +31,8 @@ const loginWithoutAccess = (url: string) => { loadPage(url); }; -describe('Artifacts pages', { tags: ['@ess', '@serverless'] }, () => { +// Flaky: https://github.com/elastic/kibana/issues/171168 +describe.skip('Artifacts pages', { tags: ['@ess', '@serverless'] }, () => { let endpointData: ReturnTypeFromChainable | undefined; before(() => { diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.test.ts b/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.test.ts index 5e451f6c44cc..1257e1e48029 100644 --- a/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.test.ts @@ -8,7 +8,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import { updateProviders } from '../../../../timelines/store/timeline/actions'; +import { updateProviders } from '../../../../timelines/store/actions'; import { useNavigateToTimeline } from './use_navigate_to_timeline'; import * as mock from './mock_data'; diff --git a/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.tsx b/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.tsx index 762286e2177f..40ac8b91cfd8 100644 --- a/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/detection_response/hooks/use_navigate_to_timeline.tsx @@ -20,7 +20,7 @@ import type { DataProvider, QueryOperator } from '../../../../../common/types/ti import { TimelineId } from '../../../../../common/types/timeline'; import { TimelineType } from '../../../../../common/api/timeline'; import { useCreateTimeline } from '../../../../timelines/components/timeline/properties/use_create_timeline'; -import { updateProviders } from '../../../../timelines/store/timeline/actions'; +import { updateProviders } from '../../../../timelines/store/actions'; import { sourcererSelectors } from '../../../../common/store'; import type { TimeRange } from '../../../../common/store/inputs/model'; diff --git a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx index e6c8068c0a86..0e5b4d690306 100644 --- a/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/recent_timelines/index.tsx @@ -16,7 +16,7 @@ import { dispatchUpdateTimeline, } from '../../../timelines/components/open_timeline/helpers'; import type { OnOpenTimeline } from '../../../timelines/components/open_timeline/types'; -import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/store/timeline/actions'; +import { updateIsLoading as dispatchUpdateIsLoading } from '../../../timelines/store/actions'; import { RecentTimelines } from './recent_timelines'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/threat_intelligence/use_investigate_in_timeline.ts b/x-pack/plugins/security_solution/public/threat_intelligence/use_investigate_in_timeline.ts index 69d626f05de9..c73855cf7d11 100644 --- a/x-pack/plugins/security_solution/public/threat_intelligence/use_investigate_in_timeline.ts +++ b/x-pack/plugins/security_solution/public/threat_intelligence/use_investigate_in_timeline.ts @@ -7,7 +7,7 @@ import { useCallback, useMemo } from 'react'; import { useDispatch } from 'react-redux'; -import { timelineDefaults } from '../timelines/store/timeline/defaults'; +import { timelineDefaults } from '../timelines/store/defaults'; import { APP_UI_ID } from '../../common/constants'; import type { DataProvider } from '../../common/types'; import { TimelineId } from '../../common/types/timeline'; @@ -15,7 +15,7 @@ import { TimelineType } from '../../common/api/timeline'; import { useDeepEqualSelector } from '../common/hooks/use_selector'; import { useKibana } from '../common/lib/kibana'; import { useStartTransaction } from '../common/lib/apm/use_start_transaction'; -import { timelineActions, timelineSelectors } from '../timelines/store/timeline'; +import { timelineActions, timelineSelectors } from '../timelines/store'; import { useCreateTimeline } from '../timelines/components/timeline/properties/use_create_timeline'; import type { CreateTimelineProps } from '../detections/components/alerts_table/types'; import { dispatchUpdateTimeline } from '../timelines/components/open_timeline/helpers'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/action_menu/save_timeline_modal.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/action_menu/save_timeline_modal.tsx index 10154901f2db..8028eb92eac7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/action_menu/save_timeline_modal.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/action_menu/save_timeline_modal.tsx @@ -27,7 +27,7 @@ import { getUseField, Field, Form, useForm } from '../../../../shared_imports'; import { TimelineId } from '../../../../../common/types/timeline'; import { TimelineStatus, TimelineType } from '../../../../../common/api/timeline'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import * as commonI18n from '../../timeline/properties/translations'; import * as i18n from './translations'; import { useStartTransaction } from '../../../../common/lib/apm/use_start_transaction'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/add_to_case_button/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/add_to_case_button/index.tsx index 81e520368da6..4eb701c5a8d9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/add_to_case_button/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/add_to_case_button/index.tsx @@ -12,15 +12,15 @@ import { useDispatch } from 'react-redux'; import type { CaseUI } from '@kbn/cases-plugin/common'; import { APP_ID, APP_UI_ID } from '../../../../../common/constants'; -import { timelineSelectors } from '../../../store/timeline'; -import { setInsertTimeline, showTimeline } from '../../../store/timeline/actions'; +import { timelineSelectors } from '../../../store'; +import { setInsertTimeline, showTimeline } from '../../../store/actions'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { useKibana } from '../../../../common/lib/kibana'; import { TimelineId } from '../../../../../common/types/timeline'; import { TimelineStatus, TimelineType } from '../../../../../common/api/timeline'; import { getCreateCaseUrl, getCaseDetailsUrl } from '../../../../common/components/link_to'; import { SecurityPageName } from '../../../../app/types'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import * as i18n from '../../timeline/properties/translations'; interface Props { diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/active_timelines.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/active_timelines.tsx index cbc38f4ccecb..9a863a5fe818 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/active_timelines.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/active_timelines.tsx @@ -18,7 +18,7 @@ import { focusActiveTimelineButton, } from '../../timeline/helpers'; import { UNTITLED_TIMELINE, UNTITLED_TEMPLATE } from '../../timeline/properties/translations'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import * as i18n from './translations'; export interface ActiveTimelinesProps { diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/index.tsx index b6e4d354e9c6..cba27263d8df 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/index.tsx @@ -15,7 +15,7 @@ import { getEsQueryConfig } from '@kbn/data-plugin/common'; import { euiStyled } from '@kbn/kibana-react-plugin/common'; import { createHistoryEntry } from '../../../../common/utils/global_query_string/helpers'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import type { State } from '../../../../common/store'; import { useKibana } from '../../../../common/lib/kibana'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; @@ -27,7 +27,7 @@ import * as i18n from './translations'; import { TimelineActionMenu } from '../action_menu'; import { AddToFavoritesButton } from '../../timeline/properties/helpers'; import { TimelineStatusInfo } from './timeline_status_info'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { AddTimelineButton } from '../add_timeline_button'; interface FlyoutHeaderPanelProps { diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/selectors.ts b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/selectors.ts index 494489a1c7bf..441ae5fed1a7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/header/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/header/selectors.ts @@ -8,7 +8,7 @@ import { createSelector } from 'reselect'; import { TimelineStatus } from '../../../../../common/api/timeline'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; export const getTimelineStatusByIdSelector = () => createSelector(timelineSelectors.selectTimeline, (timeline) => ({ diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.test.tsx index 5d0e7eebc5ee..73454f6b54b6 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.test.tsx @@ -12,7 +12,7 @@ import '../../../common/mock/react_beautiful_dnd'; import { TestProviders } from '../../../common/mock'; import { TimelineId } from '../../../../common/types/timeline'; -import * as timelineActions from '../../store/timeline/actions'; +import * as timelineActions from '../../store/actions'; import { Flyout } from '.'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx index 2f9ff64c2097..13514d82cbe7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/index.tsx @@ -16,7 +16,7 @@ import { FlyoutBottomBar } from './bottom_bar'; import { Pane } from './pane'; import { getTimelineShowStatusByIdSelector } from './selectors'; import { useTimelineSavePrompt } from '../../../common/hooks/timeline/use_timeline_save_prompt'; -import { timelineActions } from '../../store/timeline'; +import { timelineActions } from '../../store'; import { focusActiveTimelineButton } from '../timeline/helpers'; interface OwnProps { diff --git a/x-pack/plugins/security_solution/public/timelines/components/flyout/selectors.ts b/x-pack/plugins/security_solution/public/timelines/components/flyout/selectors.ts index df631c75a97d..b02284aec655 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/flyout/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/flyout/selectors.ts @@ -9,7 +9,7 @@ import { createSelector } from 'reselect'; import { TimelineTabs } from '../../../../common/types/timeline'; import { TimelineStatus } from '../../../../common/api/timeline'; -import { timelineSelectors } from '../../store/timeline'; +import { timelineSelectors } from '../../store'; export const getTimelineShowStatusByIdSelector = () => createSelector(timelineSelectors.selectTimeline, (timeline) => ({ diff --git a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx index b44fb4afc04e..b7e0c782a9e6 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/formatted_ip/index.test.tsx @@ -11,7 +11,7 @@ import userEvent from '@testing-library/user-event'; import { FormattedIp } from '.'; import { TestProviders } from '../../../common/mock'; import { TimelineId, TimelineTabs } from '../../../../common/types/timeline'; -import { timelineActions } from '../../store/timeline'; +import { timelineActions } from '../../store'; import { activeTimeline } from '../../containers/active_timeline_context'; import { StatefulEventContext } from '../../../common/components/events_viewer/stateful_event_context'; @@ -44,8 +44,8 @@ jest.mock('../../../common/components/drag_and_drop/draggable_wrapper', () => { }; }); -jest.mock('../../store/timeline', () => { - const original = jest.requireActual('../../store/timeline'); +jest.mock('../../store', () => { + const original = jest.requireActual('../../store'); return { ...original, timelineActions: { diff --git a/x-pack/plugins/security_solution/public/timelines/components/graph_overlay/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/graph_overlay/index.tsx index 7b686f1bbc11..75c074c51775 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/graph_overlay/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/graph_overlay/index.tsx @@ -33,8 +33,8 @@ import { isFullScreen } from '../timeline/body/column_headers'; import { inputsActions } from '../../../common/store/actions'; import { Resolver } from '../../../resolver/view'; import { useTimelineDataFilters } from '../../containers/use_timeline_data_filters'; -import { timelineSelectors } from '../../store/timeline'; -import { timelineDefaults } from '../../store/timeline/defaults'; +import { timelineSelectors } from '../../store'; +import { timelineDefaults } from '../../store/defaults'; const SESSION_VIEW_FULL_SCREEN = 'sessionViewFullScreen'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts index 6bd865e2750a..7d789dbc4662 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.test.ts @@ -13,13 +13,13 @@ import { mockTimelineModel, mockGetOneTimelineResult, } from '../../../common/mock'; -import { timelineDefaults } from '../../store/timeline/defaults'; +import { timelineDefaults } from '../../store/defaults'; import { setTimelineRangeDatePicker as dispatchSetTimelineRangeDatePicker } from '../../../common/store/inputs/actions'; import { applyKqlFilterQuery as dispatchApplyKqlFilterQuery, addTimeline as dispatchAddTimeline, addNote as dispatchAddGlobalTimelineNote, -} from '../../store/timeline/actions'; +} from '../../store/actions'; import { addNotes as dispatchAddNotes, updateNote as dispatchUpdateNote, @@ -50,7 +50,7 @@ import { resolveTimeline } from '../../containers/api'; jest.mock('../../../common/store/inputs/actions'); jest.mock('../../../common/utils/normalize_time_range'); -jest.mock('../../store/timeline/actions'); +jest.mock('../../store/actions'); jest.mock('../../../common/store/app/actions'); jest.mock('uuid', () => { return { diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts index e4f5f8746cc0..f7468d4958f0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/helpers.ts @@ -38,9 +38,9 @@ import { applyKqlFilterQuery as dispatchApplyKqlFilterQuery, addTimeline as dispatchAddTimeline, addNote as dispatchAddGlobalTimelineNote, -} from '../../store/timeline/actions'; -import type { TimelineModel } from '../../store/timeline/model'; -import { timelineDefaults } from '../../store/timeline/defaults'; +} from '../../store/actions'; +import type { TimelineModel } from '../../store/model'; +import { timelineDefaults } from '../../store/defaults'; import { defaultColumnHeaderType, diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx index 60f4dab89a2c..dc2cca510449 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/index.tsx @@ -18,12 +18,12 @@ import { SecurityPageName } from '../../../../common/constants'; import { useShallowEqualSelector } from '../../../common/hooks/use_selector'; import type { SortFieldTimeline } from '../../../../common/api/timeline'; import { TimelineId } from '../../../../common/types/timeline'; -import type { TimelineModel } from '../../store/timeline/model'; -import { timelineSelectors } from '../../store/timeline'; +import type { TimelineModel } from '../../store/model'; +import { timelineSelectors } from '../../store'; import { createTimeline as dispatchCreateNewTimeline, updateIsLoading as dispatchUpdateIsLoading, -} from '../../store/timeline/actions'; +} from '../../store/actions'; import { useGetAllTimeline } from '../../containers/all'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.tsx index 92011428edf0..caff8fee65b2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/note_previews/index.tsx @@ -24,7 +24,7 @@ import { useMutation } from '@tanstack/react-query'; import type { TimelineResultNote } from '../types'; import { getEmptyValue, defaultToEmptyTag } from '../../../../common/components/empty_value'; import { MarkdownRenderer } from '../../../../common/components/markdown_editor'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import { appActions } from '../../../../common/store/app'; import { NOTE_CONTENT_CLASS_NAME } from '../../timeline/body/helpers'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.tsx index 9d803357058a..75990ce7792d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline_modal/index.tsx @@ -8,7 +8,7 @@ import { EuiModal } from '@elastic/eui'; import React from 'react'; -import type { TimelineModel } from '../../../store/timeline/model'; +import type { TimelineModel } from '../../../store/model'; import * as i18n from '../translations'; import type { ActionTimelineToShow } from '../types'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts index 4a300c2c02ca..e5a8abc612b8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/open_timeline/types.ts @@ -7,7 +7,7 @@ import type React from 'react'; import type { AllTimelinesVariables } from '../../containers/all'; -import type { TimelineModel } from '../../store/timeline/model'; +import type { TimelineModel } from '../../store/model'; import type { RowRendererId, SingleTimelineResolveResponse, diff --git a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/index.tsx index 05b1e7254b9d..be33b84ca5f0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/row_renderers_browser/index.tsx @@ -25,9 +25,9 @@ import styled from 'styled-components'; import type { State } from '../../../common/store'; import { RowRendererId } from '../../../../common/api/timeline'; import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; -import { setExcludedRowRendererIds as dispatchSetExcludedRowRendererIds } from '../../store/timeline/actions'; -import { timelineSelectors } from '../../store/timeline'; -import { timelineDefaults } from '../../store/timeline/defaults'; +import { setExcludedRowRendererIds as dispatchSetExcludedRowRendererIds } from '../../store/actions'; +import { timelineSelectors } from '../../store'; +import { timelineDefaults } from '../../store/defaults'; import { RowRenderersBrowser } from './row_renderers_browser'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.test.tsx index 1d82612e4b2a..a217cd0baea4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.test.tsx @@ -7,7 +7,7 @@ import { renderHook, act } from '@testing-library/react-hooks'; import type { UseDetailPanelConfig } from './use_detail_panel'; import { useDetailPanel } from './use_detail_panel'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { TimelineId, TimelineTabs } from '../../../../../common/types/timeline'; @@ -16,7 +16,7 @@ import { FlowTargetSourceDest } from '../../../../../common/search_strategy'; const mockDispatch = jest.fn(); jest.mock('../../../../common/lib/kibana'); jest.mock('../../../../common/hooks/use_selector'); -jest.mock('../../../store/timeline'); +jest.mock('../../../store'); jest.mock('react-redux', () => { const original = jest.requireActual('react-redux'); return { diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.tsx index 5cde89c82e79..45f85294bfa3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/hooks/use_detail_panel.tsx @@ -12,12 +12,12 @@ import { dataTableSelectors } from '@kbn/securitysolution-data-table'; import type { ExpandedDetailType } from '../../../../../common/types'; import { getScopedActions, isInTableScope, isTimelineScope } from '../../../../helpers'; import type { FlowTargetSourceDest } from '../../../../../common/search_strategy'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import type { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { activeTimeline } from '../../../containers/active_timeline_context'; import { TimelineTabs, TimelineId } from '../../../../../common/types/timeline'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { DetailsPanel as DetailsPanelComponent } from '..'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.tsx index ad33fdfe1b73..ae2cd149ef69 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/index.tsx @@ -13,8 +13,8 @@ import { EuiFlyout } from '@elastic/eui'; import type { EntityType } from '@kbn/timelines-plugin/common'; import { dataTableActions, dataTableSelectors } from '@kbn/securitysolution-data-table'; import { getScopedActions, isInTableScope, isTimelineScope } from '../../../helpers'; -import { timelineSelectors } from '../../store/timeline'; -import { timelineDefaults } from '../../store/timeline/defaults'; +import { timelineSelectors } from '../../store'; +import { timelineDefaults } from '../../store/defaults'; import type { BrowserFields } from '../../../common/containers/source'; import type { RunTimeMappings } from '../../../common/store/sourcerer/model'; import { TimelineId, TimelineTabs } from '../../../../common/types/timeline'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx index 945c999dbe63..635f1a91a795 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/column_header.tsx @@ -27,7 +27,7 @@ import { EventsTh, EventsThContent, EventsHeadingHandle } from '../../styles'; import type { Sort } from '../sort'; import { Header } from './header'; -import { timelineActions } from '../../../../store/timeline'; +import { timelineActions } from '../../../../store'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx index 3f92df682768..d80831d49abc 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.test.tsx @@ -8,7 +8,7 @@ import { mount, shallow } from 'enzyme'; import React from 'react'; -import { timelineActions } from '../../../../../store/timeline'; +import { timelineActions } from '../../../../../store'; import { TestProviders } from '../../../../../../common/mock'; import type { Sort } from '../../sort'; import { CloseButton } from '../actions'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.tsx index 142d6f7894c2..99c11571f0c2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/index.tsx @@ -15,7 +15,7 @@ import { useDeepEqualSelector, useShallowEqualSelector, } from '../../../../../../common/hooks/use_selector'; -import { timelineActions, timelineSelectors } from '../../../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../../../store'; import type { OnFilterChange } from '../../../events'; import type { Sort } from '../../sort'; import { Actions } from '../actions'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/selectors.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/selectors.tsx index 52aae6ff69a5..cac232fd6ea3 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/selectors.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/header/selectors.tsx @@ -7,7 +7,7 @@ import { createSelector } from 'reselect'; import { TimelineTabs } from '../../../../../../../common/types/timeline'; -import { selectTimeline } from '../../../../../store/timeline/selectors'; +import { selectTimeline } from '../../../../../store/selectors'; export const isEqlOnSelector = () => createSelector(selectTimeline, (timeline) => timeline?.activeTab === TimelineTabs.eql); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx index b1f7ded5d5c3..4042619404d2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.test.tsx @@ -18,7 +18,7 @@ import { useMountAppended } from '../../../../../common/utils/use_mount_appended import type { ColumnHeadersComponentProps } from '.'; import { ColumnHeadersComponent } from '.'; import { cloneDeep } from 'lodash/fp'; -import { timelineActions } from '../../../../store/timeline'; +import { timelineActions } from '../../../../store'; import { TimelineId, TimelineTabs } from '../../../../../../common/types/timeline'; import { Direction } from '../../../../../../common/search_strategy'; import { getDefaultControlColumn } from '../control_columns'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx index 37ac268073bc..dbf5cf8e94ff 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/column_headers/index.tsx @@ -11,7 +11,7 @@ import { Droppable } from '@hello-pangea/dnd'; import { useDispatch } from 'react-redux'; import type { ControlColumnProps, HeaderActionProps } from '../../../../../../common/types'; -import { removeColumn, upsertColumn } from '../../../../store/timeline/actions'; +import { removeColumn, upsertColumn } from '../../../../store/actions'; import { DragEffects } from '../../../../../common/components/drag_and_drop/draggable_wrapper'; import { DraggableFieldBadge } from '../../../../../common/components/draggables/field_badge'; import type { BrowserFields } from '../../../../../common/containers/source'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx index 42c34a5f06e0..8faab92f5747 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/events/stateful_event.tsx @@ -29,13 +29,13 @@ import { useEventDetailsWidthContext } from '../../../../../common/components/ev import { EventColumnView } from './event_column_view'; import type { inputsModel } from '../../../../../common/store'; import { appSelectors } from '../../../../../common/store'; -import { timelineActions, timelineSelectors } from '../../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../../store'; import { activeTimeline } from '../../../../containers/active_timeline_context'; import type { TimelineResultNote } from '../../../open_timeline/types'; import { getRowRenderer } from '../renderers/get_row_renderer'; import { StatefulRowRenderer } from './stateful_row_renderer'; import { NOTES_BUTTON_CLASS_NAME } from '../../properties/helpers'; -import { timelineDefaults } from '../../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../../store/defaults'; import { useGetMappedNonEcsValue } from '../data_driven_columns'; import { StatefulEventContext } from '../../../../../common/components/events_viewer/stateful_event_context'; import type { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx index 4ab99faba09c..2cd9587a63de 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.test.tsx @@ -31,7 +31,7 @@ import type { Props } from '.'; import { StatefulBody } from '.'; import type { Sort } from './sort'; import { getDefaultControlColumn } from './control_columns'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { TimelineId, TimelineTabs } from '../../../../../common/types/timeline'; import { defaultRowRenderers } from './renderers'; import type { State } from '../../../../common/store'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx index ac5d73fb7e08..0478b1cf90ad 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/index.tsx @@ -24,8 +24,8 @@ import { RowRendererId } from '../../../../../common/api/timeline'; import type { BrowserFields } from '../../../../common/containers/source'; import type { TimelineItem } from '../../../../../common/search_strategy/timeline'; import type { inputsModel, State } from '../../../../common/store'; -import { timelineDefaults } from '../../../store/timeline/defaults'; -import { timelineActions } from '../../../store/timeline'; +import { timelineDefaults } from '../../../store/defaults'; +import { timelineActions } from '../../../store'; import type { OnRowSelected, OnSelectAll } from '../events'; import { getColumnHeaders } from './column_headers/helpers'; import { getEventIdToDataMapping } from './helpers'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx index 63a254f4d2d6..1535b05a97a4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/host_name.test.tsx @@ -11,7 +11,7 @@ import { waitFor } from '@testing-library/react'; import { HostName } from './host_name'; import { TestProviders } from '../../../../../common/mock'; import { TimelineId, TimelineTabs } from '../../../../../../common/types/timeline'; -import { timelineActions } from '../../../../store/timeline'; +import { timelineActions } from '../../../../store'; import { activeTimeline } from '../../../../containers/active_timeline_context'; import { StatefulEventContext } from '../../../../../common/components/events_viewer/stateful_event_context'; import { createTelemetryServiceMock } from '../../../../../common/lib/telemetry/telemetry_service.mock'; @@ -44,8 +44,8 @@ jest.mock('../../../../../common/components/draggables', () => ({ DefaultDraggable: () =>
    , })); -jest.mock('../../../../store/timeline', () => { - const original = jest.requireActual('../../../../store/timeline'); +jest.mock('../../../../store', () => { + const original = jest.requireActual('../../../../store'); return { ...original, timelineActions: { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/user_name.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/user_name.test.tsx index a2183ec19c93..81ab0e35ee21 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/user_name.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/renderers/user_name.test.tsx @@ -10,7 +10,7 @@ import { waitFor } from '@testing-library/react'; import { TestProviders } from '../../../../../common/mock'; import { TimelineId, TimelineTabs } from '../../../../../../common/types/timeline'; -import { timelineActions } from '../../../../store/timeline'; +import { timelineActions } from '../../../../store'; import { activeTimeline } from '../../../../containers/active_timeline_context'; import { UserName } from './user_name'; import { StatefulEventContext } from '../../../../../common/components/events_viewer/stateful_event_context'; @@ -44,8 +44,8 @@ jest.mock('../../../../../common/components/draggables', () => ({ DefaultDraggable: () =>
    , })); -jest.mock('../../../../store/timeline', () => { - const original = jest.requireActual('../../../../store/timeline'); +jest.mock('../../../../store', () => { + const original = jest.requireActual('../../../../store'); return { ...original, timelineActions: { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/selectors/index.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/selectors/index.ts index e4c1f422886f..26e2b11bd2b4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/selectors/index.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/selectors/index.ts @@ -7,7 +7,7 @@ import { createSelector } from 'reselect'; -import { getTimelineByIdSelector } from '../../../../store/timeline/selectors'; +import { getTimelineByIdSelector } from '../../../../store/selectors'; /** * This selector combines all the selectors used by the Timeline `StatefulBody`, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx index bff85fdf28e4..5903d4bfe302 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/add_data_provider_popover.tsx @@ -26,7 +26,7 @@ import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { StatefulEditDataProvider } from '../../edit_data_provider'; import { addContentToTimeline, getDisplayValue } from './helpers'; import { DataProviderType } from './data_provider'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; import { ADD_FIELD_LABEL, ADD_TEMPLATE_FIELD_LABEL } from './translations'; interface AddDataProviderPopoverProps { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/helpers.tsx index d96e98212f38..53ac22d384a0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/helpers.tsx @@ -9,7 +9,7 @@ import { omit } from 'lodash/fp'; import type { DraggableLocation } from '@hello-pangea/dnd'; import type { Dispatch } from 'redux'; -import { updateProviders } from '../../../store/timeline/actions'; +import { updateProviders } from '../../../store/actions'; import type { PrimitiveOrArrayOfPrimitives } from '../../../../common/lib/kuery'; import { isPrimitiveArray } from '../helpers'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx index c712c1b5c8df..175283e41824 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/index.tsx @@ -21,13 +21,13 @@ import { droppableTimelineProvidersPrefix } from '../../../../common/components/ import { Empty } from './empty'; import { Providers } from './providers'; -import { timelineSelectors } from '../../../store/timeline'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineSelectors } from '../../../store'; +import { timelineDefaults } from '../../../store/defaults'; import * as i18n from './translations'; import { options } from '../search_or_filter/helpers'; -import type { KqlMode } from '../../../store/timeline/model'; -import { updateKqlMode } from '../../../store/timeline/actions'; +import type { KqlMode } from '../../../store/model'; +import { updateKqlMode } from '../../../store/actions'; interface Props { timelineId: string; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx index b40b15a331fa..871a82a9beb2 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/provider_item_badge.tsx @@ -15,7 +15,7 @@ import { useDeepEqualSelector, useShallowEqualSelector, } from '../../../../common/hooks/use_selector'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; import type { PrimitiveOrArrayOfPrimitives } from '../../../../common/lib/kuery'; import type { OnDataProviderEdited } from '../events'; @@ -24,7 +24,7 @@ import { ProviderItemActions } from './provider_item_actions'; import type { DataProvidersAnd, QueryOperator } from './data_provider'; import { DataProviderType } from './data_provider'; import { dragAndDropActions } from '../../../../common/store/drag_and_drop'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; interface ProviderItemBadgeProps { andProviderId?: string; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx index a0be50592185..d6492c0d864b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.test.tsx @@ -11,7 +11,7 @@ import React from 'react'; import { TestProviders } from '../../../../common/mock/test_providers'; import { DroppableWrapper } from '../../../../common/components/drag_and_drop/droppable_wrapper'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { mockDataProviders } from './mock/mock_data_providers'; import { Providers } from './providers'; import { DELETE_CLASS_NAME, ENABLE_CLASS_NAME, EXCLUDE_CLASS_NAME } from './provider_item_actions'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx index 5d581a505742..dd7eb5cf1105 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/providers.tsx @@ -18,7 +18,7 @@ import { IS_DRAGGING_CLASS_NAME, } from '@kbn/securitysolution-t-grid'; import { useDraggableKeyboardWrapper } from '../../../../common/components/drag_and_drop/draggable_keyboard_wrapper_hook'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { AndOrBadge } from '../../../../common/components/and_or_badge'; import { AddDataProviderPopover } from './add_data_provider_popover'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/index.tsx index 63d20993174d..f6d5465ab492 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/eql_tab_content/index.tsx @@ -24,7 +24,7 @@ import { InPortal } from 'react-reverse-portal'; import type { ControlColumnProps } from '../../../../../common/types'; import { InputsModelId } from '../../../../common/store/inputs/constants'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import type { CellValueElementProps } from '../cell_rendering'; import type { TimelineItem } from '../../../../../common/search_strategy'; import { useTimelineEvents } from '../../../containers'; @@ -42,10 +42,10 @@ import { EventDetailsWidthProvider } from '../../../../common/components/events_ import type { inputsModel, State } from '../../../../common/store'; import { inputsSelectors } from '../../../../common/store'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useEqlEventsCountPortal } from '../../../../common/hooks/use_timeline_events_count'; -import type { TimelineModel } from '../../../store/timeline/model'; +import type { TimelineModel } from '../../../store/model'; import { TimelineDatePickerLock } from '../date_picker_lock'; import { useTimelineFullScreen } from '../../../../common/containers/use_full_screen'; import { activeTimeline } from '../../../containers/active_timeline_context'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx index c5762e0f0a45..e8a2a2cbc9ef 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx @@ -25,11 +25,11 @@ import { useDiscoverState } from './use_discover_state'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { useSetDiscoverCustomizationCallbacks } from './customizations/use_set_discover_customizations'; import { EmbeddedDiscoverContainer } from './styles'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; import { useShallowEqualSelector } from '../../../../common/hooks/use_selector'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { savedSearchComparator } from './utils'; -import { setIsDiscoverSavedSearchLoaded } from '../../../store/timeline/actions'; +import { setIsDiscoverSavedSearchLoaded } from '../../../store/actions'; import { GET_TIMELINE_DISCOVER_SAVED_SEARCH_TITLE } from './translations'; const HideSearchSessionIndicatorBreadcrumbIcon = createGlobalStyle` diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx index b37139f6b840..019a4a1ce413 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/footer/index.tsx @@ -28,7 +28,7 @@ import { EVENTS_COUNT_BUTTON_CLASS_NAME } from '../helpers'; import * as i18n from './translations'; import { useEventDetailsWidthContext } from '../../../../common/components/events_viewer/event_details_width_context'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { useKibana } from '../../../../common/lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/graph_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/graph_tab_content/index.tsx index 85c68e823da1..844dbc3712e5 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/graph_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/graph_tab_content/index.tsx @@ -8,7 +8,7 @@ import React, { useMemo } from 'react'; import { EuiFlexItem } from '@elastic/eui'; import styled from 'styled-components'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; import { useShallowEqualSelector } from '../../../../common/hooks/use_selector'; import type { TimelineId } from '../../../../../common/types/timeline'; import { GraphOverlay } from '../../graph_overlay'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/index.tsx index 0ebc326a3522..f1e8b55b7233 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/index.tsx @@ -13,8 +13,8 @@ import styled from 'styled-components'; import { isTab } from '@kbn/timelines-plugin/public'; import { useUserPrivileges } from '../../../common/components/user_privileges'; -import { timelineActions, timelineSelectors } from '../../store/timeline'; -import { timelineDefaults } from '../../store/timeline/defaults'; +import { timelineActions, timelineSelectors } from '../../store'; +import { timelineDefaults } from '../../store/defaults'; import { defaultHeaders } from './body/column_headers/default_headers'; import type { CellValueElementProps } from './cell_rendering'; import { SourcererScopeName } from '../../../common/store/sourcerer/model'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/kpi/kpi_container.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/kpi/kpi_container.tsx index 31eb9ad5e5e5..c4f49c245e6d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/kpi/kpi_container.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/kpi/kpi_container.tsx @@ -19,8 +19,8 @@ import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { TimelineKPIs } from './kpis'; import { useTimelineKpis } from '../../../containers/kpis'; import { useKibana } from '../../../../common/lib/kibana'; -import { timelineSelectors } from '../../../store/timeline'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineSelectors } from '../../../store'; +import { timelineDefaults } from '../../../store/defaults'; import { combineQueries } from '../../../../common/lib/kuery'; import { endSelector, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/index.tsx index 963713a2317a..0d794769b088 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/index.tsx @@ -24,7 +24,7 @@ import styled from 'styled-components'; import type { EuiTheme } from '@kbn/react-kibana-context-styled'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { useDeepEqualSelector, useShallowEqualSelector, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/selectors.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/selectors.ts index bc0317f4c428..57e727818d5f 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/notes_tab_content/selectors.ts @@ -7,7 +7,7 @@ import { createSelector } from 'reselect'; -import { timelineSelectors } from '../../../store/timeline'; +import { timelineSelectors } from '../../../store'; export const getTimelineNoteSelector = () => createSelector(timelineSelectors.selectTimeline, (timeline) => { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.tsx index 87e423ce9483..20eff77cfbae 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/pinned_tab_content/index.tsx @@ -15,7 +15,7 @@ import { connect } from 'react-redux'; import deepEqual from 'fast-deep-equal'; import type { ControlColumnProps } from '../../../../../common/types'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import type { CellValueElementProps } from '../cell_rendering'; import type { Direction } from '../../../../../common/search_strategy'; import { useTimelineEvents } from '../../../containers'; @@ -25,10 +25,10 @@ import { Footer, footerHeight } from '../footer'; import { requiredFieldsForActions } from '../../../../detections/components/alerts_table/default_config'; import { EventDetailsWidthProvider } from '../../../../common/components/events_viewer/event_details_width_context'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useTimelineFullScreen } from '../../../../common/containers/use_full_screen'; -import type { TimelineModel } from '../../../store/timeline/model'; +import type { TimelineModel } from '../../../store/model'; import type { State } from '../../../../common/store'; import { calculateTotalPages } from '../helpers'; import type { RowRenderer, ToggleDetailPanel } from '../../../../../common/types/timeline'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.test.tsx index 919bca8308d8..4e98a4839866 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.test.tsx @@ -13,7 +13,7 @@ import type { NewTimelineProps } from './helpers'; import { AddToFavoritesButton, NewTimeline } from './helpers'; import { useCreateTimelineButton } from './use_create_timeline'; import { kibanaObservable, TestProviders } from '../../../../common/mock/test_providers'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { TimelineId } from '../../../../../common/types/timeline'; import { TimelineStatus, TimelineType } from '../../../../../common/api/timeline'; import { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx index b8c0366e3f39..c6c252ddde87 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/helpers.tsx @@ -12,12 +12,12 @@ import { useDispatch } from 'react-redux'; import type { TimelineTypeLiteral } from '../../../../../common/api/timeline'; import { TimelineType, TimelineStatus } from '../../../../../common/api/timeline'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import { useShallowEqualSelector } from '../../../../common/hooks/use_selector'; import * as i18n from './translations'; import { useCreateTimelineButton } from './use_create_timeline'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { TIMELINE_TOUR_CONFIG_ANCHORS } from '../tour/step_config'; const NotesCountBadge = styled(EuiBadge)` diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_create_timeline.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_create_timeline.tsx index 0693901bf211..10f328f198c9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_create_timeline.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/properties/use_create_timeline.tsx @@ -11,7 +11,7 @@ import { EuiButton, EuiButtonEmpty } from '@elastic/eui'; import { InputsModelId } from '../../../../common/store/inputs/constants'; import { defaultHeaders } from '../body/column_headers/default_headers'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import { useTimelineFullScreen } from '../../../../common/containers/use_full_screen'; import { TimelineId } from '../../../../../common/types/timeline'; import type { TimelineTypeLiteral } from '../../../../../common/api/timeline'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/index.tsx index 70ea6638a66e..cbfa6b44590b 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/index.tsx @@ -24,7 +24,7 @@ import type { FieldValueQueryBar } from '../../../../../detections/components/ru import type { FormSchema } from '../../../../../shared_imports'; import { Form, UseField, useForm, useFormData } from '../../../../../shared_imports'; -import { timelineActions } from '../../../../store/timeline'; +import { timelineActions } from '../../../../store'; import * as i18n from '../translations'; import { getEqlOptions } from './selectors'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/selectors.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/selectors.tsx index 9c3555f2fb71..e533ef917517 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/selectors.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/eql/selectors.tsx @@ -6,7 +6,7 @@ */ import { createSelector } from 'reselect'; -import { selectTimeline } from '../../../../store/timeline/selectors'; +import { selectTimeline } from '../../../../store/selectors'; export const getEqlOptions = () => createSelector( diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx index e1e732b32e47..73d83469413c 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_bar/index.tsx @@ -20,13 +20,13 @@ import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { convertKueryToElasticSearchQuery } from '../../../../common/lib/kuery'; -import type { KqlMode } from '../../../store/timeline/model'; +import type { KqlMode } from '../../../store/model'; import { useSavedQueryServices } from '../../../../common/utils/saved_query_services'; import type { DispatchUpdateReduxTime } from '../../../../common/components/super_date_picker'; import { QueryBar } from '../../../../common/components/query_bar'; import type { DataProvider } from '../data_providers/data_provider'; import { buildGlobalQuery } from '../helpers'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import type { KueryFilterQuery, KueryFilterQueryKind } from '../../../../../common/types/timeline'; export interface QueryBarTimelineComponentProps { diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/index.tsx index 8d70c3e4d44c..553b71705884 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/index.tsx @@ -15,9 +15,9 @@ import { euiThemeVars } from '@kbn/ui-theme'; import type { TimelineStatusLiteralWithNull } from '../../../../../../common/api/timeline'; import { TimelineStatus, TimelineType } from '../../../../../../common/api/timeline'; -import { timelineSelectors } from '../../../../store/timeline'; +import { timelineSelectors } from '../../../../store'; import { useDeepEqualSelector } from '../../../../../common/hooks/use_selector'; -import { timelineDefaults } from '../../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../../store/defaults'; import * as i18n from './translations'; import { StatefulSearchOrFilter } from '../../search_or_filter'; import { DataProviders } from '../../data_providers'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/selectors.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/selectors.ts index 02668c18b308..62c0134b9661 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/header/selectors.ts @@ -7,7 +7,7 @@ import { createSelector } from 'reselect'; -import { timelineSelectors } from '../../../../store/timeline'; +import { timelineSelectors } from '../../../../store'; export const getTimelineSaveModalByIdSelector = () => createSelector(timelineSelectors.selectTimeline, (timeline) => ({ diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.tsx index 390369eaf89e..be05ff81f53c 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/query_tab_content/index.tsx @@ -27,7 +27,7 @@ import { getEsQueryConfig } from '@kbn/data-plugin/common'; import type { ControlColumnProps } from '../../../../../common/types'; import { InputsModelId } from '../../../../common/store/inputs/constants'; import { useInvalidFilterQuery } from '../../../../common/hooks/use_invalid_filter_query'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; +import { timelineActions, timelineSelectors } from '../../../store'; import type { CellValueElementProps } from '../cell_rendering'; import type { Direction, TimelineItem } from '../../../../../common/search_strategy'; import { useTimelineEvents } from '../../../containers'; @@ -50,10 +50,10 @@ import { EventDetailsWidthProvider } from '../../../../common/components/events_ import type { inputsModel, State } from '../../../../common/store'; import { inputsSelectors } from '../../../../common/store'; import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineDefaults } from '../../../store/defaults'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import { useTimelineEventsCountPortal } from '../../../../common/hooks/use_timeline_events_count'; -import type { TimelineModel } from '../../../store/timeline/model'; +import type { TimelineModel } from '../../../store/model'; import { useTimelineFullScreen } from '../../../../common/containers/use_full_screen'; import { activeTimeline } from '../../../containers/active_timeline_context'; import { DetailsPanel } from '../../side_panel'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/helpers.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/helpers.tsx index e8db433c0a11..282d94b873e8 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/helpers.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/helpers.tsx @@ -12,7 +12,7 @@ import styled from 'styled-components'; import { AndOrBadge } from '../../../../common/components/and_or_badge'; import * as i18n from './translations'; -import type { KqlMode } from '../../../store/timeline/model'; +import type { KqlMode } from '../../../store/model'; const AndOrContainer = styled.div` position: relative; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/index.tsx index 7dc5e7909093..cdd6fc793082 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/index.tsx @@ -25,12 +25,12 @@ import { SourcererScopeName } from '../../../../common/store/sourcerer/model'; import { useSourcererDataView } from '../../../../common/containers/sourcerer'; import type { State, inputsModel } from '../../../../common/store'; import { inputsSelectors } from '../../../../common/store'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; -import type { KqlMode, TimelineModel } from '../../../store/timeline/model'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineActions, timelineSelectors } from '../../../store'; +import type { KqlMode, TimelineModel } from '../../../store/model'; +import { timelineDefaults } from '../../../store/defaults'; import { dispatchUpdateReduxTime } from '../../../../common/components/super_date_picker'; import { SearchOrFilter } from './search_or_filter'; -import { setDataProviderVisibility } from '../../../store/timeline/actions'; +import { setDataProviderVisibility } from '../../../store/actions'; import * as i18n from './translations'; const FilterItemsContainer = styled(EuiFlexGroup)``; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx index e822dfb7e0dc..16f053b4abb7 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/search_or_filter/search_or_filter.tsx @@ -13,7 +13,7 @@ import type { Filter } from '@kbn/es-query'; import type { FilterManager } from '@kbn/data-plugin/public'; import { TimelineType } from '../../../../../common/api/timeline'; import { InputsModelId } from '../../../../common/store/inputs/constants'; -import type { KqlMode } from '../../../store/timeline/model'; +import type { KqlMode } from '../../../store/model'; import type { DispatchUpdateReduxTime } from '../../../../common/components/super_date_picker'; import { SuperDatePicker } from '../../../../common/components/super_date_picker'; import type { KueryFilterQuery } from '../../../../../common/types/timeline'; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/session_tab_content/use_session_view.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/session_tab_content/use_session_view.tsx index d4459f8de4a9..2f40cb20877d 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/session_tab_content/use_session_view.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/session_tab_content/use_session_view.tsx @@ -33,8 +33,8 @@ import { } from '../../../../common/containers/use_full_screen'; import { detectionsTimelineIds } from '../../../containers/helpers'; import { useUserPrivileges } from '../../../../common/components/user_privileges'; -import { timelineActions, timelineSelectors } from '../../../store/timeline'; -import { timelineDefaults } from '../../../store/timeline/defaults'; +import { timelineActions, timelineSelectors } from '../../../store'; +import { timelineDefaults } from '../../../store/defaults'; import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; const FullScreenButtonIcon = styled(EuiButtonIcon)` diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx index 4deaf849b627..cc4d28f30554 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx @@ -31,7 +31,7 @@ import { EqlEventsCountBadge, TimelineEventsCountBadge, } from '../../../../common/hooks/use_timeline_events_count'; -import { timelineActions } from '../../../store/timeline'; +import { timelineActions } from '../../../store'; import type { CellValueElementProps } from '../cell_rendering'; import { getActiveTabSelector, @@ -44,7 +44,7 @@ import { import * as i18n from './translations'; import { useLicense } from '../../../../common/hooks/use_license'; import { TIMELINE_CONVERSATION_TITLE } from '../../../../assistant/content/conversations/translations'; -import { initializeTimelineSettings } from '../../../store/timeline/actions'; +import { initializeTimelineSettings } from '../../../store/actions'; import { DISCOVER_ESQL_IN_TIMELINE_TECHNICAL_PREVIEW } from './translations'; const HideShowContainer = styled.div.attrs<{ $isVisible: boolean; isOverflowYScroll: boolean }>( diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/selectors.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/selectors.ts index 04045e94aee2..1d82a1e22803 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/selectors.ts @@ -8,7 +8,7 @@ import { createSelector } from 'reselect'; import { TimelineTabs } from '../../../../../common/types/timeline'; import { selectNotesById } from '../../../../common/store/app/selectors'; -import { selectTimeline } from '../../../store/timeline/selectors'; +import { selectTimeline } from '../../../store/selectors'; export const getActiveTabSelector = () => createSelector(selectTimeline, (timeline) => timeline?.activeTab ?? TimelineTabs.query); diff --git a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx index f7902dacf5e6..81252216c529 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/containers/index.tsx @@ -23,7 +23,7 @@ import type { inputsModel } from '../../common/store'; import type { RunTimeMappings } from '../../common/store/sourcerer/model'; import { useKibana } from '../../common/lib/kibana'; import { createFilter } from '../../common/containers/helpers'; -import { timelineActions } from '../store/timeline'; +import { timelineActions } from '../store'; import { detectionsTimelineIds } from './helpers'; import { getInspectResponse } from '../../helpers'; import type { diff --git a/x-pack/plugins/security_solution/public/timelines/index.ts b/x-pack/plugins/security_solution/public/timelines/index.ts index 71c15088d1ac..91078fa0420b 100644 --- a/x-pack/plugins/security_solution/public/timelines/index.ts +++ b/x-pack/plugins/security_solution/public/timelines/index.ts @@ -7,8 +7,8 @@ import type { SecuritySubPluginWithStore } from '../app/types'; import { routes } from './routes'; -import { initialTimelineState, timelineReducer } from './store/timeline/reducer'; -import type { TimelineState } from './store/timeline/types'; +import { initialTimelineState, timelineReducer } from './store/reducer'; +import type { TimelineState } from './store/types'; export class Timelines { public setup() {} diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts b/x-pack/plugins/security_solution/public/timelines/store/actions.ts similarity index 95% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts rename to x-pack/plugins/security_solution/public/timelines/store/actions.ts index 8440a534ad45..8de7d6670e28 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/actions.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/actions.ts @@ -9,19 +9,19 @@ import actionCreatorFactory from 'typescript-fsa'; import type { Filter } from '@kbn/es-query'; import type { SavedSearch } from '@kbn/saved-search-plugin/common'; -import type { SessionViewConfig } from '../../../../common/types'; +import type { SessionViewConfig } from '../../../common/types'; import type { DataProvider, DataProviderType, QueryOperator, -} from '../../components/timeline/data_providers/data_provider'; +} from '../components/timeline/data_providers/data_provider'; import type { KqlMode, TimelineModel } from './model'; import type { InitialyzeTimelineSettings, InsertTimeline } from './types'; import type { FieldsEqlOptions, TimelineNonEcsData, -} from '../../../../common/search_strategy/timeline'; +} from '../../../common/search_strategy/timeline'; import type { TimelineTabs, TimelinePersistInput, @@ -29,9 +29,9 @@ import type { ToggleDetailPanel, ColumnHeaderOptions, SortColumnTimeline, -} from '../../../../common/types/timeline'; -import type { RowRendererId } from '../../../../common/api/timeline'; -import type { ResolveTimelineConfig } from '../../components/open_timeline/types'; +} from '../../../common/types/timeline'; +import type { RowRendererId } from '../../../common/api/timeline'; +import type { ResolveTimelineConfig } from '../components/open_timeline/types'; const actionCreator = actionCreatorFactory('x-pack/security_solution/local/timeline'); diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts b/x-pack/plugins/security_solution/public/timelines/store/defaults.ts similarity index 87% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts rename to x-pack/plugins/security_solution/public/timelines/store/defaults.ts index 1df0a997a2d8..9fb94d9f5b1b 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/defaults.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/defaults.ts @@ -5,11 +5,11 @@ * 2.0. */ -import { TimelineTabs } from '../../../../common/types/timeline'; -import { TimelineType, TimelineStatus } from '../../../../common/api/timeline'; +import { TimelineTabs } from '../../../common/types/timeline'; +import { TimelineType, TimelineStatus } from '../../../common/api/timeline'; -import { defaultHeaders } from '../../components/timeline/body/column_headers/default_headers'; -import { normalizeTimeRange } from '../../../common/utils/normalize_time_range'; +import { defaultHeaders } from '../components/timeline/body/column_headers/default_headers'; +import { normalizeTimeRange } from '../../common/utils/normalize_time_range'; import type { SubsetTimelineModel, TimelineModel } from './model'; // normalizeTimeRange uses getTimeRangeSettings which cannot be used outside Kibana context if the uiSettings is not false diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts b/x-pack/plugins/security_solution/public/timelines/store/epic.test.ts similarity index 97% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic.test.ts index 9a273bc6ca14..bbcc9363a107 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/epic.test.ts @@ -7,9 +7,9 @@ import type { Filter } from '@kbn/es-query'; import { FilterStateStore } from '@kbn/es-query'; -import { Direction } from '../../../../common/search_strategy'; -import { TimelineTabs } from '../../../../common/types/timeline'; -import { TimelineType, TimelineStatus } from '../../../../common/api/timeline'; +import { Direction } from '../../../common/search_strategy'; +import { TimelineTabs } from '../../../common/types/timeline'; +import { TimelineType, TimelineStatus } from '../../../common/api/timeline'; import { convertTimelineAsInput } from './epic'; import type { TimelineModel } from './model'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts b/x-pack/plugins/security_solution/public/timelines/store/epic.ts similarity index 96% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic.ts index 7c072abce73e..d3c14c3a1e2c 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/epic.ts @@ -29,15 +29,15 @@ import { takeUntil, } from 'rxjs/operators'; -import type { TimelineErrorResponse, TimelineResponse } from '../../../../common/api/timeline'; -import type { ColumnHeaderOptions } from '../../../../common/types/timeline'; -import { TimelineStatus, TimelineType } from '../../../../common/api/timeline'; -import type { inputsModel } from '../../../common/store/inputs'; -import { addError } from '../../../common/store/app/actions'; +import type { TimelineErrorResponse, TimelineResponse } from '../../../common/api/timeline'; +import type { ColumnHeaderOptions } from '../../../common/types/timeline'; +import { TimelineStatus, TimelineType } from '../../../common/api/timeline'; +import type { inputsModel } from '../../common/store/inputs'; +import { addError } from '../../common/store/app/actions'; -import { copyTimeline, persistTimeline } from '../../containers/api'; -import { ALL_TIMELINE_QUERY_ID } from '../../containers/all'; -import * as i18n from '../../pages/translations'; +import { copyTimeline, persistTimeline } from '../containers/api'; +import { ALL_TIMELINE_QUERY_ID } from '../containers/all'; +import * as i18n from '../pages/translations'; import { updateTimeline, @@ -57,7 +57,7 @@ import { isNotNull } from './helpers'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import { myEpicTimelineId } from './my_epic_timeline_id'; import type { TimelineEpicDependencies } from './types'; -import type { TimelineInput } from '../../../../common/search_strategy'; +import type { TimelineInput } from '../../../common/search_strategy'; const isItAtimelineAction = (timelineId: string | undefined) => timelineId && timelineId.toLowerCase().startsWith('timeline'); diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_changed.ts b/x-pack/plugins/security_solution/public/timelines/store/epic_changed.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic_changed.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic_changed.ts diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_dispatcher_timeline_persistence_queue.ts b/x-pack/plugins/security_solution/public/timelines/store/epic_dispatcher_timeline_persistence_queue.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic_dispatcher_timeline_persistence_queue.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic_dispatcher_timeline_persistence_queue.ts diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts b/x-pack/plugins/security_solution/public/timelines/store/epic_favorite.ts similarity index 92% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic_favorite.ts index ff501fb4761d..c6bd77d222a6 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_favorite.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/epic_favorite.ts @@ -12,7 +12,7 @@ import type { Observable } from 'rxjs'; import { from, EMPTY } from 'rxjs'; import { filter, mergeMap, withLatestFrom, startWith, takeUntil } from 'rxjs/operators'; -import { addError } from '../../../common/store/app/actions'; +import { addError } from '../../common/store/app/actions'; import { endTimelineSaving, updateIsFavorite, @@ -23,10 +23,10 @@ import { import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import { myEpicTimelineId } from './my_epic_timeline_id'; import type { TimelineById } from './types'; -import type { inputsModel } from '../../../common/store/inputs'; -import type { ResponseFavoriteTimeline } from '../../../../common/api/timeline'; -import { TimelineType } from '../../../../common/api/timeline'; -import { persistFavorite } from '../../containers/api'; +import type { inputsModel } from '../../common/store/inputs'; +import type { ResponseFavoriteTimeline } from '../../../common/api/timeline'; +import { TimelineType } from '../../../common/api/timeline'; +import { persistFavorite } from '../containers/api'; type FavoriteTimelineAction = ReturnType; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts b/x-pack/plugins/security_solution/public/timelines/store/epic_note.ts similarity index 93% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic_note.ts index 01e612302ca3..98c4f90bfa1d 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_note.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/epic_note.ts @@ -12,9 +12,9 @@ import type { Observable } from 'rxjs'; import { from, EMPTY } from 'rxjs'; import { filter, mergeMap, switchMap, withLatestFrom, startWith, takeUntil } from 'rxjs/operators'; -import { updateNote, addError } from '../../../common/store/app/actions'; -import type { NotesById } from '../../../common/store/app/model'; -import type { inputsModel } from '../../../common/store/inputs'; +import { updateNote, addError } from '../../common/store/app/actions'; +import type { NotesById } from '../../common/store/app/model'; +import type { inputsModel } from '../../common/store/inputs'; import { addNote, @@ -27,8 +27,8 @@ import { import { myEpicTimelineId } from './my_epic_timeline_id'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import type { TimelineById } from './types'; -import { persistNote } from '../../containers/notes/api'; -import type { ResponseNote } from '../../../../common/api/timeline'; +import { persistNote } from '../containers/notes/api'; +import type { ResponseNote } from '../../../common/api/timeline'; type NoteAction = ReturnType; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts b/x-pack/plugins/security_solution/public/timelines/store/epic_pinned_event.ts similarity index 94% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts rename to x-pack/plugins/security_solution/public/timelines/store/epic_pinned_event.ts index b99de117e785..0808479bd5f2 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/epic_pinned_event.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/epic_pinned_event.ts @@ -12,9 +12,9 @@ import type { Observable } from 'rxjs'; import { from, EMPTY } from 'rxjs'; import { filter, mergeMap, startWith, withLatestFrom, takeUntil } from 'rxjs/operators'; -import { addError } from '../../../common/store/app/actions'; -import type { inputsModel } from '../../../common/store/inputs'; -import type { PinnedEventResponse } from '../../../../common/api/timeline'; +import { addError } from '../../common/store/app/actions'; +import type { inputsModel } from '../../common/store/inputs'; +import type { PinnedEventResponse } from '../../../common/api/timeline'; import { pinEvent, endTimelineSaving, @@ -26,7 +26,7 @@ import { import { myEpicTimelineId } from './my_epic_timeline_id'; import { dispatcherTimelinePersistQueue } from './epic_dispatcher_timeline_persistence_queue'; import type { TimelineById } from './types'; -import { persistPinnedEvent } from '../../containers/pinned_event/api'; +import { persistPinnedEvent } from '../containers/pinned_event/api'; type PinnedEventAction = ReturnType; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.test.ts b/x-pack/plugins/security_solution/public/timelines/store/helpers.test.ts similarity index 98% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.test.ts rename to x-pack/plugins/security_solution/public/timelines/store/helpers.test.ts index e0ca1b6dc681..2e3376396fb7 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/helpers.test.ts @@ -6,25 +6,20 @@ */ import { cloneDeep } from 'lodash/fp'; -import type { ColumnHeaderOptions } from '../../../../common/types/timeline'; -import { TimelineTabs, TimelineId } from '../../../../common/types/timeline'; -import { TimelineType, TimelineStatus } from '../../../../common/api/timeline'; - +import type { ColumnHeaderOptions } from '../../../common/types/timeline'; +import { TimelineTabs, TimelineId } from '../../../common/types/timeline'; +import { TimelineType, TimelineStatus } from '../../../common/api/timeline'; import type { DataProvider, DataProvidersAnd, -} from '../../components/timeline/data_providers/data_provider'; -import { - IS_OPERATOR, - DataProviderType, -} from '../../components/timeline/data_providers/data_provider'; -import { defaultColumnHeaderType } from '../../components/timeline/body/column_headers/default_headers'; +} from '../components/timeline/data_providers/data_provider'; +import { IS_OPERATOR, DataProviderType } from '../components/timeline/data_providers/data_provider'; +import { defaultColumnHeaderType } from '../components/timeline/body/column_headers/default_headers'; import { DEFAULT_COLUMN_MIN_WIDTH, RESIZED_COLUMN_MIN_WITH, -} from '../../components/timeline/body/constants'; -import { defaultHeaders } from '../../../common/mock'; - +} from '../components/timeline/body/constants'; +import { defaultHeaders } from '../../common/mock'; import { addNewTimeline, addTimelineProviders, @@ -49,12 +44,12 @@ import { import type { TimelineModel } from './model'; import { timelineDefaults } from './defaults'; import type { TimelineById } from './types'; -import { Direction } from '../../../../common/search_strategy'; +import { Direction } from '../../../common/search_strategy'; import type { FilterManager } from '@kbn/data-plugin/public'; -jest.mock('../../../common/utils/normalize_time_range'); -jest.mock('../../../common/utils/default_date_settings', () => { - const actual = jest.requireActual('../../../common/utils/default_date_settings'); +jest.mock('../../common/utils/normalize_time_range'); +jest.mock('../../common/utils/default_date_settings', () => { + const actual = jest.requireActual('../../common/utils/default_date_settings'); return { ...actual, DEFAULT_FROM_MOMENT: new Date('2020-10-27T11:37:31.655Z'), diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts b/x-pack/plugins/security_solution/public/timelines/store/helpers.ts similarity index 97% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts rename to x-pack/plugins/security_solution/public/timelines/store/helpers.ts index ca890b9ac3ec..3206bb96e89a 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/helpers.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/helpers.ts @@ -6,24 +6,21 @@ */ import { getOr, omit, uniq, isEmpty, isEqualWith, cloneDeep, union } from 'lodash/fp'; - import { v4 as uuidv4 } from 'uuid'; - import type { Filter } from '@kbn/es-query'; - -import type { SessionViewConfig, ExpandedDetailTimeline } from '../../../../common/types'; -import type { TimelineNonEcsData } from '../../../../common/search_strategy'; -import type { Sort } from '../../components/timeline/body/sort'; +import type { SessionViewConfig, ExpandedDetailTimeline } from '../../../common/types'; +import type { TimelineNonEcsData } from '../../../common/search_strategy'; +import type { Sort } from '../components/timeline/body/sort'; import type { DataProvider, QueryOperator, QueryMatch, -} from '../../components/timeline/data_providers/data_provider'; +} from '../components/timeline/data_providers/data_provider'; import { DataProviderType, IS_OPERATOR, EXISTS_OPERATOR, -} from '../../components/timeline/data_providers/data_provider'; +} from '../components/timeline/data_providers/data_provider'; import type { ColumnHeaderOptions, TimelineEventsType, @@ -31,25 +28,22 @@ import type { TimelinePersistInput, ToggleDetailPanel, SortColumnTimeline, -} from '../../../../common/types/timeline'; -import type { RowRendererId, TimelineTypeLiteral } from '../../../../common/api/timeline'; -import { TimelineId } from '../../../../common/types/timeline'; -import { TimelineStatus, TimelineType } from '../../../../common/api/timeline'; -import { normalizeTimeRange } from '../../../common/utils/normalize_time_range'; +} from '../../../common/types/timeline'; +import type { RowRendererId, TimelineTypeLiteral } from '../../../common/api/timeline'; +import { TimelineId } from '../../../common/types/timeline'; +import { TimelineStatus, TimelineType } from '../../../common/api/timeline'; +import { normalizeTimeRange } from '../../common/utils/normalize_time_range'; import { getTimelineManageDefaults, timelineDefaults } from './defaults'; import type { KqlMode, TimelineModel } from './model'; import type { TimelineById, TimelineModelSettings } from './types'; -import { - DEFAULT_FROM_MOMENT, - DEFAULT_TO_MOMENT, -} from '../../../common/utils/default_date_settings'; +import { DEFAULT_FROM_MOMENT, DEFAULT_TO_MOMENT } from '../../common/utils/default_date_settings'; import { DEFAULT_COLUMN_MIN_WIDTH, RESIZED_COLUMN_MIN_WITH, -} from '../../components/timeline/body/constants'; -import { activeTimeline } from '../../containers/active_timeline_context'; -import type { ResolveTimelineConfig } from '../../components/open_timeline/types'; -import { getDisplayValue } from '../../components/timeline/data_providers/helpers'; +} from '../components/timeline/body/constants'; +import { activeTimeline } from '../containers/active_timeline_context'; +import type { ResolveTimelineConfig } from '../components/open_timeline/types'; +import { getDisplayValue } from '../components/timeline/data_providers/helpers'; export const isNotNull = (value: T | null): value is T => value !== null; interface AddTimelineNoteParams { diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/index.ts b/x-pack/plugins/security_solution/public/timelines/store/index.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/index.ts rename to x-pack/plugins/security_solution/public/timelines/store/index.ts diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/manage_timeline_id.tsx b/x-pack/plugins/security_solution/public/timelines/store/manage_timeline_id.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/manage_timeline_id.tsx rename to x-pack/plugins/security_solution/public/timelines/store/manage_timeline_id.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts b/x-pack/plugins/security_solution/public/timelines/store/model.ts similarity index 96% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts rename to x-pack/plugins/security_solution/public/timelines/store/model.ts index 47e15be86e2a..0bd6f4806f06 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/model.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/model.ts @@ -8,11 +8,11 @@ import type { FilterManager } from '@kbn/data-plugin/public'; import type { Filter } from '@kbn/es-query'; import type { SavedSearch } from '@kbn/saved-search-plugin/common'; -import type { ExpandedDetailTimeline, SessionViewConfig } from '../../../../common/types'; +import type { ExpandedDetailTimeline, SessionViewConfig } from '../../../common/types'; import type { EqlOptionsSelected, TimelineNonEcsData, -} from '../../../../common/search_strategy/timeline'; +} from '../../../common/search_strategy/timeline'; import type { TimelineTabs, ScrollToTopEvent, @@ -21,14 +21,14 @@ import type { DataProvider, SerializedFilterQuery, TimelineEventsType, -} from '../../../../common/types/timeline'; +} from '../../../common/types/timeline'; import type { RowRendererId, TimelineStatus, TimelineType, PinnedEvent, -} from '../../../../common/api/timeline'; -import type { ResolveTimelineConfig } from '../../components/open_timeline/types'; +} from '../../../common/api/timeline'; +import type { ResolveTimelineConfig } from '../components/open_timeline/types'; export type KqlMode = 'filter' | 'search'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/my_epic_timeline_id.ts b/x-pack/plugins/security_solution/public/timelines/store/my_epic_timeline_id.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/my_epic_timeline_id.ts rename to x-pack/plugins/security_solution/public/timelines/store/my_epic_timeline_id.ts diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.ts b/x-pack/plugins/security_solution/public/timelines/store/reducer.ts similarity index 99% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.ts rename to x-pack/plugins/security_solution/public/timelines/store/reducer.ts index 6947b207874a..1ae41833a14b 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/reducer.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/reducer.ts @@ -106,7 +106,7 @@ import { import type { TimelineState } from './types'; import { EMPTY_TIMELINE_BY_ID } from './types'; -import { TimelineType } from '../../../../common/api/timeline'; +import { TimelineType } from '../../../common/api/timeline'; export const initialTimelineState: TimelineState = { timelineById: EMPTY_TIMELINE_BY_ID, diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts b/x-pack/plugins/security_solution/public/timelines/store/selectors.ts similarity index 97% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts rename to x-pack/plugins/security_solution/public/timelines/store/selectors.ts index d4078373aaff..f22dcb3b96fe 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/selectors.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/selectors.ts @@ -6,7 +6,7 @@ */ import { createSelector } from 'reselect'; -import type { State } from '../../../common/store/types'; +import type { State } from '../../common/store/types'; import type { TimelineModel } from './model'; import type { InsertTimeline, TimelineById } from './types'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts b/x-pack/plugins/security_solution/public/timelines/store/types.ts similarity index 87% rename from x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts rename to x-pack/plugins/security_solution/public/timelines/store/types.ts index 2d45367b937b..741b906dcdeb 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/timeline/types.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/types.ts @@ -7,11 +7,11 @@ import type { FilterManager } from '@kbn/data-plugin/public'; import type { TableById } from '@kbn/securitysolution-data-table'; -import type { RootEpicDependencies } from '../../../common/store/epic'; -import type { ColumnHeaderOptions, SortColumnTimeline } from '../../../../common/types'; -import type { RowRendererId } from '../../../../common/api/timeline'; -import type { inputsModel } from '../../../common/store/inputs'; -import type { NotesById } from '../../../common/store/app/model'; +import type { RootEpicDependencies } from '../../common/store/epic'; +import type { ColumnHeaderOptions, SortColumnTimeline } from '../../../common/types'; +import type { RowRendererId } from '../../../common/api/timeline'; +import type { inputsModel } from '../../common/store/inputs'; +import type { NotesById } from '../../common/store/app/model'; import type { TimelineModel } from './model'; diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connector_link.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connector_link.tsx index b12f446aa234..45f43a2b72b3 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connector_link.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors/connector_config/connector_link.tsx @@ -110,7 +110,7 @@ export const ConnectorLinkElasticsearch: React.FCconnector_id - + {connectorId} diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors/connectors_table.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors/connectors_table.tsx index 2e7e6f2cf6a4..53d99b37c99a 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors/connectors_table.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors/connectors_table.tsx @@ -227,12 +227,17 @@ export const ConnectorsTable: React.FC = () => { filter ? `${connector[filter]}`.toLowerCase().includes(query.toLowerCase()) : true ) .slice(pageIndex * pageSize, (pageIndex + 1) * pageSize) ?? []; - return ( <> - setQuery(queryText ?? '')} query={query} /> + setQuery(queryText ?? '')} + query={query} + /> { = ({ connector }) = value={newDescription || ''} /> ) : ( - {connector.description} + + {connector.description} + )} @@ -107,7 +109,7 @@ export const EditDescription: React.FC = ({ connector }) = `} > mutate(newDescription)} @@ -125,7 +127,7 @@ export const EditDescription: React.FC = ({ connector }) = `} > { diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors/edit_name.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors/edit_name.tsx index e8073796c7c9..fbab2b15d343 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors/edit_name.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors/edit_name.tsx @@ -69,7 +69,7 @@ export const EditName: React.FC = ({ connector }) => { {!isEditing ? ( <> - +

    {connector.name || CONNECTOR_LABEL}

    @@ -113,7 +113,7 @@ export const EditName: React.FC = ({ connector }) => { `} > = ({ connector }) => { `} > { diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors/edit_service_type.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors/edit_service_type.tsx index c3e7c3f8455b..a2df8f7c35bf 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors/edit_service_type.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors/edit_service_type.tsx @@ -37,7 +37,10 @@ export const EditServiceType: React.FC = ({ connector }) = connectorTypes?.connectors.map((connectorType) => ({ inputDisplay: ( - + = ({ connector }) = return ( - + {i18n.translate('xpack.serverlessSearch.connectors.serviceTypeLabel', { defaultMessage: 'Connector type', })} mutate(event)} options={options} diff --git a/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx b/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx index fd774f3dd491..78c70321d178 100644 --- a/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx +++ b/x-pack/plugins/serverless_search/public/application/components/connectors_overview.tsx @@ -38,6 +38,7 @@ export const ConnectorsOverview = () => { pageTitle={i18n.translate('xpack.serverlessSearch.connectors.title', { defaultMessage: 'Connectors', })} + data-test-subj="serverlessSearchConnectorsTitle" restrictWidth rightSideItems={[ diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 0b9b8f6ffcd3..35af07ca6452 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -21980,11 +21980,9 @@ "xpack.lens.indexPattern.counterRate.documentation.markdown": "\nCalcule le taux d'un compteur toujours croissant. Cette fonction renvoie uniquement des résultats utiles inhérents aux champs d'indicateurs de compteur qui contiennent une mesure quelconque à croissance régulière.\nSi la valeur diminue, elle est interprétée comme une mesure de réinitialisation de compteur. Pour obtenir des résultats plus précis, \"counter_rate\" doit être calculé d’après la valeur \"max\" du champ.\n\nCe calcul est réalisé séparément pour des séries distinctes définies par des filtres ou des dimensions de valeurs supérieures.\nIl utilise l'intervalle en cours utilisé dans la formule.\n\nExemple : visualiser le taux d'octets reçus au fil du temps par un serveur Memcached :\n`counter_rate(max(memcached.stats.read.bytes))`\n ", "xpack.lens.indexPattern.cumulativeSum.documentation.markdown": "\nCalcule la somme cumulée d'un indicateur au fil du temps, en ajoutant toutes les valeurs précédentes d'une série à chaque valeur. Pour utiliser cette fonction, vous devez également configurer une dimension de l'histogramme de dates.\n\nCe calcul est réalisé séparément pour des séries distinctes définies par des filtres ou des dimensions de valeurs supérieures.\n\nExemple : visualiser les octets reçus cumulés au fil du temps :\n`cumulative_sum(sum(bytes))`\n ", "xpack.lens.indexPattern.differences.documentation.markdown": "\nCalcule la différence par rapport à la dernière valeur d'un indicateur au fil du temps. Pour utiliser cette fonction, vous devez également configurer une dimension de l'histogramme de dates.\nLes données doivent être séquentielles pour les différences. Si vos données sont vides lorsque vous utilisez des différences, essayez d'augmenter l'intervalle de l'histogramme de dates.\n\nCe calcul est réalisé séparément pour des séries distinctes définies par des filtres ou des dimensions de valeurs supérieures.\n\nExemple : visualiser la modification des octets reçus au fil du temps :\n`differences(sum(bytes))`\n ", - "xpack.lens.indexPattern.interval.documentation.markdown": "\nL’intervalle minimum spécifié pour l’histogramme de date, en millisecondes (ms).\n ", "xpack.lens.indexPattern.lastValue.documentation.markdown": "\nRenvoie la valeur d'un champ du dernier document, triée par le champ d'heure par défaut de la vue de données.\n\nCette fonction permet de récupérer le dernier état d'une entité.\n\nExemple : obtenir le statut actuel du serveur A :\n`last_value(server.status, kql='server.name=\"A\"')`\n ", "xpack.lens.indexPattern.metric.documentation.markdown": "\nRenvoie l'indicateur {metric} d'un champ. Cette fonction fonctionne uniquement pour les champs numériques.\n\nExemple : obtenir l'indicateur {metric} d'un prix :\n\"{metric}(price)\"\n\nExemple : obtenir l'indicateur {metric} d'un prix pour des commandes du Royaume-Uni :\n\"{metric}(price, kql='location:UK')\"\n ", "xpack.lens.indexPattern.movingAverage.documentation.markdown": "\nCalcule la moyenne mobile d'un indicateur au fil du temps, en prenant la moyenne des n dernières valeurs pour calculer la valeur actuelle. Pour utiliser cette fonction, vous devez également configurer une dimension de l'histogramme de dates.\nLa valeur de fenêtre par défaut est {defaultValue}.\n\nCe calcul est réalisé séparément pour des séries distinctes définies par des filtres ou des dimensions de valeurs supérieures.\n\nPrend un paramètre nommé \"window\" qui spécifie le nombre de dernières valeurs à inclure dans le calcul de la moyenne de la valeur actuelle.\n\nExemple : lisser une ligne de mesures :\n`moving_average(sum(bytes), window=5)`\n ", - "xpack.lens.indexPattern.now.documentation.markdown": "\n La durée actuelle passée dans Kibana exprimée en millisecondes (ms).\n ", "xpack.lens.indexPattern.overall_average.documentation.markdown": "\nCalcule la moyenne d'un indicateur pour tous les points de données d'une série dans le graphique actuel. Une série est définie par une dimension à l'aide d'un histogramme de dates ou d'une fonction d'intervalle.\nD'autres dimensions permettant de répartir les données telles que les valeurs supérieures ou les filtres sont traitées en tant que séries distinctes.\n\nSi le graphique actuel n'utilise aucun histogramme de dates ou aucune fonction d'intervalle, \"overall_average\" calcule la moyenne pour toutes les dimensions, quelle que soit la fonction utilisée.\n\nExemple : écart par rapport à la moyenne :\n\"sum(bytes) - overall_average(sum(bytes))\"\n ", "xpack.lens.indexPattern.overall_max.documentation.markdown": "\nCalcule la valeur maximale d'un indicateur pour tous les points de données d'une série dans le graphique actuel. Une série est définie par une dimension à l'aide d'un histogramme de dates ou d'une fonction d'intervalle.\nD'autres dimensions permettant de répartir les données telles que les valeurs supérieures ou les filtres sont traitées en tant que séries distinctes.\n\nSi le graphique actuel n'utilise aucun histogramme de dates ou aucune fonction d'intervalle, \"overall_max\" calcule la valeur maximale pour toutes les dimensions, quelle que soit la fonction utilisée.\n\nExemple : pourcentage de plage\n\"(sum(bytes) - overall_min(sum(bytes))) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))\"\n ", "xpack.lens.indexPattern.overall_min.documentation.markdown": "\nCalcule la valeur minimale d'un indicateur pour tous les points de données d'une série dans le graphique actuel. Une série est définie par une dimension à l'aide d'un histogramme de dates ou d'une fonction d'intervalle.\nD'autres dimensions permettant de répartir les données telles que les valeurs supérieures ou les filtres sont traitées en tant que séries distinctes.\n\nSi le graphique actuel n'utilise aucun histogramme de dates ou aucune fonction d'intervalle, \"overall_min\" calcule la valeur minimale pour toutes les dimensions, quelle que soit la fonction utilisée.\n\nExemple : pourcentage de plage\n\"(sum(bytes) - overall_min(sum(bytes)) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))\"\n ", @@ -21993,7 +21991,6 @@ "xpack.lens.indexPattern.percentileRanks.documentation.markdown": "\nRetourne le pourcentage de valeurs qui sont en dessous d'une certaine valeur. Par exemple, si une valeur est supérieure à 95 % des valeurs observées, elle est placée au 95e rang centile.\n\nExemple : Obtenir le pourcentage de valeurs qui sont en dessous de 100 :\n\"percentile_rank(bytes, value=100)\"\n ", "xpack.lens.indexPattern.standardDeviation.documentation.markdown": "\nRetourne la taille de la variation ou de la dispersion du champ. Cette fonction ne s’applique qu’aux champs numériques.\n\n#### Exemples\n\nPour obtenir l'écart type d'un prix, utilisez standard_deviation(price).\n\nPour obtenir la variance du prix des commandes passées au Royaume-Uni, utilisez `square(standard_deviation(price, kql='location:UK'))`.\n ", "xpack.lens.indexPattern.time_scale.documentation.markdown": "\n\nCette fonction avancée est utile pour normaliser les comptes et les sommes sur un intervalle de temps spécifique. Elle permet l'intégration avec les indicateurs qui sont stockés déjà normalisés sur un intervalle de temps spécifique.\n\nVous pouvez faire appel à cette fonction uniquement si une fonction d'histogramme des dates est utilisée dans le graphique actuel.\n\nExemple : Un rapport comparant un indicateur déjà normalisé à un autre indicateur devant être normalisé.\n\"normalize_by_unit(counter_rate(max(system.diskio.write.bytes)), unit='s') / last_value(apache.status.bytes_per_second)\"\n ", - "xpack.lens.indexPattern.timeRange.documentation.markdown": "\nL'intervalle de temps spécifié, en millisecondes (ms).\n ", "xpack.lens.AggBasedLabel": "visualisation basée sur l'agrégation", "xpack.lens.app.addToLibrary": "Enregistrer dans la bibliothèque", "xpack.lens.app.cancel": "Annuler", @@ -26823,7 +26820,6 @@ "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.failureMessage": "Impossible de créer le pipeline \"{pipelineName}\".", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.successMessage": "Le pipeline \"{pipelineName}\" a été créé avec succès.", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.createDataViewLabel": "Créer une vue de données", - "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.description": "Ce pipeline est créé en respectant la configuration ci-dessous.", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destinationIndexLabel": "Nom de l'index de destination", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexEmpty": "Entrer un nom d'index de destination valide", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexExists": "Un index portant ce nom existe déjà.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index b913192858af..b720e9f192e7 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -21995,11 +21995,9 @@ "xpack.lens.indexPattern.counterRate.documentation.markdown": "\n増加し続けるカウンターのレートを計算します。この関数は、経時的に単調に増加する種類の測定を含むカウンターメトリックフィールドでのみ結果を生成します。\n値が小さくなる場合は、カウンターリセットであると解釈されます。最も正確な結果を得るには、フィールドの「max`」で「counter_rate」を計算してください。\n\nこの計算はフィルターで定義された別の系列または上位値のディメンションに対して個別に実行されます。\n式で使用されるときには、現在の間隔を使用します。\n\n例:Memcachedサーバーで経時的に受信されたバイトの比率を可視化します。\n`counter_rate(max(memcached.stats.read.bytes))`\n ", "xpack.lens.indexPattern.cumulativeSum.documentation.markdown": "\n経時的なメトリックの累計値を計算し、系列のすべての前の値を各値に追加します。この関数を使用するには、日付ヒストグラムディメンションも構成する必要があります。\n\nこの計算はフィルターで定義された別の系列または上位値のディメンションに対して個別に実行されます。\n\n例:経時的に累積された受信バイト数を可視化します。\n`cumulative_sum(sum(bytes))`\n ", "xpack.lens.indexPattern.differences.documentation.markdown": "\n経時的にメトリックの最後の値に対する差異を計算します。この関数を使用するには、日付ヒストグラムディメンションも構成する必要があります。\n差異ではデータが連続する必要があります。差異を使用するときにデータが空の場合は、データヒストグラム間隔を大きくしてみてください。\n\nこの計算はフィルターで定義された別の系列または上位値のディメンションに対して個別に実行されます。\n\n例:経時的に受信したバイト数の変化を可視化します。\n`differences(sum(bytes))`\n ", - "xpack.lens.indexPattern.interval.documentation.markdown": "\nミリ秒(ms)で指定した、日付ヒストグラムの最小間隔。\n ", "xpack.lens.indexPattern.lastValue.documentation.markdown": "\n最後のドキュメントからフィールドの値を返し、データビューのデフォルト時刻フィールドで並べ替えます。\n\nこの関数はエンティティの最新の状態を取得する際に役立ちます。\n\n例:サーバーAの現在のステータスを取得:\n`last_value(server.status, kql='server.name=\"A\"')`\n ", "xpack.lens.indexPattern.metric.documentation.markdown": "\nフィールドの{metric}を返します。この関数は数値フィールドでのみ動作します。\n\n例:価格の{metric}を取得:\n`{metric}(price)`\n\n例:英国からの注文の価格の{metric}を取得:\n`{metric}(price, kql='location:UK')`\n ", "xpack.lens.indexPattern.movingAverage.documentation.markdown": "\n経時的なメトリックの移動平均を計算します。最後のn番目の値を平均化し、現在の値を計算します。この関数を使用するには、日付ヒストグラムディメンションも構成する必要があります。\nデフォルトウィンドウ値は{defaultValue}です\n\nこの計算はフィルターで定義された別の系列または上位値のディメンションに対して個別に実行されます。\n\n指名パラメーター「window」を取ります。これは現在値の平均計算に含める最後の値の数を指定します。\n\n例:測定の線を平滑化:\n`moving_average(sum(bytes), window=5)`\n ", - "xpack.lens.indexPattern.now.documentation.markdown": "\n ミリ秒(ms)で表された、Kibanaで使用される現在の日時。\n ", "xpack.lens.indexPattern.overall_average.documentation.markdown": "\n現在のグラフの系列のすべてのデータポイントのメトリックの平均を計算します。系列は日付ヒストグラムまたは間隔関数を使用してディメンションによって定義されます。\n上位の値やフィルターなどのデータを分解する他のディメンションは別の系列として処理されます。\n\n日付ヒストグラムまたは間隔関数が現在のグラフで使用されている場合、使用されている関数に関係なく、「overall_average」はすべてのディメンションで平均値を計算します。\n\n例:平均からの収束:\n`sum(bytes) - overall_average(sum(bytes))`\n ", "xpack.lens.indexPattern.overall_max.documentation.markdown": "\n現在のグラフの系列のすべてのデータポイントのメトリックの最大値を計算します。系列は日付ヒストグラムまたは間隔関数を使用してディメンションによって定義されます。\n上位の値やフィルターなどのデータを分解する他のディメンションは別の系列として処理されます。\n\n日付ヒストグラムまたは間隔関数が現在のグラフで使用されている場合、使用されている関数に関係なく、「overall_max」はすべてのディメンションで最大値を計算します。\n\n例:範囲の割合\n`(sum(bytes) - overall_min(sum(bytes))) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))`\n ", "xpack.lens.indexPattern.overall_min.documentation.markdown": "\n現在のグラフの系列のすべてのデータポイントのメトリックの最小値を計算します。系列は日付ヒストグラムまたは間隔関数を使用してディメンションによって定義されます。\n上位の値やフィルターなどのデータを分解する他のディメンションは別の系列として処理されます。\n\n日付ヒストグラムまたは間隔関数が現在のグラフで使用されている場合、使用されている関数に関係なく、「overall_min」はすべてのディメンションで最小値を計算します。\n\n例:範囲の割合\n`(sum(bytes) - overall_min(sum(bytes)) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))`\n ", @@ -22008,7 +22006,6 @@ "xpack.lens.indexPattern.percentileRanks.documentation.markdown": "\n特定の値未満の値の割合が返されます。たとえば、値が観察された値の95%以上の場合、95パーセンタイルランクであるとされます。\n\n例:100未満の値のパーセンタイルを取得します。\n`percentile_rank(bytes, value=100)`\n ", "xpack.lens.indexPattern.standardDeviation.documentation.markdown": "\nフィールドの分散または散布度が返されます。この関数は数値フィールドでのみ動作します。\n\n#### 例\n\n価格の標準偏差を取得するには、standard_deviation(price)を使用します。\n\n英国からの注文書の価格の分散を取得するには、square(standard_deviation(price, kql='location:UK'))を使用します。\n ", "xpack.lens.indexPattern.time_scale.documentation.markdown": "\n\nこの高度な機能は、特定の期間に対してカウントと合計を正規化する際に役立ちます。すでに特定の期間に対して正規化され、保存されたメトリックとの統合が可能です。\n\nこの機能は、現在のグラフで日付ヒストグラム関数が使用されている場合にのみ使用できます。\n\n例:すでに正規化されているメトリックを、正規化が必要な別のメトリックと比較した比率。\n`normalize_by_unit(counter_rate(max(system.diskio.write.bytes)), unit='s') / last_value(apache.status.bytes_per_second)`\n ", - "xpack.lens.indexPattern.timeRange.documentation.markdown": "\nミリ秒(ms)で指定された時間範囲。\n ", "xpack.lens.AggBasedLabel": "集約に基づく可視化", "xpack.lens.app.addToLibrary": "ライブラリに保存", "xpack.lens.app.cancel": "キャンセル", @@ -26823,7 +26820,6 @@ "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.failureMessage": "'{pipelineName}'を作成できません。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.successMessage": "'{pipelineName}'は正常に作成されました。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.createDataViewLabel": "データビューを作成", - "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.description": "このパイプラインは以下の構成で作成されます。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destinationIndexLabel": "デスティネーションインデックス名", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexEmpty": "有効なデスティネーションインデックス名を入力", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexExists": "この名前のインデックスがすでに存在します。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index d14cc0cc35d0..480765f1543a 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -21994,11 +21994,9 @@ "xpack.lens.indexPattern.counterRate.documentation.markdown": "\n计算不断增大的计数器的速率。此函数将仅基于计数器指标字段生成有帮助的结果,包括随着时间的推移度量某种单调递增。\n如果值确实变小,则其将此解析为计数器重置。要获取很精确的结果,应基于字段的 `max`计算 `counter_rate`。\n\n筛选或排名最前值维度定义的不同序列将分别执行此计算。\n用于公式中时,其使用当前时间间隔。\n\n例如:可视化随着时间的推移 Memcached 服务器接收的字节速率:\n`counter_rate(max(memcached.stats.read.bytes))`\n ", "xpack.lens.indexPattern.cumulativeSum.documentation.markdown": "\n计算随着时间的推移指标的累计和,即序列的所有以前值相加得出每个值。要使用此函数,您还需要配置 Date Histogram 维度。\n\n筛选或排名最前值维度定义的不同序列将分别执行此计算。\n\n例如:可视化随着时间的推移累计接收的字节:\n`cumulative_sum(sum(bytes))`\n ", "xpack.lens.indexPattern.differences.documentation.markdown": "\n计算随着时间的推移与指标最后一个值的差异。要使用此函数,您还需要配置 Date Histogram 维度。\n差异需要数据是顺序的。如果使用差异时数据为空,请尝试增加 Date Histogram 时间间隔。\n\n筛选或排名最前值维度定义的不同序列将分别执行此计算。\n\n例如:可视化随着时间的推移接收的字节的变化:\n`differences(sum(bytes))`\n ", - "xpack.lens.indexPattern.interval.documentation.markdown": "\nDate Histogram 的指定最小时间间隔,单位为毫秒 (ms)。\n ", "xpack.lens.indexPattern.lastValue.documentation.markdown": "\n返回最后一个文档的字段值,按数据视图的默认时间字段排序。\n\n此函数用于检索实体的最新状态。\n\n例如:获取服务器 A 的当前状态:\n`last_value(server.status, kql='server.name=\"A\"')`\n ", "xpack.lens.indexPattern.metric.documentation.markdown": "\n返回字段的 {metric}。此函数仅适用于数字字段。\n\n例如:获取价格的 {metric}:\n`{metric}(price)`\n\n例如:获取英国订单价格的 {metric}:\n`{metric}(price, kql='location:UK')`\n ", "xpack.lens.indexPattern.movingAverage.documentation.markdown": "\n计算随着时间的推移指标的移动平均值,即计算最后 n 个值的平均值以得出当前值。要使用此函数,您还需要配置 Date Histogram 维度。\n默认窗口值为 {defaultValue}。\n\n筛选或排名最前值维度定义的不同序列将分别执行此计算。\n\n取已命名参数 `window`,其指定当前值的平均计算中要包括过去多少个值。\n\n例如:平滑度量线:\n`moving_average(sum(bytes), window=5)`\n ", - "xpack.lens.indexPattern.now.documentation.markdown": "\n Kibana 中使用的当前时刻,用毫秒 (ms) 表示。\n ", "xpack.lens.indexPattern.overall_average.documentation.markdown": "\n为当前图表中序列的所有数据点计算指标的平均值。序列由维度使用 Date Histogram 或时间间隔函数定义。\n分解数据的其他维度,如排名最前值或筛选,将被视为不同的序列。\n\n如果当前图表未使用 Date Histogram 或时间间隔函数,则无论使用什么函数,`overall_average` 都将计算所有维度的平均值\n\n例如:与平均值的偏离:\n`sum(bytes) - overall_average(sum(bytes))`\n ", "xpack.lens.indexPattern.overall_max.documentation.markdown": "\n为当前图表中序列的所有数据点计算指标的最大值。序列由维度使用 Date Histogram 或时间间隔函数定义。\n分解数据的其他维度,如排名最前值或筛选,将被视为不同的序列。\n\n如果当前图表未使用 Date Histogram 或内部函数,则无论使用什么函数,`overall_max` 都将计算所有维度的最大值\n\n例如:范围的百分比\n`(sum(bytes) - overall_min(sum(bytes))) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))`\n ", "xpack.lens.indexPattern.overall_min.documentation.markdown": "\n为当前图表中序列的所有数据点计算指标的最小值。序列由维度使用 Date Histogram 或时间间隔函数定义。\n分解数据的其他维度,如排名最前值或筛选,将被视为不同的序列。\n\n如果当前图表未使用 Date Histogram 或时间间隔函数,则无论使用什么函数,`overall_min` 都将计算所有维度的最小值\n\n例如:范围的百分比\n`(sum(bytes) - overall_min(sum(bytes)) / (overall_max(sum(bytes)) - overall_min(sum(bytes)))`\n ", @@ -22007,7 +22005,6 @@ "xpack.lens.indexPattern.percentileRanks.documentation.markdown": "\n返回小于某个值的值的百分比。例如,如果某个值大于或等于 95% 的观察值,则称它处于第 95 个百分位等级\n\n例如:获取小于 100 的值的百分比:\n`percentile_rank(bytes, value=100)`\n ", "xpack.lens.indexPattern.standardDeviation.documentation.markdown": "\n返回字段的变量或差量数量。此函数仅适用于数字字段。\n\n#### 示例\n\n要获取价格的标准偏差,请使用 `standard_deviation(price)`。\n\n要获取来自英国的订单的价格方差,请使用 `square(standard_deviation(price, kql='location:UK'))`。\n ", "xpack.lens.indexPattern.time_scale.documentation.markdown": "\n\n此高级函数用于将计数和总和标准化为特定时间间隔。它允许集成所存储的已标准化为特定时间间隔的指标。\n\n此函数只能在当前图表中使用了日期直方图函数时使用。\n\n例如:将已标准化指标与其他需要标准化的指标进行比较的比率。\n`normalize_by_unit(counter_rate(max(system.diskio.write.bytes)), unit='s') / last_value(apache.status.bytes_per_second)`\n ", - "xpack.lens.indexPattern.timeRange.documentation.markdown": "\n指定的时间范围,单位为毫秒 (ms)。\n ", "xpack.lens.AggBasedLabel": "基于聚合的可视化", "xpack.lens.app.addToLibrary": "保存到库", "xpack.lens.app.cancel": "取消", @@ -26821,7 +26818,6 @@ "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.failureMessage": "无法创建“{pipelineName}”。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.create.successMessage": "已成功创建“{pipelineName}”。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.createDataViewLabel": "创建数据视图", - "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.description": "将使用以下配置创建此管道。", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destinationIndexLabel": "目标索引名称", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexEmpty": "输入有效的目标索引", "xpack.ml.trainedModels.content.indices.pipelines.addInferencePipelineModal.steps.review.destIndexExists": "已存在具有此名称的索引。", diff --git a/x-pack/plugins/ux/e2e/journeys/inp.journey.ts b/x-pack/plugins/ux/e2e/journeys/inp.journey.ts index 800ae3e38b3f..8422dacf0378 100644 --- a/x-pack/plugins/ux/e2e/journeys/inp.journey.ts +++ b/x-pack/plugins/ux/e2e/journeys/inp.journey.ts @@ -59,7 +59,7 @@ journey('INP', async ({ page, params }) => { }); step('Check INP Values', async () => { - expect(await page.$('text=Interaction to Next Paint')); + expect(await page.$('text=Interaction to next paint')); await page.waitForSelector('[data-test-subj=inp-core-vital] > .euiTitle'); await page.waitForSelector('text=381 ms'); }); diff --git a/x-pack/test/functional/apps/infra/node_details.ts b/x-pack/test/functional/apps/infra/node_details.ts index e4cfdaae3d22..c4bbbbfc2d09 100644 --- a/x-pack/test/functional/apps/infra/node_details.ts +++ b/x-pack/test/functional/apps/infra/node_details.ts @@ -7,6 +7,7 @@ import moment from 'moment'; import expect from '@kbn/expect'; +import { enableInfrastructureProfilingIntegration } from '@kbn/observability-plugin/common'; import { FtrProviderContext } from '../../ftr_provider_context'; import { DATES, NODE_DETAILS_PATH, DATE_PICKER_FORMAT } from './constants'; @@ -67,6 +68,12 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await browser.refresh(); }; + const setInfrastructureProfilingIntegrationUiSetting = async (value: boolean = true) => { + await kibanaServer.uiSettings.update({ [enableInfrastructureProfilingIntegration]: value }); + await browser.refresh(); + await pageObjects.header.waitUntilLoadingHasFinished(); + }; + describe('Node Details', () => { describe('#With Asset Details', () => { before(async () => { @@ -190,6 +197,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.header.waitUntilLoadingHasFinished(); await pageObjects.assetDetails.overviewAlertsTitleExists(); }); + + it('shows the CPU Profiling prompt if UI setting for Profiling integration is enabled', async () => { + await setInfrastructureProfilingIntegrationUiSetting(true); + await pageObjects.assetDetails.cpuProfilingPromptExists(); + }); + + it('hides the CPU Profiling prompt if UI setting for Profiling integration is disabled', async () => { + await setInfrastructureProfilingIntegrationUiSetting(false); + await pageObjects.assetDetails.cpuProfilingPromptMissing(); + }); }); describe('Metadata Tab', () => { @@ -312,6 +329,18 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); + describe('Profiling tab', () => { + it('shows the Profiling tab if Profiling integration UI setting is enabled', async () => { + await setInfrastructureProfilingIntegrationUiSetting(true); + await pageObjects.assetDetails.profilingTabExists(); + }); + + it('hides the Profiling tab if Profiling integration UI setting is disabled', async () => { + await setInfrastructureProfilingIntegrationUiSetting(false); + await pageObjects.assetDetails.profilingTabMissing(); + }); + }); + describe('Host with alerts and no processes', () => { before(async () => { await navigateToNodeDetails('demo-stack-mysql-01', 'demo-stack-mysql-01'); diff --git a/x-pack/test/functional/page_objects/asset_details.ts b/x-pack/test/functional/page_objects/asset_details.ts index ef4e8967e692..00274c6af565 100644 --- a/x-pack/test/functional/page_objects/asset_details.ts +++ b/x-pack/test/functional/page_objects/asset_details.ts @@ -62,6 +62,22 @@ export function AssetDetailsProvider({ getService }: FtrProviderContext) { return testSubjects.click('infraAssetDetailsMetadataShowAllButton'); }, + async cpuProfilingPromptExists() { + return await testSubjects.existOrFail('infraAssetDetailsCPUProfilingPrompt'); + }, + + async cpuProfilingPromptMissing() { + return await testSubjects.missingOrFail('infraAssetDetailsCPUProfilingPrompt'); + }, + + async profilingTabExists() { + return await testSubjects.existOrFail('infraAssetDetailsProfilingTab'); + }, + + async profilingTabMissing() { + return await testSubjects.missingOrFail('infraAssetDetailsProfilingTab'); + }, + // Metadata async clickMetadataTab() { return testSubjects.click('infraAssetDetailsMetadataTab'); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/sourcerer/sourcerer_timeline.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/sourcerer/sourcerer_timeline.cy.ts index 8e7be3970440..30e1e39b4cd3 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/sourcerer/sourcerer_timeline.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/sourcerer/sourcerer_timeline.cy.ts @@ -37,10 +37,9 @@ import { getTimeline, getTimelineModifiedSourcerer } from '../../../../objects/t import { closeTimeline, openTimelineById } from '../../../../tasks/timeline'; const siemDataViewTitle = 'Security Default Data View'; -const dataViews = ['auditbeat-*,fakebeat-*', 'auditbeat-*,*beat*,siem-read*,.kibana*,fakebeat-*']; +const dataViews = ['logs-*', 'metrics-*', '.kibana-event-log-*']; -// TODO: https://github.com/elastic/kibana/issues/161539 -describe.skip('Timeline scope', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { +describe('Timeline scope', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { beforeEach(() => { cy.clearLocalStorage(); login(); @@ -78,12 +77,8 @@ describe.skip('Timeline scope', { tags: ['@ess', '@serverless', '@brokenInServer it('shows modified badge when index patterns change and removes when reset', () => { openTimelineUsingToggle(); openSourcerer('timeline'); - openDataViewSelection(); - cy.get(SOURCERER.selectListOption).contains(dataViews[1]).click(); - isDataViewSelection(dataViews[1]); openAdvancedSettings(); - const patterns = dataViews[1].split(','); - deselectSourcererOptions([patterns[0]]); + deselectSourcererOptions(['.alerts-security.alerts-default']); saveSourcerer(); cy.get(SOURCERER.badgeModified).should(`exist`); openSourcerer('timeline'); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts index 7e5e19b464c4..0f24575d8a2a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts @@ -82,7 +82,7 @@ describe('Alert details flyout', { tags: ['@ess', '@serverless'] }, () => { cy.task('esArchiverUnload', 'unmapped_fields'); }); - it('should display user and system defined highlighted fields', () => { + it.skip('should display user and system defined highlighted fields', () => { cy.get(SUMMARY_VIEW) .should('be.visible') .and('contain.text', 'event.kind') @@ -161,7 +161,7 @@ describe('Alert details flyout', { tags: ['@ess', '@serverless'] }, () => { cy.url().should('not.include', 'eventFlyout='); }); - it('should open the alert flyout when the page is refreshed', () => { + it.skip('should open the alert flyout when the page is refreshed', () => { cy.get(OVERVIEW_RULE).should('be.visible'); cy.reload(); cy.get(OVERVIEW_RULE).should('be.visible'); @@ -172,7 +172,7 @@ describe('Alert details flyout', { tags: ['@ess', '@serverless'] }, () => { cy.get(COPY_ALERT_FLYOUT_LINK).should('be.visible'); }); - it('should have the `kibana.alert.url` field set', () => { + it.skip('should have the `kibana.alert.url` field set', () => { openTable(); filterBy('kibana.alert.url'); cy.get('[data-test-subj="formatted-field-kibana.alert.url"]').should( diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts index 2dc4a360134b..8a49b4eb0206 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts @@ -158,7 +158,8 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, () }); }); }); - context('Closing alerts', () => { + // FLAKY: https://github.com/elastic/kibana/issues/173597 + context.skip('Closing alerts', () => { beforeEach(() => { login(); deleteAlertsAndRules(); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/full_screen.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/full_screen.cy.ts index bf69b711a7ae..ea9742a9c082 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/full_screen.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/full_screen.cy.ts @@ -18,7 +18,7 @@ import { populateTimeline } from '../../../tasks/timeline'; import { hostsUrl } from '../../../urls/navigation'; -describe('Toggle full screen', { tags: ['@ess', '@serverless'] }, () => { +describe.skip('Toggle full screen', { tags: ['@ess', '@serverless'] }, () => { beforeEach(() => { login(); visitWithTimeRange(hostsUrl('allHosts')); diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts index f1edd7a45800..e4d9b91e579b 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_list.ts @@ -85,7 +85,9 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { return tableData; }; - describe('endpoint list', function () { + // FLAKY: https://github.com/elastic/kibana/issues/170357 + // FLAKY: https://github.com/elastic/kibana/issues/173670 + describe.skip('endpoint list', function () { targetTags(this, ['@ess', '@serverless']); let indexedData: IndexedHostsAndAlertsResponse; diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts index 802cbf8be16f..e7c58f6f27e6 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/artifact_entries_list.ts @@ -51,7 +51,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { .set('kbn-xsrf', 'true'); }; - describe('For each artifact list under management', function () { + // Flaky: https://github.com/elastic/kibana/issues/173682 + // FLAKY: https://github.com/elastic/kibana/issues/173681 + // FLAKY: https://github.com/elastic/kibana/issues/173682 + describe.skip('For each artifact list under management', function () { targetTags(this, ['@ess', '@serverless']); this.timeout(60_000 * 5); diff --git a/x-pack/test/security_solution_endpoint/apps/integrations/policy_details.ts b/x-pack/test/security_solution_endpoint/apps/integrations/policy_details.ts index b48c64b5e9dd..a2b1feaabd7c 100644 --- a/x-pack/test/security_solution_endpoint/apps/integrations/policy_details.ts +++ b/x-pack/test/security_solution_endpoint/apps/integrations/policy_details.ts @@ -28,7 +28,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const endpointTestResources = getService('endpointTestResources'); const retry = getService('retry'); - describe('When on the Endpoint Policy Details Page', function () { + // FLAKY: https://github.com/elastic/kibana/issues/171653 + // FLAKY: https://github.com/elastic/kibana/issues/171654 + describe.skip('When on the Endpoint Policy Details Page', function () { targetTags(this, ['@ess', '@serverless']); let indexedData: IndexedHostsAndAlertsResponse; diff --git a/x-pack/test/security_solution_endpoint_api_int/apis/endpoint_response_actions/execute.ts b/x-pack/test/security_solution_endpoint_api_int/apis/endpoint_response_actions/execute.ts index f904539dae23..401ff25fee62 100644 --- a/x-pack/test/security_solution_endpoint_api_int/apis/endpoint_response_actions/execute.ts +++ b/x-pack/test/security_solution_endpoint_api_int/apis/endpoint_response_actions/execute.ts @@ -16,7 +16,9 @@ export default function ({ getService }: FtrProviderContext) { const supertestWithoutAuth = getService('supertestWithoutAuth'); const endpointTestResources = getService('endpointTestResources'); - describe('Endpoint `execute` response action', function () { + // FLAKY: https://github.com/elastic/kibana/issues/171666 + // FLAKY: https://github.com/elastic/kibana/issues/171667 + describe.skip('Endpoint `execute` response action', function () { targetTags(this, ['@ess', '@serverless']); let indexedData: IndexedHostsAndAlertsResponse; diff --git a/x-pack/test_serverless/api_integration/test_suites/observability/burn_rate_rule/burn_rate_rule.ts b/x-pack/test_serverless/api_integration/test_suites/observability/burn_rate_rule/burn_rate_rule.ts index 7d863d6cdbc6..0d2f3a5958d4 100644 --- a/x-pack/test_serverless/api_integration/test_suites/observability/burn_rate_rule/burn_rate_rule.ts +++ b/x-pack/test_serverless/api_integration/test_suites/observability/burn_rate_rule/burn_rate_rule.ts @@ -70,7 +70,8 @@ export default function ({ getService }: FtrProviderContext) { await cleanup({ esClient, logger }); }); - describe('Rule creation', () => { + // FLAKY: https://github.com/elastic/kibana/issues/173653 + describe.skip('Rule creation', () => { it('creates rule successfully', async () => { actionId = await alertingApi.createIndexConnector({ name: 'Index Connector: Slo Burn rate API test', diff --git a/x-pack/test_serverless/functional/page_objects/index.ts b/x-pack/test_serverless/functional/page_objects/index.ts index f9626a88b310..541c7dce86ce 100644 --- a/x-pack/test_serverless/functional/page_objects/index.ts +++ b/x-pack/test_serverless/functional/page_objects/index.ts @@ -18,6 +18,7 @@ import { SvlSearchLandingPageProvider } from './svl_search_landing_page'; import { SvlSecLandingPageProvider } from './svl_sec_landing_page'; import { SvlTriggersActionsPageProvider } from './svl_triggers_actions_ui_page'; import { SvlRuleDetailsPageProvider } from './svl_rule_details_ui_page'; +import { SvlSearchConnectorsPageProvider } from './svl_search_connectors_page'; export const pageObjects = { ...xpackFunctionalPageObjects, @@ -28,6 +29,7 @@ export const pageObjects = { svlObltOnboardingPage: SvlObltOnboardingPageProvider, SvlObltOnboardingStreamLogFilePage: SvlObltOnboardingStreamLogFilePageProvider, svlObltOverviewPage: SvlObltOverviewPageProvider, + svlSearchConnectorsPage: SvlSearchConnectorsPageProvider, svlSearchLandingPage: SvlSearchLandingPageProvider, svlSecLandingPage: SvlSecLandingPageProvider, svlTriggersActionsUI: SvlTriggersActionsPageProvider, diff --git a/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts b/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts new file mode 100644 index 000000000000..f610251bf071 --- /dev/null +++ b/x-pack/test_serverless/functional/page_objects/svl_search_connectors_page.ts @@ -0,0 +1,160 @@ +/* + * 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 expect from '@kbn/expect'; + +import { FtrProviderContext } from '../ftr_provider_context'; +export function SvlSearchConnectorsPageProvider({ getService }: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const browser = getService('browser'); + const retry = getService('retry'); + return { + connectorConfigurationPage: { + async createConnector() { + await testSubjects.click('serverlessSearchConnectorsOverviewCreateConnectorButton'); + await testSubjects.existOrFail('serverlessSearchEditConnectorButton'); + await testSubjects.exists('serverlessSearchConnectorLinkElasticsearchRunWithDockerButton'); + await testSubjects.exists('serverlessSearchConnectorLinkElasticsearchRunFromSourceButton'); + }, + async editDescription(description: string) { + await testSubjects.existOrFail('serverlessSearchEditDescriptionButton'); + await testSubjects.click('serverlessSearchEditDescriptionButton'); + await testSubjects.exists('serverlessSearchEditDescriptionFieldText'); + await testSubjects.existOrFail('serverlessSearchSaveDescriptionButton'); + await testSubjects.existOrFail('serverlessSearchCancelDescriptionButton'); + await testSubjects.setValue('serverlessSearchEditDescriptionFieldText', description); + await testSubjects.click('serverlessSearchSaveDescriptionButton'); + await testSubjects.exists('serverlessSearchConnectorDescription'); + expect(await testSubjects.getVisibleText('serverlessSearchConnectorDescription')).to.be( + description + ); + }, + async editName(name: string) { + await testSubjects.existOrFail('serverlessSearchEditNameButton'); + await testSubjects.click('serverlessSearchEditNameButton'); + await testSubjects.existOrFail('serverlessSearchEditNameFieldText'); + await testSubjects.existOrFail('serverlessSearchSaveNameButton'); + await testSubjects.existOrFail('serverlessSearchCancelNameButton'); + await testSubjects.setValue('serverlessSearchEditNameFieldText', name); + await testSubjects.click('serverlessSearchSaveNameButton'); + await testSubjects.exists('serverlessSearchConnectorName'); + expect(await testSubjects.getVisibleText('serverlessSearchConnectorName')).to.be(name); + }, + async editType(type: string) { + await testSubjects.existOrFail('serverlessSearchEditConnectorTypeLabel'); + await testSubjects.existOrFail('serverlessSearchEditConnectorTypeChoices'); + await testSubjects.click('serverlessSearchEditConnectorTypeChoices'); + await testSubjects.exists('serverlessSearchConnectorServiceType-zoom'); + await testSubjects.click(`serverlessSearchConnectorServiceType-${type}`); + await testSubjects.existOrFail('serverlessSearchConnectorServiceType-zoom'); + }, + async expectConnectorIdToMatchUrl(connectorId: string) { + expect(await browser.getCurrentUrl()).contain(`/app/connectors/${connectorId}`); + }, + async getConnectorId() { + return await testSubjects.getVisibleText('serverlessSearchConnectorConnectorId'); + }, + }, + connectorOverviewPage: { + async changeSearchBarTableSelectValue(option: string) { + await testSubjects.existOrFail('serverlessSearchConnectorsTableSelect'); + await testSubjects.setValue('serverlessSearchConnectorsTableSelect', option); + }, + async connectorNameExists(connectorName: string) { + const connectorsList = await this.getConnectorsList(); + return Boolean(connectorsList.find((name) => name === connectorName)); + }, + async confirmDeleteConnectorModalComponentsExists() { + await testSubjects.existOrFail('serverlessSearchDeleteConnectorModalFieldText'); + await testSubjects.existOrFail('confirmModalConfirmButton'); + await testSubjects.existOrFail('confirmModalCancelButton'); + }, + async confirmConnectorTableIsDisappearedAfterDelete() { + await retry.waitForWithTimeout('delete modal to disappear', 5000, () => + testSubjects + .missingOrFail('confirmModalConfirmButton') + .then(() => true) + .catch(() => false) + ); + browser.refresh(); + this.expectConnectorTableToHaveNoItems(); + }, + async expectConnectorOverviewPageComponentsToExist() { + await testSubjects.existOrFail('serverlessSearchConnectorsTitle'); + await testSubjects.existOrFail('serverlessSearchConnectorsOverviewElasticConnectorsLink'); + await testSubjects.exists('serverlessSearchEmptyConnectorsPromptCreateConnectorButton'); + await testSubjects.existOrFail('serverlessSearchConnectorsOverviewCreateConnectorButton'); + }, + async expectConnectorTableToExist() { + await testSubjects.existOrFail('serverlessSearchConnectorTable'); + }, + async expectConnectorTableToHaveNoItems(timeout?: number) { + await testSubjects.missingOrFail('serverlessSearchColumnsLink', { timeout }); + }, + async expectDeleteConnectorButtonExist() { + await testSubjects.existOrFail('serverlessSearchDeleteConnectorModalActionButton'); + }, + async expectSearchBarToExist() { + await testSubjects.existOrFail('serverlessSearchConnectorsTableSearchBar'); + }, + + async deleteConnectorWithCorrectName(connectorNameToBeDeleted: string) { + const fieldText = await testSubjects.find('serverlessSearchDeleteConnectorModalFieldText'); + await fieldText.clearValue(); + await retry.try(async () => { + expect( + await ( + await testSubjects.find('serverlessSearchDeleteConnectorModalFieldText') + ).getAttribute('value') + ).to.be(''); + }); + await retry.try(async () => { + await fieldText.type(connectorNameToBeDeleted); + }); + const isEnabled = await testSubjects.isEnabled('confirmModalConfirmButton'); + expect(isEnabled).to.be(true); + await retry.try(async () => await testSubjects.click('confirmModalConfirmButton')); + }, + async deleteConnectorIncorrectName(incorrectName: string) { + const fieldText = await testSubjects.find('serverlessSearchDeleteConnectorModalFieldText'); + await fieldText.clearValue(); + await retry.try(async () => { + await fieldText.type(incorrectName); + }); + const isEnabled = await testSubjects.isEnabled('confirmModalConfirmButton'); + expect(isEnabled).to.be(false); + }, + async getConnectorFromConnectorTable(connectorName: string) { + await testSubjects.getAttribute('serverlessSearchColumnsLink', connectorName); + }, + async getConnectorsList() { + const rows = await ( + await testSubjects.find('serverlessSearchConnectorTable') + ).findAllByCssSelector('.euiTableRow'); + return await Promise.all( + rows.map(async (connector) => { + return await ( + await connector.findByTestSubject('serverlessSearchColumnsLink') + ).getVisibleText(); + }) + ); + }, + async openDeleteConnectorModal() { + await retry.try( + async () => await testSubjects.click('serverlessSearchDeleteConnectorModalActionButton') + ); + await testSubjects.exists('confirmModalBodyText'); + expect(await testSubjects.getVisibleText('confirmModalBodyText')).to.be( + 'This action cannot be undone. Please type my-connector to confirm.\nConnector name' + ); + }, + async setSearchBarValue(value: string) { + await testSubjects.setValue('serverlessSearchConnectorsTableSearchBar', value); + await testSubjects.pressEnter('serverlessSearchConnectorsTableSearchBar'); + }, + }, + }; +} diff --git a/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts b/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts new file mode 100644 index 000000000000..d5fedb8c5458 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/search/connectors/connectors_overview.ts @@ -0,0 +1,112 @@ +/* + * 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 { FtrProviderContext } from '../../../ftr_provider_context'; +const TEST_CONNECTOR_NAME = 'my-connector'; +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const pageObjects = getPageObjects([ + 'svlCommonPage', + 'svlCommonNavigation', + 'common', + 'svlSearchConnectorsPage', + ]); + const testSubjects = getService('testSubjects'); + const browser = getService('browser'); + describe('connectors', function () { + before(async () => { + await pageObjects.svlCommonPage.login(); + await pageObjects.svlCommonNavigation.sidenav.clickLink({ + deepLinkId: 'serverlessConnectors', + }); + }); + + after(async () => { + await pageObjects.svlCommonPage.forceLogout(); + }); + + it('Connector app is loaded and has no connectors', async () => { + await pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectConnectorOverviewPageComponentsToExist(); + }); + describe('create and configure connector', async () => { + it('create connector and confirm connector configuration page is loaded', async () => { + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.createConnector(); + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.expectConnectorIdToMatchUrl( + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.getConnectorId() + ); + }); + it('edit description', async () => { + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.editDescription( + 'test description' + ); + }); + it('edit name', async () => { + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.editName( + TEST_CONNECTOR_NAME + ); + }); + it('edit type', async () => { + await pageObjects.svlSearchConnectorsPage.connectorConfigurationPage.editType('zoom'); + }); + it('confirm connector is created', async () => { + await pageObjects.svlCommonNavigation.sidenav.clickLink({ + deepLinkId: 'serverlessConnectors', + }); + browser.refresh(); + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectConnectorTableToExist(); + }); + }); + describe('connector table', async () => { + it('confirm searchBar to exist', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectSearchBarToExist(); + }); + + it('searchBar and select filter connector table', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.getConnectorFromConnectorTable( + TEST_CONNECTOR_NAME + ); + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.setSearchBarValue( + TEST_CONNECTOR_NAME + ); + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.connectorNameExists( + TEST_CONNECTOR_NAME + ); + + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.changeSearchBarTableSelectValue( + 'Type' + ); + + await testSubjects.click('clearSearchButton'); + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.setSearchBarValue('confluence'); + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectConnectorTableToHaveNoItems(); + await testSubjects.click('clearSearchButton'); + }); + }); + describe('delete connector', async () => { + it('delete connector button exist in table', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.expectDeleteConnectorButtonExist(); + }); + it('open delete connector modal', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.openDeleteConnectorModal(); + }); + it('delete connector button open modal', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.confirmDeleteConnectorModalComponentsExists(); + }); + it('delete connector field is disabled if field name does not match connector name', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.deleteConnectorIncorrectName( + 'invalid' + ); + }); + it('delete connector button deletes connector', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.deleteConnectorWithCorrectName( + TEST_CONNECTOR_NAME + ); + }); + it('confirm connector table is disappeared after delete ', async () => { + pageObjects.svlSearchConnectorsPage.connectorOverviewPage.confirmConnectorTableIsDisappearedAfterDelete(); + }); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/search/index.ts b/x-pack/test_serverless/functional/test_suites/search/index.ts index 6d0987d0292c..8b753e58005f 100644 --- a/x-pack/test_serverless/functional/test_suites/search/index.ts +++ b/x-pack/test_serverless/functional/test_suites/search/index.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('serverless search UI', function () { loadTestFile(require.resolve('./landing_page')); + loadTestFile(require.resolve('./connectors/connectors_overview')); loadTestFile(require.resolve('./default_dataview')); loadTestFile(require.resolve('./navigation')); loadTestFile(require.resolve('./cases/attachment_framework')); diff --git a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/compliance_dashboard.ts b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/compliance_dashboard.ts index 54fa5a725e29..6a6734b8f3fe 100644 --- a/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/compliance_dashboard.ts +++ b/x-pack/test_serverless/functional/test_suites/security/ftr/cloud_security_posture/compliance_dashboard.ts @@ -56,7 +56,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await pageObjects.svlCommonPage.forceLogout(); }); - describe('Kubernetes Dashboard', () => { + // FLAKY: https://github.com/elastic/kibana/issues/168904 + describe.skip('Kubernetes Dashboard', () => { it('displays accurate summary compliance score', async () => { const scoreElement = await dashboard.getKubernetesComplianceScore();