feat(проверка): экран проверки, список и карточка в чате (T6, T6b)

- /review/{id}: таблица по колонкам §1.9а, фильтр по состоянию, счётчики, «остановить»,
  «продолжить» после потолка, ссылка на отчёт, пометки «уведомление не доставлено» и
  «программа не отвечает»; живое обновление через поток снимком при подписке.
- /review: свои проверки, идущие сверху.
- Карточка в чате: «Проверка №N — X из Y», открыть/остановить, опрос раз в 10 с, пока
  вкладка видима; пусто или ошибка — карточки нет.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 06:11:11 +10:00
co-authored by Claude Code
parent 9254155797
commit 76fbca2d23
5 changed files with 196 additions and 0 deletions
+36
View File
@@ -754,6 +754,11 @@ html { color-scheme: light; }
<div id="file-list"></div>
<div id="input-row">
<button id="file-btn" onclick="document.getElementById('file-input').click()" title="Прикрепить файл" aria-label="Прикрепить файл">📎</button>
<div id="review-card" style="display:none;margin:0 0 .4rem;padding:.45rem .6rem;border:1px solid var(--border);border-radius:10px;font-size:.85rem;background:var(--bg-card)">
<b id="review-card-title"></b>
<a id="review-card-open" href="#" style="margin-left:.6rem">открыть</a>
<button id="review-card-stop" type="button" style="margin-left:.4rem">остановить</button>
</div>
<textarea id="msg-input" placeholder="Напишите сообщение..." rows="1" aria-label="Сообщение" onkeydown="handleKey(event)"></textarea>
<button id="send-btn" onclick="onSendClick()">Отправить</button>
</div>
@@ -1727,6 +1732,37 @@ async function connectProgram(){
}
}
function hideDevicePanel(){ document.getElementById('device-panel').style.display = 'none'; }
// Карточка проверки в чате (T6b): опрос раз в 10 с, пока вкладка видима. Пусто или
// ошибка — карточки нет: пустышка на экране хуже отсутствия карточки.
let _reviewCardId = null;
async function pollReviewCard(){
if (document.hidden) return;
try {
const r = await fetch(API + '/api/reviews', {headers: authHeaders()});
if (!r.ok) { document.getElementById('review-card').style.display = 'none'; return; }
const d = await r.json();
const live = (d.items||[]).find(x => ['queued','running','paused'].includes(x.status));
const card = document.getElementById('review-card');
if (!live) { card.style.display = 'none'; _reviewCardId = null; return; }
_reviewCardId = live.id;
const closed = (live.n_fixed||0)+(live.n_partial||0)+(live.n_not_fixed||0)+(live.n_unknown||0);
document.getElementById('review-card-title').textContent =
'Проверка №' + live.id + ' — ' + closed + ' из ' + (live.total||0);
const open = document.getElementById('review-card-open');
open.href = '/review/' + live.id;
const stop = document.getElementById('review-card-stop');
stop.style.display = live.status === 'stopped' ? 'none' : '';
card.style.display = 'block';
} catch (e) { document.getElementById('review-card').style.display = 'none'; }
}
document.getElementById('review-card-stop').onclick = async () => {
if (!_reviewCardId) return;
await fetch(API + '/api/reviews/' + _reviewCardId + '/cancel',
{method:'POST', headers: authHeaders()});
pollReviewCard();
};
setInterval(pollReviewCard, 10000);
document.addEventListener('visibilitychange', () => { if (!document.hidden) pollReviewCard(); });
function hideInvitePanel() {
document.getElementById('invite-panel').style.display = 'none';
document.getElementById('btn-invite').setAttribute('aria-expanded', 'false');