eventUsers.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import {Fragment} from 'react';
  2. import {Button} from 'sentry/components/core/button';
  3. import AdminConfirmationModal from 'admin/components/adminConfirmationModal';
  4. import ResultGrid from 'admin/components/resultGrid';
  5. type Props = {
  6. onRemoveEmail: (hash: string) => void;
  7. orgId: string;
  8. projectId: string;
  9. };
  10. function EventUsers({orgId, projectId, onRemoveEmail}: Props) {
  11. const getRow = (row: any) => {
  12. if (row.identifier === null) {
  13. return [];
  14. }
  15. return [
  16. <td key="email">{row.email}</td>,
  17. <td key="id" style={{textAlign: 'center'}}>
  18. {row.identifier}
  19. </td>,
  20. <td key="hash" style={{textAlign: 'center'}}>
  21. {row.hash}
  22. </td>,
  23. <td key="actions" style={{textAlign: 'center'}}>
  24. <AdminConfirmationModal
  25. header={<h4>{'Remove Event User'}</h4>}
  26. modalSpecificContent={
  27. <Fragment>
  28. <p>
  29. <strong>
  30. You're removing this user from events of the <code>{projectId}</code>{' '}
  31. project:
  32. </strong>
  33. </p>
  34. <p>
  35. <strong>Email:</strong> {row.email}
  36. <br />
  37. <strong>ID:</strong> {row.identifier}
  38. <br />
  39. <strong>User Hash:</strong> {row.hash}
  40. </p>
  41. </Fragment>
  42. }
  43. onConfirm={() => onRemoveEmail(row.hash)}
  44. showAuditFields
  45. >
  46. <Button size="xs" priority="danger">
  47. Delete Email
  48. </Button>
  49. </AdminConfirmationModal>
  50. </td>,
  51. ];
  52. };
  53. return (
  54. <ResultGrid
  55. inPanel
  56. path={`/_admin/customers/${orgId}/projects/${projectId}/`}
  57. endpoint={`/projects/${orgId}/${projectId}/users/`}
  58. hasSearch
  59. defaultParams={{per_page: 10}}
  60. columns={[
  61. <th key="email">Email</th>,
  62. <th key="id" style={{width: 150, textAlign: 'center'}}>
  63. ID
  64. </th>,
  65. <th key="hash" style={{width: 150, textAlign: 'center'}}>
  66. User Hash
  67. </th>,
  68. <th key="actions" style={{width: 150, textAlign: 'center'}}>
  69. Delete Email
  70. </th>,
  71. ]}
  72. columnsForRow={getRow}
  73. />
  74. );
  75. }
  76. export default EventUsers;