|
@@ -21,9 +21,10 @@ import {trackAnalytics} from 'sentry/utils/analytics';
|
|
|
import type {TableDataWithTitle} from 'sentry/utils/discover/discoverQuery';
|
|
|
import type {AggregationOutputType} from 'sentry/utils/discover/fields';
|
|
|
import {
|
|
|
- MEPConsumer,
|
|
|
MEPState,
|
|
|
+ useMEPSettingContext,
|
|
|
} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
|
|
|
+import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import {
|
|
|
getWidgetDiscoverUrl,
|
|
|
getWidgetIssueUrl,
|
|
@@ -61,6 +62,19 @@ type Props = {
|
|
|
totalIssuesCount?: string;
|
|
|
};
|
|
|
|
|
|
+const useIndexedEventsWarning = (): string | null => {
|
|
|
+ const {isMetricsData} = useDashboardsMEPContext();
|
|
|
+ const organization = useOrganization();
|
|
|
+ const metricSettingContext = useMEPSettingContext();
|
|
|
+
|
|
|
+ return !organization.features.includes('performance-mep-bannerless-ui') &&
|
|
|
+ isMetricsData === false &&
|
|
|
+ metricSettingContext &&
|
|
|
+ metricSettingContext.metricSettingState !== MEPState.TRANSACTIONS_ONLY
|
|
|
+ ? t('Indexed')
|
|
|
+ : null;
|
|
|
+};
|
|
|
+
|
|
|
function WidgetCardContextMenu({
|
|
|
organization,
|
|
|
selection,
|
|
@@ -82,6 +96,7 @@ function WidgetCardContextMenu({
|
|
|
description,
|
|
|
title,
|
|
|
}: Props) {
|
|
|
+ const indexedEventsWarning = useIndexedEventsWarning();
|
|
|
const {isMetricsData} = useDashboardsMEPContext();
|
|
|
|
|
|
if (!showContextMenu) {
|
|
@@ -106,82 +121,68 @@ function WidgetCardContextMenu({
|
|
|
return (
|
|
|
<WidgetViewerContext.Consumer>
|
|
|
{({setData}) => (
|
|
|
- <MEPConsumer>
|
|
|
- {metricSettingContext => (
|
|
|
- <ContextWrapper>
|
|
|
- {!organization.features.includes('performance-mep-bannerless-ui') &&
|
|
|
- isMetricsData === false &&
|
|
|
- metricSettingContext &&
|
|
|
- metricSettingContext.metricSettingState !==
|
|
|
- MEPState.TRANSACTIONS_ONLY && (
|
|
|
- <SampledTag
|
|
|
- tooltipText={t('This widget is only applicable to indexed events.')}
|
|
|
- >
|
|
|
- {t('Indexed')}
|
|
|
- </SampledTag>
|
|
|
- )}
|
|
|
- {title && (
|
|
|
- <Tooltip
|
|
|
- title={
|
|
|
- <span>
|
|
|
- <WidgetTooltipTitle>{title}</WidgetTooltipTitle>
|
|
|
- {description && (
|
|
|
- <WidgetTooltipDescription>
|
|
|
- {description}
|
|
|
- </WidgetTooltipDescription>
|
|
|
- )}
|
|
|
- </span>
|
|
|
- }
|
|
|
- containerDisplayMode="grid"
|
|
|
- isHoverable
|
|
|
- >
|
|
|
- <WidgetTooltipButton
|
|
|
- aria-label={t('Widget description')}
|
|
|
- borderless
|
|
|
- size="xs"
|
|
|
- icon={<IconInfo />}
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
- )}
|
|
|
- <StyledDropdownMenuControl
|
|
|
- items={[
|
|
|
- {
|
|
|
- key: 'preview',
|
|
|
- label: t(
|
|
|
- 'This is a preview only. To edit, you must add this dashboard.'
|
|
|
- ),
|
|
|
- },
|
|
|
- ]}
|
|
|
- triggerProps={{
|
|
|
- 'aria-label': t('Widget actions'),
|
|
|
- size: 'xs',
|
|
|
- borderless: true,
|
|
|
- showChevron: false,
|
|
|
- icon: <IconEllipsis direction="down" size="sm" />,
|
|
|
- }}
|
|
|
- position="bottom-end"
|
|
|
- disabledKeys={[...disabledKeys, 'preview']}
|
|
|
- />
|
|
|
- <Button
|
|
|
- aria-label={t('Open Widget Viewer')}
|
|
|
+ <ContextWrapper>
|
|
|
+ {indexedEventsWarning ? (
|
|
|
+ <SampledTag tooltipText={indexedEventsWarning}>{t('Indexed')}</SampledTag>
|
|
|
+ ) : null}
|
|
|
+ {title && (
|
|
|
+ <Tooltip
|
|
|
+ title={
|
|
|
+ <span>
|
|
|
+ <WidgetTooltipTitle>{title}</WidgetTooltipTitle>
|
|
|
+ {description && (
|
|
|
+ <WidgetTooltipDescription>{description}</WidgetTooltipDescription>
|
|
|
+ )}
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ containerDisplayMode="grid"
|
|
|
+ isHoverable
|
|
|
+ >
|
|
|
+ <WidgetTooltipButton
|
|
|
+ aria-label={t('Widget description')}
|
|
|
borderless
|
|
|
size="xs"
|
|
|
- icon={<IconExpand />}
|
|
|
- onClick={() => {
|
|
|
- (seriesData || tableData) &&
|
|
|
- setData({
|
|
|
- seriesData,
|
|
|
- tableData,
|
|
|
- pageLinks,
|
|
|
- totalIssuesCount,
|
|
|
- seriesResultsType,
|
|
|
- });
|
|
|
- openWidgetViewerPath(index);
|
|
|
- }}
|
|
|
+ icon={<IconInfo />}
|
|
|
/>
|
|
|
- </ContextWrapper>
|
|
|
+ </Tooltip>
|
|
|
)}
|
|
|
- </MEPConsumer>
|
|
|
+ <StyledDropdownMenuControl
|
|
|
+ items={[
|
|
|
+ {
|
|
|
+ key: 'preview',
|
|
|
+ label: t(
|
|
|
+ 'This is a preview only. To edit, you must add this dashboard.'
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ triggerProps={{
|
|
|
+ 'aria-label': t('Widget actions'),
|
|
|
+ size: 'xs',
|
|
|
+ borderless: true,
|
|
|
+ showChevron: false,
|
|
|
+ icon: <IconEllipsis direction="down" size="sm" />,
|
|
|
+ }}
|
|
|
+ position="bottom-end"
|
|
|
+ disabledKeys={[...disabledKeys, 'preview']}
|
|
|
+ />
|
|
|
+ <Button
|
|
|
+ aria-label={t('Open Widget Viewer')}
|
|
|
+ borderless
|
|
|
+ size="xs"
|
|
|
+ icon={<IconExpand />}
|
|
|
+ onClick={() => {
|
|
|
+ (seriesData || tableData) &&
|
|
|
+ setData({
|
|
|
+ seriesData,
|
|
|
+ tableData,
|
|
|
+ pageLinks,
|
|
|
+ totalIssuesCount,
|
|
|
+ seriesResultsType,
|
|
|
+ });
|
|
|
+ openWidgetViewerPath(index);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </ContextWrapper>
|
|
|
)}
|
|
|
</WidgetViewerContext.Consumer>
|
|
|
);
|
|
@@ -296,72 +297,60 @@ function WidgetCardContextMenu({
|
|
|
return (
|
|
|
<WidgetViewerContext.Consumer>
|
|
|
{({setData}) => (
|
|
|
- <MEPConsumer>
|
|
|
- {metricSettingContext => (
|
|
|
- <ContextWrapper>
|
|
|
- {!organization.features.includes('performance-mep-bannerless-ui') &&
|
|
|
- isMetricsData === false &&
|
|
|
- metricSettingContext &&
|
|
|
- metricSettingContext.metricSettingState !==
|
|
|
- MEPState.TRANSACTIONS_ONLY && (
|
|
|
- <SampledTag
|
|
|
- tooltipText={t('This widget is only applicable to indexed events.')}
|
|
|
- >
|
|
|
- {t('Indexed')}
|
|
|
- </SampledTag>
|
|
|
- )}
|
|
|
- {title && (
|
|
|
- <Tooltip
|
|
|
- title={
|
|
|
- <span>
|
|
|
- <WidgetTooltipTitle>{title}</WidgetTooltipTitle>
|
|
|
- {description && (
|
|
|
- <WidgetTooltipDescription>{description}</WidgetTooltipDescription>
|
|
|
- )}
|
|
|
- </span>
|
|
|
- }
|
|
|
- containerDisplayMode="grid"
|
|
|
- isHoverable
|
|
|
- >
|
|
|
- <WidgetTooltipButton
|
|
|
- aria-label={t('Widget description')}
|
|
|
- borderless
|
|
|
- size="xs"
|
|
|
- icon={<IconInfo />}
|
|
|
- />
|
|
|
- </Tooltip>
|
|
|
- )}
|
|
|
- <StyledDropdownMenuControl
|
|
|
- items={menuOptions}
|
|
|
- triggerProps={{
|
|
|
- 'aria-label': t('Widget actions'),
|
|
|
- size: 'xs',
|
|
|
- borderless: true,
|
|
|
- showChevron: false,
|
|
|
- icon: <IconEllipsis direction="down" size="sm" />,
|
|
|
- }}
|
|
|
- position="bottom-end"
|
|
|
- disabledKeys={[...disabledKeys]}
|
|
|
- />
|
|
|
- <Button
|
|
|
- aria-label={t('Open Widget Viewer')}
|
|
|
+ <ContextWrapper>
|
|
|
+ {indexedEventsWarning ? (
|
|
|
+ <SampledTag tooltipText={indexedEventsWarning}>{t('Indexed')}</SampledTag>
|
|
|
+ ) : null}
|
|
|
+ {title && (
|
|
|
+ <Tooltip
|
|
|
+ title={
|
|
|
+ <span>
|
|
|
+ <WidgetTooltipTitle>{title}</WidgetTooltipTitle>
|
|
|
+ {description && (
|
|
|
+ <WidgetTooltipDescription>{description}</WidgetTooltipDescription>
|
|
|
+ )}
|
|
|
+ </span>
|
|
|
+ }
|
|
|
+ containerDisplayMode="grid"
|
|
|
+ isHoverable
|
|
|
+ >
|
|
|
+ <WidgetTooltipButton
|
|
|
+ aria-label={t('Widget description')}
|
|
|
borderless
|
|
|
size="xs"
|
|
|
- icon={<IconExpand />}
|
|
|
- onClick={() => {
|
|
|
- setData({
|
|
|
- seriesData,
|
|
|
- tableData,
|
|
|
- pageLinks,
|
|
|
- totalIssuesCount,
|
|
|
- seriesResultsType,
|
|
|
- });
|
|
|
- openWidgetViewerPath(widget.id ?? index);
|
|
|
- }}
|
|
|
+ icon={<IconInfo />}
|
|
|
/>
|
|
|
- </ContextWrapper>
|
|
|
+ </Tooltip>
|
|
|
)}
|
|
|
- </MEPConsumer>
|
|
|
+ <StyledDropdownMenuControl
|
|
|
+ items={menuOptions}
|
|
|
+ triggerProps={{
|
|
|
+ 'aria-label': t('Widget actions'),
|
|
|
+ size: 'xs',
|
|
|
+ borderless: true,
|
|
|
+ showChevron: false,
|
|
|
+ icon: <IconEllipsis direction="down" size="sm" />,
|
|
|
+ }}
|
|
|
+ position="bottom-end"
|
|
|
+ disabledKeys={[...disabledKeys]}
|
|
|
+ />
|
|
|
+ <Button
|
|
|
+ aria-label={t('Open Widget Viewer')}
|
|
|
+ borderless
|
|
|
+ size="xs"
|
|
|
+ icon={<IconExpand />}
|
|
|
+ onClick={() => {
|
|
|
+ setData({
|
|
|
+ seriesData,
|
|
|
+ tableData,
|
|
|
+ pageLinks,
|
|
|
+ totalIssuesCount,
|
|
|
+ seriesResultsType,
|
|
|
+ });
|
|
|
+ openWidgetViewerPath(widget.id ?? index);
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </ContextWrapper>
|
|
|
)}
|
|
|
</WidgetViewerContext.Consumer>
|
|
|
);
|