debugIdBundleDeleteButton.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import Access from 'sentry/components/acl/access';
  2. import {Button, ButtonProps} from 'sentry/components/button';
  3. import Confirm from 'sentry/components/confirm';
  4. import {Tooltip} from 'sentry/components/tooltip';
  5. import {IconDelete} from 'sentry/icons';
  6. import {t} from 'sentry/locale';
  7. interface DebugIdBundleDeleteButtonProps {
  8. onDelete: () => void;
  9. size?: ButtonProps['size'];
  10. }
  11. export function DebugIdBundleDeleteButton({
  12. onDelete,
  13. size = 'xs',
  14. }: DebugIdBundleDeleteButtonProps) {
  15. return (
  16. <Access access={['project:releases']}>
  17. {({hasAccess}) => (
  18. <Tooltip
  19. disabled={hasAccess}
  20. title={t('You do not have permission to delete bundles.')}
  21. >
  22. <Confirm
  23. onConfirm={onDelete}
  24. message={t('Are you sure you want to delete this bundle?')}
  25. disabled={!hasAccess}
  26. >
  27. <Button icon={<IconDelete size="xs" />} size={size} disabled={!hasAccess}>
  28. {t('Delete Bundle')}
  29. </Button>
  30. </Confirm>
  31. </Tooltip>
  32. )}
  33. </Access>
  34. );
  35. }