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 <noreply@anthropic.com>
This commit is contained in:
@@ -1326,7 +1326,15 @@
|
|||||||
scheduleDesc = `Cron: ${s.schedule_value}`;
|
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';
|
const lastRun = safeDate(s.last_run)?.toLocaleString() ?? 'Never';
|
||||||
|
|
||||||
return `
|
return `
|
||||||
@@ -2635,6 +2643,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showCreateWorkflow() {
|
function showCreateWorkflow() {
|
||||||
|
document.getElementById('workflowName').value = '';
|
||||||
|
document.getElementById('workflowDescription').value = '';
|
||||||
|
document.getElementById('workflowDefinition').value = '';
|
||||||
|
document.getElementById('workflowWebhookUrl').value = '';
|
||||||
document.getElementById('createWorkflowModal').classList.add('show');
|
document.getElementById('createWorkflowModal').classList.add('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3038,10 +3050,8 @@
|
|||||||
// Close any open modal on ESC key
|
// Close any open modal on ESC key
|
||||||
document.addEventListener('keydown', (e) => {
|
document.addEventListener('keydown', (e) => {
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
document.querySelectorAll('.modal').forEach(modal => {
|
document.querySelectorAll('.modal.show').forEach(modal => {
|
||||||
if (modal.style.display && modal.style.display !== 'none') {
|
modal.classList.remove('show');
|
||||||
modal.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user