123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import type {SchemaFormConfig} from 'sentry/views/settings/organizationIntegrations/sentryAppExternalForm';
- import type {IssueConfigField} from './integrations';
- type IssueAlertRuleFormField =
- | {
- type: 'choice';
- choices?: [string, string][];
- initial?: string;
- placeholder?: string;
- }
- | {
- type: 'string';
- initial?: string;
- placeholder?: string;
- }
- | {
- type: 'number';
- initial?: string;
- placeholder?: number | string;
- };
- /**
- * These templates that tell the UI how to render the action or condition
- * and what fields it needs
- */
- export interface IssueAlertRuleActionTemplate {
- enabled: boolean;
- id: string;
- label: string;
- actionType?: 'ticket' | 'sentryapp';
- formFields?:
- | {
- [key: string]: IssueAlertRuleFormField;
- }
- | SchemaFormConfig;
- link?: string;
- prompt?: string;
- sentryAppInstallationUuid?: string;
- ticketType?: string;
- }
- export type IssueAlertRuleConditionTemplate = IssueAlertRuleActionTemplate;
- /**
- * These are the action or condition data that the user is editing or has saved.
- */
- export interface IssueAlertRuleAction
- extends Omit<IssueAlertRuleActionTemplate, 'formFields' | 'enabled'> {
- // These are the same values as the keys in `formFields` for a template
- [key: string]: any;
- dynamic_form_fields?: IssueConfigField[];
- }
- export type IssueAlertRuleCondition = Omit<
- IssueAlertRuleConditionTemplate,
- 'formFields' | 'enabled'
- > & {
- dynamic_form_fields?: IssueConfigField[];
- } & {
- // These are the same values as the keys in `formFields` for a template
- [key: string]: number | string;
- };
- export interface UnsavedIssueAlertRule {
- /** When an issue matches [actionMatch] of the following */
- actionMatch: 'all' | 'any' | 'none';
- actions: IssueAlertRuleAction[];
- conditions: IssueAlertRuleCondition[];
- /** If that issue has [filterMatch] of these properties */
- filterMatch: 'all' | 'any' | 'none';
- filters: IssueAlertRuleCondition[];
- frequency: number;
- name: string;
- environment?: null | string;
- owner?: string | null;
- }
- // Issue-based alert rule
- export interface IssueAlertRule extends UnsavedIssueAlertRule {
- createdBy: {email: string; id: number; name: string} | null;
- dateCreated: string;
- id: string;
- projects: string[];
- snooze: boolean;
- errors?: {detail: string}[];
- lastTriggered?: string;
- snoozeCreatedBy?: string;
- snoozeForEveryone?: boolean;
- }
- // Project's alert rule stats
- export type ProjectAlertRuleStats = {
- count: number;
- date: string;
- };
- export enum MailActionTargetType {
- ISSUE_OWNERS = 'IssueOwners',
- TEAM = 'Team',
- MEMBER = 'Member',
- RELEASE_MEMBERS = 'ReleaseMembers',
- }
- export enum AssigneeTargetType {
- UNASSIGNED = 'Unassigned',
- TEAM = 'Team',
- MEMBER = 'Member',
- }
- export type NoteType = {
- mentions: string[];
- text: string;
- };
- /**
- * Used when determining what types of actions a rule has. The default action is "sentry.mail.actions.NotifyEmailAction"
- * while other actions can be integration (Slack, PagerDuty, etc) actions. We need to know this to determine what kind of muting
- * the alert should have.
- */
- export enum RuleActionsCategories {
- ALL_DEFAULT = 'all_default',
- SOME_DEFAULT = 'some_default',
- NO_DEFAULT = 'no_default',
- }
|