diff --git a/package.json b/package.json index fd96e0efd9596..d0bee83226aa3 100644 --- a/package.json +++ b/package.json @@ -1261,7 +1261,7 @@ "rxjs": "^7.8.1", "safe-squel": "^5.12.5", "seedrandom": "^3.0.5", - "semver": "^7.7.0", + "semver": "^7.7.1", "set-value": "^4.1.0", "snakecase-keys": "^8.0.0", "source-map-support": "^0.5.19", diff --git a/packages/kbn-babel-preset/styled_components_files.js b/packages/kbn-babel-preset/styled_components_files.js index 572be52c3ad17..6c3bf430fd17f 100644 --- a/packages/kbn-babel-preset/styled_components_files.js +++ b/packages/kbn-babel-preset/styled_components_files.js @@ -405,26 +405,6 @@ module.exports = { /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]exceptions[\/\\]pages[\/\\]shared_lists[\/\\]index.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]components[\/\\]paginated_table[\/\\]index.test.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]components[\/\\]paginated_table[\/\\]index.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]components[\/\\]stat_items[\/\\]utils.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]hosts[\/\\]pages[\/\\]display.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]hosts[\/\\]pages[\/\\]hosts.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]arrows[\/\\]index.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]embeddables[\/\\]embeddable.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]embeddables[\/\\]embedded_map.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]embeddables[\/\\]map_tool_tip[\/\\]line_tool_tip_content.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]embeddables[\/\\]map_tool_tip[\/\\]tooltip_footer.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]flow_target_select_connected[\/\\]index.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]country_flag.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]geo_fields.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]index.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]ip_with_port.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]label.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]network.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]components[\/\\]source_destination[\/\\]source_destination_arrows.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]pages[\/\\]navigation[\/\\]conditional_flex_group.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]pages[\/\\]navigation[\/\\]network_routes_loading.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]network[\/\\]pages[\/\\]network.tsx/, - /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]explore[\/\\]users[\/\\]pages[\/\\]users.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]flyout[\/\\]document_details[\/\\]left[\/\\]components[\/\\]investigation_guide_view.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]flyout[\/\\]document_details[\/\\]left[\/\\]components[\/\\]response_details.tsx/, /x-pack[\/\\]solutions[\/\\]security[\/\\]plugins[\/\\]security_solution[\/\\]public[\/\\]flyout[\/\\]document_details[\/\\]left[\/\\]components[\/\\]threat_details_view_enrichment_button_content.tsx/, diff --git a/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.test.tsx b/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.test.tsx new file mode 100644 index 0000000000000..ef4170b7730b9 --- /dev/null +++ b/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.test.tsx @@ -0,0 +1,87 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React from 'react'; +import { ConfigurationFormItems } from './configuration_form_items'; +import { render, screen } from '@testing-library/react'; +import { FieldType } from '../../types/dynamic_config/types'; + +describe('ConfigurationFormItems', () => { + const mockItems = [ + { + key: 'model_id', + isValid: true, + label: 'Model ID', + description: 'Enter model ID', + validationErrors: [], + required: true, + sensitive: false, + value: '', + default_value: '', + updatable: false, + type: FieldType.STRING, + supported_task_types: ['text_embedding'], + }, + ]; + + const defaultProps = { + isLoading: false, + items: mockItems, + setConfigEntry: jest.fn(), + }; + + it('renders link when isInternalProvider is true and key is model_id', () => { + render(); + + const link = screen.getByRole('link', { name: /looking for elasticsearch model ids/i }); + expect(link).toBeInTheDocument(); + expect(link).toHaveAttribute( + 'href', + 'https://www.elastic.co/guide/en/elasticsearch/reference/current/inference-apis.html#default-enpoints' + ); + + expect(screen.getByTestId('model_id-input')).toBeInTheDocument(); + }); + + it('does not renders link when isInternalProvider is true and key is model_id', () => { + const numAllocations = [ + { + key: 'num_allocations', + isValid: true, + label: 'Number Allocations', + description: + 'The total number of allocations this model is assigned across machine learning nodes.', + validationErrors: [], + required: true, + sensitive: false, + value: '', + default_value: 1, + updatable: true, + type: FieldType.INTEGER, + supported_task_types: ['text_embedding'], + }, + ]; + + const props = { + isLoading: false, + items: numAllocations, + setConfigEntry: jest.fn(), + }; + + render(); + + const link = screen.queryByRole('link', { name: /looking for elasticsearch model ids/i }); + expect(link).not.toBeInTheDocument(); + }); + + it('does not renders link when isInternalProvider is false and key is model_id', () => { + render(); + + const link = screen.queryByRole('link', { name: /looking for elasticsearch model ids/i }); + expect(link).not.toBeInTheDocument(); + }); +}); diff --git a/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.tsx b/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.tsx index 7993b8dff420c..3b6bcbd6169aa 100644 --- a/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.tsx +++ b/x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/src/components/configuration/configuration_form_items.tsx @@ -12,6 +12,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiFormRow, + EuiLink, EuiSpacer, EuiText, } from '@elastic/eui'; @@ -27,6 +28,7 @@ interface ConfigurationFormItemsProps { direction?: 'column' | 'row' | 'rowReverse' | 'columnReverse' | undefined; isEdit?: boolean; isPreconfigured?: boolean; + isInternalProvider?: boolean; } export const ConfigurationFormItems: React.FC = ({ @@ -36,6 +38,7 @@ export const ConfigurationFormItems: React.FC = ({ direction, isEdit, isPreconfigured, + isInternalProvider, }) => { return ( @@ -54,6 +57,22 @@ export const ConfigurationFormItems: React.FC = ({

{label}

); + const helpText = + isInternalProvider && key === 'model_id' && !isPreconfigured ? ( + <> + {description}{' '} + + {LABELS.ES_MODELS_LINK_TEXT} + + + ) : ( + description + ); + const optionalLabel = !required ? ( {LABELS.OPTIONALTEXT} @@ -65,7 +84,7 @@ export const ConfigurationFormItems: React.FC = ({ = ({ setRequiredProviderFormFields(existingConfiguration.filter((p) => p.required || p.sensitive)); }, [config?.providerConfig, providerSchema, secrets, selectedTaskType]); + const isInternalProvider = config?.provider === 'elasticsearch'; // To display link for model_ids for Elasticsearch provider + return !isLoading ? ( <> = ({ setConfigEntry={onSetProviderConfigEntry} isEdit={isEdit} isPreconfigured={isPreconfigured} + isInternalProvider={isInternalProvider} /> { return i18n.translate('xpack.inferenceEndpointUICommon.components.requiredGenericTextField', { defaultMessage: diff --git a/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.test.ts b/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.test.ts index a3723309a242c..f9a6a7ac96880 100644 --- a/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.test.ts +++ b/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.test.ts @@ -60,5 +60,13 @@ describe('isNativeFunctionCallingSupported', () => { }); expect(isNativeFunctionCallingSupported(connector)).toBe(false); }); + + it('returns true if the config is not exposed', () => { + const connector = createConnector({ + type: InferenceConnectorType.OpenAI, + config: {}, + }); + expect(isNativeFunctionCallingSupported(connector)).toBe(true); + }); }); }); diff --git a/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.ts b/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.ts index 7e70d417a2996..90b71cd1e612e 100644 --- a/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.ts +++ b/x-pack/platform/plugins/shared/inference/server/chat_complete/utils/function_calling_support.ts @@ -11,9 +11,9 @@ import { OpenAiProviderType } from '../adapters/openai/types'; export const isNativeFunctionCallingSupported = (connector: InferenceConnector): boolean => { switch (connector.type) { case InferenceConnectorType.OpenAI: - const apiProvider = - (connector.config.apiProvider as OpenAiProviderType) ?? OpenAiProviderType.Other; - return apiProvider !== OpenAiProviderType.Other; + const apiProvider = (connector.config.apiProvider as OpenAiProviderType) ?? undefined; + // defaulting to `true` when the config is not accessible + return apiProvider ? apiProvider !== OpenAiProviderType.Other : true; case InferenceConnectorType.Inference: // note: later we might need to check the provider type, for now let's assume support // will be handled by ES and that all providers will support native FC. diff --git a/x-pack/platform/plugins/shared/security/server/session_management/session_index.test.ts b/x-pack/platform/plugins/shared/security/server/session_management/session_index.test.ts index eada023870a2a..74bebb961cfbe 100644 --- a/x-pack/platform/plugins/shared/security/server/session_management/session_index.test.ts +++ b/x-pack/platform/plugins/shared/security/server/session_management/session_index.test.ts @@ -96,10 +96,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); }); @@ -114,13 +110,10 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledWith({ index: aliasName }); expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledTimes(1); + expect(mockElasticsearchClient.indices.putAlias).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); }); @@ -139,10 +132,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); }); @@ -156,14 +145,46 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledWith({ index: aliasName }); expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledWith({ index: indexName }); expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledTimes(2); + expect(mockElasticsearchClient.indices.putAlias).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putIndexTemplate).not.toHaveBeenCalled(); + + expect(mockElasticsearchClient.indices.create).toHaveBeenCalled(); + }); + + it('attaches alias if no alias present', async () => { + mockElasticsearchClient.indices.existsTemplate.mockResponse(false); + mockElasticsearchClient.indices.existsIndexTemplate.mockResponse(true); + mockElasticsearchClient.indices.exists.mockImplementation( + async ({ index }) => index === indexName + ); + mockElasticsearchClient.indices.existsAlias.mockResponse(false); + + await sessionIndex.initialize(); + + expect(mockElasticsearchClient.indices.existsAlias).toHaveBeenCalledWith({ name: aliasName }); + expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ index: indexName, name: aliasName, }); - expect(mockElasticsearchClient.indices.create).toHaveBeenCalled(); + + expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); + }); + + it('does not attach alias if alias present', async () => { + mockElasticsearchClient.indices.existsTemplate.mockResponse(false); + mockElasticsearchClient.indices.existsIndexTemplate.mockResponse(true); + mockElasticsearchClient.indices.exists.mockResponse(true); + mockElasticsearchClient.indices.existsAlias.mockResponse(true); + + await sessionIndex.initialize(); + + expect(mockElasticsearchClient.indices.existsAlias).toHaveBeenCalledWith({ name: aliasName }); + expect(mockElasticsearchClient.indices.putAlias).not.toHaveBeenCalled(); + + expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); }); it('does not delete legacy index template if the legacy template API is not available (410)', async () => { @@ -182,7 +203,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( @@ -206,7 +226,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( @@ -228,7 +247,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( getSessionIndexSettings({ indexName, aliasName }) ); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); }); it('deletes legacy & modern index templates if needed and creates index if it does not exist', async () => { @@ -248,7 +266,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( getSessionIndexSettings({ indexName, aliasName }) ); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); }); it('deletes modern index template if needed and creates index if it does not exist', async () => { @@ -263,7 +280,7 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteIndexTemplate).toHaveBeenCalledWith({ name: indexTemplateName, }); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); + expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( getSessionIndexSettings({ indexName, aliasName }) ); @@ -281,11 +298,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); - - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); }); it('updates mappings for existing index without version in the meta', async () => { @@ -306,11 +318,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); - expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledWith({ index: aliasName }); expect(mockElasticsearchClient.indices.putMapping).toHaveBeenCalledTimes(1); @@ -338,11 +345,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); - expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledWith({ index: aliasName }); expect(mockElasticsearchClient.indices.putMapping).toHaveBeenCalledTimes(1); @@ -370,11 +372,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledWith({ - index: indexName, - name: aliasName, - }); - expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).toHaveBeenCalledWith({ index: aliasName }); expect(mockElasticsearchClient.indices.putMapping).not.toHaveBeenCalled(); @@ -390,7 +387,6 @@ describe('Session index', () => { assertExistenceChecksPerformed(); expect(mockElasticsearchClient.indices.deleteTemplate).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.deleteIndexTemplate).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.indices.getMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.putMapping).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).toHaveBeenCalledWith( @@ -527,7 +523,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledTimes(2); expect(mockElasticsearchClient.indices.create).toHaveBeenCalledTimes(1); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.search).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.bulk).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.closePointInTime).toHaveBeenCalledTimes(1); // since we attempted to delete sessions, we still refresh the index @@ -1510,7 +1505,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.exists).toHaveBeenCalledTimes(2); expect(mockElasticsearchClient.indices.create).toHaveBeenCalledTimes(1); - expect(mockElasticsearchClient.indices.putAlias).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.create).toHaveBeenCalledTimes(2); expect(mockElasticsearchClient.create).toHaveBeenNthCalledWith( @@ -1567,7 +1561,6 @@ describe('Session index', () => { expect(mockElasticsearchClient.indices.exists).not.toHaveBeenCalled(); expect(mockElasticsearchClient.indices.create).not.toHaveBeenCalled(); - expect(mockElasticsearchClient.indices.putAlias).not.toHaveBeenCalled(); expect(mockElasticsearchClient.create).toHaveBeenCalledTimes(1); expect(mockElasticsearchClient.create).toHaveBeenCalledWith( diff --git a/x-pack/platform/plugins/shared/security/server/session_management/session_index.ts b/x-pack/platform/plugins/shared/security/server/session_management/session_index.ts index 21b6df5479252..33d1603fc602c 100644 --- a/x-pack/platform/plugins/shared/security/server/session_management/session_index.ts +++ b/x-pack/platform/plugins/shared/security/server/session_management/session_index.ts @@ -681,17 +681,25 @@ export class SessionIndex { } } - await this.attachAliasToIndex(); - return; } + const isIndexNameAlias = await this.options.elasticsearchClient.indices.existsAlias({ + name: this.aliasName, + }); + + if (!isIndexNameAlias) { + this.options.logger.debug( + 'Session index already exists with no alias. Attaching alias to the index.' + ); + + await this.attachAliasToIndex(); + } + this.options.logger.debug( - 'Session index already exists. Attaching alias to the index and ensuring up-to-date mappings...' + 'Session index already exists. Ensuring up-to-date index mappings...' ); - await this.attachAliasToIndex(); - let indexMappingsVersion: string | undefined; try { const indexMappings = await this.options.elasticsearchClient.indices.getMapping({ diff --git a/x-pack/solutions/observability/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts b/x-pack/solutions/observability/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts index e61fa75dfa4c1..925da8a33cc9d 100644 --- a/x-pack/solutions/observability/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts +++ b/x-pack/solutions/observability/plugins/apm/server/routes/errors/get_error_groups/get_error_group_main_statistics.ts @@ -17,7 +17,6 @@ import { ERROR_EXC_TYPE, ERROR_GROUP_ID, ERROR_GROUP_NAME, - ERROR_ID, ERROR_LOG_MESSAGE, SERVICE_NAME, TRACE_ID, @@ -97,7 +96,7 @@ export async function getErrorGroupMainStatistics({ ] : []; - const requiredFields = asMutableArray([AT_TIMESTAMP, ERROR_GROUP_ID, ERROR_ID] as const); + const requiredFields = asMutableArray([AT_TIMESTAMP, ERROR_GROUP_ID] as const); const optionalFields = asMutableArray([ TRACE_ID, diff --git a/x-pack/solutions/security/plugins/security_solution/emotion.d.ts b/x-pack/solutions/security/plugins/security_solution/emotion.d.ts new file mode 100644 index 0000000000000..213178080e536 --- /dev/null +++ b/x-pack/solutions/security/plugins/security_solution/emotion.d.ts @@ -0,0 +1,14 @@ +/* + * 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 '@emotion/react'; +import type { UseEuiTheme } from '@elastic/eui'; + +declare module '@emotion/react' { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + export interface Theme extends UseEuiTheme {} +} diff --git a/x-pack/solutions/security/plugins/security_solution/public/contract_components.ts b/x-pack/solutions/security/plugins/security_solution/public/contract_components.ts index 8f5072f43f033..f7c255bcd34b8 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/contract_components.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/contract_components.ts @@ -11,6 +11,7 @@ import type { Observable } from 'rxjs'; export type ContractComponents = Partial<{ GetStarted: React.ComponentType<{ indicesExist?: boolean }>; DashboardsLandingCallout: React.ComponentType<{}>; + EnablementModalCallout: React.ComponentType<{}>; }>; export type SetComponents = (components: ContractComponents) => void; diff --git a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx index cccccb175ff19..c16eb7e557a4b 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.test.tsx @@ -6,6 +6,7 @@ */ import React from 'react'; +import { act } from 'react-dom/test-utils'; import { fireEvent, render, screen } from '@testing-library/react'; import { EntityStoreEnablementModal } from './enablement_modal'; import { TestProviders } from '../../../../common/mock'; @@ -25,6 +26,11 @@ jest.mock('../../../hooks/use_missing_risk_engine_privileges', () => ({ useMissingRiskEnginePrivileges: () => mockUseMissingRiskEnginePrivileges(), })); +const mockUseContractComponents = jest.fn(() => ({})); +jest.mock('../../../../common/hooks/use_contract_component', () => ({ + useContractComponents: () => mockUseContractComponents(), +})); + const defaultProps = { visible: true, toggle: mockToggle, @@ -77,8 +83,10 @@ const missingRiskEnginePrivileges: RiskEngineMissingPrivilegesResponse = { }, }; -const renderComponent = (props = defaultProps) => { - return render(, { wrapper: TestProviders }); +const renderComponent = async (props = defaultProps) => { + await act(async () => { + return render(, { wrapper: TestProviders }); + }); }; describe('EntityStoreEnablementModal', () => { @@ -172,5 +180,16 @@ describe('EntityStoreEnablementModal', () => { renderComponent(); expect(screen.getByTestId('callout-missing-risk-engine-privileges')).toBeInTheDocument(); }); + + it('should render additional charges message when available', async () => { + const EnablementModalCalloutMock = () => ; + mockUseContractComponents.mockReturnValue({ + EnablementModalCallout: EnablementModalCalloutMock, + }); + + await renderComponent(); + + expect(screen.queryByTestId('enablement-modal-test')).toBeInTheDocument(); + }); }); }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx index 4dc7bdac85b55..d977267137626 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/entity_analytics/components/entity_store/components/enablement_modal.tsx @@ -24,6 +24,7 @@ import { import { css } from '@emotion/react'; import React, { useState } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { useContractComponents } from '../../../../common/hooks/use_contract_component'; import { ENABLEMENT_DESCRIPTION_RISK_ENGINE_ONLY, ENABLEMENT_DESCRIPTION_ENTITY_STORE_ONLY, @@ -69,6 +70,7 @@ export const EntityStoreEnablementModal: React.FC + {EnablementModalCallout && } ` - ${({ show }) => (show ? '' : 'display: none;')}; -`; +export const Display = styled.div<{ show: boolean }>(({ show }) => ({ + display: show ? undefined : 'none', +})); Display.displayName = 'Display'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx index 0fe710e2cc920..4f1b221a6f61e 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/hosts/pages/hosts.tsx @@ -6,7 +6,7 @@ */ import { EuiSpacer, EuiWindowEvent } from '@elastic/eui'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { noop } from 'lodash/fp'; import React, { useCallback, useMemo, useRef } from 'react'; import { useParams } from 'react-router-dom'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/__snapshots__/index.test.tsx.snap b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/__snapshots__/index.test.tsx.snap index 7702695520790..64bf33f3db0ae 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/__snapshots__/index.test.tsx.snap +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/__snapshots__/index.test.tsx.snap @@ -1,17 +1,1102 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`arrows ArrowBody renders correctly against snapshot 1`] = ` -.c0 { - background-color: #343741; - height: 3px; - width: 25px; -} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + , + ], + }, + } + } + isStringTag={true} + serialized={ + Object { + "map": undefined, + "name": "4rtwwc", + "next": undefined, + "styles": " + background-color: #D3DAE6; + height: 3px; + width: 25px; +", + "toString": [Function], + } + } + /> diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/index.tsx index 4acfc6de98f20..c7a4ff7cfd7d8 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/arrows/index.tsx @@ -7,11 +7,11 @@ import { EuiIcon } from '@elastic/eui'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; /** Renders the body (non-pointy part) of an arrow */ export const ArrowBody = styled.span<{ height: number }>` - background-color: ${(props) => props.theme.eui.euiColorLightShade}; + background-color: ${(props) => props.theme.euiTheme.colors.lightShade}; height: ${({ height }) => `${height}px`}; width: 25px; `; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embeddable.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embeddable.tsx index 55950b2bffff5..3d6941f92fff2 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embeddable.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embeddable.tsx @@ -8,7 +8,7 @@ import { EuiPanel } from '@elastic/eui'; import type { PropsWithChildren } from 'react'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; const Panel = styled(EuiPanel)` overflow: hidden; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embedded_map.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embedded_map.tsx index bdd86a09ba231..6aa55916a40fd 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embedded_map.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/embedded_map.tsx @@ -11,7 +11,8 @@ import { EuiAccordion, EuiLink, EuiText } from '@elastic/eui'; import React, { useCallback, useEffect, useState, useMemo } from 'react'; import { useSelector } from 'react-redux'; import { createHtmlPortalNode, InPortal, OutPortal } from 'react-reverse-portal'; -import styled, { css } from 'styled-components'; +import styled from '@emotion/styled'; +import { css } from '@emotion/react'; import type { Filter, Query } from '@kbn/es-query'; import { isEqual } from 'lodash/fp'; import type { MapApi, RenderTooltipContentParams } from '@kbn/maps-plugin/public'; @@ -37,23 +38,19 @@ interface EmbeddableMapProps { maintainRatio?: boolean; } -const EmbeddableMapRatioHolder = styled.div.attrs(() => ({ - className: 'siemEmbeddable__map', -}))` +const EmbeddableMapRatioHolder = styled.div` .mapToolbarOverlay__button { display: none; } - - ${({ maintainRatio }) => + ${({ maintainRatio, theme: { euiTheme } }) => maintainRatio && css` padding-top: calc(3 / 4 * 100%); /* 4:3 (standard) ratio */ position: relative; - @media only screen and (min-width: ${({ theme }) => theme.eui.euiBreakpoints.m}) { + @media only screen and (min-width: ${euiTheme.breakpoint.m}) { padding-top: calc(9 / 32 * 100%); /* 32:9 (ultra widescreen) ratio */ } - @media only screen and (min-width: 1441px) and (min-height: 901px) { padding-top: calc(9 / 21 * 100%); /* 21:9 (ultrawide) ratio */ } @@ -188,7 +185,7 @@ export const EmbeddedMapComponent = ({ - + {isIndexError ? ( ) : ( diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/line_tool_tip_content.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/line_tool_tip_content.tsx index fb6d0dc6898d5..858dac720b9de 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/line_tool_tip_content.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/line_tool_tip_content.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { EuiBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import type { ITooltipProperty } from '@kbn/maps-plugin/public/classes/tooltips/tooltip_property'; import { SourceDestinationArrows } from '../../source_destination/source_destination_arrows'; import { diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/tooltip_footer.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/tooltip_footer.tsx index fd57256602aa5..7d5e55a0172a7 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/tooltip_footer.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/embeddables/map_tool_tip/tooltip_footer.tsx @@ -15,7 +15,7 @@ import { EuiText, } from '@elastic/eui'; import { euiLightVars as theme } from '@kbn/ui-theme'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import * as i18n from '../translations'; export const Icon = styled(EuiIcon)` diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/flow_target_select_connected/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/flow_target_select_connected/index.tsx index b175f44a5532b..742e715915fe7 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/flow_target_select_connected/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/flow_target_select_connected/index.tsx @@ -9,7 +9,7 @@ import type { Location } from 'history'; import { EuiFlexItem } from '@elastic/eui'; import React, { useCallback } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import * as i18nIp from '../details/translations'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/country_flag.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/country_flag.tsx index 2a991dfa35fcb..0e2a4f00a02ac 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/country_flag.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/country_flag.tsx @@ -10,7 +10,7 @@ import { isEmpty } from 'lodash/fp'; import { EuiToolTip } from '@elastic/eui'; import countries from 'i18n-iso-countries'; import countryJson from 'i18n-iso-countries/langs/en.json'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; // Fixes vertical alignment of the flag const FlagWrapper = styled.span` diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/geo_fields.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/geo_fields.tsx index 65521d03f3d38..df7f7902689d6 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/geo_fields.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/geo_fields.tsx @@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { get, uniq } from 'lodash/fp'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { DefaultDraggable } from '../../../../common/components/draggables'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/index.tsx index b546716e58ab4..c29d1dba5a5a0 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/index.tsx @@ -7,7 +7,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { Network } from './network'; import { SourceDestinationWithArrows } from './source_destination_with_arrows'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/ip_with_port.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/ip_with_port.tsx index e99aecbc535e7..6fe257851e1e5 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/ip_with_port.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/ip_with_port.tsx @@ -7,7 +7,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { Ip } from '../ip'; import { Port } from '../port'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/label.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/label.tsx index 4366ca8b8dd1a..e11640c2250a5 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/label.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/label.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import styled from 'styled-components'; +import styled from '@emotion/styled'; export const Label = styled.div` font-weight: bold; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/network.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/network.tsx index ff29cdcb0f5b4..4385dd3750951 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/network.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/network.tsx @@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import { uniq } from 'lodash/fp'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { DirectionBadge } from '../direction'; import { DefaultDraggable, DraggableBadge } from '../../../../common/components/draggables'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/source_destination_arrows.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/source_destination_arrows.tsx index 050dedd79325c..8f033abc1ac23 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/source_destination_arrows.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/components/source_destination/source_destination_arrows.tsx @@ -8,7 +8,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; import numeral from '@elastic/numeral'; import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { ArrowBody, ArrowHead } from '../arrows'; import { diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/conditional_flex_group.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/conditional_flex_group.tsx index 680533f1a17dc..a8cf91ac73be9 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/conditional_flex_group.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/conditional_flex_group.tsx @@ -6,7 +6,7 @@ */ import { EuiFlexGroup } from '@elastic/eui'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; export const ConditionalFlexGroup = styled(EuiFlexGroup)` @media only screen and (min-width: 1441px) { diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/network_routes_loading.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/network_routes_loading.tsx index 7074aa95051a1..ed0a19e48748b 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/network_routes_loading.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/navigation/network_routes_loading.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { EuiFlexItem, EuiLoadingSpinner, EuiFlexGroup } from '@elastic/eui'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx index 00a88da0cfcf5..ef525e41a54d9 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/network/pages/network.tsx @@ -9,7 +9,7 @@ import { EuiPanel, EuiSpacer, EuiWindowEvent } from '@elastic/eui'; import { noop } from 'lodash/fp'; import React, { useCallback, useMemo, useRef } from 'react'; import { useParams } from 'react-router-dom'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { isTab } from '@kbn/timelines-plugin/public'; import { getEsQueryConfig } from '@kbn/data-plugin/common'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/users.tsx b/x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/users.tsx index 01c15e6f22287..2078fd9e90979 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/users.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/explore/users/pages/users.tsx @@ -6,7 +6,7 @@ */ import { EuiSpacer, EuiWindowEvent } from '@elastic/eui'; -import styled from 'styled-components'; +import styled from '@emotion/styled'; import { noop } from 'lodash/fp'; import React, { useCallback, useMemo, useRef } from 'react'; import { useParams } from 'react-router-dom'; diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/content.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/content.tsx index 53d2efe883397..5da0f5b8f5fc8 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/content.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/content.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { useEuiBackgroundColor } from '@elastic/eui'; +import { useEuiTheme } from '@elastic/eui'; import type { FC } from 'react'; import React, { useMemo } from 'react'; import { css } from '@emotion/react'; @@ -29,6 +29,7 @@ export interface PanelContentProps { * Displays the content of investigation and insights tabs (visualize is hidden for 8.9). */ export const PanelContent: FC = ({ selectedTabId, tabs }) => { + const { euiTheme } = useEuiTheme(); const selectedTabContent = useMemo(() => { return tabs.find((tab) => tab.id === selectedTabId)?.content; }, [selectedTabId, tabs]); @@ -36,7 +37,7 @@ export const PanelContent: FC = ({ selectedTabId, tabs }) => return ( {selectedTabContent} diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/header.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/header.tsx index 2b61a97577e06..1e8f88cb68964 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/header.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/document_details/left/header.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiTab, EuiTabs, useEuiBackgroundColor } from '@elastic/eui'; +import { EuiTab, EuiTabs, useEuiTheme } from '@elastic/eui'; import type { FC } from 'react'; import React, { memo } from 'react'; import { css } from '@emotion/react'; @@ -38,6 +38,7 @@ export interface PanelHeaderProps { */ export const PanelHeader: FC = memo( ({ selectedTabId, setSelectedTabId, tabs }) => { + const { euiTheme } = useEuiTheme(); const { getFieldsData } = useDocumentDetailsContext(); const isEventKindSignal = getField(getFieldsData('event.kind')) === EventKind.signal; @@ -56,7 +57,7 @@ export const PanelHeader: FC = memo( return ( = ({ selectedTabId, tabs }) => { + const { euiTheme } = useEuiTheme(); const selectedTabContent = useMemo(() => { return tabs.find((tab) => tab.id === selectedTabId)?.content; }, [selectedTabId, tabs]); @@ -29,7 +30,7 @@ export const LeftPanelContent: VFC = ({ selectedTabId, tabs } return ( {selectedTabContent} diff --git a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/shared/components/left_panel/left_panel_header.tsx b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/shared/components/left_panel/left_panel_header.tsx index 2d7fc23115eb7..3c4e1b9da65bc 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/shared/components/left_panel/left_panel_header.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/flyout/entity_details/shared/components/left_panel/left_panel_header.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { EuiTab, EuiTabs, useEuiBackgroundColor } from '@elastic/eui'; +import { EuiTab, EuiTabs, useEuiTheme } from '@elastic/eui'; import type { ReactElement, VFC } from 'react'; import React, { memo } from 'react'; import { css } from '@emotion/react'; @@ -57,6 +57,7 @@ export interface PanelHeaderProps { */ export const LeftPanelHeader: VFC = memo( ({ selectedTabId, setSelectedTabId, tabs }) => { + const { euiTheme } = useEuiTheme(); const onSelectedTabChanged = (id: EntityDetailsLeftPanelTab) => setSelectedTabId(id); const renderTabs = tabs.map((tab, index) => ( = memo( return ( { - // At this point 8.14.2 is GA and this functionality is not available until 8.15.0 - return createEndpointHost(policy.policy_ids[0], '8.15.0').then((host) => { + return createEndpointHost(policy.policy_ids[0]).then((host) => { createdHost = host as CreateAndEnrollEndpointHostResponse; }); }); diff --git a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/onboarding_card_panel.styles.ts b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/onboarding_card_panel.styles.ts index ca3e3e765b977..02017dccf1990 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/onboarding_card_panel.styles.ts +++ b/x-pack/solutions/security/plugins/security_solution/public/onboarding/components/onboarding_body/onboarding_card_panel.styles.ts @@ -5,14 +5,14 @@ * 2.0. */ -import { COLOR_MODES_STANDARD, useEuiBackgroundColor, useEuiTheme } from '@elastic/eui'; +import { COLOR_MODES_STANDARD, useEuiTheme } from '@elastic/eui'; import { css } from '@emotion/css'; export const HEIGHT_ANIMATION_DURATION = 250; export const useCardPanelStyles = () => { const { euiTheme, colorMode } = useEuiTheme(); - const successBackgroundColor = useEuiBackgroundColor('success'); + const successBackgroundColor = euiTheme.colors.backgroundBaseSuccess; const isDarkMode = colorMode === COLOR_MODES_STANDARD.dark; const darkModeStyles = useDarkPanelStyles(isDarkMode); @@ -31,7 +31,7 @@ export const useCardPanelStyles = () => { } .onboardingCardHeaderCompleteBadge { background-color: ${successBackgroundColor}; - color: ${euiTheme.colors.successText}; + color: ${euiTheme.colors.textSuccess}; } .onboardingCardContentWrapper { display: grid; diff --git a/x-pack/solutions/security/plugins/security_solution/public/siem_migrations/rules/components/rule_details_flyout/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/siem_migrations/rules/components/rule_details_flyout/index.tsx index 8c75f4b92a767..96d63bd24d054 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/siem_migrations/rules/components/rule_details_flyout/index.tsx +++ b/x-pack/solutions/security/plugins/security_solution/public/siem_migrations/rules/components/rule_details_flyout/index.tsx @@ -244,7 +244,14 @@ export const MigrationRuleDetailsFlyout: React.FC - + - .c11, -.c11 * { + .c7, +.c7 * { display: inline-block; max-width: 100%; overflow: hidden; @@ -106,75 +106,17 @@ tr:hover .c3:focus::before { vertical-align: top; } -.c13 svg { +.c8 svg { position: relative; top: -1px; } -.c22 { - margin-right: 5px; -} - -.c21 { - margin-right: 5px; -} - -.c15 { - position: relative; - top: 1px; -} - -.c14 { - margin-right: 5px; -} - -.c17 { - background-color: #343741; - height: 2.8px; - width: 25px; -} - -.c20 { - background-color: #343741; - height: 2.2px; - width: 25px; -} - -.c19 { - margin-right: 5px; -} - -.c16 { - margin: 0 2px; -} - -.c16 .euiToolTipAnchor { - white-space: nowrap; -} - -.c18 { - margin: 0 5px; -} - -.c7 { - margin-right: 3px; -} - -.c8 { - margin: 0 5px; -} - -.c12 { - margin: 0 3px; -} - .c10 { - font-weight: bold; - margin-top: 2px; + margin-right: 5px; } .c9 { - margin-top: 3px; + margin-right: 5px; } .c6 { @@ -537,7 +479,7 @@ tr:hover .c3:focus::before { class="euiFlexGroup emotion-euiFlexGroup-responsive-none-center-center-row" >
100B @@ -706,7 +648,7 @@ tr:hover .c3:focus::before {
3 pkts @@ -756,7 +698,7 @@ tr:hover .c3:focus::before {
Source
@@ -954,7 +896,7 @@ tr:hover .c3:focus::before { tabindex="-1" > : @@ -995,7 +937,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
🇺🇸 @@ -1197,7 +1139,7 @@ tr:hover .c3:focus::before {
@@ -1361,10 +1303,10 @@ tr:hover .c3:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
(60.00%) @@ -1383,7 +1325,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1424,7 +1366,7 @@ tr:hover .c3:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
2 pkts @@ -1441,7 +1383,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1475,7 +1417,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1524,10 +1466,10 @@ tr:hover .c3:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
(40.00%) @@ -1550,7 +1492,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1591,7 +1533,7 @@ tr:hover .c3:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
1 pkts @@ -1608,7 +1550,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1637,7 +1579,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
Destination
@@ -1692,7 +1634,7 @@ tr:hover .c3:focus::before { tabindex="-1" >
: @@ -1733,7 +1675,7 @@ tr:hover .c3:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
🇺🇸 @@ -1935,7 +1877,7 @@ tr:hover .c3:focus::before {
ja3 @@ -2195,7 +2137,7 @@ tr:hover .c3:focus::before { class="euiBadge__text emotion-euiBadge__text" > client cert @@ -2280,7 +2222,7 @@ tr:hover .c3:focus::before { class="euiBadge__text emotion-euiBadge__text" > server cert diff --git a/x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap b/x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap index ba36ad1878592..6b6501e1e6857 100644 --- a/x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap +++ b/x-pack/solutions/security/plugins/security_solution/public/timelines/components/timeline/body/renderers/netflow/__snapshots__/netflow_row_renderer.test.tsx.snap @@ -16,8 +16,8 @@ exports[`netflowRowRenderer renders correctly against snapshot 1`] = ` border-radius: 4px; } -.c13, -.c13 * { +.c9, +.c9 * { display: inline-block; max-width: 100%; overflow: hidden; @@ -120,75 +120,17 @@ tr:hover .c5:focus::before { vertical-align: top; } -.c15 svg { +.c10 svg { position: relative; top: -1px; } -.c24 { - margin-right: 5px; -} - -.c23 { - margin-right: 5px; -} - -.c9 { - margin-right: 3px; -} - -.c10 { - margin: 0 5px; -} - -.c19 { - background-color: #343741; - height: 2.8px; - width: 25px; -} - -.c22 { - background-color: #343741; - height: 2.2px; - width: 25px; -} - -.c21 { - margin-right: 5px; -} - -.c18 { - margin: 0 2px; -} - -.c18 .euiToolTipAnchor { - white-space: nowrap; -} - -.c20 { - margin: 0 5px; -} - -.c17 { - position: relative; - top: 1px; -} - -.c16 { - margin-right: 5px; -} - -.c14 { - margin: 0 3px; -} - .c12 { - font-weight: bold; - margin-top: 2px; + margin-right: 5px; } .c11 { - margin-top: 3px; + margin-right: 5px; } .c8 { @@ -611,7 +553,7 @@ tr:hover .c5:focus::before { class="euiFlexGroup emotion-euiFlexGroup-responsive-none-center-center-row" >
100B @@ -810,7 +752,7 @@ tr:hover .c5:focus::before {
3 pkts @@ -870,7 +812,7 @@ tr:hover .c5:focus::before {
Source
@@ -1093,7 +1035,7 @@ tr:hover .c5:focus::before { source.ip

: @@ -1185,7 +1127,7 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
🇺🇸 @@ -1432,7 +1374,7 @@ tr:hover .c5:focus::before {
@@ -1621,10 +1563,10 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
(60.00%) @@ -1648,7 +1590,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1694,7 +1636,7 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
2 pkts @@ -1716,7 +1658,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1750,7 +1692,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1804,10 +1746,10 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
(40.00%) @@ -1835,7 +1777,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1881,7 +1823,7 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
1 pkts @@ -1903,7 +1845,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
@@ -1932,7 +1874,7 @@ tr:hover .c5:focus::before { class="euiFlexItem emotion-euiFlexItem-growZero" >
Destination
@@ -1992,7 +1934,7 @@ tr:hover .c5:focus::before { destination.ip

: @@ -2084,7 +2026,7 @@ tr:hover .c5:focus::before { class="euiToolTipAnchor emotion-euiToolTipAnchor-inlineBlock" >
🇺🇸 @@ -2331,7 +2273,7 @@ tr:hover .c5:focus::before {
ja3 @@ -2626,7 +2568,7 @@ tr:hover .c5:focus::before { class="euiBadge__text emotion-euiBadge__text" > client cert @@ -2721,7 +2663,7 @@ tr:hover .c5:focus::before { class="euiBadge__text emotion-euiBadge__text" > server cert diff --git a/x-pack/solutions/security/plugins/security_solution/tsconfig.json b/x-pack/solutions/security/plugins/security_solution/tsconfig.json index 41a197b81dd71..9fa2d71e925fd 100644 --- a/x-pack/solutions/security/plugins/security_solution/tsconfig.json +++ b/x-pack/solutions/security/plugins/security_solution/tsconfig.json @@ -13,7 +13,8 @@ "server/**/*.json", "scripts/**/*.json", "public/**/*.json", - "../../../../../typings/**/*" + "../../../../../typings/**/*", + "emotion.d.ts" ], "exclude": ["target/**/*", "**/cypress/**", "public/management/cypress.config.ts"], "kbn_references": [ diff --git a/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/enablement_modal_callout.tsx b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/enablement_modal_callout.tsx new file mode 100644 index 0000000000000..0048a0547ecf5 --- /dev/null +++ b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/enablement_modal_callout.tsx @@ -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 React from 'react'; +import { EuiText } from '@elastic/eui'; +import { ADDITIONAL_CHARGES_MESSAGE } from '../../upselling/translations'; + +export const EnablementModalCallout: React.FC = () => { + return ( +
+ {ADDITIONAL_CHARGES_MESSAGE} +
+ ); +}; + +// eslint-disable-next-line import/no-default-export +export default EnablementModalCallout; diff --git a/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/index.tsx b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/index.tsx new file mode 100644 index 0000000000000..0bc65a33d6530 --- /dev/null +++ b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/index.tsx @@ -0,0 +1,19 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import React from 'react'; +import type { Services } from '../../common/services'; +import { ServicesProvider } from '../../common/services'; +import { EnablementModalCallout } from './lazy'; + +export const getEnablementModalCallout = (services: Services): React.ComponentType => + function EnablementModalCalloutComponent() { + return ( + + + + ); + }; diff --git a/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/lazy.tsx b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/lazy.tsx new file mode 100644 index 0000000000000..547a15fc535e9 --- /dev/null +++ b/x-pack/solutions/security/plugins/security_solution_serverless/public/components/enablement_modal_callout/lazy.tsx @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { lazy, Suspense } from 'react'; +import { EuiLoadingSpinner } from '@elastic/eui'; + +const EnablementModalCalloutLazy = lazy(() => import('./enablement_modal_callout')); + +export const EnablementModalCallout = () => ( + }> + + +); diff --git a/x-pack/solutions/security/plugins/security_solution_serverless/public/plugin.ts b/x-pack/solutions/security/plugins/security_solution_serverless/public/plugin.ts index 4d94a11500d50..30e0f86ccdacf 100644 --- a/x-pack/solutions/security/plugins/security_solution_serverless/public/plugin.ts +++ b/x-pack/solutions/security/plugins/security_solution_serverless/public/plugin.ts @@ -23,6 +23,7 @@ import { type ExperimentalFeatures, } from '../common/experimental_features'; import { setOnboardingSettings } from './onboarding'; +import { getEnablementModalCallout } from './components/enablement_modal_callout'; export class SecuritySolutionServerlessPlugin implements @@ -69,6 +70,7 @@ export class SecuritySolutionServerlessPlugin securitySolution.setComponents({ DashboardsLandingCallout: getDashboardsLandingCallout(services), + EnablementModalCallout: getEnablementModalCallout(services), }); setOnboardingSettings(services); diff --git a/x-pack/solutions/security/plugins/security_solution_serverless/public/upselling/translations.ts b/x-pack/solutions/security/plugins/security_solution_serverless/public/upselling/translations.ts index 971873ca77838..f70a36f90348f 100644 --- a/x-pack/solutions/security/plugins/security_solution_serverless/public/upselling/translations.ts +++ b/x-pack/solutions/security/plugins/security_solution_serverless/public/upselling/translations.ts @@ -18,3 +18,11 @@ export const UPGRADE_PRODUCT_MESSAGE = (requiredProduct: string) => }, } ); + +export const ADDITIONAL_CHARGES_MESSAGE = i18n.translate( + 'xpack.securitySolutionServerless.entityStoreEnablementCallout.additionalChargesMessage', + { + defaultMessage: + 'Please be aware that activating these features may incur additional charges depending on your subscription plan. Review your plan details carefully to avoid unexpected costs before proceeding.', + } +); diff --git a/yarn.lock b/yarn.lock index e52703c339557..ed6139a4ffb7f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29279,7 +29279,7 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.2, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.0, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3, semver@^7.7.0: +semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.0, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4, semver@^7.6.3, semver@^7.7.1: version "7.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==