newMonitorButton.tsx 630 B

12345678910111213141516171819202122
  1. import type {ButtonProps} from 'sentry/components/button';
  2. import {LinkButton} from 'sentry/components/button';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. import usePageFilters from 'sentry/utils/usePageFilters';
  5. export function NewMonitorButton(props: ButtonProps) {
  6. const organization = useOrganization();
  7. const {selection} = usePageFilters();
  8. return (
  9. <LinkButton
  10. to={{
  11. pathname: `/organizations/${organization.slug}/crons/create/`,
  12. query: {project: selection.projects},
  13. }}
  14. priority="primary"
  15. {...props}
  16. >
  17. {props.children}
  18. </LinkButton>
  19. );
  20. }