editRulesModal.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {EditOwnershipRulesModalOptions} from 'sentry/actionCreators/modal';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import {t, tct} from 'sentry/locale';
  6. import ConfigStore from 'sentry/stores/configStore';
  7. import {space} from 'sentry/styles/space';
  8. import OwnerInput from 'sentry/views/settings/project/projectOwnership/ownerInput';
  9. interface EditOwnershipRulesModalProps extends EditOwnershipRulesModalOptions {
  10. onCancel: () => void;
  11. }
  12. export function EditOwnershipRules({ownership, ...props}: EditOwnershipRulesModalProps) {
  13. const email = ConfigStore.get('user')?.email ?? '#team-slug';
  14. return (
  15. <Fragment>
  16. <Fragment>
  17. <Description>
  18. {tct(
  19. 'Assign issues based on custom rules. To learn more, [docs:read the docs].',
  20. {
  21. docs: (
  22. <ExternalLink href="https://docs.sentry.io/product/issues/issue-owners/" />
  23. ),
  24. }
  25. )}
  26. </Description>
  27. <StyledPre>
  28. # {t("Here's an example")}
  29. <br />
  30. path:src/views/checkout {email}
  31. <br />
  32. url:https://example.com/checkout {email}
  33. <br />
  34. tags.transaction:/checkout/:page {email}
  35. </StyledPre>
  36. </Fragment>
  37. {ownership && (
  38. <OwnerInput
  39. {...props}
  40. dateUpdated={ownership.lastUpdated}
  41. initialText={ownership.raw || ''}
  42. page="project_settings"
  43. />
  44. )}
  45. </Fragment>
  46. );
  47. }
  48. const StyledPre = styled('pre')`
  49. word-break: break-word;
  50. padding: ${space(2)};
  51. line-height: 1.6;
  52. color: ${p => p.theme.subText};
  53. `;
  54. const Description = styled('p')`
  55. margin-bottom: ${space(1)};
  56. `;