Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GettingStarted Rework #2194

Merged
merged 9 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions common/constants/getting_started_routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export type TutorialId =
| 'otelLogs'
| 'otelMetrics'
| 'otelTraces'
| 'nginx'
| 'java'
| 'python'
| 'golang';

export const COMPONENT_MAP: Record<TutorialId, string> = {
otelLogs: 'otel-index-patterns',
otelMetrics: 'otel-index-patterns',
otelTraces: 'otel-index-patterns',
nginx: 'nginx',
java: 'java-tutorial',
python: 'python-tutorial',
golang: 'golang-tutorial',
};

export const VERSION_MAP: Record<TutorialId, string> = {
otelLogs: '1.0.0',
otelMetrics: '1.0.0',
otelTraces: '1.0.0',
nginx: '1.0.0',
java: '1.0.0',
python: '1.0.0',
golang: '1.0.0',
};

export const SIGNAL_MAP: Record<TutorialId, string> = {
otelLogs: 'Logs',
otelMetrics: 'Metrics',
otelTraces: 'Traces',
nginx: '',
java: '',
python: '',
golang: '',
};
40 changes: 1 addition & 39 deletions public/components/getting_started/components/getting_started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiPage, EuiPageBody, EuiSpacer } from '@elastic/eui';
import { EuiPage, EuiPageBody } from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { HomeProps } from 'public/components/getting_started/home';
import { CollectAndShipData } from './getting_started_collectData';
import { QueryAndAnalyze } from './getting_started_queryAndAnalyze';
import { observabilityGettingStartedTitle } from '../../../../common/constants/shared';

interface ExtendedHomeProps extends HomeProps {
Expand All @@ -17,10 +16,7 @@ interface ExtendedHomeProps extends HomeProps {

export const NewGettingStarted = (props: ExtendedHomeProps) => {
const { chrome, selectedDataSourceId, selectedDataSourceLabel } = props;
const [selectedSource, setSelectedSource] = useState('');
const [isPickYourSourceOpen, setIsPickYourSourceOpen] = useState(true);
const [isQueryDataOpen, setIsQueryDataOpen] = useState(false);
const [isSampleDataset, setIsSampleDataset] = useState(false);

useEffect(() => {
chrome.setBreadcrumbs([
Expand All @@ -31,28 +27,8 @@ export const NewGettingStarted = (props: ExtendedHomeProps) => {
]);
}, [chrome]);

const handleSelectSource = (source: string) => {
setSelectedSource(source);
};

const togglePickYourSource = (isOpen: boolean) => {
setIsPickYourSourceOpen(isOpen);
if (isOpen) {
setIsQueryDataOpen(false);
}
};

const toggleQueryData = (isOpen: boolean) => {
setIsQueryDataOpen(isOpen);
};

const setQueryDataOpen = () => {
setIsPickYourSourceOpen(false);
setIsQueryDataOpen(true);
};

const handleCardSelectionChange = (isSample: boolean) => {
setIsSampleDataset(isSample);
};

return (
Expand All @@ -61,23 +37,9 @@ export const NewGettingStarted = (props: ExtendedHomeProps) => {
<CollectAndShipData
isOpen={isPickYourSourceOpen}
onToggle={togglePickYourSource}
selectedTechnology={selectedSource}
onMoveToQueryData={setQueryDataOpen}
onSelectSource={handleSelectSource}
onCardSelectionChange={handleCardSelectionChange}
selectedDataSourceId={selectedDataSourceId}
selectedDataSourceLabel={selectedDataSourceLabel}
/>
<EuiSpacer size="m" />
{!isSampleDataset && (
<QueryAndAnalyze
isOpen={isQueryDataOpen}
onToggle={toggleQueryData}
selectedTechnology={selectedSource}
selectedDataSourceId={selectedDataSourceId}
selectedDataSourceLabel={selectedDataSourceLabel}
/>
)}
</EuiPageBody>
</EuiPage>
);
Expand Down
Loading
Loading