diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/index.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/index.tsx index 9cdffa9ea05d0..956e5c64c152d 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/index.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/index.tsx @@ -5,10 +5,11 @@ * 2.0. */ -import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useBreadcrumbs } from '@kbn/observability-plugin/public'; import React, { ComponentType, useRef, useState } from 'react'; +import { breadcrumbsApp } from '../../../application/app'; import { FilmstripFrame, FilmstripTransition, @@ -16,8 +17,6 @@ import { } from '../../shared/filmstrip_transition'; import { Provider as WizardProvider, Step as WizardStep } from './wizard'; import { HorizontalSteps } from './wizard/horizontal_steps'; -import { PageTitle } from './wizard/page_title'; -import { breadcrumbsApp } from '../../../application/app'; export function CustomLogs() { useBreadcrumbs( @@ -62,7 +61,16 @@ function AnimatedTransitionsWizard() { - + +

+ {i18n.translate( + 'xpack.observability_onboarding.title.collectCustomLogs', + { + defaultMessage: 'Collect custom logs', + } + )} +

+
diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/collect_logs.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/collect_logs.tsx new file mode 100644 index 0000000000000..66adb4025d87a --- /dev/null +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/collect_logs.tsx @@ -0,0 +1,105 @@ +/* + * 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 { + EuiButton, + EuiButtonEmpty, + EuiCallOut, + EuiFlexGroup, + EuiFlexItem, + EuiHorizontalRule, + EuiLoadingSpinner, + EuiSpacer, + EuiSteps, + EuiText, +} from '@elastic/eui'; +import React from 'react'; +import { useWizard } from '.'; +import { useFetcher } from '../../../../hooks/use_fetcher'; +import { + StepPanel, + StepPanelContent, + StepPanelFooter, +} from '../../../shared/step_panel'; + +export function CollectLogs() { + const { goToStep, goBack } = useWizard(); + + const { data } = useFetcher((callApi) => { + return callApi('GET /internal/observability_onboarding/get_status'); + }, []); + + function onContinue() { + goToStep('inspect'); + } + + function onBack() { + goBack(); + } + + return ( + + + +

+ It might take a few minutes for the data to get to Elasticsearch. If + you're not seeing any, try generating some to verify. If + you're having trouble connecting, check out the troubleshooting + guide. +

+
+ + + + + + + + +

Listening for incoming logs

+
+
+
+
+ + + + + + Need some help? + + +
+ + Back + , + + Continue + , + ]} + /> +
+ ); +} diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/horizontal_steps.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/horizontal_steps.tsx index 789f09bb7d574..cfbeacec438cd 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/horizontal_steps.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/horizontal_steps.tsx @@ -5,12 +5,13 @@ * 2.0. */ -import React from 'react'; import { EuiStepsHorizontal } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; import { useWizard } from '.'; export function HorizontalSteps() { - const { getPath } = useWizard(); + const { getPath, goToStep } = useWizard(); const [currentStep, ...previousSteps] = getPath().reverse(); function getStatus(stepKey: ReturnType[0]) { @@ -23,28 +24,63 @@ export function HorizontalSteps() { return 'incomplete'; } + function isDisabled(stepKey: ReturnType[0]) { + return getStatus(stepKey) === 'incomplete'; + } + return ( {}, + title: i18n.translate( + 'xpack.observability_onboarding.steps.selectLogs', + { + defaultMessage: 'Select logs', + } + ), + status: getStatus('selectLogs'), + onClick: () => { + goToStep('selectLogs'); + }, }, { - title: 'Configure logs', + title: i18n.translate( + 'xpack.observability_onboarding.steps.configureLogs', + { + defaultMessage: 'Configure logs', + } + ), status: getStatus('configureLogs'), - onClick: () => {}, + disabled: isDisabled('configureLogs'), + onClick: () => { + goToStep('configureLogs'); + }, }, { - title: 'Install shipper', + title: i18n.translate( + 'xpack.observability_onboarding.steps.installShipper', + { + defaultMessage: 'Install shipper', + } + ), status: getStatus('installElasticAgent'), - onClick: () => {}, + disabled: isDisabled('installElasticAgent'), + onClick: () => { + goToStep('installElasticAgent'); + }, }, { - title: 'Import data', - status: getStatus('importData'), - onClick: () => {}, + title: i18n.translate( + 'xpack.observability_onboarding.steps.collectLogs', + { + defaultMessage: 'Collect logs', + } + ), + status: getStatus('collectLogs'), + disabled: isDisabled('collectLogs'), + onClick: () => { + goToStep('collectLogs'); + }, }, ]} /> diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/import_data.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/import_data.tsx index 7b64ca81ccaee..66adb4025d87a 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/import_data.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/import_data.tsx @@ -26,7 +26,7 @@ import { StepPanelFooter, } from '../../../shared/step_panel'; -export function ImportData() { +export function CollectLogs() { const { goToStep, goBack } = useWizard(); const { data } = useFetcher((callApi) => { diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/index.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/index.tsx index d7f3eeca3da46..89477b1d27eec 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/index.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/index.tsx @@ -5,11 +5,11 @@ * 2.0. */ -import { NameLogs } from './name_logs'; import { ConfigureLogs } from './configure_logs'; +import { SelectLogs } from './select_logs'; import { InstallElasticAgent } from './install_elastic_agent'; import { createWizardContext } from '../../../../context/create_wizard_context'; -import { ImportData } from './import_data'; +import { CollectLogs } from './collect_logs'; import { Inspect } from './inspect'; interface WizardState { @@ -45,12 +45,12 @@ const initialState: WizardState = { const { Provider, Step, useWizard } = createWizardContext({ initialState, - initialStep: 'nameLogs', + initialStep: 'selectLogs', steps: { - nameLogs: NameLogs, + selectLogs: SelectLogs, configureLogs: ConfigureLogs, installElasticAgent: InstallElasticAgent, - importData: ImportData, + collectLogs: CollectLogs, inspect: Inspect, }, }); diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/install_elastic_agent.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/install_elastic_agent.tsx index f75ecee1d3992..593b09cff4343 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/install_elastic_agent.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/install_elastic_agent.tsx @@ -39,7 +39,7 @@ export function InstallElasticAgent() { function onContinue() { setState({ ...getState(), elasticAgentPlatform, alternativeShippers }); - goToStep('importData'); + goToStep('collectLogs'); } function createAlternativeShipperToggle( diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/page_title.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/page_title.tsx deleted file mode 100644 index dde2797c1cf23..0000000000000 --- a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/page_title.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { EuiTitle } from '@elastic/eui'; -import { useWizard } from '.'; - -export function PageTitle() { - const { getPath } = useWizard(); - const [currentStep] = getPath().reverse(); - - if (currentStep === 'installElasticAgent') { - return ( - -

Select your shipper

-
- ); - } - - if (currentStep === 'importData') { - return ( - -

Incoming logs

-
- ); - } - - return ( - -

Collect and analyze my logs

-
- ); -} diff --git a/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/select_logs.tsx b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/select_logs.tsx new file mode 100644 index 0000000000000..847360b0ef81a --- /dev/null +++ b/x-pack/plugins/observability_onboarding/public/components/app/custom_logs/wizard/select_logs.tsx @@ -0,0 +1,242 @@ +/* + * 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. + */ + +/* eslint-disable @elastic/eui/href-or-on-click */ + +import React, { PropsWithChildren, MouseEvent } from 'react'; +import { + EuiTitle, + EuiLink, + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiHorizontalRule, + EuiSpacer, + EuiCard, + EuiIcon, + EuiIconProps, +} from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { + StepPanel, + StepPanelContent, + StepPanelFooter, +} from '../../../shared/step_panel'; +import { useWizard } from '.'; +import { useKibanaNavigation } from '../../../../hooks/use_kibana_navigation'; + +export function SelectLogs() { + const { navigateToKibanaUrl, navigateToAppUrl } = useKibanaNavigation(); + const { goToStep, getState, setState } = useWizard(); + + function onBack() { + navigateToKibanaUrl('/app/observabilityOnboarding'); + } + + return ( + + + + + { + setState({ ...getState(), logsType: 'log-file' }); + goToStep('configureLogs'); + }} + description={i18n.translate( + 'xpack.observability_onboarding.selectLogs.streamLogFiles.description', + { + defaultMessage: 'Stream your log file or directory.', + } + )} + /> + + + + + + + {}} + description={i18n.translate( + 'xpack.observability_onboarding.selectLogs.sysLog.description', + { + defaultMessage: + 'Stream logs over TCP or UDP ports or from your syslog server.', + } + )} + /> + + + {}} + description={i18n.translate( + 'xpack.observability_onboarding.selectLogs.httpEndpointLogs.description', + { + defaultMessage: + 'Collect JSON data from listening HTTP port.', + } + )} + /> + + + + + + + + {}} + description={i18n.translate( + 'xpack.observability_onboarding.selectLogs.uploadLogFiles.description', + { + defaultMessage: + 'Upload data from a CSV, TSV, JSON or other log file type for analysis.', + } + )} + /> + + + {}} + description={i18n.translate( + 'xpack.observability_onboarding.selectLogs.useOwnShipper.description', + { + defaultMessage: + 'Use your own shipper to collect logs data by generating an API key.', + } + )} + /> + + + + { + event.preventDefault(); + navigateToAppUrl('/integrations/browse/observability'); + }} + > + {i18n.translate( + 'xpack.observability_onboarding.exploreOtherIntegrations', + { + defaultMessage: 'Explore other integrations', + } + )} + + + + + {i18n.translate('xpack.observability_onboarding.steps.back', { + defaultMessage: 'Back', + })} + , + <>, + ]} + /> + + ); +} + +function LogsTypeSection({ + title, + children, +}: PropsWithChildren<{ title: string }>) { + return ( + <> + +

{title}

+
+ + {children} + + ); +} + +function OptionCard({ + title, + iconType, + onClick, + description, +}: { + title: string; + iconType: EuiIconProps['type']; + onClick: () => void; + description: string; +}) { + return ( + } + title={title} + titleSize="xs" + paddingSize="m" + onClick={onClick} + hasBorder={true} + description={description} + /> + ); +} diff --git a/x-pack/plugins/observability_onboarding/public/components/app/home/index.tsx b/x-pack/plugins/observability_onboarding/public/components/app/home/index.tsx index 5620b7535ba63..2fac8b0d9c60b 100644 --- a/x-pack/plugins/observability_onboarding/public/components/app/home/index.tsx +++ b/x-pack/plugins/observability_onboarding/public/components/app/home/index.tsx @@ -25,7 +25,7 @@ import { breadcrumbsApp } from '../../../application/app'; export function Home() { useBreadcrumbs([], breadcrumbsApp); - const navigateToKibanaUrl = useKibanaNavigation(); + const { navigateToKibanaUrl } = useKibanaNavigation(); const handleClickSystemLogs = () => {}; const handleClickCustomLogs = () => { diff --git a/x-pack/plugins/observability_onboarding/public/hooks/use_kibana_navigation.ts b/x-pack/plugins/observability_onboarding/public/hooks/use_kibana_navigation.ts index f9628e7e333ba..0e8e4ee72134a 100644 --- a/x-pack/plugins/observability_onboarding/public/hooks/use_kibana_navigation.ts +++ b/x-pack/plugins/observability_onboarding/public/hooks/use_kibana_navigation.ts @@ -15,13 +15,17 @@ interface ObservabilityOnboardingAppServices { export function useKibanaNavigation() { const { - application: { navigateToUrl }, + application: { navigateToUrl, navigateToApp }, http: { basePath }, } = useKibana().services; const navigateToKibanaUrl = (kibanaPath: string) => { - navigateToUrl(basePath.prepend(kibanaPath)); + navigateToUrl(basePath.prepend(kibanaPath), {}); }; - return navigateToKibanaUrl; + const navigateToAppUrl = (path: string) => { + navigateToApp('', { path, openInNewTab: true }); + }; + + return { navigateToKibanaUrl, navigateToAppUrl }; }