Skip to content

Commit

Permalink
Removed the Cron option from the scheduler picker to simplify functio…
Browse files Browse the repository at this point in the history
…nality, as it introduced unnecessary complexity. The existing scheduling options—Daily, Weekly, Monthly, and Yearly—adequately cover all required use cases.
  • Loading branch information
ydahal1 committed Nov 19, 2024
1 parent 25addd5 commit 1978b1a
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function SchedulePicker({
completeSchedule,
setCompleteSchedule,
cron,
setCron,
cronMessage,
// setCron,
// cronMessage,
setCronMessage,
}) {
const [yearlyRadio, setYearlyRadio] = useState(null);
Expand Down Expand Up @@ -385,43 +385,43 @@ function SchedulePicker({
</div>
);
// handle corn input change
const handleCronInputChange = (e) => {
const v = e.target.value;
setCron(v);
setIntermittentScheduling((prev) => ({ frequency: prev.frequency, cron: v }));
};
// const handleCronInputChange = (e) => {
// const v = e.target.value;
// setCron(v);
// setIntermittentScheduling((prev) => ({ frequency: prev.frequency, cron: v }));
// };

//Cron Input and validation
const cronInputAndValidation = (
<>
<Input placeholder="*/5 * * * *" onChange={(e) => handleCronInputChange(e)} allowClear value={cron} />
{cronMessage == null ? (
<div>
Click{' '}
<a
href="https://crontab.cronhub.io/"
style={{ textDecoration: 'underline' }}
target="_blank"
rel="noreferrer">
Here
</a>{' '}
to create cron expression
</div>
) : null}
{cronMessage && cronMessage?.valid ? (
<div style={{ color: 'var(--primary' }}>Runs {cronMessage.message.toLowerCase()} </div>
) : null}
{cronMessage && !cronMessage?.valid ? <div style={{ color: 'var(--danger' }}>{cronMessage.message} </div> : null}
</>
);
// const cronInputAndValidation = (
// <>
// <Input placeholder="*/5 * * * *" onChange={(e) => handleCronInputChange(e)} allowClear value={cron} />
// {cronMessage == null ? (
// <div>
// Click{' '}
// <a
// href="https://crontab.cronhub.io/"
// style={{ textDecoration: 'underline' }}
// target="_blank"
// rel="noreferrer">
// Here
// </a>{' '}
// to create cron expression
// </div>
// ) : null}
// {cronMessage && cronMessage?.valid ? (
// <div style={{ color: 'var(--primary' }}>Runs {cronMessage.message.toLowerCase()} </div>
// ) : null}
// {cronMessage && !cronMessage?.valid ? <div style={{ color: 'var(--danger' }}>{cronMessage.message} </div> : null}
// </>
// );

//Schedule options
const schedulingOptions = [
{ label: 'Daily', value: 'daily', component: dailyBreakDown },
{ label: 'Weekly', value: 'weekly', component: weeklyBreakDown },
{ label: 'Monthly', value: 'monthly', component: monthlyBreakDown },
{ label: 'Yearly', value: 'yearly', component: yearlyBreakDown },
{ label: 'Cron', value: 'cron', component: cronInputAndValidation },
// { label: 'Cron', value: 'cron', component: cronInputAndValidation },
];

const selectedComponent = schedulingOptions.find(
Expand Down

0 comments on commit 1978b1a

Please sign in to comment.