Skip to content

Commit 7bb9d5b

Browse files
authored
fix(aci): Fix issue with manual cron monitor selected project (#112602)
1 parent 878479c commit 7bb9d5b

File tree

2 files changed

+19
-22
lines changed

2 files changed

+19
-22
lines changed

static/app/views/detectors/components/forms/cron/index.spec.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ describe('NewCronDetectorForm', () => {
5757
renderForm();
5858

5959
// Form sections should be visible
60-
expect(await screen.findByText(/Detect/)).toBeInTheDocument();
61-
expect(screen.getByText(/Issue Ownership/)).toBeInTheDocument();
60+
expect(await screen.findByTestId('form-sections')).toBeVisible();
6261

6362
// Create Monitor button should be present and enabled
6463
const createButton = screen.getByRole('button', {name: 'Create Monitor'});
@@ -78,8 +77,7 @@ describe('NewCronDetectorForm', () => {
7877
await screen.findByText('Step 2 of 2');
7978

8079
// Form sections should be hidden
81-
expect(screen.queryByText(/Detect/)).not.toBeInTheDocument();
82-
expect(screen.queryByText(/Issue Ownership/)).not.toBeInTheDocument();
80+
expect(screen.getByTestId('form-sections')).not.toBeVisible();
8381

8482
// Create Monitor button should be present but disabled
8583
const createButton = screen.getByRole('button', {name: 'Create Monitor'});

static/app/views/detectors/components/forms/cron/index.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Fragment} from 'react';
21
import {useTheme} from '@emotion/react';
32

43
import {Alert} from '@sentry/scraps/alert';
@@ -43,26 +42,26 @@ function CronDetectorForm({detector}: {detector?: CronDetector}) {
4342
const theme = useTheme();
4443
const showingPlatformGuide = useIsShowingPlatformGuide();
4544

46-
const formSections = (
47-
<Fragment>
48-
{dataSource?.queryObj.isUpserting && (
49-
<Alert variant="warning">
50-
{t(
51-
'This monitor is managed in code and updates automatically with each check-in. Changes made here may be overwritten!'
52-
)}
53-
</Alert>
54-
)}
55-
<PreviewSection />
56-
{FORM_SECTIONS.map((FormSection, index) => (
57-
<FormSection key={index} step={index + 1} />
58-
))}
59-
</Fragment>
60-
);
61-
6245
return (
6346
<Stack gap="2xl" maxWidth={theme.breakpoints.xl}>
6447
{!detector && <InstrumentationGuide />}
65-
{!showingPlatformGuide && formSections}
48+
<Stack
49+
data-test-id="form-sections"
50+
style={showingPlatformGuide ? {display: 'none'} : undefined}
51+
gap="2xl"
52+
>
53+
{dataSource?.queryObj.isUpserting && (
54+
<Alert variant="warning">
55+
{t(
56+
'This monitor is managed in code and updates automatically with each check-in. Changes made here may be overwritten!'
57+
)}
58+
</Alert>
59+
)}
60+
<PreviewSection />
61+
{FORM_SECTIONS.map((FormSection, index) => (
62+
<FormSection key={index} step={index + 1} />
63+
))}
64+
</Stack>
6665
</Stack>
6766
);
6867
}

0 commit comments

Comments
 (0)