Skip to content

Commit dcfd3ab

Browse files
feat(flags): add python onboarding sidebar
1 parent 88fe9d1 commit dcfd3ab

File tree

15 files changed

+783
-233
lines changed

15 files changed

+783
-233
lines changed

static/app/components/events/featureFlags/eventFeatureFlagList.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {Fragment, useCallback, useEffect, useMemo, useRef, useState} from 'react';
22
import styled from '@emotion/styled';
33

4-
import {openModal} from 'sentry/actionCreators/modal';
54
import {Button} from 'sentry/components/button';
65
import ButtonBar from 'sentry/components/buttonBar';
76
import EmptyStateWarning from 'sentry/components/emptyStateWarning';
@@ -11,10 +10,7 @@ import {
1110
FeatureFlagDrawer,
1211
} from 'sentry/components/events/featureFlags/featureFlagDrawer';
1312
import FeatureFlagSort from 'sentry/components/events/featureFlags/featureFlagSort';
14-
import {
15-
modalCss,
16-
SetupIntegrationModal,
17-
} from 'sentry/components/events/featureFlags/setupIntegrationModal';
13+
import {useFeatureFlagOnboarding} from 'sentry/components/events/featureFlags/useFeatureFlagOnboarding';
1814
import {
1915
FlagControlOptions,
2016
OrderBy,
@@ -80,6 +76,7 @@ export function EventFeatureFlagList({
8076
statsPeriod: eventView.statsPeriod,
8177
},
8278
});
79+
const {activateSidebar} = useFeatureFlagOnboarding();
8380

8481
const {
8582
suspectFlags,
@@ -95,13 +92,6 @@ export function EventFeatureFlagList({
9592
const hasFlagContext = !!event.contexts.flags;
9693
const hasFlags = Boolean(hasFlagContext && event?.contexts?.flags?.values.length);
9794

98-
function handleSetupButtonClick() {
99-
trackAnalytics('flags.setup_modal_opened', {organization});
100-
openModal(modalProps => <SetupIntegrationModal {...modalProps} />, {
101-
modalCss,
102-
});
103-
}
104-
10595
const suspectFlagNames: Set<string> = useMemo(() => {
10696
return isSuspectError || isSuspectPending
10797
? new Set()
@@ -195,7 +185,7 @@ export function EventFeatureFlagList({
195185
<Button
196186
aria-label={t('Set Up Integration')}
197187
size="xs"
198-
onClick={handleSetupButtonClick}
188+
onClick={activateSidebar}
199189
>
200190
{t('Set Up Integration')}
201191
</Button>
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import {useMemo} from 'react';
2+
import styled from '@emotion/styled';
3+
4+
import OnboardingIntegrationSection from 'sentry/components/events/featureFlags/onboardingIntegrationSection';
5+
import {AuthTokenGeneratorProvider} from 'sentry/components/onboarding/gettingStartedDoc/authTokenGenerator';
6+
import type {OnboardingLayoutProps} from 'sentry/components/onboarding/gettingStartedDoc/onboardingLayout';
7+
import {Step, StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
8+
import type {DocsParams} from 'sentry/components/onboarding/gettingStartedDoc/types';
9+
import {useSourcePackageRegistries} from 'sentry/components/onboarding/gettingStartedDoc/useSourcePackageRegistries';
10+
import {useUrlPlatformOptions} from 'sentry/components/onboarding/platformOptionsControl';
11+
import ConfigStore from 'sentry/stores/configStore';
12+
import {useLegacyStore} from 'sentry/stores/useLegacyStore';
13+
import {space} from 'sentry/styles/space';
14+
import useApi from 'sentry/utils/useApi';
15+
import useOrganization from 'sentry/utils/useOrganization';
16+
17+
export function FeatureFlagOnboardingLayout({
18+
docsConfig,
19+
dsn,
20+
platformKey,
21+
projectId,
22+
projectSlug,
23+
newOrg,
24+
projectKeyId,
25+
configType = 'onboarding',
26+
integration = '',
27+
provider = '',
28+
}: OnboardingLayoutProps) {
29+
const api = useApi();
30+
const organization = useOrganization();
31+
const {isPending: isLoadingRegistry, data: registryData} =
32+
useSourcePackageRegistries(organization);
33+
const selectedOptions = useUrlPlatformOptions(docsConfig.platformOptions);
34+
const {isSelfHosted, urlPrefix} = useLegacyStore(ConfigStore);
35+
36+
const {introduction, steps} = useMemo(() => {
37+
const doc = docsConfig[configType] ?? docsConfig.onboarding;
38+
39+
const docParams: DocsParams<any> = {
40+
api,
41+
projectKeyId,
42+
dsn,
43+
organization,
44+
platformKey,
45+
projectId,
46+
projectSlug,
47+
isFeedbackSelected: false,
48+
isPerformanceSelected: false,
49+
isProfilingSelected: false,
50+
isReplaySelected: false,
51+
sourcePackageRegistries: {
52+
isLoading: isLoadingRegistry,
53+
data: registryData,
54+
},
55+
platformOptions: selectedOptions,
56+
newOrg,
57+
isSelfHosted,
58+
urlPrefix,
59+
integration,
60+
};
61+
62+
return {
63+
introduction: doc.introduction?.(docParams),
64+
steps: [
65+
...doc.install(docParams),
66+
...doc.configure(docParams),
67+
...doc.verify(docParams),
68+
],
69+
nextSteps: doc.nextSteps?.(docParams) || [],
70+
};
71+
}, [
72+
docsConfig,
73+
dsn,
74+
isLoadingRegistry,
75+
newOrg,
76+
organization,
77+
platformKey,
78+
projectId,
79+
projectSlug,
80+
registryData,
81+
selectedOptions,
82+
configType,
83+
urlPrefix,
84+
isSelfHosted,
85+
api,
86+
projectKeyId,
87+
integration,
88+
]);
89+
90+
return (
91+
<AuthTokenGeneratorProvider projectSlug={projectSlug}>
92+
<Wrapper>
93+
{introduction && <Introduction>{introduction}</Introduction>}
94+
<Steps>
95+
{steps.map(step =>
96+
step.type === StepType.CONFIGURE ? (
97+
<Step
98+
key={step.title ?? step.type}
99+
{...{
100+
...step,
101+
}}
102+
/>
103+
) : (
104+
<Step key={step.title ?? step.type} {...step} />
105+
)
106+
)}
107+
</Steps>
108+
<OnboardingIntegrationSection provider={provider} integration={integration} />
109+
</Wrapper>
110+
</AuthTokenGeneratorProvider>
111+
);
112+
}
113+
114+
const Steps = styled('div')`
115+
display: flex;
116+
flex-direction: column;
117+
gap: 1.5rem;
118+
`;
119+
120+
const Wrapper = styled('div')`
121+
h4 {
122+
margin-bottom: 0.5em;
123+
}
124+
&& {
125+
p {
126+
margin-bottom: 0;
127+
}
128+
h5 {
129+
margin-bottom: 0;
130+
}
131+
}
132+
`;
133+
134+
const Introduction = styled('div')`
135+
display: flex;
136+
flex-direction: column;
137+
margin: 0 0 ${space(2)} 0;
138+
`;

0 commit comments

Comments
 (0)