import React, { useCallback, useEffect, useState } from 'react'; import { useHistory, useParams } from 'react-router-dom'; import getServerSchedule from '@/api/server/schedules/getServerSchedule'; import Spinner from '@/components/elements/Spinner'; import FlashMessageRender from '@/components/FlashMessageRender'; import EditScheduleModal from '@/components/server/schedules/EditScheduleModal'; import NewTaskButton from '@/components/server/schedules/NewTaskButton'; import DeleteScheduleButton from '@/components/server/schedules/DeleteScheduleButton'; import Can from '@/components/elements/Can'; import useFlash from '@/plugins/useFlash'; import { ServerContext } from '@/state/server'; import PageContentBlock from '@/components/elements/PageContentBlock'; import tw from 'twin.macro'; import { Button } from '@/components/elements/button/index'; import ScheduleTaskRow from '@/components/server/schedules/ScheduleTaskRow'; import isEqual from 'react-fast-compare'; import { format } from 'date-fns'; import ScheduleCronRow from '@/components/server/schedules/ScheduleCronRow'; import RunScheduleButton from '@/components/server/schedules/RunScheduleButton'; import BeforeEdit from '@/blueprint/components/Server/Schedules/Edit/BeforeEdit'; import AfterEdit from '@/blueprint/components/Server/Schedules/Edit/AfterEdit'; interface Params { id: string; } const CronBox = ({ title, value }: { title: string; value: string }) => (
{title}
{value}
Last run at: {schedule.lastRunAt ? ( format(schedule.lastRunAt, "MMM do 'at' h:mma") ) : ( n/a )} Next run at: {schedule.nextRunAt ? ( format(schedule.nextRunAt, "MMM do 'at' h:mma") ) : ( n/a )}