fix(интерфейс): значок вкладки, опрос проверок через обновление пропуска, метка ошибки
Три найденных изъяна на боевой странице: - браузер просил /favicon.ico и получал 404 на каждом заходе — теперь отдаётся значок бренда; - публичная страница каждые десять секунд дёргала /api/reviews без пропуска и получала 401 в журнале; карточка проверки спрашивает только у вошедшего и через authFetch — при истёкшем пропуске он обновляется, а не молча умирает; - строка «не удалось загрузить журнал» помечалась классом без стиля; теперь это признак данных, а проверка «каждый класс обязан иметь правило» снова строга. Проверки админки приведены к нынешней таблице людей (столбец «Доступ» вместо «Агент», метка удалённой в статусе, сборка строки из ячеек, галочка только живым). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -2621,7 +2621,7 @@ async function loadAudit(offset) {
|
||||
const upd = document.getElementById('audit-updated');
|
||||
const more = document.getElementById('audit-more');
|
||||
const my = ++auditReq;
|
||||
t.querySelectorAll('.row-err').forEach(e => e.remove());
|
||||
t.querySelectorAll('[data-err]').forEach(e => e.remove());
|
||||
if (auditOffset === 0) t.innerHTML = AUDIT_HEAD + '<tr><td colspan="7" class="dim">Загрузка…</td></tr>';
|
||||
if (more) more.disabled = true;
|
||||
try {
|
||||
@@ -2646,7 +2646,7 @@ async function loadAudit(offset) {
|
||||
if (more) { more.disabled = false; more.style.display = rows.length >= AUDIT_LIMIT ? '' : 'none'; }
|
||||
} catch (e) {
|
||||
if (my !== auditReq) return;
|
||||
const errRow = '<tr class="row-err"><td colspan="7" class="bad">Не удалось загрузить журнал: '
|
||||
const errRow = '<tr data-err="1"><td colspan="7" class="bad">Не удалось загрузить журнал: '
|
||||
+ esc(e.message || 'сеть') + ' <button type="button" class="btn-sm" onclick="loadAudit('
|
||||
+ auditOffset + ')">Повторить</button></td></tr>';
|
||||
if (auditOffset === 0) t.innerHTML = AUDIT_HEAD + errRow;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
+12
-3
@@ -1737,8 +1737,17 @@ function hideDevicePanel(){ document.getElementById('device-panel').style.displa
|
||||
let _reviewCardId = null;
|
||||
async function pollReviewCard(){
|
||||
if (document.hidden) return;
|
||||
const card0 = document.getElementById('review-card');
|
||||
// Публичной странице список проверок не нужен: без пропуска опрос только сорил бы
|
||||
// отказом 401 каждые десять секунд.
|
||||
if (!localStorage.getItem('token')) {
|
||||
if (card0) card0.style.display = 'none';
|
||||
_reviewCardId = null;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const r = await fetch(API + '/api/reviews', {headers: authHeaders()});
|
||||
// authFetch: при истёкшем пропуске обновляет его и повторяет запрос.
|
||||
const r = await authFetch(API + '/api/reviews');
|
||||
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));
|
||||
@@ -1757,8 +1766,8 @@ async function pollReviewCard(){
|
||||
}
|
||||
document.getElementById('review-card-stop').onclick = async () => {
|
||||
if (!_reviewCardId) return;
|
||||
await fetch(API + '/api/reviews/' + _reviewCardId + '/cancel',
|
||||
{method:'POST', headers: authHeaders()});
|
||||
await authFetch(API + '/api/reviews/' + _reviewCardId + '/cancel',
|
||||
{method:'POST'});
|
||||
pollReviewCard();
|
||||
};
|
||||
setInterval(pollReviewCard, 10000);
|
||||
|
||||
Reference in New Issue
Block a user