import {browserHistory} from 'react-router'; import {deleteMonitor, updateMonitor} from 'sentry/actionCreators/monitors'; import {Button} from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import Confirm from 'sentry/components/confirm'; import {IconDelete, IconEdit, IconPause, IconPlay} from 'sentry/icons'; import {t} from 'sentry/locale'; import useApi from 'sentry/utils/useApi'; import usePageFilters from 'sentry/utils/usePageFilters'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import {Monitor, MonitorStatus} from '../types'; import CronsFeedbackButton from './cronsFeedbackButton'; type Props = { monitor: Monitor; onUpdate: (data: Monitor) => void; orgId: string; }; function MonitorHeaderActions({monitor, orgId, onUpdate}: Props) { const api = useApi(); const {selection} = usePageFilters(); const handleDelete = async () => { await deleteMonitor(api, orgId, monitor.slug); browserHistory.push(normalizeUrl(`/organizations/${orgId}/crons/`)); }; const handleUpdate = async (data: Partial) => { const resp = await updateMonitor(api, orgId, monitor.slug, data); onUpdate?.(resp); }; const toggleStatus = () => handleUpdate({ status: monitor.status === MonitorStatus.DISABLED ? MonitorStatus.ACTIVE : MonitorStatus.DISABLED, }); return ( ); } export default MonitorHeaderActions;