Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions static/app/views/detectors/components/forms/cron/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function NewCronDetectorForm() {
initialFormData={{
scheduleType: CRON_DEFAULT_SCHEDULE_TYPE,
}}
noEnvironment
>
<CronDetectorForm />
</NewDetectorLayout>
Expand All @@ -59,6 +60,7 @@ export function EditExistingCronDetectorForm({detector}: {detector: CronDetector
detector={detector}
formDataToEndpointPayload={cronFormDataToEndpointPayload}
savedDetectorToFormData={cronSavedDetectorToFormData}
noEnvironment
>
<CronDetectorForm detector={detector} />
</EditDetectorLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import useProjects from 'sentry/utils/useProjects';
import {useDetectorFormContext} from 'sentry/views/detectors/components/forms/context';
import {useCanEditDetector} from 'sentry/views/detectors/utils/useCanEditDetector';

export function DetectorBaseFields() {
interface DetectorBaseFieldsProps {
noEnvironment?: boolean;
}

export function DetectorBaseFields({noEnvironment}: DetectorBaseFieldsProps) {
const {setHasSetDetectorName} = useDetectorFormContext();

return (
Expand All @@ -39,7 +43,7 @@ export function DetectorBaseFields() {
</Layout.Title>
<Flex gap="md">
<ProjectField />
<EnvironmentField />
{!noEnvironment && <EnvironmentField />}
</Flex>
</Flex>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type EditDetectorLayoutProps<TDetector, TFormData, TUpdatePayload> = {
formDataToEndpointPayload: (formData: TFormData) => TUpdatePayload;
savedDetectorToFormData: (detector: TDetector) => TFormData;
mapFormErrors?: (error: any) => any;
noEnvironment?: boolean;
previewChart?: React.ReactNode;
};

Expand All @@ -38,6 +39,7 @@ export function EditDetectorLayout<
formDataToEndpointPayload,
savedDetectorToFormData,
mapFormErrors,
noEnvironment,
}: EditDetectorLayoutProps<TDetector, TFormData, TUpdatePayload>) {
const theme = useTheme();
const maxWidth = theme.breakpoints.xl;
Expand Down Expand Up @@ -71,7 +73,7 @@ export function EditDetectorLayout<
</div>

<EditLayout.HeaderFields>
<DetectorBaseFields />
<DetectorBaseFields noEnvironment={noEnvironment} />
{previewChart ?? <div />}
</EditLayout.HeaderFields>
</EditLayout.Header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type NewDetectorLayoutProps<TFormData, TUpdatePayload> = {
formDataToEndpointPayload: (formData: TFormData) => TUpdatePayload;
initialFormData: Partial<TFormData>;
mapFormErrors?: (error: any) => any;
noEnvironment?: boolean;
previewChart?: React.ReactNode;
};

Expand All @@ -33,6 +34,7 @@ export function NewDetectorLayout<
formDataToEndpointPayload,
initialFormData,
mapFormErrors,
noEnvironment,
previewChart,
detectorType,
}: NewDetectorLayoutProps<TFormData, TUpdatePayload>) {
Expand Down Expand Up @@ -83,7 +85,7 @@ export function NewDetectorLayout<
</div>

<EditLayout.HeaderFields>
<DetectorBaseFields />
<DetectorBaseFields noEnvironment={noEnvironment} />
{previewChart ?? <div />}
</EditLayout.HeaderFields>
</EditLayout.Header>
Expand Down
Loading