feat(jobs): add Retry button for failed jobs with an associated asset
This commit is contained in:
parent
de4cb1b6a0
commit
43a17ecd14
1 changed files with 23 additions and 0 deletions
|
|
@ -670,6 +670,10 @@ function renderRow(job) {
|
||||||
|
|
||||||
const dur = formatDuration(job.started_at, job.completed_at || job.failed_at);
|
const dur = formatDuration(job.started_at, job.completed_at || job.failed_at);
|
||||||
|
|
||||||
|
const retryBtn = (job.status === 'failed' && job.asset_id)
|
||||||
|
? `<button class="btn btn-ghost" style="font-size:var(--text-xs);padding:4px 10px;color:var(--status-green)" onclick="retryJob('${escHtml(job.asset_id)}', event)" title="Re-queue asset processing">Retry</button>`
|
||||||
|
: '';
|
||||||
|
|
||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<td><span class="type-chip ${escHtml(job.type || 'conform')}">${escHtml((job.type || 'conform').toUpperCase())}</span></td>
|
<td><span class="type-chip ${escHtml(job.type || 'conform')}">${escHtml((job.type || 'conform').toUpperCase())}</span></td>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -690,6 +694,7 @@ function renderRow(job) {
|
||||||
<td class="time-cell">${dur}</td>
|
<td class="time-cell">${dur}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="btn btn-ghost" style="font-size:var(--text-xs);padding:4px 10px" onclick="openDetail('${escHtml(job.id)}')">Details</button>
|
<button class="btn btn-ghost" style="font-size:var(--text-xs);padding:4px 10px" onclick="openDetail('${escHtml(job.id)}')">Details</button>
|
||||||
|
${retryBtn}
|
||||||
<button class="btn btn-ghost" style="font-size:var(--text-xs);padding:4px 10px;color:var(--signal-bad)" onclick="killJob('${escHtml(job.id)}', event)" title="Remove this job from the queue">Kill</button>
|
<button class="btn btn-ghost" style="font-size:var(--text-xs);padding:4px 10px;color:var(--signal-bad)" onclick="killJob('${escHtml(job.id)}', event)" title="Remove this job from the queue">Kill</button>
|
||||||
</td>`;
|
</td>`;
|
||||||
|
|
||||||
|
|
@ -708,6 +713,17 @@ async function killJob(jobId, ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function retryJob(assetId, ev) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
try {
|
||||||
|
await api('/assets/' + encodeURIComponent(assetId) + '/retry', { method: 'POST' });
|
||||||
|
toast('Job re-queued — processing will restart shortly.');
|
||||||
|
loadJobs();
|
||||||
|
} catch (e) {
|
||||||
|
showError('Retry failed: ' + e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function statusBadge(status) {
|
function statusBadge(status) {
|
||||||
const map = {
|
const map = {
|
||||||
active: '<span class="badge badge-recording">Active</span>',
|
active: '<span class="badge badge-recording">Active</span>',
|
||||||
|
|
@ -792,6 +808,13 @@ function openDetail(jobId) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
${job.status === 'failed' && job.asset_id ? `
|
||||||
|
<div class="panel-section">
|
||||||
|
<button class="btn btn-secondary btn-sm" onclick="retryJob('${escHtml(job.asset_id)}', event); closeDetail();">
|
||||||
|
Retry — re-queue processing
|
||||||
|
</button>
|
||||||
|
</div>` : ''}
|
||||||
|
|
||||||
${job.error ? `
|
${job.error ? `
|
||||||
<div class="panel-section">
|
<div class="panel-section">
|
||||||
<div class="detail-label">Error</div>
|
<div class="detail-label">Error</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue