reprocessEventModal.tsx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import {Fragment, useState} from 'react';
  2. import styled from '@emotion/styled';
  3. import {addErrorMessage} from 'sentry/actionCreators/indicator';
  4. import {ModalRenderProps} from 'sentry/actionCreators/modal';
  5. import NumberField from 'sentry/components/forms/fields/numberField';
  6. import RadioField from 'sentry/components/forms/fields/radioField';
  7. import Form from 'sentry/components/forms/form';
  8. import ExternalLink from 'sentry/components/links/externalLink';
  9. import List from 'sentry/components/list';
  10. import ListItem from 'sentry/components/list/listItem';
  11. import {t, tct} from 'sentry/locale';
  12. import {space} from 'sentry/styles/space';
  13. import {Group, Organization} from 'sentry/types';
  14. export type ReprocessEventModalOptions = {
  15. groupId: Group['id'];
  16. organization: Organization;
  17. };
  18. export function ReprocessingEventModal({
  19. Header,
  20. Body,
  21. organization,
  22. closeModal,
  23. groupId,
  24. }: ModalRenderProps & ReprocessEventModalOptions) {
  25. const [maxEvents, setMaxEvents] = useState<number | undefined>(undefined);
  26. function handleSuccess() {
  27. closeModal();
  28. window.location.reload();
  29. }
  30. return (
  31. <Fragment>
  32. <Header closeButton>
  33. <h4>{t('Reprocess Events')}</h4>
  34. </Header>
  35. <Body>
  36. <Introduction>
  37. {t(
  38. 'Reprocessing applies new debug files and grouping enhancements to this Issue. Please consider these impacts:'
  39. )}
  40. </Introduction>
  41. <StyledList symbol="bullet">
  42. <ListItem>
  43. {tct(
  44. "[strong:Quota applies.] Every event you choose to reprocess counts against your plan's quota. Rate limits and spike protection do not apply.",
  45. {strong: <strong />}
  46. )}
  47. </ListItem>
  48. <ListItem>
  49. {tct(
  50. '[strong:Attachment storage required.] If your events come from minidumps or unreal crash reports, you must have [link:attachment storage] enabled.',
  51. {
  52. strong: <strong />,
  53. link: (
  54. <ExternalLink href="https://docs.sentry.io/platforms/native/enriching-events/attachments/#crash-reports-and-privacy" />
  55. ),
  56. }
  57. )}
  58. </ListItem>
  59. <ListItem>
  60. {t(
  61. 'Please wait one hour after upload before attempting to reprocess missing debug files.'
  62. )}
  63. </ListItem>
  64. </StyledList>
  65. <Introduction>
  66. {tct('For more information, please refer to [link:the documentation.]', {
  67. link: (
  68. <ExternalLink href="https://docs.sentry.io/product/error-monitoring/reprocessing/" />
  69. ),
  70. })}
  71. </Introduction>
  72. <Form
  73. submitLabel={t('Reprocess Events')}
  74. apiEndpoint={`/organizations/${organization.slug}/issues/${groupId}/reprocessing/`}
  75. apiMethod="POST"
  76. initialData={{maxEvents: undefined, remainingEvents: 'keep'}}
  77. onSubmitSuccess={handleSuccess}
  78. onSubmitError={() =>
  79. addErrorMessage(t('Failed to reprocess. Please check your input.'))
  80. }
  81. onCancel={closeModal}
  82. footerClass="modal-footer"
  83. >
  84. <NumberField
  85. name="maxEvents"
  86. label={t('Number of events to be reprocessed')}
  87. help={t('If you set a limit, we will reprocess your most recent events.')}
  88. placeholder={t('Reprocess all events')}
  89. onChange={value => setMaxEvents(!isNaN(value) ? Number(value) : undefined)}
  90. min={1}
  91. />
  92. <RadioField
  93. orientInline
  94. label={t('Remaining events')}
  95. help={t('What to do with the events that are not reprocessed.')}
  96. name="remainingEvents"
  97. choices={[
  98. ['keep', t('Keep')],
  99. ['delete', t('Delete')],
  100. ]}
  101. disabled={maxEvents === undefined}
  102. />
  103. </Form>
  104. </Body>
  105. </Fragment>
  106. );
  107. }
  108. const Introduction = styled('p')`
  109. font-size: ${p => p.theme.fontSizeLarge};
  110. `;
  111. const StyledList = styled(List)`
  112. gap: ${space(1)};
  113. margin-bottom: ${space(4)};
  114. font-size: ${p => p.theme.fontSizeMedium};
  115. `;