|
@@ -42,7 +42,6 @@ import {MetricsCardinalityProvider} from 'sentry/utils/performance/contexts/metr
|
|
|
import {MetricsResultsMetaProvider} from 'sentry/utils/performance/contexts/metricsEnhancedPerformanceDataContext';
|
|
|
import {MEPSettingProvider} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
|
|
|
import {OnDemandControlProvider} from 'sentry/utils/performance/contexts/onDemandControl';
|
|
|
-import {decodeScalar} from 'sentry/utils/queryString';
|
|
|
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
|
|
|
import withApi from 'sentry/utils/withApi';
|
|
|
import withOrganization from 'sentry/utils/withOrganization';
|
|
@@ -57,9 +56,9 @@ import {
|
|
|
isWidgetUsingTransactionName,
|
|
|
resetPageFilters,
|
|
|
} from 'sentry/views/dashboards/utils';
|
|
|
-import DevBuilder from 'sentry/views/dashboards/widgetBuilder/components/devBuilder';
|
|
|
import DevWidgetBuilder from 'sentry/views/dashboards/widgetBuilder/components/newWidgetBuilder';
|
|
|
import {DataSet} from 'sentry/views/dashboards/widgetBuilder/utils';
|
|
|
+import {convertWidgetToBuilderStateParams} from 'sentry/views/dashboards/widgetBuilder/utils/convertWidgetToBuilderStateParams';
|
|
|
import WidgetLegendNameEncoderDecoder from 'sentry/views/dashboards/widgetLegendNameEncoderDecoder';
|
|
|
import {MetricsDataSwitcherAlert} from 'sentry/views/performance/landing/metricsDataSwitcherAlert';
|
|
|
|
|
@@ -336,6 +335,10 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
},
|
|
|
onEdit: () => {
|
|
|
const widgetIndex = dashboard.widgets.indexOf(widget);
|
|
|
+ if (organization.features.includes('dashboards-widget-builder-redesign')) {
|
|
|
+ this.onEditWidget(widget);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (dashboardId) {
|
|
|
const query = omit(location.query, Object.values(WidgetViewerQueryField));
|
|
|
|
|
@@ -726,6 +729,27 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+ onEditWidget = (widget: Widget) => {
|
|
|
+ const {router, organization, params, location, dashboard} = this.props;
|
|
|
+ const {dashboardId} = params;
|
|
|
+ const widgetIndex = dashboard.widgets.indexOf(widget);
|
|
|
+ this.setState({
|
|
|
+ isWidgetBuilderOpen: true,
|
|
|
+ });
|
|
|
+ const path = defined(dashboardId)
|
|
|
+ ? `/organizations/${organization.slug}/dashboard/${dashboardId}/widget-builder/widget/${widgetIndex}/edit/`
|
|
|
+ : `/organizations/${organization.slug}/dashboards/new/widget-builder/widget/${widgetIndex}/edit/`;
|
|
|
+ router.push(
|
|
|
+ normalizeUrl({
|
|
|
+ pathname: path,
|
|
|
+ query: {
|
|
|
+ ...location.query,
|
|
|
+ ...convertWidgetToBuilderStateParams(widget),
|
|
|
+ },
|
|
|
+ })
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
/* Handles POST request for Edit Access Selector Changes */
|
|
|
onChangeEditAccess = (newDashboardPermissions: DashboardPermissions) => {
|
|
|
const {dashboard, api, organization} = this.props;
|
|
@@ -1218,6 +1242,7 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
isPreview={this.isPreview}
|
|
|
widgetLegendState={this.state.widgetLegendState}
|
|
|
onAddWidget={this.onAddWidget}
|
|
|
+ onEditWidget={this.onEditWidget}
|
|
|
/>
|
|
|
|
|
|
<DevWidgetBuilder
|
|
@@ -1250,22 +1275,8 @@ class DashboardDetail extends Component<Props, State> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * This is a temporary component to test the new widget builder hook during development.
|
|
|
- */
|
|
|
- renderDevWidgetBuilder() {
|
|
|
- return <DevBuilder />;
|
|
|
- }
|
|
|
-
|
|
|
render() {
|
|
|
- const {organization, location} = this.props;
|
|
|
-
|
|
|
- if (
|
|
|
- organization.features.includes('dashboards-widget-builder-redesign') &&
|
|
|
- decodeScalar(location.query?.devBuilder) === 'true'
|
|
|
- ) {
|
|
|
- return this.renderDevWidgetBuilder();
|
|
|
- }
|
|
|
+ const {organization} = this.props;
|
|
|
|
|
|
if (this.isWidgetBuilderRouter) {
|
|
|
return this.renderWidgetBuilder();
|