group.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. import type {SearchGroup} from 'sentry/components/smartSearchBar/types';
  2. import type {FieldKind} from 'sentry/utils/fields';
  3. import type {Actor, TimeseriesValue} from './core';
  4. import type {Event, EventMetadata, EventOrGroupType, Level} from './event';
  5. import type {Commit, PullRequest, Repository} from './integrations';
  6. import type {Team} from './organization';
  7. import type {PlatformKey, Project} from './project';
  8. import type {AvatarUser, User} from './user';
  9. export type EntryData = Record<string, any | Array<any>>;
  10. /**
  11. * Saved issues searches
  12. */
  13. export type RecentSearch = {
  14. dateCreated: string;
  15. id: string;
  16. lastSeen: string;
  17. organizationId: string;
  18. query: string;
  19. type: SavedSearchType;
  20. };
  21. // XXX: Deprecated Sentry 9 attributes are not included here.
  22. export type SavedSearch = {
  23. dateCreated: string;
  24. id: string;
  25. isGlobal: boolean;
  26. isPinned: boolean;
  27. name: string;
  28. query: string;
  29. sort: string;
  30. type: SavedSearchType;
  31. visibility: SavedSearchVisibility;
  32. };
  33. export enum SavedSearchVisibility {
  34. ORGANIZATION = 'organization',
  35. OWNER = 'owner',
  36. OWNER_PINNED = 'owner_pinned',
  37. }
  38. export enum SavedSearchType {
  39. ISSUE = 0,
  40. EVENT = 1,
  41. SESSION = 2,
  42. REPLAY = 3,
  43. METRIC = 4,
  44. }
  45. export enum IssueCategory {
  46. PERFORMANCE = 'performance',
  47. ERROR = 'error',
  48. CRON = 'cron',
  49. PROFILE = 'profile',
  50. }
  51. export enum IssueType {
  52. // Error
  53. ERROR = 'error',
  54. // Performance
  55. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'performance_consecutive_db_queries',
  56. PERFORMANCE_CONSECUTIVE_HTTP = 'performance_consecutive_http',
  57. PERFORMANCE_FILE_IO_MAIN_THREAD = 'performance_file_io_main_thread',
  58. PERFORMANCE_DB_MAIN_THREAD = 'performance_db_main_thread',
  59. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'performance_n_plus_one_api_calls',
  60. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'performance_n_plus_one_db_queries',
  61. PERFORMANCE_SLOW_DB_QUERY = 'performance_slow_db_query',
  62. PERFORMANCE_RENDER_BLOCKING_ASSET = 'performance_render_blocking_asset_span',
  63. PERFORMANCE_UNCOMPRESSED_ASSET = 'performance_uncompressed_assets',
  64. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'performance_large_http_payload',
  65. PERFORMANCE_HTTP_OVERHEAD = 'performance_http_overhead',
  66. PERFORMANCE_DURATION_REGRESSION = 'performance_duration_regression',
  67. PERFORMANCE_ENDPOINT_REGRESSION = 'performance_p95_endpoint_regression',
  68. // Profile
  69. PROFILE_FILE_IO_MAIN_THREAD = 'profile_file_io_main_thread',
  70. PROFILE_IMAGE_DECODE_MAIN_THREAD = 'profile_image_decode_main_thread',
  71. PROFILE_JSON_DECODE_MAIN_THREAD = 'profile_json_decode_main_thread',
  72. PROFILE_REGEX_MAIN_THREAD = 'profile_regex_main_thread',
  73. PROFILE_FRAME_DROP = 'profile_frame_drop',
  74. PROFILE_FRAME_DROP_EXPERIMENTAL = 'profile_frame_drop_experimental',
  75. PROFILE_FUNCTION_REGRESSION = 'profile_function_regression',
  76. PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL = 'profile_function_regression_exp',
  77. }
  78. export enum IssueTitle {
  79. PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'Consecutive DB Queries',
  80. PERFORMANCE_CONSECUTIVE_HTTP = 'Consecutive HTTP',
  81. PERFORMANCE_FILE_IO_MAIN_THREAD = 'File IO on Main Thread',
  82. PERFORMANCE_DB_MAIN_THREAD = 'DB on Main Thread',
  83. PERFORMANCE_N_PLUS_ONE_API_CALLS = 'N+1 API Call',
  84. PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 'N+1 Query',
  85. PERFORMANCE_SLOW_DB_QUERY = 'Slow DB Query',
  86. PERFORMANCE_RENDER_BLOCKING_ASSET = 'Large Render Blocking Asset',
  87. PERFORMANCE_UNCOMPRESSED_ASSET = 'Uncompressed Asset',
  88. PERFORMANCE_LARGE_HTTP_PAYLOAD = 'Large HTTP payload',
  89. PERFORMANCE_HTTP_OVERHEAD = 'HTTP/1.1 Overhead',
  90. PERFORMANCE_DURATION_REGRESSION = 'Duration Regression',
  91. }
  92. const OCCURRENCE_TYPE_TO_ISSUE_TYPE = {
  93. 1001: IssueType.PERFORMANCE_SLOW_DB_QUERY,
  94. 1004: IssueType.PERFORMANCE_RENDER_BLOCKING_ASSET,
  95. 1006: IssueType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
  96. 1007: IssueType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
  97. 1008: IssueType.PERFORMANCE_FILE_IO_MAIN_THREAD,
  98. 1009: IssueType.PERFORMANCE_CONSECUTIVE_HTTP,
  99. 1010: IssueType.PERFORMANCE_N_PLUS_ONE_API_CALLS,
  100. 1012: IssueType.PERFORMANCE_UNCOMPRESSED_ASSET,
  101. 1013: IssueType.PERFORMANCE_DB_MAIN_THREAD,
  102. 1015: IssueType.PERFORMANCE_LARGE_HTTP_PAYLOAD,
  103. 1016: IssueType.PERFORMANCE_HTTP_OVERHEAD,
  104. 1017: IssueType.PERFORMANCE_DURATION_REGRESSION,
  105. 1018: IssueType.PERFORMANCE_ENDPOINT_REGRESSION,
  106. 2001: IssueType.PROFILE_FILE_IO_MAIN_THREAD,
  107. 2002: IssueType.PROFILE_IMAGE_DECODE_MAIN_THREAD,
  108. 2003: IssueType.PROFILE_JSON_DECODE_MAIN_THREAD,
  109. 2007: IssueType.PROFILE_REGEX_MAIN_THREAD,
  110. 2008: IssueType.PROFILE_FRAME_DROP,
  111. 2009: IssueType.PROFILE_FRAME_DROP_EXPERIMENTAL,
  112. 2010: IssueType.PROFILE_FUNCTION_REGRESSION,
  113. 2011: IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL,
  114. };
  115. const PERFORMANCE_REGRESSION_TYPE_IDS = new Set([1017, 1018, 2010, 2011]);
  116. export function getIssueTypeFromOccurrenceType(
  117. typeId: number | undefined
  118. ): IssueType | null {
  119. if (!typeId) {
  120. return null;
  121. }
  122. return OCCURRENCE_TYPE_TO_ISSUE_TYPE[typeId] ?? null;
  123. }
  124. export function isTransactionBased(typeId: number | undefined): boolean {
  125. if (!typeId) {
  126. return false;
  127. }
  128. // the 1xxx type ids are transaction based performance issues
  129. return typeId >= 1000 && typeId < 2000;
  130. }
  131. export function isOccurrenceBased(typeId: number | undefined): boolean {
  132. if (!typeId) {
  133. return false;
  134. }
  135. // these are regression type performance issues
  136. return !PERFORMANCE_REGRESSION_TYPE_IDS.has(typeId);
  137. }
  138. // endpoint: /api/0/issues/:issueId/attachments/?limit=50
  139. export type IssueAttachment = {
  140. dateCreated: string;
  141. event_id: string;
  142. headers: object;
  143. id: string;
  144. mimetype: string;
  145. name: string;
  146. sha1: string;
  147. size: number;
  148. type: string;
  149. };
  150. // endpoint: /api/0/projects/:orgSlug/:projSlug/events/:eventId/attachments/
  151. export type EventAttachment = IssueAttachment;
  152. /**
  153. * Issue Tags
  154. */
  155. export type Tag = {
  156. key: string;
  157. name: string;
  158. isInput?: boolean;
  159. kind?: FieldKind;
  160. /**
  161. * How many values should be suggested in autocomplete.
  162. * Overrides SmartSearchBar's `maxSearchItems` prop.
  163. */
  164. maxSuggestedValues?: number;
  165. predefined?: boolean;
  166. totalValues?: number;
  167. /**
  168. * Usually values are strings, but a predefined tag can define its SearchGroups
  169. */
  170. values?: string[] | SearchGroup[];
  171. };
  172. export type TagCollection = Record<string, Tag>;
  173. export type TagValue = {
  174. count: number;
  175. firstSeen: string;
  176. lastSeen: string;
  177. name: string;
  178. value: string;
  179. email?: string;
  180. identifier?: string;
  181. ipAddress?: string;
  182. key?: string;
  183. query?: string;
  184. username?: string;
  185. } & AvatarUser;
  186. type Topvalue = {
  187. count: number;
  188. firstSeen: string;
  189. key: string;
  190. lastSeen: string;
  191. name: string;
  192. value: string;
  193. // Might not actually exist.
  194. query?: string;
  195. readable?: string;
  196. };
  197. export type TagWithTopValues = {
  198. key: string;
  199. name: string;
  200. topValues: Array<Topvalue>;
  201. totalValues: number;
  202. uniqueValues: number;
  203. canDelete?: boolean;
  204. };
  205. /**
  206. * Inbox, issue owners and Activity
  207. */
  208. export type InboxReasonDetails = {
  209. count?: number | null;
  210. until?: string | null;
  211. user_count?: number | null;
  212. user_window?: number | null;
  213. window?: number | null;
  214. };
  215. export const enum GroupInboxReason {
  216. NEW = 0,
  217. UNIGNORED = 1,
  218. REGRESSION = 2,
  219. MANUAL = 3,
  220. REPROCESSED = 4,
  221. ESCALATING = 5,
  222. ONGOING = 6,
  223. }
  224. export type InboxDetails = {
  225. date_added?: string;
  226. reason?: GroupInboxReason;
  227. reason_details?: InboxReasonDetails | null;
  228. };
  229. export type SuggestedOwnerReason =
  230. | 'suspectCommit'
  231. | 'ownershipRule'
  232. | 'projectOwnership'
  233. // TODO: codeowners may no longer exist
  234. | 'codeowners';
  235. // Received from the backend to denote suggested owners of an issue
  236. export type SuggestedOwner = {
  237. date_added: string;
  238. owner: string;
  239. type: SuggestedOwnerReason;
  240. };
  241. export interface ParsedOwnershipRule {
  242. matcher: {pattern: string; type: string};
  243. owners: Actor[];
  244. }
  245. export type IssueOwnership = {
  246. autoAssignment:
  247. | 'Auto Assign to Suspect Commits'
  248. | 'Auto Assign to Issue Owner'
  249. | 'Turn off Auto-Assignment';
  250. codeownersAutoSync: boolean;
  251. dateCreated: string | null;
  252. fallthrough: boolean;
  253. isActive: boolean;
  254. lastUpdated: string | null;
  255. raw: string | null;
  256. schema?: {rules: ParsedOwnershipRule[]; version: number};
  257. };
  258. export enum GroupActivityType {
  259. NOTE = 'note',
  260. SET_RESOLVED = 'set_resolved',
  261. SET_RESOLVED_BY_AGE = 'set_resolved_by_age',
  262. SET_RESOLVED_IN_RELEASE = 'set_resolved_in_release',
  263. SET_RESOLVED_IN_COMMIT = 'set_resolved_in_commit',
  264. SET_RESOLVED_IN_PULL_REQUEST = 'set_resolved_in_pull_request',
  265. SET_UNRESOLVED = 'set_unresolved',
  266. SET_IGNORED = 'set_ignored',
  267. SET_PUBLIC = 'set_public',
  268. SET_PRIVATE = 'set_private',
  269. SET_REGRESSION = 'set_regression',
  270. CREATE_ISSUE = 'create_issue',
  271. UNMERGE_SOURCE = 'unmerge_source',
  272. UNMERGE_DESTINATION = 'unmerge_destination',
  273. FIRST_SEEN = 'first_seen',
  274. ASSIGNED = 'assigned',
  275. UNASSIGNED = 'unassigned',
  276. MERGE = 'merge',
  277. REPROCESS = 'reprocess',
  278. MARK_REVIEWED = 'mark_reviewed',
  279. AUTO_SET_ONGOING = 'auto_set_ongoing',
  280. SET_ESCALATING = 'set_escalating',
  281. }
  282. interface GroupActivityBase {
  283. dateCreated: string;
  284. id: string;
  285. project: Project;
  286. assignee?: string;
  287. issue?: Group;
  288. user?: null | User;
  289. }
  290. interface GroupActivityNote extends GroupActivityBase {
  291. data: {
  292. text: string;
  293. };
  294. type: GroupActivityType.NOTE;
  295. }
  296. interface GroupActivitySetResolved extends GroupActivityBase {
  297. data: Record<string, any>;
  298. type: GroupActivityType.SET_RESOLVED;
  299. }
  300. interface GroupActivitySetUnresolved extends GroupActivityBase {
  301. data: Record<string, any>;
  302. type: GroupActivityType.SET_UNRESOLVED;
  303. }
  304. interface GroupActivitySetPublic extends GroupActivityBase {
  305. data: Record<string, any>;
  306. type: GroupActivityType.SET_PUBLIC;
  307. }
  308. interface GroupActivitySetPrivate extends GroupActivityBase {
  309. data: Record<string, any>;
  310. type: GroupActivityType.SET_PRIVATE;
  311. }
  312. interface GroupActivitySetByAge extends GroupActivityBase {
  313. data: Record<string, any>;
  314. type: GroupActivityType.SET_RESOLVED_BY_AGE;
  315. }
  316. interface GroupActivityUnassigned extends GroupActivityBase {
  317. data: Record<string, any>;
  318. type: GroupActivityType.UNASSIGNED;
  319. }
  320. interface GroupActivityFirstSeen extends GroupActivityBase {
  321. data: Record<string, any>;
  322. type: GroupActivityType.FIRST_SEEN;
  323. }
  324. interface GroupActivityMarkReviewed extends GroupActivityBase {
  325. data: Record<string, any>;
  326. type: GroupActivityType.MARK_REVIEWED;
  327. }
  328. interface GroupActivityRegression extends GroupActivityBase {
  329. data: {
  330. /**
  331. * True if the project is using semver to decide if the event is a regression.
  332. * Available when the issue was resolved in a release.
  333. */
  334. follows_semver?: boolean;
  335. /**
  336. * The version that the issue was previously resolved in.
  337. * Available when the issue was resolved in a release.
  338. */
  339. resolved_in_version?: string;
  340. version?: string;
  341. };
  342. type: GroupActivityType.SET_REGRESSION;
  343. }
  344. export interface GroupActivitySetByResolvedInNextSemverRelease extends GroupActivityBase {
  345. data: {
  346. // Set for semver releases
  347. current_release_version: string;
  348. };
  349. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  350. }
  351. export interface GroupActivitySetByResolvedInRelease extends GroupActivityBase {
  352. data: {
  353. version?: string;
  354. };
  355. type: GroupActivityType.SET_RESOLVED_IN_RELEASE;
  356. }
  357. interface GroupActivitySetByResolvedInCommit extends GroupActivityBase {
  358. data: {
  359. commit?: Commit;
  360. };
  361. type: GroupActivityType.SET_RESOLVED_IN_COMMIT;
  362. }
  363. interface GroupActivitySetByResolvedInPullRequest extends GroupActivityBase {
  364. data: {
  365. pullRequest?: PullRequest;
  366. };
  367. type: GroupActivityType.SET_RESOLVED_IN_PULL_REQUEST;
  368. }
  369. export interface GroupActivitySetIgnored extends GroupActivityBase {
  370. data: {
  371. ignoreCount?: number;
  372. ignoreDuration?: number;
  373. ignoreUntil?: string;
  374. /** Archived until escalating */
  375. ignoreUntilEscalating?: boolean;
  376. ignoreUserCount?: number;
  377. ignoreUserWindow?: number;
  378. ignoreWindow?: number;
  379. };
  380. type: GroupActivityType.SET_IGNORED;
  381. }
  382. export interface GroupActivityReprocess extends GroupActivityBase {
  383. data: {
  384. eventCount: number;
  385. newGroupId: number;
  386. oldGroupId: number;
  387. };
  388. type: GroupActivityType.REPROCESS;
  389. }
  390. interface GroupActivityUnmergeDestination extends GroupActivityBase {
  391. data: {
  392. fingerprints: Array<string>;
  393. source?: {
  394. id: string;
  395. shortId: string;
  396. };
  397. };
  398. type: GroupActivityType.UNMERGE_DESTINATION;
  399. }
  400. interface GroupActivityUnmergeSource extends GroupActivityBase {
  401. data: {
  402. fingerprints: Array<string>;
  403. destination?: {
  404. id: string;
  405. shortId: string;
  406. };
  407. };
  408. type: GroupActivityType.UNMERGE_SOURCE;
  409. }
  410. interface GroupActivityMerge extends GroupActivityBase {
  411. data: {
  412. issues: Array<any>;
  413. };
  414. type: GroupActivityType.MERGE;
  415. }
  416. interface GroupActivityAutoSetOngoing extends GroupActivityBase {
  417. data: {
  418. afterDays?: number;
  419. };
  420. type: GroupActivityType.AUTO_SET_ONGOING;
  421. }
  422. export interface GroupActivitySetEscalating extends GroupActivityBase {
  423. data: {
  424. expired_snooze?: {
  425. count: number | null;
  426. until: Date | null;
  427. user_count: number | null;
  428. user_window: number | null;
  429. window: number | null;
  430. };
  431. forecast?: number;
  432. };
  433. type: GroupActivityType.SET_ESCALATING;
  434. }
  435. export interface GroupActivityAssigned extends GroupActivityBase {
  436. data: {
  437. assignee: string;
  438. assigneeType: string;
  439. user: Team | User;
  440. assigneeEmail?: string;
  441. /**
  442. * If the user was assigned via an integration
  443. */
  444. integration?: 'projectOwnership' | 'codeowners' | 'slack' | 'msteams';
  445. /** Codeowner or Project owner rule as a string */
  446. rule?: string;
  447. };
  448. type: GroupActivityType.ASSIGNED;
  449. }
  450. export interface GroupActivityCreateIssue extends GroupActivityBase {
  451. data: {
  452. location: string;
  453. provider: string;
  454. title: string;
  455. };
  456. type: GroupActivityType.CREATE_ISSUE;
  457. }
  458. export type GroupActivity =
  459. | GroupActivityNote
  460. | GroupActivitySetResolved
  461. | GroupActivitySetUnresolved
  462. | GroupActivitySetIgnored
  463. | GroupActivitySetByAge
  464. | GroupActivitySetByResolvedInRelease
  465. | GroupActivitySetByResolvedInNextSemverRelease
  466. | GroupActivitySetByResolvedInCommit
  467. | GroupActivitySetByResolvedInPullRequest
  468. | GroupActivityFirstSeen
  469. | GroupActivityMerge
  470. | GroupActivityReprocess
  471. | GroupActivityUnassigned
  472. | GroupActivityMarkReviewed
  473. | GroupActivityUnmergeDestination
  474. | GroupActivitySetPublic
  475. | GroupActivitySetPrivate
  476. | GroupActivityRegression
  477. | GroupActivityUnmergeSource
  478. | GroupActivityAssigned
  479. | GroupActivityCreateIssue
  480. | GroupActivityAutoSetOngoing
  481. | GroupActivitySetEscalating;
  482. export type Activity = GroupActivity;
  483. interface GroupFiltered {
  484. count: string;
  485. firstSeen: string;
  486. lastSeen: string;
  487. stats: Record<string, TimeseriesValue[]>;
  488. userCount: number;
  489. }
  490. export interface GroupStats extends GroupFiltered {
  491. filtered: GroupFiltered | null;
  492. id: string;
  493. isUnhandled?: boolean;
  494. // for issue alert previews, the last time a group triggered a rule
  495. lastTriggered?: string;
  496. lifetime?: GroupFiltered;
  497. sessionCount?: string | null;
  498. }
  499. export interface IgnoredStatusDetails {
  500. actor?: AvatarUser;
  501. ignoreCount?: number;
  502. // Sent in requests. ignoreUntil is used in responses.
  503. ignoreDuration?: number;
  504. ignoreUntil?: string;
  505. ignoreUntilEscalating?: boolean;
  506. ignoreUserCount?: number;
  507. ignoreUserWindow?: number;
  508. ignoreWindow?: number;
  509. }
  510. export interface ResolvedStatusDetails {
  511. actor?: AvatarUser;
  512. autoResolved?: boolean;
  513. inCommit?: {
  514. commit?: string;
  515. dateCreated?: string;
  516. id?: string;
  517. repository?: string | Repository;
  518. };
  519. inNextRelease?: boolean;
  520. inRelease?: string;
  521. repository?: string;
  522. }
  523. interface ReprocessingStatusDetails {
  524. info: {
  525. dateCreated: string;
  526. totalEvents: number;
  527. } | null;
  528. pendingEvents: number;
  529. }
  530. export interface UserParticipant extends User {
  531. type: 'user';
  532. }
  533. export interface TeamParticipant extends Team {
  534. type: 'team';
  535. }
  536. /**
  537. * The payload sent when marking reviewed
  538. */
  539. export interface MarkReviewed {
  540. inbox: false;
  541. }
  542. /**
  543. * The payload sent when updating a group's status
  544. */
  545. export interface GroupStatusResolution {
  546. status: GroupStatus.RESOLVED | GroupStatus.UNRESOLVED | GroupStatus.IGNORED;
  547. statusDetails: ResolvedStatusDetails | IgnoredStatusDetails | {};
  548. substatus?: GroupSubstatus | null;
  549. }
  550. export const enum GroupStatus {
  551. RESOLVED = 'resolved',
  552. UNRESOLVED = 'unresolved',
  553. IGNORED = 'ignored',
  554. REPROCESSING = 'reprocessing',
  555. }
  556. export const enum GroupSubstatus {
  557. ARCHIVED_UNTIL_ESCALATING = 'archived_until_escalating',
  558. ARCHIVED_UNTIL_CONDITION_MET = 'archived_until_condition_met',
  559. ARCHIVED_FOREVER = 'archived_forever',
  560. ESCALATING = 'escalating',
  561. ONGOING = 'ongoing',
  562. REGRESSED = 'regressed',
  563. NEW = 'new',
  564. }
  565. // TODO(ts): incomplete
  566. export interface BaseGroup {
  567. activity: GroupActivity[];
  568. annotations: string[];
  569. assignedTo: Actor | null;
  570. culprit: string;
  571. firstSeen: string;
  572. hasSeen: boolean;
  573. id: string;
  574. isBookmarked: boolean;
  575. isPublic: boolean;
  576. isSubscribed: boolean;
  577. issueCategory: IssueCategory;
  578. issueType: IssueType;
  579. lastSeen: string;
  580. level: Level;
  581. logger: string | null;
  582. metadata: EventMetadata;
  583. numComments: number;
  584. participants: Array<UserParticipant | TeamParticipant>;
  585. permalink: string;
  586. platform: PlatformKey;
  587. pluginActions: any[]; // TODO(ts)
  588. pluginContexts: any[]; // TODO(ts)
  589. pluginIssues: any[]; // TODO(ts)
  590. project: Project;
  591. seenBy: User[];
  592. shareId: string;
  593. shortId: string;
  594. status: GroupStatus;
  595. statusDetails: IgnoredStatusDetails | ResolvedStatusDetails | ReprocessingStatusDetails;
  596. subscriptionDetails: {disabled?: boolean; reason?: string} | null;
  597. title: string;
  598. type: EventOrGroupType;
  599. userReportCount: number;
  600. inbox?: InboxDetails | null | false;
  601. latestEvent?: Event;
  602. owners?: SuggestedOwner[] | null;
  603. substatus?: GroupSubstatus | null;
  604. }
  605. export interface GroupReprocessing extends BaseGroup, GroupStats {
  606. status: GroupStatus.REPROCESSING;
  607. statusDetails: ReprocessingStatusDetails;
  608. }
  609. export interface GroupResolved extends BaseGroup, GroupStats {
  610. status: GroupStatus.RESOLVED;
  611. statusDetails: ResolvedStatusDetails;
  612. }
  613. export interface GroupIgnored extends BaseGroup, GroupStats {
  614. status: GroupStatus.IGNORED;
  615. statusDetails: IgnoredStatusDetails;
  616. }
  617. export interface GroupUnresolved extends BaseGroup, GroupStats {
  618. status: GroupStatus.UNRESOLVED;
  619. statusDetails: {};
  620. }
  621. export type Group = GroupUnresolved | GroupResolved | GroupIgnored | GroupReprocessing;
  622. export interface GroupTombstone {
  623. actor: AvatarUser;
  624. culprit: string;
  625. id: string;
  626. level: Level;
  627. metadata: EventMetadata;
  628. type: EventOrGroupType;
  629. title?: string;
  630. }
  631. export interface GroupTombstoneHelper extends GroupTombstone {
  632. isTombstone: true;
  633. }
  634. export type ProcessingIssueItem = {
  635. checksum: string;
  636. data: {
  637. // TODO(ts) This type is likely incomplete, but this is what
  638. // project processing issues settings uses.
  639. _scope: string;
  640. image_arch: string;
  641. image_path: string;
  642. image_uuid: string;
  643. dist?: string;
  644. release?: string;
  645. };
  646. id: string;
  647. lastSeen: string;
  648. numEvents: number;
  649. type: string;
  650. };
  651. export type ProcessingIssue = {
  652. hasIssues: boolean;
  653. hasMoreResolveableIssues: boolean;
  654. issuesProcessing: number;
  655. lastSeen: string;
  656. numIssues: number;
  657. project: string;
  658. resolveableIssues: number;
  659. signedLink: string;
  660. issues?: ProcessingIssueItem[];
  661. };
  662. /**
  663. * Datascrubbing
  664. */
  665. export type Meta = {
  666. chunks: Array<ChunkType>;
  667. err: Array<MetaError>;
  668. len: number;
  669. rem: Array<MetaRemark>;
  670. };
  671. export type MetaError = string | [string, any];
  672. export type MetaRemark = Array<string | number>;
  673. export type ChunkType = {
  674. rule_id: string | number;
  675. text: string;
  676. type: string;
  677. remark?: string | number;
  678. };
  679. /**
  680. * User Feedback
  681. */
  682. export type UserReport = {
  683. comments: string;
  684. dateCreated: string;
  685. email: string;
  686. event: {eventID: string; id: string};
  687. eventID: string;
  688. id: string;
  689. issue: Group;
  690. name: string;
  691. user: User;
  692. };
  693. export type KeyValueListDataItem = {
  694. key: string;
  695. subject: string;
  696. actionButton?: React.ReactNode;
  697. isContextData?: boolean;
  698. isMultiValue?: boolean;
  699. meta?: Meta;
  700. subjectDataTestId?: string;
  701. subjectIcon?: React.ReactNode;
  702. value?: React.ReactNode;
  703. };
  704. export type KeyValueListData = KeyValueListDataItem[];
  705. // Response from ShortIdLookupEndpoint
  706. // /organizations/${orgId}/shortids/${query}/
  707. export type ShortIdResponse = {
  708. group: Group;
  709. groupId: string;
  710. organizationSlug: string;
  711. projectSlug: string;
  712. shortId: string;
  713. };
  714. /**
  715. * Note used in Group Activity and Alerts for users to comment
  716. */
  717. export type Note = {
  718. /**
  719. * Array of [id, display string] tuples used for @-mentions
  720. */
  721. mentions: [string, string][];
  722. /**
  723. * Note contents (markdown allowed)
  724. */
  725. text: string;
  726. };