From a596c6075ced1dddaa946f6c12d6661978f79d8d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Thu, 12 Mar 2026 11:26:48 -0400 Subject: [PATCH] Fix ESC handler, form reset, and scheduler next-run countdown - Fix ESC key handler to use .modal.show class selector instead of style.display check - Reset create workflow form fields when opening the create modal - Show relative countdown (e.g. "in 5m") alongside next run timestamp in scheduler list Co-Authored-By: Claude Sonnet 4.6 --- public/index.html | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index 3fdfc84..4c29449 100644 --- a/public/index.html +++ b/public/index.html @@ -1326,7 +1326,15 @@ scheduleDesc = `Cron: ${s.schedule_value}`; } - const nextRun = safeDate(s.next_run)?.toLocaleString() ?? 'Not scheduled'; + const nextRunDate = safeDate(s.next_run); + const nextRunIn = nextRunDate ? (() => { + const secs = Math.round((nextRunDate - Date.now()) / 1000); + if (secs <= 0) return 'now'; + if (secs < 60) return `${secs}s`; + if (secs < 3600) return `${Math.round(secs/60)}m`; + return `${Math.round(secs/3600)}h`; + })() : null; + const nextRun = nextRunDate ? `${nextRunDate.toLocaleString()}${nextRunIn ? ` (in ${nextRunIn})` : ''}` : 'Not scheduled'; const lastRun = safeDate(s.last_run)?.toLocaleString() ?? 'Never'; return ` @@ -2635,6 +2643,10 @@ } function showCreateWorkflow() { + document.getElementById('workflowName').value = ''; + document.getElementById('workflowDescription').value = ''; + document.getElementById('workflowDefinition').value = ''; + document.getElementById('workflowWebhookUrl').value = ''; document.getElementById('createWorkflowModal').classList.add('show'); } @@ -3038,10 +3050,8 @@ // Close any open modal on ESC key document.addEventListener('keydown', (e) => { if (e.key === 'Escape') { - document.querySelectorAll('.modal').forEach(modal => { - if (modal.style.display && modal.style.display !== 'none') { - modal.style.display = 'none'; - } + document.querySelectorAll('.modal.show').forEach(modal => { + modal.classList.remove('show'); }); } });