fix: repair photo worker broken code; add pending queue view
- Fix runAiEnhance missing return/closing brace from previous commit - Remove duplicate code fragments in worker.js - Add renderPhotoPending() to show pending/processing jobs in worker dashboard - New pending queue table in worker.html photo section
This commit is contained in:
@@ -232,6 +232,7 @@ function renderPhoto() {
|
||||
['error', 'Ошибка', c.error || 0],
|
||||
].map(([cls, label, n]) => `<span class="chip ${cls}">${label}: <b>${n}</b></span>`).join('');
|
||||
const rows = photoState.recent || [];
|
||||
renderPhotoPending();
|
||||
const tbody = document.querySelector('#photoTable tbody');
|
||||
const empty = document.getElementById('photoEmpty');
|
||||
if (!rows.length) { tbody.innerHTML = ''; empty.style.display = 'block'; return; }
|
||||
@@ -258,6 +259,26 @@ function renderPhoto() {
|
||||
renderIcons();
|
||||
}
|
||||
|
||||
function renderPhotoPending() {
|
||||
const rows = photoState.pending || [];
|
||||
document.getElementById('photoPendingCount').textContent = rows.length;
|
||||
const tbody = document.querySelector('#photoPendingTable tbody');
|
||||
const empty = document.getElementById('photoPendingEmpty');
|
||||
if (!rows.length) { tbody.innerHTML = ''; empty.style.display = 'block'; return; }
|
||||
empty.style.display = 'none';
|
||||
tbody.innerHTML = rows.map(r => {
|
||||
const processing = r.status === 'processing';
|
||||
const action = esc(PHOTO_ACTION_LABELS[r.action] || r.action);
|
||||
const badge = `<span class="ai-badge ${processing ? 'ai-badge-skipped' : ''}">${processing ? '⏳ Обрабатывается' : 'В очереди'}</span>`;
|
||||
return `<tr${processing ? ' style="background:rgba(59,130,246,.08)"' : ''}>
|
||||
<td>#${r.id}</td>
|
||||
<td>#${r.entry_id} ${esc(r.student_name || '')} <span style="color:var(--muted)">(${esc(r.group_name || '')})</span></td>
|
||||
<td>${action} ${badge}</td>
|
||||
<td style="color:var(--muted);white-space:nowrap">${fmtTime(r.created_at)}</td>
|
||||
</tr>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function findPhotoJob(id) {
|
||||
return (photoState && photoState.recent || []).find(r => r.id === id) || null;
|
||||
}
|
||||
|
||||
@@ -106,6 +106,16 @@
|
||||
<button class="btn-link" id="photoRequeueBtn" type="button" title="Вернуть задания с ошибкой в очередь">Повторить ошибки фото</button>
|
||||
</div>
|
||||
<div class="worker-counts" id="photoCounts" style="margin-bottom:10px"></div>
|
||||
<p class="hint">В очереди (<span id="photoPendingCount">0</span>)</p>
|
||||
<div class="audit-wrap" style="margin-bottom:14px">
|
||||
<table class="audit-table" id="photoPendingTable">
|
||||
<thead>
|
||||
<tr><th>Задание</th><th>Запись</th><th>Действие</th><th>Поставлено</th></tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
<div class="empty" id="photoPendingEmpty" style="display:none">Очередь пуста.</div>
|
||||
</div>
|
||||
<div class="audit-wrap">
|
||||
<table class="audit-table" id="photoTable">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user