editRulesModal.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import {EditOwnershipRulesModalOptions} from 'app/actionCreators/modal';
  4. import {t} from 'app/locale';
  5. import TextBlock from 'app/views/settings/components/text/textBlock';
  6. import OwnerInput from 'app/views/settings/project/projectOwnership/ownerInput';
  7. type Props = EditOwnershipRulesModalOptions;
  8. type State = {};
  9. class EditOwnershipRulesModal extends React.Component<Props, State> {
  10. render() {
  11. const {ownership} = this.props;
  12. return (
  13. <React.Fragment>
  14. <Block>
  15. {t('Rules follow the pattern: ')} <code>type:glob owner owner</code>
  16. </Block>
  17. <Block>
  18. {t('Owners can be team identifiers starting with #, or user emails')}
  19. </Block>
  20. <Block>
  21. {t('Globbing Syntax:')}
  22. <CodeBlock>{'* matches everything\n? matches any single character'}</CodeBlock>
  23. </Block>
  24. <Block>
  25. {t('Examples')}
  26. <CodeBlock>
  27. path:src/example/pipeline/* person@sentry.io #infrastructure
  28. {'\n'}
  29. url:http://example.com/settings/* #product
  30. {'\n'}
  31. tags.sku_class:enterprise #enterprise
  32. </CodeBlock>
  33. </Block>
  34. {ownership && <OwnerInput {...this.props} initialText={ownership.raw || ''} />}
  35. </React.Fragment>
  36. );
  37. }
  38. }
  39. const Block = styled(TextBlock)`
  40. margin-bottom: 16px;
  41. `;
  42. const CodeBlock = styled('pre')`
  43. word-break: break-all;
  44. white-space: pre-wrap;
  45. `;
  46. export default EditOwnershipRulesModal;