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
24 changes: 18 additions & 6 deletions static/app/components/workflowEngine/gridCell/titleCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {StatusWarning} from 'sentry/types/workflowEngine/automations';
import {defined} from 'sentry/utils';

export type TitleCellProps = {
link: string;
link: string | null;
name: string;
className?: string;
details?: React.ReactNode;
Expand Down Expand Up @@ -57,6 +57,14 @@ export function TitleCell({
</Fragment>
);

if (!link) {
return (
<TitleBase className={className} noHover>
{content}
</TitleBase>
);
}

if (openInNewTab) {
return (
<TitleWrapperAnchor
Expand Down Expand Up @@ -98,19 +106,23 @@ const CreatedBySentryIcon = styled(IconSentry)`
flex-shrink: 0;
`;

const TitleBase = styled('div')`
const TitleBase = styled('div')<{noHover?: boolean}>`
display: flex;
flex-direction: column;
gap: ${space(0.5)};
flex: 1;
overflow: hidden;
min-height: 20px;

&:hover {
${NameText} {
text-decoration: underline;
${p =>
!p.noHover &&
`
&:hover {
${NameText} {
text-decoration: underline;
}
}
}
`}
`;

const TitleWrapper = TitleBase.withComponent(Link);
Expand Down
12 changes: 11 additions & 1 deletion static/app/types/workflowEngine/detectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,17 @@ export interface ErrorDetector extends BaseDetector {
readonly type: 'error';
}

export type Detector = MetricDetector | UptimeDetector | CronDetector | ErrorDetector;
interface IssueStreamDetector extends BaseDetector {
// TODO: Add issue stream detector type fields
readonly type: 'issue_stream';
}

export type Detector =
| MetricDetector
| UptimeDetector
| CronDetector
| ErrorDetector
| IssueStreamDetector;

interface UpdateConditionGroupPayload {
conditions: Array<Omit<MetricCondition, 'id'>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ export default function ConnectedMonitorsList({
isSuccess,
getResponseHeader,
} = useDetectorsQuery(
{ids: detectorIds ?? undefined, limit: limit ?? undefined, cursor, query},
{
ids: detectorIds ?? undefined,
limit: limit ?? undefined,
cursor,
query,
includeIssueStreamDetectors: true,
},
{enabled: detectorIds === null || detectorIds.length > 0}
);

Expand Down Expand Up @@ -143,6 +149,7 @@ export default function ConnectedMonitorsList({
<SimpleTable.Empty>{emptyMessage}</SimpleTable.Empty>
)}
{isSuccess &&
(detectorIds === null || detectorIds.length > 0) &&
detectors.map(detector => (
<SimpleTable.Row key={detector.id}>
<SimpleTable.RowCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function ConnectMonitorsDrawer({
makeDetectorListQueryKey({
orgSlug: organization.slug,
ids: localDetectorIds,
includeIssueStreamDetectors: true,
})
) ?? [];

Expand All @@ -126,6 +127,7 @@ function ConnectMonitorsDrawer({
makeDetectorListQueryKey({
orgSlug: organization.slug,
ids: newDetectorIds,
includeIssueStreamDetectors: true,
}),
newDetectors
);
Expand Down
10 changes: 10 additions & 0 deletions static/app/views/detectors/components/details/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {Alert} from 'sentry/components/core/alert';
import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
import {t} from 'sentry/locale';
import type {Project} from 'sentry/types/project';
import type {Detector} from 'sentry/types/workflowEngine/detectors';
import {unreachable} from 'sentry/utils/unreachable';
Expand Down Expand Up @@ -37,6 +39,14 @@ export function DetectorDetailsContent({detector, project}: DetectorDetailsConte
<CronDetectorDetails detector={detector} project={project} />
</PageFiltersContainer>
);
case 'issue_stream':
return (
<Alert.Container>
<Alert type="error">
{t('Issue stream monitors do not support detail views.')}
</Alert>
</Alert.Container>
);
default:
unreachable(detectorType);
return (
Expand Down
15 changes: 13 additions & 2 deletions static/app/views/detectors/components/detectorLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ function Details({detector}: {detector: Detector}) {
case 'monitor_check_in_failure':
return <CronDetectorDetails detector={detector} />;
case 'error':
case 'issue_stream':
return null;
default:
unreachable(detectorType);
Expand All @@ -208,11 +209,21 @@ export function DetectorLink({detector, className, openInNewTab}: DetectorLinkPr
const org = useOrganization();
const project = useProjectFromId({project_id: detector.projectId});

const detectorName =
detector.type === 'issue_stream'
? t('All Issues in %s', project?.name || 'project')
: detector.name;

const detectorLink =
detector.type === 'issue_stream'
? null
: makeMonitorDetailsPathname(org.slug, detector.id);

return (
<TitleCell
className={className}
name={detector.name}
link={makeMonitorDetailsPathname(org.slug, detector.id)}
name={detectorName}
link={detectorLink}
systemCreated={getDetectorSystemCreatedNotice(detector)}
disabled={!detector.enabled}
openInNewTab={openInNewTab}
Expand Down
7 changes: 7 additions & 0 deletions static/app/views/detectors/components/forms/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {Alert} from 'sentry/components/core/alert';
import * as Layout from 'sentry/components/layouts/thirds';
import LoadingError from 'sentry/components/loadingError';
import {t} from 'sentry/locale';
Expand Down Expand Up @@ -61,6 +62,12 @@ export function EditExistingDetectorForm({detector}: {detector: Detector}) {
return <EditExistingErrorDetectorForm detector={detector} />;
case 'monitor_check_in_failure':
return <EditExistingCronDetectorForm detector={detector} />;
case 'issue_stream':
return (
<Alert.Container>
<Alert type="error">{t('Issue stream monitors can not be edited.')}</Alert>
</Alert.Container>
);
default:
unreachable(detectorType);
return <PlaceholderForm />;
Expand Down
1 change: 1 addition & 0 deletions static/app/views/detectors/utils/detectorTypeConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const DETECTOR_TYPE_CONFIG: Record<DetectorType, DetectorTypeConfig> = {
issue_stream: {
userCreateable: false,
label: t('Issue Stream'),
systemCreatedNotice: () => t('This monitor is managed by Sentry'),
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function getDetectorEnvironment(detector: Detector): string | null {
// Crons can have multiple environments
return null;
case 'error':
case 'issue_stream':
return null;
default:
unreachable(detectorType);
Expand Down
Loading