diff --git a/static/app/components/dashboards/widgetQueriesForm.tsx b/static/app/components/dashboards/widgetQueriesForm.tsx index 0d4c9fee638c35..b3d47517374aae 100644 --- a/static/app/components/dashboards/widgetQueriesForm.tsx +++ b/static/app/components/dashboards/widgetQueriesForm.tsx @@ -54,7 +54,7 @@ export const generateOrderOptions = ({ } if (widgetBuilderNewDesign) { - options.push({label, value: alias}); + options.push({label, value: isMetrics ? field : alias}); return; } diff --git a/static/app/views/dashboardsV2/widgetBuilder/buildSteps/columnsStep/index.tsx b/static/app/views/dashboardsV2/widgetBuilder/buildSteps/columnsStep/index.tsx index c52b532ce41b32..be44938805c356 100644 --- a/static/app/views/dashboardsV2/widgetBuilder/buildSteps/columnsStep/index.tsx +++ b/static/app/views/dashboardsV2/widgetBuilder/buildSteps/columnsStep/index.tsx @@ -47,21 +47,21 @@ export function ColumnsStep({ - ), tagFieldLink: ( ), } ) : tct( - '[tagFieldLink: Tag and field] columns will help you view more details about the issues (i.e. title).', + 'To group events, add [functionLink: functions] f(x) that may take in additional parameters. [tagFieldLink: Tag and field] columns will help you view more details about the events (i.e. title).', { + functionLink: ( + + ), tagFieldLink: ( ), diff --git a/static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/index.tsx b/static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/index.tsx index f3340d377e2d57..83a4b1f58feaca 100644 --- a/static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/index.tsx +++ b/static/app/views/dashboardsV2/widgetBuilder/buildSteps/filterResultsStep/index.tsx @@ -115,12 +115,12 @@ export function FilterResultsStep({ {widgetType === WidgetType.ISSUE ? ( ) : widgetType === WidgetType.DISCOVER ? ( { const newState = cloneDeep(prevState); - const query = cloneDeep(getDataSetQuery(widgetBuilderNewDesign)[DataSet.EVENTS]); + const query = cloneDeep(getDataSetQuery(widgetBuilderNewDesign)[prevState.dataSet]); query.fields = prevState.queries[0].fields; query.aggregates = prevState.queries[0].aggregates; query.columns = prevState.queries[0].columns; diff --git a/tests/js/spec/views/dashboardsV2/widgetBuilder/widgetBuilder.spec.tsx b/tests/js/spec/views/dashboardsV2/widgetBuilder/widgetBuilder.spec.tsx index 83f9979bc5a955..a605c3ae4d6d48 100644 --- a/tests/js/spec/views/dashboardsV2/widgetBuilder/widgetBuilder.spec.tsx +++ b/tests/js/spec/views/dashboardsV2/widgetBuilder/widgetBuilder.spec.tsx @@ -26,6 +26,9 @@ const defaultOrgFeatures = [ 'global-views', ]; +// Mocking worldMapChart to avoid act warnings +jest.mock('sentry/components/charts/worldMapChart'); + function renderTestComponent({ dashboard, query, @@ -179,6 +182,16 @@ describe('WidgetBuilder', function () { body: [{key: 'environment'}, {key: 'release'}, {key: 'session.status'}], }); + MockApiClient.addMockResponse({ + url: `/organizations/org-slug/metrics/tags/session.status/`, + body: [ + { + key: 'session.status', + value: 'crashed', + }, + ], + }); + MockApiClient.addMockResponse({ url: `/organizations/org-slug/metrics/meta/`, body: [ @@ -201,12 +214,6 @@ describe('WidgetBuilder', function () { body: TestStubs.MetricsField({ field: `sum(${SessionMetric.SESSION})`, }), - match: [ - MockApiClient.matchQuery({ - groupBy: [], - orderBy: `sum(${SessionMetric.SESSION})`, - }), - ], }); }); @@ -1684,6 +1691,7 @@ describe('WidgetBuilder', function () { expect.objectContaining({ aggregates: ['sum(sentry.sessions.session)'], fields: ['sum(sentry.sessions.session)'], + orderby: '-sum(sentry.sessions.session)', }), ], }), @@ -1692,6 +1700,54 @@ describe('WidgetBuilder', function () { expect(handleSave).toHaveBeenCalledTimes(1); }); + + it('render release data set disabled when the display type is world map', async function () { + renderTestComponent({ + query: { + source: DashboardWidgetSource.DISCOVERV2, + }, + orgFeatures: [...defaultOrgFeatures, 'new-widget-builder-experience-design'], + }); + + userEvent.click(await screen.findByText('Table')); + userEvent.click(screen.getByText('World Map')); + expect( + screen.getByRole('radio', { + name: 'Select Events (Errors, transactions)', + }) + ).toBeEnabled(); + expect( + screen.getByRole('radio', { + name: 'Select Issues (Status, assignee, etc.)', + }) + ).toBeDisabled(); + expect( + screen.getByRole('radio', { + name: 'Select Releases (sessions, crash rates)', + }) + ).toBeDisabled(); + }); + + // Disabling for CI, but should run locally when making changes + // eslint-disable-next-line jest/no-disabled-tests + it.skip('renders with an release search bar', async function () { + renderTestComponent({ + orgFeatures: [...defaultOrgFeatures, 'new-widget-builder-experience-design'], + }); + + userEvent.type( + await screen.findByPlaceholderText('Search for events, users, tags, and more'), + 'session.status:' + ); + expect(await screen.findByText('No items found')).toBeInTheDocument(); + + userEvent.click(screen.getByText('Releases (sessions, crash rates)')); + userEvent.type( + screen.getByPlaceholderText('Search for events, users, tags, and more'), + 'session.status:' + ); + expect(await screen.findByText('crashed')).toBeInTheDocument(); + }); }); describe('Widget Library', function () {