Skip to content
Closed
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: 1 addition & 1 deletion static/app/types/workflowEngine/detectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface UptimeSubscriptionDataSource extends BaseDataSource {
}

export interface CronMonitorDataSource extends BaseDataSource {
queryObj: Omit<Monitor, 'alertRule'>;
queryObj: Omit<Monitor, 'alertRule'> | null;
type: 'cron_monitor';
}

Expand Down
13 changes: 7 additions & 6 deletions static/app/views/detectors/list/cron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ import {selectCheckInData} from 'sentry/views/insights/crons/utils/selectCheckIn
import {useMonitorStats} from 'sentry/views/insights/crons/utils/useMonitorStats';

function VisualizationCell({detector}: {detector: CronDetector}) {
const cronId = detector.dataSources[0].queryObj.id;
const cronEnvironments = detector.dataSources[0].queryObj.environments;
const queryObj = detector.dataSources[0].queryObj;
const cronId = queryObj?.id;
const cronEnvironments = queryObj?.environments;

const elementRef = useRef<HTMLDivElement>(null);
const {width: containerWidth} = useDimensions({elementRef});
const timelineWidth = useDebouncedValue(containerWidth, 1000);
const timeWindowConfig = useTimeWindowConfig({timelineWidth});
const {data: monitorStats, isPending} = useMonitorStats({
monitors: [detector.dataSources[0].queryObj.id],
monitors: cronId ? [cronId] : [],
timeWindowConfig,
});

Expand All @@ -72,7 +73,7 @@ function VisualizationCell({detector}: {detector: CronDetector}) {
height="100%"
>
<Stack gap="sm" width="100%" ref={elementRef}>
{cronEnvironments.map(environment => {
{cronEnvironments?.map(environment => {
if (isPending) {
return <CheckInPlaceholder key={environment.name} />;
}
Expand All @@ -84,7 +85,7 @@ function VisualizationCell({detector}: {detector: CronDetector}) {
statusPrecedent={checkInStatusPrecedent}
timeWindowConfig={timeWindowConfig}
bucketedData={selectCheckInData(
monitorStats?.[cronId] ?? [],
monitorStats?.[cronId!] ?? [],
environment.name
)}
/>
Expand All @@ -108,7 +109,7 @@ const ADDITIONAL_COLUMNS: MonitorListAdditionalColumn[] = [
return (
<SimpleTable.RowCell data-column-name="environment-label" alignSelf="start">
<Stack gap="sm" width="100%">
{detector.dataSources[0].queryObj.environments.map(environment => {
{detector.dataSources[0].queryObj?.environments?.map(environment => {
return (
<Text density="compressed" key={environment.name}>
<MonitorEnvironmentLabel
Expand Down
Loading