diff --git a/static/app/views/alerts/rules/metric/eapField.spec.tsx b/static/app/views/alerts/rules/metric/eapField.spec.tsx index 7960443457f89d..55ed3e3ea220ec 100644 --- a/static/app/views/alerts/rules/metric/eapField.spec.tsx +++ b/static/app/views/alerts/rules/metric/eapField.spec.tsx @@ -2,7 +2,9 @@ import {OrganizationFixture} from 'sentry-fixture/organization'; import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary'; +import {DiscoverDatasets} from 'sentry/utils/discover/types'; import EAPField from 'sentry/views/alerts/rules/metric/eapField'; +import {SpanTagsProvider} from 'sentry/views/explore/contexts/spanTagsContext'; describe('EAPField', () => { const organization = OrganizationFixture(); @@ -16,7 +18,11 @@ describe('EAPField', () => { }); it('renders', () => { - render( {}} />); + render( + + {}} /> + + ); expect(fieldsMock).toHaveBeenCalledWith( `/organizations/${organization.slug}/spans/fields/`, expect.objectContaining({ @@ -35,7 +41,11 @@ describe('EAPField', () => { it('should call onChange with the new aggregate string when switching aggregates', async () => { const onChange = jest.fn(); - render(); + render( + + + + ); expect(fieldsMock).toHaveBeenCalledWith( `/organizations/${organization.slug}/spans/fields/`, expect.objectContaining({ diff --git a/static/app/views/alerts/rules/metric/eapField.tsx b/static/app/views/alerts/rules/metric/eapField.tsx index 908a4983a39ae0..1a858c6543dc73 100644 --- a/static/app/views/alerts/rules/metric/eapField.tsx +++ b/static/app/views/alerts/rules/metric/eapField.tsx @@ -5,16 +5,12 @@ import SelectControl from 'sentry/components/forms/controls/selectControl'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {parseFunction} from 'sentry/utils/discover/fields'; -import {DiscoverDatasets} from 'sentry/utils/discover/types'; import {ALLOWED_EXPLORE_VISUALIZE_AGGREGATES} from 'sentry/utils/fields'; import { DEFAULT_EAP_FIELD, DEFAULT_EAP_METRICS_ALERT_FIELD, } from 'sentry/utils/metrics/mri'; -import { - SpanTagsProvider, - useSpanTags, -} from 'sentry/views/explore/contexts/spanTagsContext'; +import {useSpanTags} from 'sentry/views/explore/contexts/spanTagsContext'; interface Props { aggregate: string; @@ -30,11 +26,7 @@ const OPERATIONS = [ ]; function EAPFieldWrapper({aggregate, onChange}: Props) { - return ( - - - - ); + return ; } function EAPField({aggregate, onChange}: Props) { diff --git a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx index e75b3cc13dd201..84cc270d232cc0 100644 --- a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx +++ b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx @@ -678,73 +678,79 @@ class RuleConditionsForm extends PureComponent { ) : ( - {isExtrapolatedChartData && ( - - )} - {hasActivatedAlerts && this.renderMonitorTypeSelect()} - {!isErrorMigration && this.renderInterval()} - {t('Filter events')} - - {this.renderProjectSelector()} - ({ - ...base, - }), - option: (base: any) => ({ - ...base, - }), - }} - options={environmentOptions} - isDisabled={ - disabled || this.state.environments === null || isErrorMigration - } - isClearable - inline={false} - flexibleControlStateSize - /> - {allowChangeEventTypes && this.renderEventTypeFilter()} - - - - {({onChange, onBlur, initialData, value}) => { - return (hasCustomMetrics(organization) && - alertType === 'custom_metrics') || - alertType === 'insights_metrics' ? ( - { - onFilterSearch(query, true); - onChange(query, {}); - }} - /> - ) : alertType === 'eap_metrics' ? ( - + + {isExtrapolatedChartData && ( + + )} + {hasActivatedAlerts && this.renderMonitorTypeSelect()} + {!isErrorMigration && this.renderInterval()} + {t('Filter events')} + + {this.renderProjectSelector()} + ({ + ...base, + }), + option: (base: any) => ({ + ...base, + }), + }} + options={environmentOptions} + isDisabled={ + disabled || this.state.environments === null || isErrorMigration + } + isClearable + inline={false} + flexibleControlStateSize + /> + {allowChangeEventTypes && this.renderEventTypeFilter()} + + + + {({onChange, onBlur, initialData, value}) => { + return (hasCustomMetrics(organization) && + alertType === 'custom_metrics') || + alertType === 'insights_metrics' ? ( + { + onFilterSearch(query, true); + onChange(query, {}); + }} + /> + ) : alertType === 'eap_metrics' ? ( {tags => ( { /> )} - - ) : ( - - { - onFilterSearch(query, true); - onChange(query, {}); - }} - onBlur={(query, {parsedQuery}) => { - onFilterSearch(query, parsedQuery); - onBlur(query); - }} - // We only need strict validation for Transaction queries, everything else is fine - disallowUnsupportedFilters={ - organization.features.includes('alert-allow-indexed') || - (hasOnDemandMetricAlertFeature(organization) && - isOnDemandQueryString(value)) - ? false - : dataset === Dataset.GENERIC_METRICS - } - /> - {isExtrapolatedChartData && isOnDemandQueryString(value) && ( - - {getOnDemandKeys(value) - .map(key => `"${key}"`) - .join(', ')} - - ), - strong: , - } - )} + ) : ( + + { + onFilterSearch(query, true); + onChange(query, {}); + }} + onBlur={(query, {parsedQuery}) => { + onFilterSearch(query, parsedQuery); + onBlur(query); + }} + // We only need strict validation for Transaction queries, everything else is fine + disallowUnsupportedFilters={ + organization.features.includes('alert-allow-indexed') || + (hasOnDemandMetricAlertFeature(organization) && + isOnDemandQueryString(value)) + ? false + : dataset === Dataset.GENERIC_METRICS + } /> - )} - - ); - }} - - - - - {args => { - if ( - args.value?.includes('is:unresolved') && - comparisonType === AlertRuleComparisonType.DYNAMIC - ) { - return ( - + {getOnDemandKeys(value) + .map(key => `"${key}"`) + .join(', ')} + + ), + strong: , + } + )} + /> )} - /> + ); - } - return null; - }} - - + }} + + + + + {args => { + if ( + args.value?.includes('is:unresolved') && + comparisonType === AlertRuleComparisonType.DYNAMIC + ) { + return ( + + ); + } + return null; + }} + + + )} diff --git a/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/spansSearchBar.spec.tsx b/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/spansSearchBar.spec.tsx index dda9e3a60a1024..0523c8e28182cf 100644 --- a/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/spansSearchBar.spec.tsx +++ b/static/app/views/dashboards/widgetBuilder/buildSteps/filterResultsStep/spansSearchBar.spec.tsx @@ -18,7 +18,7 @@ function renderWithProvider({ onSearch, }: ComponentProps) { return render( - + ); diff --git a/static/app/views/dashboards/widgetBuilder/index.tsx b/static/app/views/dashboards/widgetBuilder/index.tsx index 92db19f009051c..d6abe202ad7cf7 100644 --- a/static/app/views/dashboards/widgetBuilder/index.tsx +++ b/static/app/views/dashboards/widgetBuilder/index.tsx @@ -26,7 +26,10 @@ function WidgetBuilderContainer(props: WidgetBuilderProps) { )} > - + + ); diff --git a/static/app/views/explore/contexts/spanTagsContext.tsx b/static/app/views/explore/contexts/spanTagsContext.tsx index 130916c037d46d..60396ff0fb5836 100644 --- a/static/app/views/explore/contexts/spanTagsContext.tsx +++ b/static/app/views/explore/contexts/spanTagsContext.tsx @@ -21,20 +21,21 @@ export const SpanTagsContext = createContext(undefine interface SpanTagsProviderProps { children: React.ReactNode; dataset: DiscoverDatasets; + enabled: boolean; } -export function SpanTagsProvider({children, dataset}: SpanTagsProviderProps) { +export function SpanTagsProvider({children, dataset, enabled}: SpanTagsProviderProps) { const {data: indexedTags} = useSpanFieldCustomTags({ - enabled: dataset === DiscoverDatasets.SPANS_INDEXED, + enabled: dataset === DiscoverDatasets.SPANS_INDEXED && enabled, }); const numberTags: TagCollection = useTypedSpanTags({ - enabled: dataset === DiscoverDatasets.SPANS_EAP, + enabled: dataset === DiscoverDatasets.SPANS_EAP && enabled, type: 'number', }); const stringTags: TagCollection = useTypedSpanTags({ - enabled: dataset === DiscoverDatasets.SPANS_EAP, + enabled: dataset === DiscoverDatasets.SPANS_EAP && enabled, type: 'string', }); diff --git a/static/app/views/explore/hooks/useGroupBys.spec.tsx b/static/app/views/explore/hooks/useGroupBys.spec.tsx index 93f21496f99efd..2bdbafaad4ea95 100644 --- a/static/app/views/explore/hooks/useGroupBys.spec.tsx +++ b/static/app/views/explore/hooks/useGroupBys.spec.tsx @@ -34,7 +34,7 @@ describe('useGroupBys', function () { } render( - + , {disableRouterMocks: true} diff --git a/static/app/views/explore/hooks/useResultsMode.spec.tsx b/static/app/views/explore/hooks/useResultsMode.spec.tsx index 92b8a7594c98ec..7b62332b3bd6b0 100644 --- a/static/app/views/explore/hooks/useResultsMode.spec.tsx +++ b/static/app/views/explore/hooks/useResultsMode.spec.tsx @@ -31,7 +31,7 @@ describe('useResultMode', function () { } render( - + , {disableRouterMocks: true} diff --git a/static/app/views/explore/toolbar/index.spec.tsx b/static/app/views/explore/toolbar/index.spec.tsx index 2239519d172c7b..920ef919b7c2b1 100644 --- a/static/app/views/explore/toolbar/index.spec.tsx +++ b/static/app/views/explore/toolbar/index.spec.tsx @@ -38,7 +38,7 @@ describe('ExploreToolbar', function () { } render( - + , {disableRouterMocks: true} @@ -98,7 +98,7 @@ describe('ExploreToolbar', function () { return ; } render( - + , {disableRouterMocks: true} @@ -202,7 +202,7 @@ describe('ExploreToolbar', function () { return ; } render( - + , {disableRouterMocks: true} @@ -259,7 +259,7 @@ describe('ExploreToolbar', function () { return ; } render( - + , {disableRouterMocks: true}