Merge pull request 'Workers tab: show the commit each worker runs' (#64) from workers-version into main
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 16s
CI / Lint (eslint) (push) Successful in 18s
CI / Security (npm audit) (push) Successful in 20s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m16s
CI / Integration (api) (push) Successful in 2m42s
CI / UI (playwright) (push) Successful in 1m51s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 4s
CI / Notify (push) Successful in 3s
CI / UI screenshots (before/after) (push) Skipped
CI / Test (jest) (push) Successful in 16s
CI / Lint (eslint) (push) Successful in 18s
CI / Security (npm audit) (push) Successful in 20s
CI / Scan (secrets, workflows, shell) (push) Successful in 2m16s
CI / Integration (api) (push) Successful in 2m42s
CI / UI (playwright) (push) Successful in 1m51s
CI / Deploy (push) Successful in 14s
CI / Deploy worker (push) Successful in 4s
CI / Notify (push) Successful in 3s
This commit was merged in pull request #64.
This commit is contained in:
commit
8d96028070
2 files changed
+24
No files matched your search
@@ -26,6 +26,14 @@
|
|||||||
return meta.loadavg.map(l => Number(l).toFixed(2)).join(', ');
|
return meta.loadavg.map(l => Number(l).toFixed(2)).join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The commit the worker runs (#40): a short sha linked to the commit, or "unknown".
|
||||||
|
function versionHtml(meta) {
|
||||||
|
const v = meta && meta.version;
|
||||||
|
if (typeof v !== 'string' || !/^[0-9a-f]{40}$/.test(v)) return esc('unknown');
|
||||||
|
return '<a class="wk-version" href="https://code.lotusguild.org/LotusGuild/pulse/commit/' + esc(v) +
|
||||||
|
'" target="_blank" rel="noopener" title="' + esc(v) + '">' + esc(v.slice(0, 7)) + '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
Card construction
|
Card construction
|
||||||
------------------------------------------------------------------- */
|
------------------------------------------------------------------- */
|
||||||
@@ -66,6 +74,8 @@
|
|||||||
'<div class="lt-kv-val" data-wk-uptime>' + esc(fmt.uptime(meta && meta.uptime)) + '</div>' +
|
'<div class="lt-kv-val" data-wk-uptime>' + esc(fmt.uptime(meta && meta.uptime)) + '</div>' +
|
||||||
'<div class="lt-kv-key">Active Tasks</div>' +
|
'<div class="lt-kv-key">Active Tasks</div>' +
|
||||||
'<div class="lt-kv-val" data-wk-tasks>' + esc((meta && meta.activeTasks || 0) + ' / ' + (meta && meta.maxConcurrentTasks || 0)) + '</div>' +
|
'<div class="lt-kv-val" data-wk-tasks>' + esc((meta && meta.activeTasks || 0) + ' / ' + (meta && meta.maxConcurrentTasks || 0)) + '</div>' +
|
||||||
|
'<div class="lt-kv-key">Version</div>' +
|
||||||
|
'<div class="lt-kv-val" data-wk-version>' + versionHtml(meta) + '</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
footerHtml(worker)
|
footerHtml(worker)
|
||||||
);
|
);
|
||||||
@@ -132,6 +142,9 @@
|
|||||||
const tasks = card.querySelector('[data-wk-tasks]');
|
const tasks = card.querySelector('[data-wk-tasks]');
|
||||||
if (tasks) tasks.textContent = (meta && meta.activeTasks || 0) + ' / ' + (meta && meta.maxConcurrentTasks || 0);
|
if (tasks) tasks.textContent = (meta && meta.activeTasks || 0) + ' / ' + (meta && meta.maxConcurrentTasks || 0);
|
||||||
|
|
||||||
|
const version = card.querySelector('[data-wk-version]');
|
||||||
|
if (version) version.innerHTML = versionHtml(meta);
|
||||||
|
|
||||||
// Admin footer can appear/disappear if isAdmin changes mid-session (rare,
|
// Admin footer can appear/disappear if isAdmin changes mid-session (rare,
|
||||||
// but keep it correct rather than assuming it's static).
|
// but keep it correct rather than assuming it's static).
|
||||||
const hasFooter = !!card.querySelector('.lt-card-footer');
|
const hasFooter = !!card.querySelector('.lt-card-footer');
|
||||||
|
|||||||
@@ -39,6 +39,17 @@ test('workers page lists each worker as online', async ({ page }) => {
|
|||||||
await expect(grid.getByText(/^online$/i)).toHaveCount(3);
|
await expect(grid.getByText(/^online$/i)).toHaveCount(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('workers page shows the commit each worker runs (#40)', async ({ page }) => {
|
||||||
|
const head = require('child_process').execFileSync('git', ['rev-parse', 'HEAD']).toString().trim();
|
||||||
|
await page.goto('/workers');
|
||||||
|
const versions = page.locator('#wk-grid [data-wk-version] a.wk-version');
|
||||||
|
await expect(versions).toHaveCount(3);
|
||||||
|
for (const v of await versions.all()) {
|
||||||
|
await expect(v).toHaveText(head.slice(0, 7));
|
||||||
|
await expect(v).toHaveAttribute('href', `https://code.lotusguild.org/LotusGuild/pulse/commit/${head}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('quick command offers every online worker', async ({ page }) => {
|
test('quick command offers every online worker', async ({ page }) => {
|
||||||
await page.goto('/quick');
|
await page.goto('/quick');
|
||||||
await expect(page.locator('#qc-worker option', { hasText: 'online' })).toHaveCount(3);
|
await expect(page.locator('#qc-worker option', { hasText: 'online' })).toHaveCount(3);
|
||||||
|
|||||||
Reference in new issue
Block a user