InviteeRow.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React, { PureComponent } from 'react';
  2. import { connect, ConnectedProps } from 'react-redux';
  3. import { Button, ClipboardButton } from '@grafana/ui';
  4. import { Invitee } from 'app/types';
  5. import { revokeInvite } from './state/actions';
  6. const mapDispatchToProps = {
  7. revokeInvite,
  8. };
  9. const connector = connect(null, mapDispatchToProps);
  10. interface OwnProps {
  11. invitee: Invitee;
  12. }
  13. export type Props = OwnProps & ConnectedProps<typeof connector>;
  14. class InviteeRow extends PureComponent<Props> {
  15. render() {
  16. const { invitee, revokeInvite } = this.props;
  17. return (
  18. <tr>
  19. <td>{invitee.email}</td>
  20. <td>{invitee.name}</td>
  21. <td className="text-right">
  22. <ClipboardButton variant="secondary" size="sm" getText={() => invitee.url}>
  23. Copy Invite
  24. </ClipboardButton>
  25. &nbsp;
  26. </td>
  27. <td>
  28. <Button variant="destructive" size="sm" icon="times" onClick={() => revokeInvite(invitee.code)} />
  29. </td>
  30. </tr>
  31. );
  32. }
  33. }
  34. export default connector(InviteeRow);