Executions: Re-run Workflow, and search that finds commands (#18, #16)
CI / Test (jest) (pull_request) Successful in 23s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m42s
CI / Integration (api) (pull_request) Successful in 2m37s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m41s
CI / Test (jest) (pull_request) Successful in 23s
CI / Lint (eslint) (pull_request) Successful in 26s
CI / Security (npm audit) (pull_request) Successful in 15s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m42s
CI / Integration (api) (pull_request) Successful in 2m37s
CI / UI (playwright) (pull_request) Successful in 2m45s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m41s
- #18: a workflow execution's detail now offers Re-run Workflow, which starts the same workflow with the parameters from its params log entry (after a confirm listing them) and opens the new run. Quick commands keep Re-run Command. - #16: search runs on the server: workflow name, who started it, the id, or any command the execution ran (JSON_SEARCH over the logs). The page sends it as you type (debounced 300 ms, from the first page); the status filter stays local. - Regression tests for #12 (Create Workflow starts with the example) and #13 (dry run works for workflows without parameters), which the UI rewrite had already fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06d6c72709
commit
4cf3c084a9
5 files changed
+116
-16
No files matched your search
@@ -77,6 +77,8 @@
|
||||
const params = new URLSearchParams({ limit: String(LIMIT), offset: String(offset) });
|
||||
if (view === 'manual') params.set('hide_internal', 'true');
|
||||
if (view === 'automated') params.set('only_internal', 'true'); // server-side (#4)
|
||||
const term = searchTerm();
|
||||
if (term) params.set('search', term); // server-side (#16)
|
||||
|
||||
try {
|
||||
const data = await Pulse.api.get('/api/executions?' + params.toString());
|
||||
@@ -103,21 +105,20 @@
|
||||
// Live events trigger this; coalesce bursts into at most one reload per 2 s (#10).
|
||||
const reloadCurrent = Pulse.util.throttle(reloadNow, 2000);
|
||||
|
||||
// Typing in the search box: search on the server once typing pauses (#16).
|
||||
let searchTimer = null;
|
||||
function searchSoon() {
|
||||
clearTimeout(searchTimer);
|
||||
searchTimer = setTimeout(reloadNow, 300);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
Rendering: list
|
||||
------------------------------------------------------------------ */
|
||||
// Search runs on the server (it can see commands); status stays a local filter.
|
||||
function filteredRows(view) {
|
||||
const term = searchTerm();
|
||||
const status = statusTerm();
|
||||
return state[view].rows.filter((e) => {
|
||||
if (status && displayStatus(e) !== status) return false;
|
||||
if (term) {
|
||||
const name = execName(e).toLowerCase();
|
||||
const id = String(e.id || '').toLowerCase();
|
||||
if (name.indexOf(term) === -1 && id.indexOf(term) === -1) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return state[view].rows.filter((e) => !status || displayStatus(e) === status);
|
||||
}
|
||||
|
||||
function countLabel(view) {
|
||||
@@ -473,7 +474,11 @@
|
||||
'data-execution-id="' + esc(id) + '">⛔ Abort Execution</button>';
|
||||
}
|
||||
const cmdLog = (Array.isArray(ex.logs) ? ex.logs : []).find((l) => l.action === 'command_sent' && l.command);
|
||||
if (cmdLog) {
|
||||
if (ex.workflow_id) {
|
||||
// A workflow re-runs as the whole workflow with its parameters, not its first command (#18).
|
||||
html += '<button type="button" class="lt-btn lt-btn-secondary lt-btn-sm" data-action="ex:rerun-workflow" ' +
|
||||
'data-execution-id="' + esc(id) + '">↻ Re-run Workflow</button>';
|
||||
} else if (cmdLog) {
|
||||
html += '<button type="button" class="lt-btn lt-btn-secondary lt-btn-sm" data-action="ex:rerun" ' +
|
||||
'data-command="' + esc(cmdLog.command) + '" data-worker-id="' + esc(cmdLog.worker_id || '') + '">' +
|
||||
'↻ Re-run Command</button>';
|
||||
@@ -633,7 +638,7 @@
|
||||
setView(view);
|
||||
},
|
||||
|
||||
'ex:search': () => { render(); },
|
||||
'ex:search': () => { searchSoon(); },
|
||||
'ex:filter-status': () => { render(); },
|
||||
|
||||
'ex:clear-filters': () => {
|
||||
@@ -641,7 +646,7 @@
|
||||
const st = $('ex-status');
|
||||
if (s) s.value = '';
|
||||
if (st) st.value = '';
|
||||
render();
|
||||
reloadNow();
|
||||
},
|
||||
|
||||
'ex:load-more': async (el) => {
|
||||
@@ -736,6 +741,37 @@
|
||||
window.location.href = '/quick';
|
||||
},
|
||||
|
||||
'ex:rerun-workflow': async (el) => {
|
||||
const id = el.getAttribute('data-execution-id');
|
||||
if (!id) return;
|
||||
let ex;
|
||||
try {
|
||||
ex = await Pulse.api.get('/api/executions/' + encodeURIComponent(id));
|
||||
} catch (e) {
|
||||
toast('error', (e && e.message) || 'Failed to load the execution');
|
||||
return;
|
||||
}
|
||||
const paramsLog = (Array.isArray(ex.logs) ? ex.logs : []).find((l) => l.action === 'params');
|
||||
const params = (paramsLog && paramsLog.params) || {};
|
||||
const names = Object.keys(params);
|
||||
const ok = await askConfirm({
|
||||
title: 'Re-run Workflow',
|
||||
message: 'Run ' + ((state.rowIndex.get(id) || {}).workflow_name || 'this workflow') + ' again' +
|
||||
(names.length ? ' with the same parameters?\n\n' + names.map((k) => k + ' = ' + params[k]).join('\n') : '?'),
|
||||
type: 'warning',
|
||||
confirmLabel: 'RE-RUN',
|
||||
});
|
||||
if (!ok) return;
|
||||
try {
|
||||
const started = await Pulse.api.post('/api/executions', { workflow_id: ex.workflow_id, params: params });
|
||||
toast('success', 'Workflow started');
|
||||
openDetail(started.id, false);
|
||||
reloadNow();
|
||||
} catch (e) {
|
||||
toast('error', (e && e.message) || 'Failed to start the workflow');
|
||||
}
|
||||
},
|
||||
|
||||
'ex:download': async (el) => {
|
||||
const id = el.getAttribute('data-execution-id') || openDetailId();
|
||||
if (!id) return;
|
||||
|
||||
Reference in new issue
Block a user