import {useState} from 'react'; import {browserHistory} from 'react-router'; import styled from '@emotion/styled'; import onboardingImg from 'sentry-images/spot/onboarding-preview.svg'; import {Button, LinkButton} from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import OnboardingPanel from 'sentry/components/onboardingPanel'; import Panel from 'sentry/components/panels/panel'; import PanelBody from 'sentry/components/panels/panelBody'; import {TabList, TabPanels, Tabs} from 'sentry/components/tabs'; import {PlatformKey} from 'sentry/data/platformCategories'; import {IconChevron} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import useOrganization from 'sentry/utils/useOrganization'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import MonitorForm from 'sentry/views/monitors/components/monitorForm'; import {Monitor} from 'sentry/views/monitors/types'; import {NewMonitorButton} from './newMonitorButton'; import { CRON_SDK_PLATFORMS, PlatformPickerPanel, SupportedPlatform, } from './platformPickerPanel'; import { CeleryBeatAutoDiscovery, LaravelUpsertPlatformGuide, NodeJsUpsertPlatformGuide, PHPUpsertPlatformGuide, QuickStartProps, } from './quickStartEntries'; interface PlatformGuide { Guide: React.ComponentType; title: string; } const platformGuides: Record = { 'python-celery': [ { Guide: CeleryBeatAutoDiscovery, title: 'Beat Auto Discovery', }, ], php: [ { Guide: PHPUpsertPlatformGuide, title: 'Upsert', }, ], 'php-laravel': [ { Guide: LaravelUpsertPlatformGuide, title: 'Upsert', }, ], python: [], node: [ { Guide: NodeJsUpsertPlatformGuide, title: 'Upsert', }, ], }; export function CronsLandingPanel() { const organization = useOrganization(); const [platform, setPlatform] = useState(null); if (!platform) { return ; } const platformText = CRON_SDK_PLATFORMS.find( ({platform: sdkPlatform}) => sdkPlatform === platform )?.label; const guides = platformGuides[platform]; function onCreateMonitor(data: Monitor) { const url = normalizeUrl(`/organizations/${organization.slug}/crons/${data.slug}/`); browserHistory.push(url); } return ( } onClick={() => setPlatform(null)} borderless > {t('Back to Platforms')}

{t('Get Started with %s', platformText)}

{[ ...guides.map(({title}) => ( {title} )), {t('Manual')}, ]} {[ ...guides.map(({title, Guide}) => ( )), , ]}
); } const BackButton = styled(Button)` font-weight: normal; color: ${p => p.theme.subText}; margin: ${space(1)} 0 0 ${space(1)}; padding-left: ${space(0.5)}; padding-right: ${space(0.5)}; `; const GuideContainer = styled('div')` display: flex; flex-direction: column; gap: ${space(2)}; padding-top: ${space(2)}; `; export function OldCronsLandingPanel() { return ( }>

{t('Let Sentry monitor your recurring jobs')}

{t( "We'll tell you if your recurring jobs are running on schedule, failing, or succeeding." )}

{t('Set up first cron monitor')} {t('Read docs')}
); } const OnboardingActions = styled(ButtonBar)` grid-template-columns: repeat(auto-fit, minmax(130px, max-content)); `;