statusToggleButton.tsx 724 B

1234567891011121314151617181920212223
  1. import {BaseButtonProps, Button} from 'sentry/components/button';
  2. import {IconPause, IconPlay} from 'sentry/icons';
  3. import {t} from 'sentry/locale';
  4. import {Monitor} from 'sentry/views/monitors/types';
  5. interface StatusToggleButtonProps extends BaseButtonProps {
  6. monitor: Monitor;
  7. }
  8. function StatusToggleButton({monitor, ...props}: StatusToggleButtonProps) {
  9. const {status} = monitor;
  10. const isDisabeld = status === 'disabled';
  11. const Icon = isDisabeld ? IconPlay : IconPause;
  12. const label = isDisabeld
  13. ? t('Reactive this monitor')
  14. : t('Disable this monitor and discard incoming check-ins');
  15. return <Button icon={<Icon />} aria-label={label} title={label} {...props} />;
  16. }
  17. export {StatusToggleButton};