diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/mocks/state.ts b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/mocks/state.ts index 29f574776e295..3b356c39dea7f 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/mocks/state.ts +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/mocks/state.ts @@ -418,7 +418,7 @@ export const mockState: State = { dataStreamTitle: 'Mocked Data Stream Title', dataStreamName: 'mocked_datastream_name', dataStreamDescription: 'Mocked Data Stream Description', - inputType: 'filestream', + inputTypes: ['filestream'], logsSampleParsed: rawSamples, }, isGenerating: false, diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.test.tsx b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.test.tsx index b71fa6c5cabf1..476c5b24cbf5f 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.test.tsx +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.test.tsx @@ -12,6 +12,22 @@ import { DataStreamStep } from './data_stream_step'; import { ActionsProvider } from '../../state'; import { mockActions, mockState } from '../../mocks/state'; +jest.mock('@elastic/eui', () => { + return { + ...jest.requireActual('@elastic/eui'), + // Mocking EuiComboBox, as it utilizes "react-virtualized" for rendering search suggestions, + // which does not produce a valid component wrapper + EuiComboBox: (props: { onChange: (options: unknown) => void; 'data-test-subj': string }) => ( + { + props.onChange([{ value: syntheticEvent.target.value }]); + }} + /> + ), + }; +}); + jest.mock('./generation_modal', () => ({ GenerationModal: jest.fn(() =>
), })); @@ -204,7 +220,7 @@ describe('DataStreamStep', () => { it('should call setIntegrationSettings', () => { expect(mockActions.setIntegrationSettings).toHaveBeenCalledWith({ - inputType: dataCollectionMethod, + inputTypes: [dataCollectionMethod], }); }); }); diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.tsx b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.tsx index fbaf315374e92..08b9cb24232be 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.tsx +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/data_stream_step/data_stream_step.tsx @@ -6,14 +6,15 @@ */ import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import type { EuiComboBoxOptionOption } from '@elastic/eui'; import { + EuiComboBox, EuiFieldText, EuiFlexGroup, EuiFlexItem, EuiForm, EuiFormRow, EuiPanel, - EuiSelect, } from '@elastic/eui'; import type { InputType } from '../../../../../../common'; import { useActions, type State } from '../../state'; @@ -25,21 +26,21 @@ import { GenerationModal } from './generation_modal'; import { useLoadPackageNames } from './use_load_package_names'; import * as i18n from './translations'; -export const InputTypeOptions: Array<{ value: InputType; text: string }> = [ - { value: 'aws_cloudwatch', text: 'AWS Cloudwatch' }, - { value: 'aws_s3', text: 'AWS S3' }, - { value: 'azure_blob_storage', text: 'Azure Blob Storage' }, - { value: 'azure_eventhub', text: 'Azure Event Hub' }, - { value: 'cel', text: 'Common Expression Language (CEL)' }, - { value: 'cloudfoundry', text: 'Cloud Foundry' }, - { value: 'filestream', text: 'File Stream' }, - { value: 'gcp_pubsub', text: 'GCP Pub/Sub' }, - { value: 'gcs', text: 'Google Cloud Storage' }, - { value: 'http_endpoint', text: 'HTTP Endpoint' }, - { value: 'journald', text: 'Journald' }, - { value: 'kafka', text: 'Kafka' }, - { value: 'tcp', text: 'TCP' }, - { value: 'udp', text: 'UDP' }, +export const InputTypeOptions: Array> = [ + { value: 'aws_cloudwatch', label: 'AWS Cloudwatch' }, + { value: 'aws_s3', label: 'AWS S3' }, + { value: 'azure_blob_storage', label: 'Azure Blob Storage' }, + { value: 'azure_eventhub', label: 'Azure Event Hub' }, + { value: 'cel', label: 'Common Expression Language (CEL)' }, + { value: 'cloudfoundry', label: 'Cloud Foundry' }, + { value: 'filestream', label: 'File Stream' }, + { value: 'gcp_pubsub', label: 'GCP Pub/Sub' }, + { value: 'gcs', label: 'Google Cloud Storage' }, + { value: 'http_endpoint', label: 'HTTP Endpoint' }, + { value: 'journald', label: 'Journald' }, + { value: 'kafka', label: 'Kafka' }, + { value: 'tcp', label: 'TCP' }, + { value: 'udp', label: 'UDP' }, ]; const isValidName = (name: string) => /^[a-z0-9_]+$/.test(name); @@ -96,8 +97,8 @@ export const DataStreamStep = React.memo( setIntegrationValues({ dataStreamTitle: e.target.value }), dataStreamDescription: (e: React.ChangeEvent) => setIntegrationValues({ dataStreamDescription: e.target.value }), - inputType: (e: React.ChangeEvent) => { - setIntegrationValues({ inputType: e.target.value as InputType }); + inputTypes: (options: EuiComboBoxOptionOption[]) => { + setIntegrationValues({ inputTypes: options.map((option) => option.value as InputType) }); }, }; }, [setIntegrationValues, setInvalidFields, packageNames]); @@ -135,6 +136,14 @@ export const DataStreamStep = React.memo( } }, [packageNames, name]); + const selectedInputTypeOptions = useMemo>>( + () => + InputTypeOptions.filter((inputType) => + integrationSettings?.inputTypes?.includes(inputType.value as InputType) + ), + [integrationSettings?.inputTypes] + ); + return ( @@ -205,12 +214,12 @@ export const DataStreamStep = React.memo( /> - diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/deploy_step.test.tsx b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/deploy_step.test.tsx index 703a381a96e3b..094d4bd37ad31 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/deploy_step.test.tsx +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/deploy_step.test.tsx @@ -30,7 +30,7 @@ const parameters: BuildIntegrationRequestBody = { title: integrationSettings.dataStreamTitle!, description: integrationSettings.dataStreamDescription!, name: integrationSettings.dataStreamName!, - inputTypes: [integrationSettings.inputType!], + inputTypes: integrationSettings.inputTypes!, rawSamples: integrationSettings.logsSampleParsed!, docs: results.docs!, pipeline: results.pipeline, @@ -105,7 +105,7 @@ describe('DeployStep', () => { integrationName, integrationDescription: integrationSettings.description, dataStreamName: integrationSettings.dataStreamName, - inputType: integrationSettings.inputType, + inputTypes: integrationSettings.inputTypes, model: expect.any(String), actionTypeId: connector.actionTypeId, provider: connector.apiProvider ?? 'unknown', @@ -172,7 +172,7 @@ describe('DeployStep', () => { integrationName: integrationSettings.name, integrationDescription: integrationSettings.description, dataStreamName: integrationSettings.dataStreamName, - inputType: integrationSettings.inputType, + inputTypes: integrationSettings.inputTypes, model: expect.any(String), actionTypeId: connector.actionTypeId, provider: connector.apiProvider ?? 'unknown', @@ -224,7 +224,7 @@ describe('DeployStep', () => { integrationName: integrationSettings.name, integrationDescription: integrationSettings.description, dataStreamName: integrationSettings.dataStreamName, - inputType: integrationSettings.inputType, + inputTypes: integrationSettings.inputTypes, model: expect.any(String), actionTypeId: connector.actionTypeId, provider: connector.apiProvider ?? 'unknown', diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/use_deploy_integration.ts b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/use_deploy_integration.ts index 1de53e160efb1..7e12cdad8f611 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/use_deploy_integration.ts +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/steps/deploy_step/use_deploy_integration.ts @@ -57,7 +57,7 @@ export const useDeployIntegration = ({ title: integrationSettings.dataStreamTitle ?? '', description: integrationSettings.dataStreamDescription ?? '', name: integrationSettings.dataStreamName ?? '', - inputTypes: integrationSettings.inputType ? [integrationSettings.inputType] : [], + inputTypes: integrationSettings.inputTypes ?? [], rawSamples: integrationSettings.logsSampleParsed ?? [], docs: result.docs ?? [], pipeline: result.pipeline, diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/types.ts b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/types.ts index 9e0100f2e95d5..ec0ea443d37c7 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/types.ts +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration_assistant/types.ts @@ -32,6 +32,6 @@ export interface IntegrationSettings { dataStreamTitle?: string; dataStreamDescription?: string; dataStreamName?: string; - inputType?: InputType; + inputTypes?: InputType[]; logsSampleParsed?: string[]; } diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/telemetry.tsx b/x-pack/plugins/integration_assistant/public/components/create_integration/telemetry.tsx index f596964deb6ba..54988e238bd4d 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/telemetry.tsx +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/telemetry.tsx @@ -120,7 +120,7 @@ export const TelemetryContextProvider = React.memo>(({ chi integrationName, integrationDescription: integrationSettings?.description ?? 'unknown', dataStreamName: integrationSettings?.dataStreamName ?? 'unknown', - inputType: integrationSettings?.inputType ?? 'unknown', + inputTypes: integrationSettings?.inputTypes ?? ['unknown'], actionTypeId: connector.actionTypeId, model: getConnectorModel(connector), provider: connector.apiProvider ?? 'unknown', diff --git a/x-pack/plugins/integration_assistant/public/services/telemetry/events.ts b/x-pack/plugins/integration_assistant/public/services/telemetry/events.ts index 91d8abbf68dbd..4d2d24ff7a657 100644 --- a/x-pack/plugins/integration_assistant/public/services/telemetry/events.ts +++ b/x-pack/plugins/integration_assistant/public/services/telemetry/events.ts @@ -169,11 +169,14 @@ export const telemetryEventsSchemas: TelemetryEventsSchemas = { optional: false, }, }, - inputType: { - type: 'keyword', - _meta: { - description: 'The input type used for the integration', - optional: false, + inputTypes: { + type: 'array', + items: { + type: 'keyword', + _meta: { + description: 'The input type used for the integration', + optional: false, + }, }, }, actionTypeId: { diff --git a/x-pack/plugins/integration_assistant/public/services/telemetry/types.ts b/x-pack/plugins/integration_assistant/public/services/telemetry/types.ts index 98ba1c0792caa..2f674b5880514 100644 --- a/x-pack/plugins/integration_assistant/public/services/telemetry/types.ts +++ b/x-pack/plugins/integration_assistant/public/services/telemetry/types.ts @@ -49,7 +49,7 @@ interface IntegrationAssistantCompleteData { integrationName: string; integrationDescription: string; dataStreamName: string; - inputType: string; + inputTypes: string[]; actionTypeId: string; model: string; provider: string;