import styled from '@emotion/styled'; import Breadcrumbs from 'sentry/components/breadcrumbs'; import {SectionHeading} from 'sentry/components/charts/styles'; import Clipboard from 'sentry/components/clipboard'; import IdBadge from 'sentry/components/idBadge'; import * as Layout from 'sentry/components/layouts/thirds'; import TimeSince from 'sentry/components/timeSince'; import {IconCopy} from 'sentry/icons'; import {t} from 'sentry/locale'; import space from 'sentry/styles/space'; import MonitorHeaderActions from './monitorHeaderActions'; import MonitorIcon from './monitorIcon'; import {Status} from './types'; type Props = React.ComponentProps; const statusToLabel: Record = { ok: t('Ok'), error: t('Failed'), disabled: t('Disabled'), active: t('Active'), missed_checkin: t('Missed'), }; const MonitorHeader = ({monitor, orgId, onUpdate}: Props) => { const crumbs = [ { label: t('Crons'), to: `/organizations/${orgId}/crons/`, }, { label: t('Cron Monitor Details'), }, ]; return ( {monitor.name} {monitor.id} {t('Last Check-in')} {t('Next Check-in')} {t('Status')}
{monitor.lastCheckIn && }
{monitor.nextCheckIn && }
{statusToLabel[monitor.status]}
); }; const MonitorId = styled('div')` margin-top: ${space(1)}; color: ${p => p.theme.subText}; cursor: pointer; `; const MonitorStats = styled('div')` display: grid; align-self: flex-end; grid-template-columns: repeat(3, max-content); grid-column-gap: ${space(4)}; grid-row-gap: ${space(0.5)}; margin-bottom: ${space(2)}; margin-top: ${space(1)}; `; const MonitorStatLabel = styled(SectionHeading)` text-transform: uppercase; font-size: ${p => p.theme.fontSizeSmall}; text-align: center; `; const MonitorStatus = styled('div')` display: flex; align-items: center; `; const MonitorStatusLabel = styled('div')` margin-left: ${space(1)}; `; export default MonitorHeader;