|
@@ -33,12 +33,25 @@ import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import {PageContent} from 'sentry/styles/organization';
|
|
|
import space from 'sentry/styles/space';
|
|
|
-import {Organization} from 'sentry/types';
|
|
|
+import {Organization, Project} from 'sentry/types';
|
|
|
import {defined} from 'sentry/utils';
|
|
|
import {trackAnalyticsEvent} from 'sentry/utils/analytics';
|
|
|
import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
|
|
|
import withApi from 'sentry/utils/withApi';
|
|
|
import withOrganization from 'sentry/utils/withOrganization';
|
|
|
+import withProjects from 'sentry/utils/withProjects';
|
|
|
+import {
|
|
|
+ cloneDashboard,
|
|
|
+ getCurrentPageFilters,
|
|
|
+ hasSavedPageFilters,
|
|
|
+ hasUnsavedFilterChanges,
|
|
|
+ isWidgetUsingTransactionName,
|
|
|
+ resetPageFilters,
|
|
|
+} from 'sentry/views/dashboardsV2/utils';
|
|
|
+import {MetricsDataSwitcherAlert} from 'sentry/views/performance/landing/metricsDataSwitcherAlert';
|
|
|
+
|
|
|
+import {generatePerformanceEventView} from '../performance/data';
|
|
|
+import {MetricsDataSwitcher} from '../performance/landing/metricsDataSwitcher';
|
|
|
|
|
|
import {
|
|
|
WidgetViewerContext,
|
|
@@ -64,13 +77,6 @@ import {
|
|
|
Widget,
|
|
|
WidgetType,
|
|
|
} from './types';
|
|
|
-import {
|
|
|
- cloneDashboard,
|
|
|
- getCurrentPageFilters,
|
|
|
- hasSavedPageFilters,
|
|
|
- hasUnsavedFilterChanges,
|
|
|
- resetPageFilters,
|
|
|
-} from './utils';
|
|
|
|
|
|
const UNSAVED_MESSAGE = t('You have unsaved changes, are you sure you want to leave?');
|
|
|
|
|
@@ -93,6 +99,7 @@ type Props = RouteComponentProps<RouteParams, {}> & {
|
|
|
dashboards: DashboardListItem[];
|
|
|
initialState: DashboardState;
|
|
|
organization: Organization;
|
|
|
+ projects: Project[];
|
|
|
route: PlainRoute;
|
|
|
newWidget?: Widget;
|
|
|
onDashboardUpdate?: (updatedDashboard: DashboardDetails) => void;
|
|
@@ -727,6 +734,7 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
newWidget,
|
|
|
onSetNewWidget,
|
|
|
onDashboardUpdate,
|
|
|
+ projects,
|
|
|
} = this.props;
|
|
|
const {modifiedDashboard, dashboardState, widgetLimitReached, seriesData, setData} =
|
|
|
this.state;
|
|
@@ -740,6 +748,12 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
dashboardState !== DashboardState.CREATE &&
|
|
|
hasUnsavedFilterChanges(dashboard, location, filters);
|
|
|
|
|
|
+ const eventView = generatePerformanceEventView(location, projects);
|
|
|
+
|
|
|
+ const isDashboardUsingTransaction = dashboard.widgets.some(
|
|
|
+ isWidgetUsingTransactionName
|
|
|
+ );
|
|
|
+
|
|
|
return (
|
|
|
<SentryDocumentTitle title={dashboard.title} orgSlug={organization.slug}>
|
|
|
<PageFiltersContainer
|
|
@@ -796,6 +810,27 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
</Layout.Header>
|
|
|
<Layout.Body>
|
|
|
<Layout.Main fullWidth>
|
|
|
+ {(organization.features.includes('dashboards-mep') ||
|
|
|
+ organization.features.includes('mep-rollout-flag')) &&
|
|
|
+ isDashboardUsingTransaction ? (
|
|
|
+ <MetricsDataSwitcher
|
|
|
+ organization={organization}
|
|
|
+ eventView={eventView}
|
|
|
+ location={location}
|
|
|
+ hideLoadingIndicator
|
|
|
+ >
|
|
|
+ {metricsDataSide => (
|
|
|
+ <MetricsDataSwitcherAlert
|
|
|
+ organization={organization}
|
|
|
+ eventView={eventView}
|
|
|
+ projects={projects}
|
|
|
+ location={location}
|
|
|
+ router={router}
|
|
|
+ {...metricsDataSide}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </MetricsDataSwitcher>
|
|
|
+ ) : null}
|
|
|
<FiltersBar
|
|
|
hasUnsavedChanges={disableDashboardModifications}
|
|
|
isEditingDashboard={
|
|
@@ -901,4 +936,4 @@ const StyledPageFilterBar = styled(PageFilterBar)`
|
|
|
margin-bottom: ${space(2)};
|
|
|
`;
|
|
|
|
|
|
-export default withApi(withOrganization(DashboardDetail));
|
|
|
+export default withProjects(withApi(withOrganization(DashboardDetail)));
|