Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
priscilawebdev committed Sep 23, 2024
1 parent 56af4de commit d651392
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 67 deletions.
27 changes: 4 additions & 23 deletions static/app/gettingStartedDocs/node/awslambda.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
import type {
BasePlatformOptions,
Docs,
DocsParams,
OnboardingConfig,
Expand All @@ -15,28 +14,10 @@ import {getJSServerMetricsOnboarding} from 'sentry/components/onboarding/getting
import {t, tct} from 'sentry/locale';
import {trackAnalytics} from 'sentry/utils/analytics';
import {getInstallConfig, getSdkInitSnippet} from 'sentry/utils/gettingStartedDocs/node';

export enum InstallationMode {
AUTO = 'auto',
MANUAL = 'manual',
}

const platformOptions = {
installationMode: {
label: t('Installation Mode'),
items: [
{
label: t('Auto'),
value: InstallationMode.AUTO,
},
{
label: t('Manual'),
value: InstallationMode.MANUAL,
},
],
defaultValue: InstallationMode.AUTO,
},
} satisfies BasePlatformOptions;
import {
InstallationMode,
platformOptions,
} from 'sentry/views/onboarding/integrationSetup';

type PlatformOptions = typeof platformOptions;
type Params = DocsParams<PlatformOptions>;
Expand Down
27 changes: 4 additions & 23 deletions static/app/gettingStartedDocs/python/awslambda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Alert from 'sentry/components/alert';
import ExternalLink from 'sentry/components/links/externalLink';
import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
import {
type BasePlatformOptions,
type Docs,
DocsPageLocation,
type DocsParams,
Expand All @@ -15,28 +14,10 @@ import {crashReportOnboardingPython} from 'sentry/gettingStartedDocs/python/pyth
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {trackAnalytics} from 'sentry/utils/analytics';

export enum InstallationMode {
AUTO = 'auto',
MANUAL = 'manual',
}

const platformOptions = {
installationMode: {
label: t('Installation Mode'),
items: [
{
label: t('Auto'),
value: InstallationMode.AUTO,
},
{
label: t('Manual'),
value: InstallationMode.MANUAL,
},
],
defaultValue: InstallationMode.AUTO,
},
} satisfies BasePlatformOptions;
import {
InstallationMode,
platformOptions,
} from 'sentry/views/onboarding/integrationSetup';

type PlatformOptions = typeof platformOptions;
type Params = DocsParams<PlatformOptions>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import {useCallback} from 'react';

import {decodeBoolean, decodeList, decodeScalar} from 'sentry/utils/queryString';
import {decodeBoolean, decodeList} from 'sentry/utils/queryString';
import useLocationQuery from 'sentry/utils/url/useLocationQuery';
import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';

type QueryValues = {
/**
* Used to show the installation mode for certain platforms, e.g. manual or auto.
* This is defined inside of a platform file
*/
installationMode: string;
/**
* Used to show product selection (error monitoring, tracing, profiling and session replay) for certain platforms, e.g. javascript-react
*/
Expand All @@ -31,7 +26,6 @@ export function useOnboardingQueryParams(): [
fields: {
product: decodeList,
showManualSetup: decodeBoolean,
installationMode: decodeScalar,
},
});

Expand Down
41 changes: 32 additions & 9 deletions static/app/views/onboarding/integrationSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import {Button} from 'sentry/components/button';
import ExternalLink from 'sentry/components/links/externalLink';
import LoadingError from 'sentry/components/loadingError';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import type {DocsParams} from 'sentry/components/onboarding/gettingStartedDoc/types';
import type {
BasePlatformOptions,
DocsParams,
} from 'sentry/components/onboarding/gettingStartedDoc/types';
import {useLoadGettingStarted} from 'sentry/components/onboarding/gettingStartedDoc/utils/useLoadGettingStarted';
import {
PlatformOptionsControl,
Expand All @@ -30,6 +33,28 @@ import {AddIntegrationButton} from 'sentry/views/settings/organizationIntegratio
import AddInstallationInstructions from './components/integrations/addInstallationInstructions';
import PostInstallCodeSnippet from './components/integrations/postInstallCodeSnippet';

export enum InstallationMode {
AUTO = 'auto',
MANUAL = 'manual',
}

export const platformOptions = {
installationMode: {
label: t('Installation Mode'),
items: [
{
label: t('Auto'),
value: InstallationMode.AUTO,
},
{
label: t('Manual'),
value: InstallationMode.MANUAL,
},
],
defaultValue: InstallationMode.AUTO,
},
} satisfies BasePlatformOptions;

type Props = {
integrationSlug: string;
platform: PlatformIntegration;
Expand All @@ -56,7 +81,7 @@ function IntegrationSetup({project, integrationSlug, platform}: Props) {
platform,
});

const platformOptions = useUrlPlatformOptions(docsConfig?.platformOptions);
const selectedPlatformOptions = useUrlPlatformOptions(docsConfig?.platformOptions);

const api = useApi();
const fetchData = useCallback(() => {
Expand Down Expand Up @@ -201,7 +226,7 @@ function IntegrationSetup({project, integrationSlug, platform}: Props) {
isProfilingSelected: false,
isReplaySelected: false,
isSelfHosted,
platformOptions,
platformOptions: selectedPlatformOptions,
sourcePackageRegistries: {
isLoading: false,
data: undefined,
Expand All @@ -215,12 +240,10 @@ function IntegrationSetup({project, integrationSlug, platform}: Props) {
stepHeaderText={t('Automatically instrument %s SDK', platform.name)}
platform={platform.id}
/>
{docsConfig.platformOptions && (
<PlatformOptionsControl
platformOptions={docsConfig.platformOptions}
onChange={docsConfig.onboarding.onPlatformOptionsChange?.(docParams)}
/>
)}
<PlatformOptionsControl
platformOptions={platformOptions}
onChange={docsConfig.onboarding.onPlatformOptionsChange?.(docParams)}
/>
<Divider />
{installed ? renderPostInstallInstructions() : renderIntegrationInstructions()}
{getDynamicText({
Expand Down
7 changes: 2 additions & 5 deletions static/app/views/onboarding/setupDocs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import {platformToIntegrationMap} from 'sentry/utils/integrationUtil';
import {decodeList} from 'sentry/utils/queryString';
import useOrganization from 'sentry/utils/useOrganization';
import SetupIntroduction from 'sentry/views/onboarding/components/setupIntroduction';
import {useOnboardingQueryParams} from 'sentry/views/onboarding/components/useOnboardingQueryParams';
import {OtherPlatformsInfo} from 'sentry/views/projectInstall/otherPlatformsInfo';

import FirstEventFooter from './components/firstEventFooter';
import IntegrationSetup from './integrationSetup';
import IntegrationSetup, {InstallationMode} from './integrationSetup';
import type {StepProps} from './types';

function SetupDocs({location, recentCreatedProject: project}: StepProps) {
Expand All @@ -32,16 +31,14 @@ function SetupDocs({location, recentCreatedProject: project}: StepProps) {
const currentPlatform =
platforms.find(p => p.id === currentPlatformKey) ?? otherPlatform;

const [params] = useOnboardingQueryParams();

if (!project || !currentPlatform) {
return null;
}

const platformName = currentPlatform.name;
const integrationSlug = project.platform && platformToIntegrationMap[project.platform];
const showIntegrationOnboarding =
integrationSlug && params.installationMode !== 'manual';
integrationSlug && location.query.installationMode !== InstallationMode.MANUAL;

return (
<Fragment>
Expand Down

0 comments on commit d651392

Please sign in to comment.