Merge pull request 'Executions list: show what a command ran and on which worker' (#76) from execution-summaries into main
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 26s
CI / Test (jest) (push) Successful in 26s
CI / Security (npm audit) (push) Successful in 31s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m54s
CI / Integration (api) (push) Successful in 2m48s
CI / UI (playwright) (push) Successful in 1m52s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 6s
CI / Notify (push) Successful in 3s
CI / UI screenshots (before/after) (push) Skipped
CI / Lint (eslint) (push) Successful in 26s
CI / Test (jest) (push) Successful in 26s
CI / Security (npm audit) (push) Successful in 31s
CI / Scan (secrets, workflows, shell) (push) Successful in 1m54s
CI / Integration (api) (push) Successful in 2m48s
CI / UI (playwright) (push) Successful in 1m52s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 6s
CI / Notify (push) Successful in 3s
This commit was merged in pull request #76.
This commit is contained in:
commit
c5d2258f52
5 files changed
+37
-2
No files matched your search
@@ -250,3 +250,15 @@ html[data-theme="light"] .ex-cmp-head { background: var(--bg-secondary); }
|
||||
html[data-theme="light"] .ex-log-title { color: var(--text-primary); }
|
||||
html[data-theme="light"] .ex-diff-same { color: var(--text-muted); }
|
||||
html[data-theme="light"] .ex-row.is-selected td { background: rgba(255, 179, 0, 0.18); }
|
||||
|
||||
/* Command executions in the list: `command @ worker` (#15). */
|
||||
.ex-row-cmd {
|
||||
display: inline-block;
|
||||
max-width: min(24rem, 100%);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
vertical-align: bottom;
|
||||
color: var(--text-primary, inherit);
|
||||
}
|
||||
.ex-row-worker { color: var(--text-muted, inherit); white-space: nowrap; }
|
||||
@@ -128,6 +128,13 @@
|
||||
return '(' + st.total + ')';
|
||||
}
|
||||
|
||||
// Workflows by name; commands as `command @ worker` instead of "[Quick Command]" (#15).
|
||||
function nameCell(e) {
|
||||
if (e.workflow_name || !e.command) return '<strong>' + esc(execName(e)) + '</strong>';
|
||||
return '<code class="ex-row-cmd" title="' + esc(e.command) + '">' + esc(e.command) + '</code>' +
|
||||
(e.worker_name ? ' <span class="ex-row-worker">@ ' + esc(e.worker_name) + '</span>' : '');
|
||||
}
|
||||
|
||||
// 'waiting' when a running execution is blocked on a prompt (#3).
|
||||
function displayStatus(e) {
|
||||
return e.status === 'running' && e.waiting_for_input ? 'waiting' : e.status;
|
||||
@@ -157,7 +164,7 @@
|
||||
' data-execution-id="' + esc(e.id) + '" tabindex="0">' +
|
||||
check +
|
||||
'<td data-label="Status"><span class="' + Pulse.fmt.status(displayStatus(e)) + '">' + esc(displayStatus(e)) + '</span></td>' +
|
||||
'<td data-label="Name"><strong>' + esc(execName(e)) + '</strong></td>' +
|
||||
'<td data-label="Name">' + nameCell(e) + '</td>' +
|
||||
'<td data-label="Started by">' + esc(e.started_by || '') + '</td>' +
|
||||
'<td data-label="Started">' + esc(Pulse.fmt.dateTime(e.started_at)) + '</td>' +
|
||||
'<td data-label="Completed">' + completed + '</td>' +
|
||||
|
||||
@@ -1695,9 +1695,13 @@ app.get('/api/executions', authenticateSSO, async (req, res) => {
|
||||
|
||||
const [rows] = await pool.query(
|
||||
`SELECT e.id, e.workflow_id, e.status, e.started_by, e.started_at, e.completed_at,
|
||||
w.name as workflow_name
|
||||
w.name as workflow_name,
|
||||
-- What a command execution ran, and where (#15): its first log entry.
|
||||
IF(e.workflow_id IS NULL, LEFT(JSON_UNQUOTE(JSON_EXTRACT(e.logs, '$[0].command')), 500), NULL) AS command,
|
||||
IF(e.workflow_id IS NULL, wk.name, NULL) AS worker_name
|
||||
FROM executions e
|
||||
LEFT JOIN workflows w ON e.workflow_id = w.id
|
||||
LEFT JOIN workers wk ON e.workflow_id IS NULL AND wk.id = JSON_UNQUOTE(JSON_EXTRACT(e.logs, '$[0].worker_id'))
|
||||
${whereClause}
|
||||
ORDER BY e.started_at DESC LIMIT ? OFFSET ?`,
|
||||
[...queryParams, limit, offset]
|
||||
|
||||
@@ -76,3 +76,11 @@ test('execution search finds runs by the command they ran (#16)', async () => {
|
||||
expect(byId.executions.map(e => e.id)).toContain(submit.json.execution_id);
|
||||
expect((await sso('GET', '/api/executions?search=no-such-command-anywhere')).json.executions).toEqual([]);
|
||||
});
|
||||
|
||||
test('the execution list says what a command ran and where (#15)', async () => {
|
||||
const marker = `sum-${Date.now().toString(36)}`;
|
||||
const submit = await gandalf('POST', '/api/internal/command', { worker_id: workerId, command: `echo ${marker}` });
|
||||
await waitForExecution(submit.json.execution_id);
|
||||
const row = (await sso('GET', `/api/executions?search=${marker}`)).json.executions[0];
|
||||
expect(row).toMatchObject({ command: `echo ${marker}`, worker_name: 'node-01' });
|
||||
});
|
||||
@@ -21,6 +21,10 @@ test('a quick command runs on a worker and its output shows in Executions', asyn
|
||||
const detail = page.locator('#ex-detail-body');
|
||||
await expect(detail).toContainText(marker);
|
||||
await expect(detail).toContainText(/completed/i);
|
||||
|
||||
// The list row says what ran and where, not just "[Quick Command]" (#15).
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.locator('#ex-list-manual .ex-row').filter({ hasText: `echo ${marker}` }).first()).toContainText('@ node-02');
|
||||
});
|
||||
|
||||
test('a failing command is reported as failed with its stderr', async ({ page }) => {
|
||||
|
||||
Reference in new issue
Block a user