2020-02-12 07:23:06 +00:00
|
|
|
import { Schedule } from '@/api/server/schedules/getServerSchedules';
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
2020-07-05 01:46:09 +00:00
|
|
|
import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
import { format } from 'date-fns';
|
2020-07-05 00:00:19 +00:00
|
|
|
import tw from 'twin.macro';
|
2020-10-15 03:13:36 +00:00
|
|
|
import ScheduleCronRow from '@/components/server/schedules/ScheduleCronRow';
|
2020-02-12 07:23:06 +00:00
|
|
|
|
|
|
|
export default ({ schedule }: { schedule: Schedule }) => (
|
|
|
|
<>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`hidden md:block`}>
|
2022-06-26 19:13:52 +00:00
|
|
|
<FontAwesomeIcon icon={faCalendarAlt} fixedWidth />
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div css={tw`flex-1 md:ml-4`}>
|
2020-02-12 07:23:06 +00:00
|
|
|
<p>{schedule.name}</p>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`text-xs text-neutral-400`}>
|
2022-06-26 19:13:52 +00:00
|
|
|
Last run at: {schedule.lastRunAt ? format(schedule.lastRunAt, "MMM do 'at' h:mma") : 'never'}
|
2020-02-12 07:23:06 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-09-13 17:02:25 +00:00
|
|
|
<div>
|
|
|
|
<p
|
|
|
|
css={[
|
|
|
|
tw`py-1 px-3 rounded text-xs uppercase text-white sm:hidden`,
|
|
|
|
schedule.isActive ? tw`bg-green-600` : tw`bg-neutral-400`,
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
{schedule.isActive ? 'Active' : 'Inactive'}
|
|
|
|
</p>
|
|
|
|
</div>
|
2022-06-26 19:13:52 +00:00
|
|
|
<ScheduleCronRow cron={schedule.cron} css={tw`mx-auto sm:mx-8 w-full sm:w-auto mt-4 sm:mt-0`} />
|
2020-02-12 07:23:06 +00:00
|
|
|
<div>
|
|
|
|
<p
|
2020-07-05 00:00:19 +00:00
|
|
|
css={[
|
2020-09-13 17:02:25 +00:00
|
|
|
tw`py-1 px-3 rounded text-xs uppercase text-white hidden sm:block`,
|
2020-10-15 03:13:36 +00:00
|
|
|
schedule.isActive && !schedule.isProcessing ? tw`bg-green-600` : tw`bg-neutral-400`,
|
2020-07-05 00:00:19 +00:00
|
|
|
]}
|
2020-02-12 07:23:06 +00:00
|
|
|
>
|
2022-06-26 19:13:52 +00:00
|
|
|
{schedule.isProcessing ? 'Processing' : schedule.isActive ? 'Active' : 'Inactive'}
|
2020-02-12 07:23:06 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|