CronJobsTab.EstimateErrorNotice.tsx42 lines · main
| 1 | import { Button } from 'ui' |
| 2 | import { Admonition } from 'ui-patterns/admonition' |
| 3 | |
| 4 | interface CronJobRunDetailsEstimateErrorNoticeProps { |
| 5 | error?: Error | null |
| 6 | isRetrying?: boolean |
| 7 | onRetry?: () => void |
| 8 | } |
| 9 | |
| 10 | export const CronJobRunDetailsEstimateErrorNotice = ({ |
| 11 | error, |
| 12 | isRetrying, |
| 13 | onRetry, |
| 14 | }: CronJobRunDetailsEstimateErrorNoticeProps) => { |
| 15 | return ( |
| 16 | <Admonition |
| 17 | type="warning" |
| 18 | title="Error displaying cron jobs" |
| 19 | description="There was an error displaying cron jobs. Please try again." |
| 20 | className="max-w-3xl w-full" |
| 21 | > |
| 22 | <div className="space-y-3 text-sm"> |
| 23 | {error?.message && ( |
| 24 | <p className="text-foreground-light wrap-break-word"> |
| 25 | Error message: <code className="text-xs">{error.message}</code> |
| 26 | </p> |
| 27 | )} |
| 28 | {onRetry && ( |
| 29 | <Button |
| 30 | type="default" |
| 31 | loading={isRetrying} |
| 32 | disabled={isRetrying} |
| 33 | className="mt-1" |
| 34 | onClick={onRetry} |
| 35 | > |
| 36 | Retry check |
| 37 | </Button> |
| 38 | )} |
| 39 | </div> |
| 40 | </Admonition> |
| 41 | ) |
| 42 | } |