Handle natural language to cron translation error on web client

This commit is contained in:
Debanjum Singh Solanky 2024-05-01 09:06:59 +05:30
parent 70ee9ddf91
commit 19c5af3ebc

View file

@ -172,6 +172,17 @@
// Get cron string from natural language user schedule, if changed
const crontime = scheduleEl.getAttribute('data-original') !== scheduleEl.value ? getCronString(scheduleEl.value) : scheduleEl.getAttribute('data-cron');
if (crontime.startsWith("ERROR:")) {
notificationEl.textContent = `⚠️ Failed to automate. Fix or simplify Schedule input field.`;
notificationEl.style.display = "block";
let originalScheduleElBorder = scheduleEl.style.border;
scheduleEl.style.border = "2px solid red";
setTimeout(function() {
scheduleEl.style.border = originalScheduleElBorder;
}, 2000);
return;
}
const encodedCrontime = encodeURIComponent(crontime);
// Construct query string and select method for API call