import {InjectedRouter} from 'react-router'; import styled from '@emotion/styled'; import {Location} from 'history'; import {openDashboardWidgetQuerySelectorModal} from 'sentry/actionCreators/modal'; import {Button} from 'sentry/components/button'; import {openConfirmModal} from 'sentry/components/confirm'; import {DropdownMenu, MenuItemProps} from 'sentry/components/dropdownMenu'; import {isWidgetViewerPath} from 'sentry/components/modals/widgetViewerModal/utils'; import Tag from 'sentry/components/tag'; import {IconEllipsis, IconExpand} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {Organization, PageFilters} from 'sentry/types'; import {Series} from 'sentry/types/echarts'; import {trackAnalytics} from 'sentry/utils/analytics'; import {TableDataWithTitle} from 'sentry/utils/discover/discoverQuery'; import {AggregationOutputType} from 'sentry/utils/discover/fields'; import { MEPConsumer, MEPState, } from 'sentry/utils/performance/contexts/metricsEnhancedSetting'; import { getWidgetDDMUrl, getWidgetDiscoverUrl, getWidgetIssueUrl, } from 'sentry/views/dashboards/utils'; import {Widget, WidgetType} from '../types'; import {WidgetViewerContext} from '../widgetViewer/widgetViewerContext'; import {useDashboardsMEPContext} from './dashboardsMEPContext'; type Props = { location: Location; organization: Organization; router: InjectedRouter; selection: PageFilters; widget: Widget; widgetLimitReached: boolean; index?: string; isPreview?: boolean; onDelete?: () => void; onDuplicate?: () => void; onEdit?: () => void; pageLinks?: string; seriesData?: Series[]; seriesResultsType?: Record; showContextMenu?: boolean; tableData?: TableDataWithTitle[]; totalIssuesCount?: string; }; function WidgetCardContextMenu({ organization, selection, widget, widgetLimitReached, onDelete, onDuplicate, onEdit, showContextMenu, isPreview, router, location, index, seriesData, tableData, pageLinks, totalIssuesCount, seriesResultsType, }: Props) { const {isMetricsData} = useDashboardsMEPContext(); if (!showContextMenu) { return null; } const menuOptions: MenuItemProps[] = []; const disabledKeys: string[] = []; const openWidgetViewerPath = (id: string | undefined) => { if (!isWidgetViewerPath(location.pathname)) { router.push({ pathname: `${location.pathname}${ location.pathname.endsWith('/') ? '' : '/' }widget/${id}/`, query: location.query, }); } }; if (isPreview) { return ( {({setData}) => ( {metricSettingContext => ( {!organization.features.includes('performance-mep-bannerless-ui') && isMetricsData === false && metricSettingContext && metricSettingContext.metricSettingState !== MEPState.TRANSACTIONS_ONLY && ( {t('Indexed')} )} , }} position="bottom-end" disabledKeys={[...disabledKeys, 'preview']} />