@@ -2,6 +2,7 @@ import {Fragment, useRef, useState} from 'react';
22import styled from '@emotion/styled' ;
33
44import { Button } from 'sentry/components/core/button' ;
5+ import { LinkButton } from 'sentry/components/core/button/linkButton' ;
56import { Flex } from 'sentry/components/core/layout' ;
67import useDrawer from 'sentry/components/globalDrawer' ;
78import { DrawerHeader } from 'sentry/components/globalDrawer/components' ;
@@ -21,6 +22,8 @@ import usePageFilters from 'sentry/utils/usePageFilters';
2122import ConnectedMonitorsList from 'sentry/views/automations/components/connectedMonitorsList' ;
2223import { DetectorSearch } from 'sentry/views/detectors/components/detectorSearch' ;
2324import { makeDetectorListQueryKey , useDetectorsQuery } from 'sentry/views/detectors/hooks' ;
25+ import { useMonitorViewContext } from 'sentry/views/detectors/monitorViewContext' ;
26+ import { makeMonitorCreatePathname } from 'sentry/views/detectors/pathnames' ;
2427
2528interface Props {
2629 connectedIds : Automation [ 'detectorIds' ] ;
@@ -199,6 +202,8 @@ function ConnectMonitorsContent({
199202export default function EditConnectedMonitors ( { connectedIds, setConnectedIds} : Props ) {
200203 const ref = useRef < HTMLButtonElement > ( null ) ;
201204 const { openDrawer, closeDrawer, isDrawerOpen} = useDrawer ( ) ;
205+ const organization = useOrganization ( ) ;
206+ const { monitorsLinkPrefix} = useMonitorViewContext ( ) ;
202207
203208 const toggleDrawer = ( ) => {
204209 if ( isDrawerOpen ) {
@@ -237,9 +242,14 @@ export default function EditConnectedMonitors({connectedIds, setConnectedIds}: P
237242 < Container >
238243 < SelectedMonitors connectedIds = { connectedIds } />
239244 < ButtonWrapper justify = "between" >
240- < Button size = "sm" icon = { < IconAdd /> } onClick = { toggleDrawer } >
245+ < LinkButton
246+ size = "sm"
247+ icon = { < IconAdd /> }
248+ href = { makeMonitorCreatePathname ( organization . slug , monitorsLinkPrefix ) }
249+ external
250+ >
241251 { t ( 'Create New Monitor' ) }
242- </ Button >
252+ </ LinkButton >
243253 < Button size = "sm" icon = { < IconEdit /> } onClick = { toggleDrawer } >
244254 { t ( 'Edit Monitors' ) }
245255 </ Button >
0 commit comments