11import styled from '@emotion/styled' ;
22
3- import { useFormField } from 'sentry/components/workflowEngine/form/useFormField' ;
43import { t } from 'sentry/locale' ;
54import type { UptimeDetector } from 'sentry/types/workflowEngine/detectors' ;
6- import { HTTPSnippet } from 'sentry/views/alerts/rules/uptime/httpSnippet' ;
75import { AutomateSection } from 'sentry/views/detectors/components/forms/automateSection' ;
86import { AssignSection } from 'sentry/views/detectors/components/forms/common/assignSection' ;
97import { useSetAutomaticName } from 'sentry/views/detectors/components/forms/common/useSetAutomaticName' ;
@@ -17,32 +15,6 @@ import {
1715import { UptimeRegionWarning } from 'sentry/views/detectors/components/forms/uptime/regionWarning' ;
1816import { UptimeDetectorResolveSection } from 'sentry/views/detectors/components/forms/uptime/resolve' ;
1917
20- const HTTP_METHODS_NO_BODY = [ 'GET' , 'HEAD' , 'OPTIONS' ] ;
21-
22- function ConnectedHttpSnippet ( ) {
23- const url = useFormField < string > ( 'url' ) ;
24- const method = useFormField < string > ( 'method' ) ;
25- const headers = useFormField < Array < [ string , string ] > > ( 'headers' ) ;
26- const body = useFormField < string > ( 'body' ) ;
27- const traceSampling = useFormField < boolean > ( 'traceSampling' ) ;
28-
29- if ( ! url || ! method ) {
30- return null ;
31- }
32-
33- const shouldIncludeBody = ! HTTP_METHODS_NO_BODY . includes ( method ) ;
34-
35- return (
36- < HTTPSnippet
37- url = { url }
38- method = { method }
39- headers = { headers ?? [ ] }
40- body = { shouldIncludeBody ? ( body ?? null ) : null }
41- traceSampling = { traceSampling ?? false }
42- />
43- ) ;
44- }
45-
4618function UptimeDetectorForm ( ) {
4719 useSetAutomaticName ( form => {
4820 const url = form . getValue ( 'url' ) ;
@@ -66,7 +38,6 @@ function UptimeDetectorForm() {
6638 < FormStack >
6739 < UptimeRegionWarning />
6840 < UptimeDetectorFormDetectSection />
69- < ConnectedHttpSnippet />
7041 < UptimeDetectorResolveSection />
7142 < AssignSection />
7243 < AutomateSection />
0 commit comments