diff --git a/web/static/css/style.css b/web/static/css/style.css index 1638ddfb..71538980 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -37068,6 +37068,80 @@ html[data-theme="dark"] .workflow-status-toggle.is-disabled { transform: translateX(16px); } +.workflow-dry-run-modal-content { + width: min(420px, calc(100vw - 32px)); + max-width: 420px; + height: auto !important; + margin: 14vh auto auto; + border-radius: 14px; +} + +.workflow-dry-run-modal-content .workflow-dry-run-modal-header { + padding: 14px 18px; + box-shadow: none; +} + +.workflow-dry-run-modal-title-group { + display: flex; + align-items: center; + gap: 10px; +} + +.workflow-dry-run-modal-icon { + width: 30px; + height: 30px; + display: inline-grid; + flex: 0 0 30px; + place-items: center; + color: var(--accent-color); + border-radius: 9px; + background: color-mix(in srgb, var(--accent-color) 10%, var(--bg-primary)); +} + +.workflow-dry-run-modal-content .workflow-dry-run-modal-header h2 { + margin: 0; + font-size: 15px; + font-weight: 700; +} + +.workflow-dry-run-modal-content .workflow-dry-run-modal-body { + padding: 18px; + overflow: visible; +} + +.workflow-dry-run-modal-field.form-group { + gap: 7px; + margin: 0; +} + +.workflow-dry-run-modal-field label { + color: var(--text-primary); + font-size: 13px; + font-weight: 600; +} + +.workflow-dry-run-modal-field .form-input { + height: 38px; + box-sizing: border-box; +} + +.workflow-dry-run-modal-field .form-hint { + margin: 0; + color: var(--text-secondary); + font-size: 11px; + line-height: 1.45; +} + +.workflow-dry-run-modal-content .workflow-dry-run-modal-footer { + gap: 8px; + padding: 12px 18px; +} + +html[data-theme="dark"] .workflow-dry-run-modal-icon { + color: #bfdbfe; + background: rgba(59, 130, 246, 0.14); +} + .form-required { color: #ef4444; } diff --git a/web/static/i18n/en-US.json b/web/static/i18n/en-US.json index f622e643..3b9f5fd7 100644 --- a/web/static/i18n/en-US.json +++ b/web/static/i18n/en-US.json @@ -3322,6 +3322,7 @@ "loadFailed": "Failed to load workflows", "saveFailed": "Failed to save workflow", "dryRunPrompt": "Input message for dry-run", + "dryRunPromptHint": "This message is passed to the Start node as the message input.", "dryRunFailed": "Dry-run failed", "dryRunDone": "Dry-run completed", "dryRunTrace": "Dry-run trace", diff --git a/web/static/i18n/zh-CN.json b/web/static/i18n/zh-CN.json index 3328974d..27c0d6fd 100644 --- a/web/static/i18n/zh-CN.json +++ b/web/static/i18n/zh-CN.json @@ -3310,6 +3310,7 @@ "loadFailed": "加载工作流失败", "saveFailed": "保存工作流失败", "dryRunPrompt": "输入试运行消息", + "dryRunPromptHint": "该消息将作为开始节点的 message 输入。", "dryRunFailed": "试运行失败", "dryRunDone": "试运行完成", "dryRunTrace": "试运行轨迹", diff --git a/web/static/js/modal.js b/web/static/js/modal.js index 65f65db4..2b119819 100644 --- a/web/static/js/modal.js +++ b/web/static/js/modal.js @@ -14,6 +14,7 @@ 'batch-manage-modal', 'create-group-modal', 'workflow-meta-modal', + 'workflow-dry-run-modal', 'login-overlay', ]); diff --git a/web/static/js/workflows.js b/web/static/js/workflows.js index df1c0758..fe4aa43f 100644 --- a/web/static/js/workflows.js +++ b/web/static/js/workflows.js @@ -1678,7 +1678,7 @@ } }; - window.dryRunWorkflowDraft = async function () { + window.dryRunWorkflowDraft = function () { initCy(); const graph = elementsToGraph(); const errors = validateWorkflowGraph(graph); @@ -1686,8 +1686,29 @@ showNotification(errors.slice(0, 4).join(';'), 'error'); return; } - const message = window.prompt(_t('workflows.dryRunPrompt') || 'Input message for dry-run', 'ping'); - if (message === null) return; + const input = document.getElementById('workflow-dry-run-message'); + if (input) input.value = 'ping'; + if (typeof openAppModal === 'function') { + openAppModal('workflow-dry-run-modal', { focusEl: input }); + if (input) requestAnimationFrame(function () { input.select(); }); + } + }; + + window.closeWorkflowDryRunModal = function () { + if (typeof closeAppModal === 'function') closeAppModal('workflow-dry-run-modal'); + }; + + window.submitWorkflowDryRun = async function () { + initCy(); + const graph = elementsToGraph(); + const errors = validateWorkflowGraph(graph); + if (errors.length) { + showNotification(errors.slice(0, 4).join(';'), 'error'); + return; + } + const input = document.getElementById('workflow-dry-run-message'); + const message = input && input.value.trim() ? input.value.trim() : 'ping'; + closeWorkflowDryRunModal(); try { const response = await apiFetch('/api/workflows/dry-run', { method: 'POST', @@ -2437,7 +2458,7 @@ if (page && typeof window.applyTranslations === 'function') { window.applyTranslations(page); } - ['workflow-package-import-modal', 'workflow-package-overwrite-modal'].forEach(function (id) { + ['workflow-dry-run-modal', 'workflow-package-import-modal', 'workflow-package-overwrite-modal'].forEach(function (id) { const modal = document.getElementById(id); if (modal && typeof window.applyTranslations === 'function') window.applyTranslations(modal); }); diff --git a/web/templates/index.html b/web/templates/index.html index 4dc32f76..fcf193f7 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -4920,6 +4920,30 @@ +