|
@@ -1,4 +1,4 @@
|
|
|
-import {useEffect} from 'react';
|
|
|
+import {Fragment, useEffect} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
import * as Sentry from '@sentry/react';
|
|
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
addLoadingMessage,
|
|
|
clearIndicators,
|
|
|
} from 'sentry/actionCreators/indicator';
|
|
|
+import UnsupportedAlert from 'sentry/components/alerts/unsupportedAlert';
|
|
|
import {Button} from 'sentry/components/button';
|
|
|
import ButtonBar from 'sentry/components/buttonBar';
|
|
|
import type {TourStep} from 'sentry/components/modals/featureTourModal';
|
|
@@ -23,7 +24,10 @@ import FeatureTourModal, {
|
|
|
import OnboardingPanel from 'sentry/components/onboardingPanel';
|
|
|
import {filterProjects} from 'sentry/components/performanceOnboarding/utils';
|
|
|
import {SidebarPanelKey} from 'sentry/components/sidebar/types';
|
|
|
-import {withPerformanceOnboarding} from 'sentry/data/platformCategories';
|
|
|
+import {
|
|
|
+ withoutPerformanceSupport,
|
|
|
+ withPerformanceOnboarding,
|
|
|
+} from 'sentry/data/platformCategories';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import SidebarPanelStore from 'sentry/stores/sidebarPanelStore';
|
|
|
import type {Organization} from 'sentry/types/organization';
|
|
@@ -140,6 +144,8 @@ function Onboarding({organization, project}: Props) {
|
|
|
const hasPerformanceOnboarding = currentPlatform
|
|
|
? withPerformanceOnboarding.has(currentPlatform)
|
|
|
: false;
|
|
|
+ const noPerformanceSupport =
|
|
|
+ currentPlatform && withoutPerformanceSupport.has(currentPlatform);
|
|
|
|
|
|
let setupButton = (
|
|
|
<Button
|
|
@@ -167,76 +173,81 @@ function Onboarding({organization, project}: Props) {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <OnboardingPanel image={<PerfImage src={emptyStateImg} />}>
|
|
|
- <h3>{t('Pinpoint problems')}</h3>
|
|
|
- <p>
|
|
|
- {t(
|
|
|
- 'Something seem slow? Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
|
|
|
- )}
|
|
|
- </p>
|
|
|
- <ButtonList gap={1}>
|
|
|
- {setupButton}
|
|
|
- <Button
|
|
|
- data-test-id="create-sample-transaction-btn"
|
|
|
- onClick={async () => {
|
|
|
- trackAnalytics('performance_views.create_sample_transaction', {
|
|
|
- platform: project.platform,
|
|
|
- organization,
|
|
|
- });
|
|
|
- addLoadingMessage(t('Processing sample event...'), {
|
|
|
- duration: 15000,
|
|
|
- });
|
|
|
- const url = `/projects/${organization.slug}/${project.slug}/create-sample-transaction/`;
|
|
|
- try {
|
|
|
- const eventData = await api.requestPromise(url, {method: 'POST'});
|
|
|
- const traceSlug = eventData.contexts?.trace?.trace_id ?? '';
|
|
|
-
|
|
|
- browserHistory.push(
|
|
|
- generateLinkToEventInTraceView({
|
|
|
- eventId: eventData.eventID,
|
|
|
- location,
|
|
|
- projectSlug: project.slug,
|
|
|
- organization,
|
|
|
- timestamp: eventData.endTimestamp,
|
|
|
- traceSlug,
|
|
|
- demo: `${project.slug}:${eventData.eventID}`,
|
|
|
- })
|
|
|
- );
|
|
|
- clearIndicators();
|
|
|
- } catch (error) {
|
|
|
- Sentry.withScope(scope => {
|
|
|
- scope.setExtra('error', error);
|
|
|
- Sentry.captureException(new Error('Failed to create sample event'));
|
|
|
- });
|
|
|
- clearIndicators();
|
|
|
- addErrorMessage(t('Failed to create a new sample event'));
|
|
|
- return;
|
|
|
- }
|
|
|
- }}
|
|
|
- >
|
|
|
- {t('View Sample Transaction')}
|
|
|
- </Button>
|
|
|
- </ButtonList>
|
|
|
- <FeatureTourModal
|
|
|
- steps={PERFORMANCE_TOUR_STEPS}
|
|
|
- onAdvance={handleAdvance}
|
|
|
- onCloseModal={handleClose}
|
|
|
- doneUrl={performanceSetupUrl}
|
|
|
- doneText={t('Start Setup')}
|
|
|
- >
|
|
|
- {({showModal}) => (
|
|
|
+ <Fragment>
|
|
|
+ {noPerformanceSupport && (
|
|
|
+ <UnsupportedAlert projectSlug={project.slug} featureName="Performance" />
|
|
|
+ )}
|
|
|
+ <OnboardingPanel image={<PerfImage src={emptyStateImg} />}>
|
|
|
+ <h3>{t('Pinpoint problems')}</h3>
|
|
|
+ <p>
|
|
|
+ {t(
|
|
|
+ 'Something seem slow? Track down transactions to connect the dots between 10-second page loads and poor-performing API calls or slow database queries.'
|
|
|
+ )}
|
|
|
+ </p>
|
|
|
+ <ButtonList gap={1}>
|
|
|
+ {setupButton}
|
|
|
<Button
|
|
|
- priority="link"
|
|
|
- onClick={() => {
|
|
|
- trackAnalytics('performance_views.tour.start', {organization});
|
|
|
- showModal();
|
|
|
+ data-test-id="create-sample-transaction-btn"
|
|
|
+ onClick={async () => {
|
|
|
+ trackAnalytics('performance_views.create_sample_transaction', {
|
|
|
+ platform: project.platform,
|
|
|
+ organization,
|
|
|
+ });
|
|
|
+ addLoadingMessage(t('Processing sample event...'), {
|
|
|
+ duration: 15000,
|
|
|
+ });
|
|
|
+ const url = `/projects/${organization.slug}/${project.slug}/create-sample-transaction/`;
|
|
|
+ try {
|
|
|
+ const eventData = await api.requestPromise(url, {method: 'POST'});
|
|
|
+ const traceSlug = eventData.contexts?.trace?.trace_id ?? '';
|
|
|
+
|
|
|
+ browserHistory.push(
|
|
|
+ generateLinkToEventInTraceView({
|
|
|
+ eventId: eventData.eventID,
|
|
|
+ location,
|
|
|
+ projectSlug: project.slug,
|
|
|
+ organization,
|
|
|
+ timestamp: eventData.endTimestamp,
|
|
|
+ traceSlug,
|
|
|
+ demo: `${project.slug}:${eventData.eventID}`,
|
|
|
+ })
|
|
|
+ );
|
|
|
+ clearIndicators();
|
|
|
+ } catch (error) {
|
|
|
+ Sentry.withScope(scope => {
|
|
|
+ scope.setExtra('error', error);
|
|
|
+ Sentry.captureException(new Error('Failed to create sample event'));
|
|
|
+ });
|
|
|
+ clearIndicators();
|
|
|
+ addErrorMessage(t('Failed to create a new sample event'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
}}
|
|
|
>
|
|
|
- {t('Take a Tour')}
|
|
|
+ {t('View Sample Transaction')}
|
|
|
</Button>
|
|
|
- )}
|
|
|
- </FeatureTourModal>
|
|
|
- </OnboardingPanel>
|
|
|
+ </ButtonList>
|
|
|
+ <FeatureTourModal
|
|
|
+ steps={PERFORMANCE_TOUR_STEPS}
|
|
|
+ onAdvance={handleAdvance}
|
|
|
+ onCloseModal={handleClose}
|
|
|
+ doneUrl={performanceSetupUrl}
|
|
|
+ doneText={t('Start Setup')}
|
|
|
+ >
|
|
|
+ {({showModal}) => (
|
|
|
+ <Button
|
|
|
+ priority="link"
|
|
|
+ onClick={() => {
|
|
|
+ trackAnalytics('performance_views.tour.start', {organization});
|
|
|
+ showModal();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {t('Take a Tour')}
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+ </FeatureTourModal>
|
|
|
+ </OnboardingPanel>
|
|
|
+ </Fragment>
|
|
|
);
|
|
|
}
|
|
|
|