2020-02-12 07:23:06 +00:00
|
|
|
import React from 'react';
|
|
|
|
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-02-12 07:23:06 +00:00
|
|
|
|
|
|
|
export default ({ schedule }: { schedule: Schedule }) => (
|
|
|
|
<>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div>
|
|
|
|
<FontAwesomeIcon icon={faCalendarAlt} fixedWidth/>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`flex-1 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`}>
|
2020-02-12 07:23:06 +00:00
|
|
|
Last run
|
|
|
|
at: {schedule.lastRunAt ? format(schedule.lastRunAt, 'MMM Do [at] h:mma') : 'never'}
|
|
|
|
</p>
|
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`flex items-center mx-8`}>
|
2020-02-12 07:23:06 +00:00
|
|
|
<div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<p css={tw`font-medium text-center`}>{schedule.cron.minute}</p>
|
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Minute</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`ml-4`}>
|
|
|
|
<p css={tw`font-medium text-center`}>{schedule.cron.hour}</p>
|
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Hour</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`ml-4`}>
|
|
|
|
<p css={tw`font-medium text-center`}>{schedule.cron.dayOfMonth}</p>
|
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Day (Month)</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`ml-4`}>
|
|
|
|
<p css={tw`font-medium text-center`}>*</p>
|
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Month</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
2020-07-05 00:00:19 +00:00
|
|
|
<div css={tw`ml-4`}>
|
|
|
|
<p css={tw`font-medium text-center`}>{schedule.cron.dayOfWeek}</p>
|
|
|
|
<p css={tw`text-2xs text-neutral-500 uppercase`}>Day (Week)</p>
|
2020-02-12 07:23:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p
|
2020-07-05 00:00:19 +00:00
|
|
|
css={[
|
|
|
|
tw`py-1 px-3 rounded text-xs uppercase text-white`,
|
|
|
|
schedule.isActive ? tw`bg-green-600` : tw`bg-neutral-400`,
|
|
|
|
]}
|
2020-02-12 07:23:06 +00:00
|
|
|
>
|
|
|
|
{schedule.isActive ? 'Active' : 'Inactive'}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|