|
@@ -7,6 +7,7 @@ import emptyStateImg from 'sentry-images/spot/custom-metrics-empty-state.svg';
|
|
|
|
|
|
import Alert from 'sentry/components/alert';
|
|
|
import GuideAnchor from 'sentry/components/assistant/guideAnchor';
|
|
|
+import FeatureBadge from 'sentry/components/badge/featureBadge';
|
|
|
import Banner from 'sentry/components/banner';
|
|
|
import {Button} from 'sentry/components/button';
|
|
|
import ButtonBar from 'sentry/components/buttonBar';
|
|
@@ -23,21 +24,16 @@ import {t} from 'sentry/locale';
|
|
|
import {space} from 'sentry/styles/space';
|
|
|
import {trackAnalytics} from 'sentry/utils/analytics';
|
|
|
import {METRICS_DOCS_URL} from 'sentry/utils/metrics/constants';
|
|
|
-import {canSeeMetricsPage} from 'sentry/utils/metrics/features';
|
|
|
+import {hasCustomMetrics} from 'sentry/utils/metrics/features';
|
|
|
import useDismissAlert from 'sentry/utils/useDismissAlert';
|
|
|
import {useLocalStorageState} from 'sentry/utils/useLocalStorageState';
|
|
|
import useMedia from 'sentry/utils/useMedia';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import usePageFilters from 'sentry/utils/usePageFilters';
|
|
|
import BackgroundSpace from 'sentry/views/discover/backgroundSpace';
|
|
|
-import {
|
|
|
- MetricsOnboardingPanelPrimaryAction,
|
|
|
- MetricsSubscriptionAlert,
|
|
|
-} from 'sentry/views/metrics/billing';
|
|
|
import {useMetricsContext} from 'sentry/views/metrics/context';
|
|
|
import {useMetricsOnboardingSidebar} from 'sentry/views/metrics/ddmOnboarding/useMetricsOnboardingSidebar';
|
|
|
import {IntervalSelect} from 'sentry/views/metrics/intervalSelect';
|
|
|
-import {MetricsFeatureBadge} from 'sentry/views/metrics/metricFeatureBadge';
|
|
|
import {PageHeaderActions} from 'sentry/views/metrics/pageHeaderActions';
|
|
|
import {Queries} from 'sentry/views/metrics/queries';
|
|
|
import {MetricScratchpad} from 'sentry/views/metrics/scratchpad';
|
|
@@ -47,8 +43,11 @@ export const MetricsLayout = memo(() => {
|
|
|
const organization = useOrganization();
|
|
|
const pageFilters = usePageFilters();
|
|
|
const selectedProjects = pageFilters.selection.projects.join();
|
|
|
- const {hasCustomMetrics, hasPerformanceMetrics, isHasMetricsLoading} =
|
|
|
- useMetricsContext();
|
|
|
+ const {
|
|
|
+ hasCustomMetrics: hasSentCustomMetrics,
|
|
|
+ hasPerformanceMetrics,
|
|
|
+ isHasMetricsLoading,
|
|
|
+ } = useMetricsContext();
|
|
|
const {activateSidebar} = useMetricsOnboardingSidebar();
|
|
|
const {dismiss: emptyStateDismiss, isDismissed: isEmptyStateDismissed} =
|
|
|
useDismissAlert({
|
|
@@ -58,7 +57,7 @@ export const MetricsLayout = memo(() => {
|
|
|
const isSmallBanner = useMedia(`(max-width: ${theme.breakpoints.medium})`);
|
|
|
const [isBannerDismissed] = useLocalStorageState('metrics-banner-dismissed', false);
|
|
|
|
|
|
- const showOnboardingPanel = !isEmptyStateDismissed && !hasCustomMetrics;
|
|
|
+ const showOnboardingPanel = !isEmptyStateDismissed && !hasSentCustomMetrics;
|
|
|
|
|
|
const addCustomMetric = useCallback(
|
|
|
(referrer: 'header' | 'onboarding_panel' | 'banner') => {
|
|
@@ -84,7 +83,7 @@ export const MetricsLayout = memo(() => {
|
|
|
emptyStateDismiss();
|
|
|
}, [emptyStateDismiss, organization]);
|
|
|
|
|
|
- if (!canSeeMetricsPage(organization)) {
|
|
|
+ if (!hasCustomMetrics(organization)) {
|
|
|
return (
|
|
|
<Layout.Page withPadding>
|
|
|
<Alert type="warning">{t("You don't have access to this feature")}</Alert>
|
|
@@ -94,7 +93,6 @@ export const MetricsLayout = memo(() => {
|
|
|
|
|
|
return (
|
|
|
<Fragment>
|
|
|
- <MetricsSubscriptionAlert organization={organization} />
|
|
|
<Layout.Header>
|
|
|
<Layout.HeaderContent>
|
|
|
<Layout.Title>
|
|
@@ -105,14 +103,14 @@ export const MetricsLayout = memo(() => {
|
|
|
'Metrics help you track and visualize the data points you care about, making it easier to monitor your application health and identify issues.'
|
|
|
)}
|
|
|
/>
|
|
|
- <MetricsFeatureBadge />
|
|
|
+ <FeatureBadge type="beta" />
|
|
|
</Layout.Title>
|
|
|
</Layout.HeaderContent>
|
|
|
<Layout.HeaderActions>
|
|
|
{!showOnboardingPanel ? (
|
|
|
<PageHeaderActions
|
|
|
showCustomMetricButton={
|
|
|
- hasCustomMetrics || (isEmptyStateDismissed && isBannerDismissed)
|
|
|
+ hasSentCustomMetrics || (isEmptyStateDismissed && isBannerDismissed)
|
|
|
}
|
|
|
addCustomMetric={() => addCustomMetric('header')}
|
|
|
/>
|
|
@@ -122,7 +120,7 @@ export const MetricsLayout = memo(() => {
|
|
|
<Layout.Body>
|
|
|
<FloatingFeedbackWidget />
|
|
|
<Layout.Main fullWidth>
|
|
|
- {isEmptyStateDismissed && !hasCustomMetrics && (
|
|
|
+ {isEmptyStateDismissed && !hasSentCustomMetrics && (
|
|
|
<Banner
|
|
|
title={t('Custom Metrics')}
|
|
|
subtitle={t(
|
|
@@ -166,24 +164,22 @@ export const MetricsLayout = memo(() => {
|
|
|
'Create custom metrics to track and visualize the data points you care about over time, like processing time, checkout conversion rate, or user signups. See correlated trace exemplars and metrics if used together with Performance Monitoring.'
|
|
|
)}
|
|
|
</p>
|
|
|
- <MetricsOnboardingPanelPrimaryAction organization={organization}>
|
|
|
- <ButtonList gap={1}>
|
|
|
- <Button
|
|
|
- priority="primary"
|
|
|
- onClick={() => addCustomMetric('onboarding_panel')}
|
|
|
- >
|
|
|
- {t('Set Up Custom Metric')}
|
|
|
+ <ButtonList gap={1}>
|
|
|
+ <Button
|
|
|
+ priority="primary"
|
|
|
+ onClick={() => addCustomMetric('onboarding_panel')}
|
|
|
+ >
|
|
|
+ {t('Set Up Custom Metric')}
|
|
|
+ </Button>
|
|
|
+ <Button href={METRICS_DOCS_URL} external>
|
|
|
+ {t('Read Docs')}
|
|
|
+ </Button>
|
|
|
+ {hasPerformanceMetrics && (
|
|
|
+ <Button onClick={viewPerformanceMetrics}>
|
|
|
+ {t('View Performance Metrics')}
|
|
|
</Button>
|
|
|
- <Button href={METRICS_DOCS_URL} external>
|
|
|
- {t('Read Docs')}
|
|
|
- </Button>
|
|
|
- {hasPerformanceMetrics && (
|
|
|
- <Button onClick={viewPerformanceMetrics}>
|
|
|
- {t('View Performance Metrics')}
|
|
|
- </Button>
|
|
|
- )}
|
|
|
- </ButtonList>
|
|
|
- </MetricsOnboardingPanelPrimaryAction>
|
|
|
+ )}
|
|
|
+ </ButtonList>
|
|
|
</OnboardingPanel>
|
|
|
)}
|
|
|
</Layout.Main>
|