Обновить оформление мессенджера и панели системы
@@ -271,3 +271,15 @@ API проверяет фактическое отсутствие тела (с
|
||||
Проверка: `.venv/bin/python student-tests/chunked_login.py`.
|
||||
Внешняя регистрация, вход, точный поиск, создание общего чата и сообщение проверены
|
||||
через публичный HTTPS-адрес; результат без токенов записан в evidence/operations.txt.
|
||||
|
||||
## Оформление интерфейса
|
||||
|
||||
Общие стили мессенджера находятся в wwwroot/design.css, панель системы в
|
||||
operations.css и operations.js. Добавлены 16 SVG на общей сетке и спрайт,
|
||||
две новые иллюстрации персонажа в WebP с прозрачностью. Использование графики
|
||||
описано в docs/ASSETS.md. Изображения загружаются в размерах 320/640, без
|
||||
исходных PNG в webroot. На ширине 1366 и 390 проверены отсутствие горизонтальной
|
||||
прокрутки, загрузка иллюстраций, навигация панели и доступность поля сообщения.
|
||||
В браузере проверены реальные состояния восьми карточек API/зависимостей.
|
||||
SVG разобраны XML-парсером, все новые asset URL отвечают 200. make check,
|
||||
make validate и публичный smoke-сценарий прошли после изменений.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Графика интерфейса
|
||||
|
||||
Набор: src/Messenger.Api/wwwroot/assets/.
|
||||
|
||||
## SVG
|
||||
|
||||
16 отдельных файлов в icons/: api, database, queue, storage, worker, dispatcher,
|
||||
cache, proxy, browser, chat, image, activity, check, clock, error, overview.
|
||||
Размерная сетка 48×48, обводка 2, скруглённые окончания, прозрачный фон.
|
||||
Для обычной картинки: `<img src="/assets/icons/database.svg" alt="База данных">`.
|
||||
Для управления цветом через CSS используйте спрайт:
|
||||
|
||||
```html
|
||||
<svg viewBox="0 0 48 48" width="24" height="24" aria-hidden="true"
|
||||
style="color:#FFE135">
|
||||
<use href="/assets/system-icons.svg#database"></use>
|
||||
</svg>
|
||||
```
|
||||
|
||||
Файл system-icons.svg должен находиться на том же origin. В другом проекте
|
||||
измените путь к спрайту. Для кнопки задайте текст или aria-label; декоративному
|
||||
SVG оставьте aria-hidden. Исходные SVG не зависят от JavaScript или библиотеки.
|
||||
conversation-grid.svg используется как малоконтрастный фон переписки.
|
||||
|
||||
## Иллюстрации
|
||||
|
||||
kolovertysh-message-320.webp / kolovertysh-message-640.webp: пустой экран чатов
|
||||
и боковая панель системы. kolovertysh-reconnect-320.webp: ошибка подключения.
|
||||
Все изображения содержат alpha; прозрачность сохранена при экспорте.
|
||||
Созданы с помощью ChatGPT по существующему образу персонажа. Для UI используются
|
||||
уменьшенные WebP, исходные PNG оставлены локально вне webroot.
|
||||
|
||||
## Цвета и движение
|
||||
|
||||
Основной фон #262626, акцент #FFE135, основной текст #EEEEE2.
|
||||
Рабочие поверхности #282A25 и #30312C, вторичный текст #A8AC9B.
|
||||
Состояния: зелёный #A6CF9A, ошибка #EEB09F.
|
||||
Анимация точек между узлами запускается после реального ответа панели.
|
||||
Выбранный API определяется по X-Instance-Id. При prefers-reduced-motion
|
||||
переходы, появление окон и движение точек отключены. Графики строят прямые
|
||||
отрезки между измерениями, без сглаживания или искусственных данных.
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="240" viewBox="0 0 300 240"><g fill="none" stroke="#c8d7ad" stroke-opacity=".035" stroke-width="1"><path d="M35 30h25a8 8 0 0 1 8 8v12a8 8 0 0 1-8 8H43l-10 6V38a8 8 0 0 1 2-8ZM185 155h25a8 8 0 0 1 8 8v12a8 8 0 0 1-8 8h-17l-10 6v-26a8 8 0 0 1 2-8Z"/><circle cx="210" cy="42" r="12"/><circle cx="60" cy="168" r="12"/><path d="M130 95v8m-4-4h8m138 11v8m-4-4h8M14 222h8m-4-4v8"/></g></svg>
|
||||
|
After Width: | Height: | Size: 445 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 25h9l6-17 12 33 6-16h9"/></svg>
|
||||
|
After Width: | Height: | Size: 218 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="6" width="32" height="36" rx="8"/><path d="M8 18h32M16 12h.1M22 12h.1M19 25l-5 5 5 5m10-10 5 5-5 5"/></svg>
|
||||
|
After Width: | Height: | Size: 297 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="7" width="40" height="34" rx="7"/><path d="M4 18h40M11 12h.1M17 12h.1M23 12h.1M17 26h14m-14 7h9"/></svg>
|
||||
|
After Width: | Height: | Size: 294 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m27 4-17 23h13l-2 17 17-24H25l2-16Z"/></svg>
|
||||
|
After Width: | Height: | Size: 228 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 7h20a9 9 0 0 1 9 9v14a9 9 0 0 1-9 9H18L6 45V16a9 9 0 0 1 8-9Z"/><path d="M16 19h18M16 27h12"/></svg>
|
||||
|
After Width: | Height: | Size: 288 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="19"/><path d="m15 24 6 6 13-14"/></svg>
|
||||
|
After Width: | Height: | Size: 241 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="19"/><path d="M24 13v12l8 5"/></svg>
|
||||
|
After Width: | Height: | Size: 238 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="24" cy="11" rx="16" ry="6"/><path d="M8 11v26c0 8 32 8 32 0V11M8 24c0 8 32 8 32 0"/></svg>
|
||||
|
After Width: | Height: | Size: 278 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 12h20a9 9 0 0 1 9 9v14M29 28l7 7 7-7M41 12H21a9 9 0 0 0-9 9v14m-7-7 7 7 7-7"/></svg>
|
||||
|
After Width: | Height: | Size: 271 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7a4 4 0 0 1 6 0l17 30a4 4 0 0 1-3 6H7a4 4 0 0 1-3-6L21 7Z"/><path d="M24 17v11M24 35h.1"/></svg>
|
||||
|
After Width: | Height: | Size: 284 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="6" width="38" height="36" rx="8"/><circle cx="17" cy="17" r="4"/><path d="m6 35 10-9 7 6 9-13 10 16"/></svg>
|
||||
|
After Width: | Height: | Size: 298 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="15" height="15" rx="4"/><rect x="28" y="5" width="15" height="15" rx="4"/><rect x="5" y="28" width="15" height="15" rx="4"/><rect x="28" y="28" width="15" height="15" rx="4"/></svg>
|
||||
|
After Width: | Height: | Size: 381 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="17" y="5" width="14" height="11" rx="4"/><rect x="4" y="32" width="14" height="11" rx="4"/><rect x="30" y="32" width="14" height="11" rx="4"/><path d="M24 16v8H11v8m13-8h13v8"/></svg>
|
||||
|
After Width: | Height: | Size: 367 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="9" width="10" height="30" rx="4"/><rect x="19" y="9" width="10" height="30" rx="4"/><rect x="33" y="9" width="10" height="30" rx="4"/><path d="m8 24 3 3 3-3m8 0 3 3 3-3m8 0 3 3 3-3"/></svg>
|
||||
|
After Width: | Height: | Size: 379 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 15 24 6l17 9v20l-17 9-17-9V15Zm0 0 17 9 17-9M24 24v20M15 11l18 9"/></svg>
|
||||
|
After Width: | Height: | Size: 260 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" color="#FFE135" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="12" y="12" width="24" height="24" rx="7"/><path d="M19 4v8M29 4v8M19 36v8M29 36v8M4 19h8M4 29h8M36 19h8M36 29h8m-25-8 4 4 7-8"/></svg>
|
||||
|
After Width: | Height: | Size: 318 B |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg"><symbol id="api" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="6" width="32" height="36" rx="8"/><path d="M8 18h32M16 12h.1M22 12h.1M19 25l-5 5 5 5m10-10 5 5-5 5"/></symbol><symbol id="database" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="24" cy="11" rx="16" ry="6"/><path d="M8 11v26c0 8 32 8 32 0V11M8 24c0 8 32 8 32 0"/></symbol><symbol id="queue" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="9" width="10" height="30" rx="4"/><rect x="19" y="9" width="10" height="30" rx="4"/><rect x="33" y="9" width="10" height="30" rx="4"/><path d="m8 24 3 3 3-3m8 0 3 3 3-3m8 0 3 3 3-3"/></symbol><symbol id="storage" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 15 24 6l17 9v20l-17 9-17-9V15Zm0 0 17 9 17-9M24 24v20M15 11l18 9"/></symbol><symbol id="worker" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="12" y="12" width="24" height="24" rx="7"/><path d="M19 4v8M29 4v8M19 36v8M29 36v8M4 19h8M4 29h8M36 19h8M36 29h8m-25-8 4 4 7-8"/></symbol><symbol id="dispatcher" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 12h20a9 9 0 0 1 9 9v14M29 28l7 7 7-7M41 12H21a9 9 0 0 0-9 9v14m-7-7 7 7 7-7"/></symbol><symbol id="cache" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m27 4-17 23h13l-2 17 17-24H25l2-16Z"/></symbol><symbol id="proxy" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="17" y="5" width="14" height="11" rx="4"/><rect x="4" y="32" width="14" height="11" rx="4"/><rect x="30" y="32" width="14" height="11" rx="4"/><path d="M24 16v8H11v8m13-8h13v8"/></symbol><symbol id="browser" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="7" width="40" height="34" rx="7"/><path d="M4 18h40M11 12h.1M17 12h.1M23 12h.1M17 26h14m-14 7h9"/></symbol><symbol id="chat" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 7h20a9 9 0 0 1 9 9v14a9 9 0 0 1-9 9H18L6 45V16a9 9 0 0 1 8-9Z"/><path d="M16 19h18M16 27h12"/></symbol><symbol id="image" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="6" width="38" height="36" rx="8"/><circle cx="17" cy="17" r="4"/><path d="m6 35 10-9 7 6 9-13 10 16"/></symbol><symbol id="activity" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 25h9l6-17 12 33 6-16h9"/></symbol><symbol id="check" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="19"/><path d="m15 24 6 6 13-14"/></symbol><symbol id="clock" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="24" cy="24" r="19"/><path d="M24 13v12l8 5"/></symbol><symbol id="error" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 7a4 4 0 0 1 6 0l17 30a4 4 0 0 1-3 6H7a4 4 0 0 1-3-6L21 7Z"/><path d="M24 17v11M24 35h.1"/></symbol><symbol id="overview" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="15" height="15" rx="4"/><rect x="28" y="5" width="15" height="15" rx="4"/><rect x="5" y="28" width="15" height="15" rx="4"/><rect x="28" y="28" width="15" height="15" rx="4"/></symbol></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,109 @@
|
||||
:root {--paper:#262626;--surface:#30312c;--border:#ffffff14;--ink:#eeeee2;--muted:#a8ac9b;--accent:#FFE135;--soft:#ffe1350c;--danger:#eeb09f;}
|
||||
body {background:#1e201c;}
|
||||
input,textarea {background:#252722;border-color:#ffffff1c;color:#eeeee2;}
|
||||
input::placeholder,textarea::placeholder {color:#7d8571;}
|
||||
.button {border-radius:11px;min-height:44px;}
|
||||
.button.primary {box-shadow:0 4px 18px #ffe13508;}
|
||||
.button.primary:hover {box-shadow:0 5px 22px #ffe13518;}
|
||||
.button.secondary {background:#ffffff07;border-color:#ffffff1a;}
|
||||
.icon-button {border-radius:10px;}
|
||||
.icon-button:hover {background:#ffe1350b;}
|
||||
.brand {color:#ffe135;letter-spacing:-1px;}
|
||||
.app-shell {max-width:1560px;margin:16px auto;height:calc(100svh - 32px);border-radius:20px;border-color:#ffffff12;box-shadow:0 16px 80px #0003;background:#252722;}
|
||||
.sidebar {background:#20221e;border-color:#ffffff0d;padding:27px 16px 0;}
|
||||
.sidebar .brand {font-size:24px;}
|
||||
.sidebar .brand-mark {width:30px;height:30px;}
|
||||
.sidebar-heading {padding:29px 10px 18px;}
|
||||
.sidebar-heading .eyebrow {display:none;}
|
||||
.sidebar-heading h2 {font-size:21px;color:#eeeee2;font-weight:550;}
|
||||
.search-field {background:#2a2d25;border-color:#ffffff0e;border-radius:11px;margin-bottom:16px;}
|
||||
.search-field input {font-size:12px;}
|
||||
.chat-row {padding:14px 10px;border-radius:12px;gap:12px;margin-bottom:5px;transition:background .18s,transform .18s,border-color .18s;}
|
||||
.chat-row:hover {background:#ffffff04;transform:translateX(2px);}
|
||||
.chat-row.active {background:#ffe1350a;border-color:#ffe13524;}
|
||||
.chat-row-heading strong {font-weight:550;font-size:13px;}
|
||||
.chat-preview {font-size:11px;color:#969e86;}
|
||||
.chat-row-heading time {font-size:9px;color:#929b84;}
|
||||
.avatar {border-radius:13px;}
|
||||
.profile {border-color:#ffffff0b;}
|
||||
.profile-text strong {font-weight:500;color:#e4e6d6;}
|
||||
.profile-text span {font-size:10px;color:#8b947d;}
|
||||
#open-operations {display:flex;align-items:center;gap:10px;padding:12px 14px;border:1px solid #ffe13525;border-radius:11px;background:#ffe13509;color:#ffe135;font-size:12px;margin:12px 5px 0;}
|
||||
#open-operations svg {width:17px;height:17px;fill:none;stroke:currentColor;}
|
||||
#open-operations::after {content:'↗';margin-left:auto;opacity:.6;}
|
||||
#open-operations:hover {background:#ffe13511;}
|
||||
.sidebar-diagnostics:not(#open-operations) {font-size:10px;color:#7e896f;margin-bottom:4px;}
|
||||
.workspace {background:#262823;}
|
||||
.chat-header {background:#292c25;border-bottom-color:#ffffff0d;padding:18px 26px;min-height:82px;}
|
||||
.chat-heading h2 {font-size:16px;color:#eeeee2;font-weight:550;}
|
||||
.chat-heading span {font-size:10px;color:#8e9a7d;}
|
||||
.message-scroll {background-color:#252722;background-image:url('/assets/conversation-grid.svg');background-size:300px 240px;padding:12px 28px 26px;}
|
||||
.message-list {gap:13px;}
|
||||
.message-bubble {background:#32362b;border:1px solid #ffffff0d;border-radius:15px 15px 15px 4px;padding:12px 15px 9px;box-shadow:0 3px 8px #0000000a;}
|
||||
.message-text {font-size:14px;line-height:1.65;color:#e8ebdf;}
|
||||
.mine .message-bubble {background:#e8d44e;border-color:#e8d44e;border-radius:15px 15px 4px 15px;}
|
||||
.mine .message-text {color:#282c1e;}
|
||||
.message-time {font-size:9px;color:#929d7f;}
|
||||
.mine .message-time {color:#655e2d;}
|
||||
.message-author {font-size:10px;color:#b2c397;}
|
||||
.date-separator {background:#ffffff05;border-color:#ffffff0b;color:#8c9879;font-size:9px;padding:5px 11px;backdrop-filter:blur(8px);}
|
||||
.composer {background:#292c25;border-color:#ffffff0d;padding:16px 24px 14px;}
|
||||
.composer textarea {background:#22251e;border-color:#ffffff17;border-radius:12px;line-height:1.5;}
|
||||
.composer textarea:focus {border-color:#b3a739;box-shadow:0 0 0 3px #ffe13507;}
|
||||
.composer-note {font-size:9px;color:#929e81;}
|
||||
.send-button {border-radius:12px;}
|
||||
.send-button:disabled {background:#3b4130;color:#7d896b;}
|
||||
#pick-file {border:1px solid #ffffff13;background:#ffffff03;border-radius:11px;}
|
||||
.attachment-card {border-radius:12px;padding:5px;background:#00000006;}
|
||||
.attachment-preview {border-radius:10px;}
|
||||
.attachment-name {font-size:11px;}
|
||||
.attachment-size {font-size:9px;}
|
||||
.processing-link {font-size:10px;text-decoration:none;border:1px solid currentColor;border-radius:7px;padding:6px 8px;opacity:.7;}
|
||||
.processing-link:hover {opacity:1;}
|
||||
.reaction-button,.reaction-picker {background:#2a2e24;border-color:#454e37;border-radius:9px;font-size:11px;}
|
||||
.reaction-button[aria-pressed=true] {border-color:#b6a43c;background:#ffe1350d;}
|
||||
.welcome {background:radial-gradient(ellipse at 50% 45%,#ffe13506,transparent 65%);}
|
||||
.welcome-illustration {width:300px;max-width:75%;filter:drop-shadow(0 18px 25px #0002);}
|
||||
.welcome h1 {font-size:27px;font-weight:550;letter-spacing:-.8px;color:#eceee0;margin:12px 0;}
|
||||
.welcome p {font-size:12px;color:#909a80;}
|
||||
.empty-conversation img {width:180px!important;height:auto;filter:drop-shadow(0 12px 16px #0002);}
|
||||
.empty-conversation p {font-size:14px;font-weight:500;color:#dce2cf;}
|
||||
.empty-conversation span {font-size:11px;color:#8a9679;}
|
||||
.auth-layout {max-width:1440px;}
|
||||
.intro {background:radial-gradient(ellipse at 40% 60%,#ffe13507,transparent 65%),#242721;}
|
||||
.intro::before {border-color:#ffe1350e;}
|
||||
.intro-copy h1 {font-family:inherit;font-size:43px;font-weight:550;letter-spacing:-1.5px;line-height:1.2;color:#eaeede;}
|
||||
.auth-side {background:#2a2d26;border-color:#ffffff0d;}
|
||||
.auth-switch {background:#20231d;border-color:#ffffff12;border-radius:12px;margin-bottom:34px;}
|
||||
.auth-switch button {transition:background .25s,color .25s;}
|
||||
.auth-card h2 {font-size:31px;letter-spacing:-1px;font-weight:550;color:#ecefe1;}
|
||||
.auth-card form {gap:19px;}
|
||||
.auth-card label {font-size:11px;color:#b8c1a8;}
|
||||
.auth-card input {padding:14px;background:#22251e;border-color:#ffffff19;border-radius:10px;}
|
||||
.auth-card input:focus {border-color:#b7a940;}
|
||||
.auth-bottom {color:#7f8b6f;}
|
||||
dialog:not(.ops-panel):not(.image-viewer) {background:#292d24;border-color:#ffffff17;border-radius:18px;color:#e7ecda;box-shadow:0 25px 90px #0007;}
|
||||
dialog::backdrop {background:#10130db3;}
|
||||
.dialog-heading h2 {font-size:21px;font-weight:550;letter-spacing:-.5px;}
|
||||
.dialog-heading {border-color:#ffffff10;}
|
||||
.processing-panel {width:min(950px,94vw);}
|
||||
.processing-panel section {padding:26px;}
|
||||
.processing-panel header {padding-bottom:17px;border-bottom:1px solid #ffffff0d;}
|
||||
.processing-panel h2 {font-size:19px;font-weight:550;}
|
||||
.processing-panel h3 {color:#b8c5a4;font-weight:500;}
|
||||
.processing-summary {padding:8px 0;}
|
||||
.processing-summary strong {font-size:13px;}
|
||||
.processing-badge {font-size:11px;padding:5px 9px;border:1px solid #ffe13525;border-radius:7px;background:#ffe13507;}
|
||||
.processing-results article {background:#22261d;border-color:#ffffff0e;}
|
||||
.processing-results img {height:170px;border-radius:9px;background:#1d2118;}
|
||||
.processing-results strong {font-size:12px;}
|
||||
.processing-results a {border-color:#ffffff15;transition:background .18s;}
|
||||
.processing-results a:hover {background:#ffe1350a;}
|
||||
.toast {border-radius:11px;box-shadow:0 10px 40px #0004;}
|
||||
@media(min-width:721px){.app-shell{grid-template-columns:300px minmax(0,1fr);}}
|
||||
@media(min-width:721px) and (max-width:1100px){.app-shell{margin:12px;height:calc(100svh - 24px);grid-template-columns:270px minmax(0,1fr);}}
|
||||
@media(max-width:720px){.app-shell{margin:0;height:100svh;border:0;border-radius:0;}.sidebar{padding:24px 14px 0;}.sidebar-heading{padding-top:24px;}.chat-header{padding:14px 16px;min-height:74px;}.message-scroll{padding:8px 15px 20px;}.composer{padding:12px 14px max(12px,env(safe-area-inset-bottom));}.message{max-width:88%;}.message-text{font-size:14px;}.auth-card h2{font-size:28px;}.processing-panel section{padding:17px;}.processing-panel h2{font-size:17px;}.processing-results img{height:150px;}}
|
||||
@media(prefers-reduced-motion:no-preference){dialog[open]:not(.ops-panel):not(.image-viewer){animation:dialog-appear .22s cubic-bezier(.2,.7,.3,1);} .welcome-illustration{animation:welcome-appear .55s ease-out;} .chat-row:active{transform:scale(.985);} .ops-panel[open] .ops-metrics{animation:welcome-appear .35s ease-out;} }
|
||||
@keyframes dialog-appear{from{opacity:0;transform:translateY(8px) scale(.985);}to{opacity:1;transform:none;}}
|
||||
@keyframes welcome-appear{from{opacity:0;transform:translateY(9px);}to{opacity:1;transform:none;}}
|
||||
@media(prefers-reduced-motion:reduce){.chat-row,.button,.icon-button,.processing-results a,.auth-switch button{transition:none;}.chat-row:hover{transform:none;}}
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="theme-color" content="#262626">
|
||||
<meta name="description" content="n1k0der - место для ваших разговоров.">
|
||||
<meta name="description" content="n1k0der · Мессенджер">
|
||||
<title>n1k0der · Мессенджер</title>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' rx='12' fill='%23262626'/%3E%3Cpath d='M11 14h18M11 20h13M11 26h8' stroke='%23FFE135' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E">
|
||||
<link rel="stylesheet" href="/app.css">
|
||||
@@ -13,6 +13,7 @@
|
||||
<link rel="stylesheet" href="/showcase.css">
|
||||
<script type="module" src="/app.js"></script>
|
||||
<link rel="stylesheet" href="/operations.css">
|
||||
<link rel="stylesheet" href="/design.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg class="svg-sprite" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
@@ -35,7 +36,7 @@
|
||||
<section id="auth-screen" class="auth-layout">
|
||||
<div class="intro">
|
||||
<a class="brand" href="/" aria-label="n1k0der, главная"><span class="brand-mark"><i></i><i></i><i></i></span>n1k0der<span class="brand-dot">.</span></a>
|
||||
<div class="intro-copy"><h1>Место для<br> ваших<br> <em>разговоров.</em></h1></div>
|
||||
<div class="intro-copy"><h1>Мессенджер</h1></div>
|
||||
<div id="mascot-stage" class="mascot-stage" aria-hidden="true" data-mood="idle">
|
||||
<div class="mascot-conversation"><div class="mascot-bubble mascot-bubble-filled"><span></span><span></span><span></span></div><div class="mascot-bubble mascot-bubble-outline"><i></i><i></i></div></div>
|
||||
<svg class="spirit-svg" viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" stroke="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
@@ -113,7 +114,7 @@
|
||||
<div id="register-panel" hidden><h2>Создайте аккаунт.</h2><p class="muted">Присоединяйтесь к разговору.</p>
|
||||
<form id="register-form"><label>Имя<input id="register-name" name="display_name" autocomplete="nickname" placeholder="Никита" required></label><label>Имя пользователя<input id="register-username" name="username" autocomplete="username" placeholder="n1k0der" pattern="[a-z0-9_]{3,32}" required autocapitalize="none" spellcheck="false"><span class="field-note">3-32 символа: a-z, цифры и _</span></label><label>Пароль<span class="password-field"><input id="register-password" aria-label="Пароль" name="password" type="password" autocomplete="new-password" placeholder="Придумайте пароль" required><button class="password-toggle" type="button" data-password-toggle="register-password" aria-label="Показать пароль" aria-pressed="false"><svg><use href="#i-eye"/></svg></button></span><span class="field-note">12-128 символов</span></label><button class="button primary wide" type="submit">Создать аккаунт <svg class="action-arrow" aria-hidden="true"><use href="#i-arrow-up-right"/></svg></button></form>
|
||||
</div>
|
||||
<img id="auth-error-art" class="auth-error-art" src="/assets/kolovertysh-error-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async" hidden>
|
||||
<img id="auth-error-art" class="auth-error-art" src="/assets/kolovertysh-reconnect-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async" hidden>
|
||||
<p id="auth-notice" class="form-notice" role="status" aria-live="polite" hidden></p>
|
||||
</div>
|
||||
<div class="auth-bottom">n1k0der<button class="diagnostics-toggle" type="button" data-diagnostics-toggle aria-controls="diagnostics-panel" aria-expanded="false"><svg><use href="#i-code"/></svg>Запросы API</button></div>
|
||||
@@ -126,16 +127,16 @@
|
||||
<div class="sidebar-heading"><div><span class="eyebrow">На связи</span><h2>Ваши чаты<span id="chat-count" class="count"></span></h2></div><button id="new-chat" class="icon-button filled" aria-label="Создать чат" title="Создать чат"><svg><use href="#i-plus"/></svg></button></div>
|
||||
<label class="search-field"><span class="visually-hidden">Поиск среди загруженных чатов</span><svg aria-hidden="true"><use href="#i-search"/></svg><input id="chat-search" placeholder="Найти разговор" type="search" autocomplete="off"></label>
|
||||
<div id="chat-list" class="chat-list" aria-label="Список чатов"></div><button id="more-chats" class="text-button" hidden>Ещё чаты</button>
|
||||
<button id="open-operations" class="diagnostics-toggle sidebar-diagnostics" type="button" hidden>Система</button>
|
||||
<button id="open-operations" class="diagnostics-toggle sidebar-diagnostics" type="button" hidden><svg viewBox="0 0 48 48" aria-hidden="true"><use href="/assets/system-icons.svg#overview"/></svg>Система</button>
|
||||
<button class="diagnostics-toggle sidebar-diagnostics" type="button" data-diagnostics-toggle aria-controls="diagnostics-panel" aria-expanded="false"><svg><use href="#i-code"/></svg>Запросы API</button>
|
||||
<div class="profile"><button id="open-profile" class="profile-main" title="Открыть профиль"><span id="profile-avatar" class="avatar"></span><span class="profile-text"><strong id="profile-name"></strong><span id="profile-username"></span></span></button><button id="logout" class="icon-button" aria-label="Выйти" title="Выйти"><svg><use href="#i-exit"/></svg></button></div>
|
||||
</aside>
|
||||
<main class="workspace">
|
||||
<div id="welcome" class="welcome"><img class="welcome-illustration" src="/assets/kolovertysh-welcome-320.webp" srcset="/assets/kolovertysh-welcome-320.webp 320w, /assets/kolovertysh-welcome-640.webp 640w" sizes="(max-width: 720px) 200px, 260px" width="640" height="480" alt="" decoding="async"><h1>Начните<br><em>разговор.</em></h1><p>Выберите чат или создайте новый.</p><button id="welcome-new-chat" class="button primary"><svg><use href="#i-plus"/></svg>Создать чат</button></div>
|
||||
<div id="workspace-error" class="state-error welcome" hidden><img src="/assets/kolovertysh-error-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><h2>Чаты пока не загрузились</h2><p>Проверьте соединение и попробуйте ещё раз.</p><button id="retry-chats" class="button primary" type="button">Повторить</button></div>
|
||||
<div id="welcome" class="welcome"><img class="welcome-illustration" src="/assets/kolovertysh-message-320.webp" srcset="/assets/kolovertysh-message-320.webp 320w, /assets/kolovertysh-message-640.webp 640w" sizes="(max-width: 720px) 200px, 260px" width="640" height="480" alt="" decoding="async"><h1>Ваши чаты</h1><p>Выберите чат или создайте новый.</p><button id="welcome-new-chat" class="button primary"><svg><use href="#i-plus"/></svg>Создать чат</button></div>
|
||||
<div id="workspace-error" class="state-error welcome" hidden><img src="/assets/kolovertysh-reconnect-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><h2>Чаты пока не загрузились</h2><p>Проверьте соединение и попробуйте ещё раз.</p><button id="retry-chats" class="button primary" type="button">Повторить</button></div>
|
||||
<section id="conversation" class="conversation" hidden>
|
||||
<header class="chat-header"><button id="back-to-chats" class="icon-button mobile-only" aria-label="К списку чатов"><svg><use href="#i-arrow"/></svg></button><span id="current-avatar" class="avatar chat-avatar"></span><div class="chat-heading"><h2 id="current-title"></h2><span id="current-members"></span></div><button id="refresh-messages" class="icon-button" aria-label="Обновить сообщения" title="Обновить сообщения"><svg><use href="#i-refresh"/></svg></button><button id="show-members" class="icon-button" aria-label="Участники чата" title="Участники чата"><svg><use href="#i-users"/></svg></button><button class="icon-button mobile-only" type="button" data-diagnostics-toggle aria-label="Запросы API" title="Запросы API" aria-controls="diagnostics-panel" aria-expanded="false"><svg><use href="#i-code"/></svg></button></header>
|
||||
<div class="message-region"><div id="message-scroll" class="message-scroll"><div class="history-control"><button id="older-messages" class="text-button" hidden>Ранее в разговоре ↑</button></div><div id="messages-loading" class="messages-loading" aria-hidden="true" hidden><i></i><i></i><i></i></div><div id="message-list" class="message-list" aria-label="Сообщения"></div><div id="empty-conversation" class="empty-conversation" hidden><img src="/assets/kolovertysh-empty-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><p>Здесь начинается разговор</p><span>Напишите первое сообщение.</span></div><div id="conversation-error" class="state-error" hidden><img src="/assets/kolovertysh-error-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><h3>Не удалось загрузить сообщения</h3><p>Попробуйте обновить разговор.</p><button id="retry-messages" class="button secondary" type="button">Повторить</button></div></div><button id="jump-latest" class="jump-latest" type="button" hidden>К последним ↓</button></div>
|
||||
<div class="message-region"><div id="message-scroll" class="message-scroll"><div class="history-control"><button id="older-messages" class="text-button" hidden>Ранее в разговоре ↑</button></div><div id="messages-loading" class="messages-loading" aria-hidden="true" hidden><i></i><i></i><i></i></div><div id="message-list" class="message-list" aria-label="Сообщения"></div><div id="empty-conversation" class="empty-conversation" hidden><img src="/assets/kolovertysh-message-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><p>Нет сообщений</p><span>Напишите первое сообщение.</span></div><div id="conversation-error" class="state-error" hidden><img src="/assets/kolovertysh-reconnect-320.webp" width="320" height="320" alt="" loading="lazy" decoding="async"><h3>Не удалось загрузить сообщения</h3><p>Попробуйте обновить разговор.</p><button id="retry-messages" class="button secondary" type="button">Повторить</button></div></div><button id="jump-latest" class="jump-latest" type="button" hidden>К последним ↓</button></div>
|
||||
<form id="message-form" class="composer"><label class="visually-hidden" for="message-input">Сообщение</label><input id="image-file" type="file" accept="image/png,image/jpeg" hidden><button id="pick-file" class="icon-button" type="button" aria-label="Добавить изображение" title="Добавить изображение"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="m8 13 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"/></svg></button><textarea id="message-input" rows="1" placeholder="Сообщение…" enterkeyhint="send"></textarea><button id="send-message" class="send-button" aria-label="Отправить сообщение" title="Отправить сообщение" disabled><svg><use href="#i-send"/></svg></button><div id="attached-files" class="attached-files"></div><div class="composer-note"><span>Enter - отправить · Shift + Enter - новая строка</span><span id="message-count">0 / 4000</span></div></form>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -1,5 +1,108 @@
|
||||
.ops-panel {position:fixed;inset:0;width:100dvw;height:100dvh;max-width:none;max-height:none;margin:0;border:0;border-radius:0;background:#20211f;color:#efefe7;padding:0;overflow:auto;color-scheme:dark;}
|
||||
.ops-panel::backdrop {background:#20211f;}.ops-shell {max-width:1450px;margin:auto;padding:0 36px;}.ops-header {display:flex;align-items:center;gap:25px;padding:24px 0;border-bottom:1px solid #ffffff12;}.ops-brand {font-size:23px;font-weight:750;letter-spacing:-1px;color:#ffe135;text-decoration:none;}.ops-brand span {color:#aaa;font-size:15px;font-weight:400;letter-spacing:0;}.ops-live {margin-left:auto;font-size:12px;color:#b6ce9c;}.ops-panel button {cursor:pointer;color:inherit;background:#ffffff08;border:1px solid #ffffff25;border-radius:9px;padding:9px 14px;font:inherit;font-size:12px;}.ops-panel button:hover {background:#ffffff18;}.ops-panel button:focus-visible,.ops-panel a:focus-visible {outline:2px solid #ffe135;outline-offset:3px;}.ops-notice {color:#ffb4a2;font-size:13px;}.ops-notice:empty {display:none;}.ops-metrics {display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:18px 0 25px;}.ops-metrics article {background:#2b2c29;border:1px solid #ffffff10;padding:20px 24px;border-radius:14px;display:grid;gap:12px;}.ops-metrics span {color:#bdbeb2;font-size:12px;}.ops-metrics strong {font-size:36px;line-height:1;font-weight:550;font-variant-numeric:tabular-nums;}.ops-metrics [data-kind=queued] strong {color:#ffe135;}.ops-metrics [data-kind=failed] strong {color:#e7a18c;}.ops-box {background:#282925;border:1px solid #ffffff12;padding:24px;border-radius:16px;min-width:0;}.ops-section-head {display:flex;align-items:center;justify-content:space-between;gap:15px;}.ops-box h2 {font-size:19px;letter-spacing:-.4px;margin:8px 0 20px;}.ops-checked {font-size:11px;color:#a2a697;}.ops-flow {display:flex;align-items:center;gap:20px;padding:10px 0 25px;}.ops-node,.ops-api-nodes {flex:1;min-width:0;}.ops-node {padding:20px;border:1px solid #d9dcbb25;border-radius:12px;display:grid;gap:9px;}.ops-node>span {font-size:10px;color:#a3a594;text-transform:uppercase;letter-spacing:1px;}.ops-node strong {font-size:20px;}.ops-node small {font-size:11px;color:#a4a69b;}.ops-arrow {color:#ffe135;font-size:25px;}.ops-api-nodes {display:grid;gap:8px;}.ops-services {display:grid;grid-template-columns:repeat(6,1fr);gap:10px;}.ops-service {border:1px solid #ffffff16;border-radius:10px;padding:14px;display:grid;gap:9px;min-width:0;transition:border-color .4s,background .4s;}.ops-service>span {font-size:9px;color:#b6cd9f;}.ops-service strong {font-size:13px;overflow-wrap:anywhere;}.ops-service small {font-size:10px;color:#a5a897;line-height:1.5;}.ops-service[data-state=down] {border-color:#b0755744;}.ops-service[data-state=down]>span {color:#eaa590;}.ops-service[data-state=unknown]>span {color:#aaa;}.ops-service.served {border-color:#ffe13588;background:#ffe13508;animation:ops-served 1s ease-out;}.ops-pipeline {display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:25px;padding-top:20px;border-top:1px solid #ffffff10;font-size:11px;color:#c6c9b4;}.ops-pipeline i {color:#ffe135;font-style:normal;}.ops-footnote {font-size:10px;color:#919586;line-height:1.7;margin:16px 0 0;}.ops-charts {display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px;}.ops-charts svg {width:100%;height:150px;display:block;}.ops-chart-caption {display:flex;justify-content:space-between;color:#8f9384;font-size:10px;}.ops-queue-value,.ops-latency-value {font-variant-numeric:tabular-nums;color:#ffe135;font-size:20px;font-weight:500;}.ops-bottom {display:grid;grid-template-columns:1.3fr 1fr;gap:18px;margin:18px 0;}.ops-jobs {max-height:440px;overflow:auto;}.ops-job {display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 0;border-top:1px solid #ffffff0d;}.ops-job>div {display:grid;gap:7px;min-width:0;}.ops-job strong {font-size:12px;font-weight:500;overflow-wrap:anywhere;}.ops-job small {font-size:10px;color:#b0b49e;}.ops-job button {color:#ffe135;flex-shrink:0;}.ops-events {list-style:none;padding:0;margin:0;max-height:440px;overflow:auto;}.ops-events li {display:grid;grid-template-columns:60px 1fr;gap:5px 10px;padding:12px 0;border-top:1px solid #ffffff0d;font-size:11px;}.ops-events time {color:#8f9580;font-variant-numeric:tabular-nums;}.ops-events strong {font-weight:450;}.ops-events li>span {grid-column:2;color:#8f9580;overflow-wrap:anywhere;font-size:10px;}.ops-empty {font-size:12px;color:#aaa;line-height:1.7;}.ops-shell footer {padding:15px 0 30px;font-size:11px;color:#959b85;}.ops-panel.is-stale .ops-live {color:#e7a18c;}
|
||||
@keyframes ops-served {from {box-shadow:0 0 20px #ffe13522;}to {box-shadow:none;}}
|
||||
@media(max-width:1000px){.ops-services{grid-template-columns:repeat(3,1fr);}.ops-shell{padding:0 22px;}}@media(max-width:650px){.ops-shell{padding:0 14px;}.ops-header{gap:10px;}.ops-brand{font-size:20px;}.ops-brand span{display:none;}.ops-live{font-size:9px;}.ops-metrics{grid-template-columns:repeat(2,1fr);gap:8px;}.ops-metrics article{padding:16px;}.ops-metrics strong{font-size:30px;}.ops-box{padding:16px;}.ops-flow{gap:7px;flex-wrap:wrap;}.ops-node{padding:12px;}.ops-node strong{font-size:15px;}.ops-node small{font-size:9px;}.ops-api-nodes{flex-basis:100%;grid-template-columns:1fr 1fr;}.ops-arrow{font-size:17px;}.ops-services{grid-template-columns:repeat(2,1fr);}.ops-charts,.ops-bottom{grid-template-columns:1fr;}.ops-box h2{font-size:17px;}.ops-checked{font-size:9px;}}
|
||||
@media(prefers-reduced-motion:reduce){.ops-service.served{animation:none;}.ops-service{transition:none;}}
|
||||
.ops-panel {position:fixed;inset:0;width:100dvw;height:100dvh;max-width:none;max-height:none;margin:0;border:0;border-radius:0;background:#222321;color:#eeeee7;padding:0;overflow:auto;color-scheme:dark;scroll-behavior:smooth;}
|
||||
.ops-panel::backdrop {background:#222321;}
|
||||
.ops-panel * {box-sizing:border-box;}
|
||||
.ops-panel svg {width:26px;height:26px;fill:none;stroke:currentColor;flex-shrink:0;}
|
||||
.ops-shell {max-width:1800px;margin:auto;display:grid;grid-template-columns:210px minmax(0,1fr);min-height:100%;}
|
||||
.ops-rail {position:sticky;top:0;height:100dvh;display:flex;flex-direction:column;padding:34px 20px 24px;background:#1d1e1c;border-right:1px solid #ffffff0d;}
|
||||
.ops-brand {color:#ffe135;text-decoration:none;display:grid;font-size:25px;font-weight:750;letter-spacing:-1px;padding:0 14px;gap:8px;}
|
||||
.ops-brand span {color:#a0a297;font-size:11px;font-weight:400;letter-spacing:0;}
|
||||
.ops-rail nav {display:grid;gap:6px;margin-top:42px;}
|
||||
.ops-panel button {cursor:pointer;color:inherit;background:#ffffff05;border:1px solid #ffffff18;border-radius:10px;padding:10px 14px;font:inherit;font-size:12px;transition:background .2s,color .2s,border-color .2s;}
|
||||
.ops-panel button:hover {background:#ffffff0d;border-color:#ffffff30;}
|
||||
.ops-panel button:focus-visible,.ops-panel a:focus-visible,.ops-legend summary:focus-visible {outline:2px solid #ffe135;outline-offset:3px;}
|
||||
.ops-rail nav button {display:flex;align-items:center;gap:12px;border-color:transparent;background:transparent;text-align:left;color:#a8aa9e;padding:13px;}
|
||||
.ops-rail nav button svg {width:20px;height:20px;}
|
||||
.ops-rail nav .is-active {color:#ffe135;background:#ffe1350d;border-color:#ffe1351a;}
|
||||
.ops-rail-art {margin:auto -2px 16px;padding-top:30px;}
|
||||
.ops-rail-art img {display:block;width:100%;height:auto;opacity:.85;filter:drop-shadow(0 12px 15px #0004);}
|
||||
.ops-close {text-align:left;color:#b5b7a9!important;}
|
||||
.ops-content {min-width:0;padding:0 32px;}
|
||||
.ops-header {display:flex;align-items:center;gap:18px;padding:25px 0;margin-bottom:4px;}
|
||||
.ops-header h1 {font-size:24px;letter-spacing:-.7px;margin:0 0 7px;font-weight:600;color:#f2f2e9;}
|
||||
.ops-checked {font-size:10px;color:#85897b;}
|
||||
.ops-live {display:flex;align-items:center;gap:8px;margin-left:auto;font-size:11px;color:#b8c8a4;}
|
||||
.ops-live::before {content:'';width:6px;height:6px;border-radius:50%;background:#b8c8a4;box-shadow:0 0 0 4px #b8c8a409;}
|
||||
.ops-panel .ops-refresh {font-size:22px;padding:5px 13px;color:#a8aa9a;}
|
||||
.ops-panel .ops-mobile-close {display:none;}
|
||||
.ops-notice {color:#efb39f;font-size:12px;background:#efb39f08;border:1px solid #efb39f24;border-radius:10px;padding:14px;}
|
||||
.ops-notice:empty {display:none;}
|
||||
.ops-metrics {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:12px 0 22px;scroll-margin-top:20px;}
|
||||
.ops-metrics article {position:relative;display:grid;gap:14px;background:linear-gradient(140deg,#32332e,#2b2c28);border:1px solid #ffffff0d;padding:22px;border-radius:15px;overflow:hidden;}
|
||||
.ops-metrics article::after {content:'';position:absolute;right:-12px;bottom:-35px;width:90px;height:90px;border:1px solid #ffffff06;border-radius:50%;}
|
||||
.ops-metrics svg {position:absolute;right:18px;top:20px;width:24px;height:24px;color:#aaa993;opacity:.65;}
|
||||
.ops-metrics span {font-size:11px;color:#b5b7a7;padding-right:26px;}
|
||||
.ops-metrics strong {font-size:34px;letter-spacing:-1px;line-height:1.1;font-weight:500;font-variant-numeric:tabular-nums;}
|
||||
.ops-metrics [data-kind=queued] strong,.ops-metrics [data-kind=queued] svg {color:#ffe135;}
|
||||
.ops-metrics [data-kind=ready] svg {color:#a9c49b;}
|
||||
.ops-metrics [data-kind=failed] svg {color:#dda28b;}
|
||||
.ops-box {background:#282a25;border:1px solid #ffffff0c;padding:24px;border-radius:16px;min-width:0;scroll-margin-top:20px;}
|
||||
.ops-section-head {display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:22px;}
|
||||
.ops-box h2 {font-size:15px;font-weight:550;letter-spacing:-.2px;margin:0;color:#e3e5d8;}
|
||||
.ops-topology-count,.ops-job-count {font-size:10px;color:#9ca18c;border:1px solid #ffffff12;border-radius:20px;padding:5px 9px;white-space:nowrap;}
|
||||
.ops-flow {display:flex;align-items:center;gap:16px;padding:4px 0 25px;}
|
||||
.ops-node,.ops-api-nodes {flex:1;min-width:0;}
|
||||
.ops-node {background:#22241f;padding:18px;border:1px solid #ffffff12;border-radius:12px;display:grid;gap:9px;}
|
||||
.ops-node svg {color:#d1cfaa;width:28px;height:28px;margin-bottom:5px;}
|
||||
.ops-node strong {font-size:14px;font-weight:550;}
|
||||
.ops-node small {font-size:10px;color:#97a28b;}
|
||||
.ops-arrow {position:relative;flex:0 0 36px;height:1px;background:#ffe13530;}
|
||||
.ops-arrow::after {content:'';position:absolute;right:0;top:-3px;width:6px;height:6px;border-top:1px solid #b4ad63;border-right:1px solid #b4ad63;transform:rotate(45deg);}
|
||||
.ops-api-nodes {display:grid;gap:8px;}
|
||||
.ops-services {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;}
|
||||
.ops-service {position:relative;border:1px solid #ffffff0f;border-radius:11px;padding:16px;display:grid;grid-template-columns:30px minmax(0,1fr);gap:6px 12px;min-width:0;background:#ffffff02;transition:border-color .35s,background .35s;}
|
||||
.ops-service>svg {grid-row:1/4;color:#c4c4a4;width:28px;height:28px;margin-top:3px;}
|
||||
.ops-service-status {grid-column:2;font-size:9px;color:#a6bf94;display:flex;align-items:center;gap:6px;}
|
||||
.ops-service-status::before {content:'';width:4px;height:4px;background:currentColor;border-radius:50%;}
|
||||
.ops-service strong {font-size:12px;font-weight:550;overflow-wrap:anywhere;grid-column:2;}
|
||||
.ops-service small {font-size:9px;color:#939a82;line-height:1.5;grid-column:2;}
|
||||
.ops-service[data-state=down] {border-color:#d798762a;background:#d7987605;}
|
||||
.ops-service[data-state=down] .ops-service-status {color:#dda18b;}
|
||||
.ops-service[data-state=unknown] {border-style:dashed;}
|
||||
.ops-service[data-state=unknown] .ops-service-status {color:#a1a299;}
|
||||
.ops-service.served {border-color:#ffe13566;background:#ffe13506;animation:ops-served 1.3s ease-out;}
|
||||
.ops-service.served>svg {color:#ffe135;}
|
||||
.ops-pipeline {display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:12px;padding:18px 10px 0;margin-top:16px;border-top:1px solid #ffffff0b;font-size:10px;color:#b7bea4;}
|
||||
.ops-pipeline span {padding:5px 9px;border:1px solid #ffffff0c;border-radius:6px;background:#22241f;}
|
||||
.ops-pipeline i {color:#777c65;font-style:normal;}
|
||||
.ops-legend {font-size:10px;color:#97a28b;margin-top:18px;line-height:1.7;}
|
||||
.ops-legend summary {cursor:pointer;width:fit-content;}
|
||||
.ops-legend p {max-width:700px;color:#a6ae95;}
|
||||
.ops-charts {display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px;scroll-margin-top:20px;}
|
||||
.ops-charts .ops-section-head {margin-bottom:12px;}
|
||||
.ops-charts svg {width:100%;height:auto;min-height:145px;display:block;stroke:none;overflow:visible;}
|
||||
.ops-chart-legend {display:flex;align-items:center;gap:6px;font-size:9px;color:#8e977d;margin-bottom:15px;}
|
||||
.ops-chart-legend i {width:5px;height:5px;border-radius:50%;background:#ffe135;}
|
||||
.ops-chart-legend.secondary i {background:#a6cf9a;}
|
||||
.ops-chart-caption {display:flex;justify-content:space-between;font-size:9px;color:#97a28b;font-variant-numeric:tabular-nums;}
|
||||
.ops-chart-point:hover {stroke:#efefd4;stroke-width:2;}
|
||||
.ops-queue-value,.ops-latency-value {font-size:21px;font-variant-numeric:tabular-nums;font-weight:500;letter-spacing:-.5px;color:#ffe135;}
|
||||
.ops-latency-value {color:#b3c5a5;}
|
||||
.ops-footnote {font-size:9px;color:#97a28b;line-height:1.7;margin:16px 0 0;}
|
||||
.ops-bottom {display:grid;grid-template-columns:1.2fr 1fr;gap:18px;margin:18px 0;}
|
||||
.ops-jobs,.ops-events {max-height:390px;overflow:auto;scrollbar-width:thin;scrollbar-color:#494e3f transparent;}
|
||||
.ops-job-heading {display:flex;justify-content:space-between;font-size:9px;color:#97a28b;padding:0 0 12px;border-bottom:1px solid #ffffff0b;}
|
||||
.ops-job {display:flex;align-items:center;gap:10px;padding:14px 0;border-bottom:1px solid #ffffff08;}
|
||||
.ops-job>svg {width:30px;height:30px;color:#899476;background:#ffffff04;padding:6px;border-radius:7px;}
|
||||
.ops-job>div {display:grid;gap:6px;min-width:0;flex:1;}
|
||||
.ops-job strong {font-size:11px;font-weight:450;overflow-wrap:anywhere;}
|
||||
.ops-job small {font-size:9px;color:#97a28b;line-height:1.5;}
|
||||
.ops-job-state {font-size:9px;white-space:nowrap;border-radius:6px;padding:5px 7px;background:#ffffff06;color:#b8bca9;}
|
||||
.ops-job-state.ready {color:#b0c79a;background:#b0c79a0a;}.ops-job-state.failed {color:#d7a18d;background:#d7a18d0a;}.ops-job-state.queued {color:#e4d172;background:#e4d1720a;}
|
||||
.ops-job button {font-size:10px;padding:6px 8px;color:#ffe135;}
|
||||
.ops-events {list-style:none;padding:0;margin:0;}
|
||||
.ops-events li {position:relative;display:grid;grid-template-columns:50px 1fr;gap:5px 10px;padding:0 0 20px 15px;font-size:10px;border-left:1px solid #ffffff0c;margin-left:3px;}
|
||||
.ops-events li::before {content:'';position:absolute;width:5px;height:5px;left:-3px;top:4px;border-radius:50%;background:#737b61;}
|
||||
.ops-events li:first-child::before {background:#ffe135;box-shadow:0 0 0 4px #ffe1350b;}
|
||||
.ops-events time {color:#97a28b;font-size:9px;font-variant-numeric:tabular-nums;}
|
||||
.ops-events strong {font-weight:450;color:#cbd0ba;}
|
||||
.ops-events li>span {grid-column:2;font-size:9px;color:#97a28b;overflow-wrap:anywhere;}
|
||||
.ops-event-dot {height:6px;width:6px;border-radius:50%;background:#b1c69b;}
|
||||
.ops-empty {font-size:11px;line-height:1.7;color:#a2aa91;}
|
||||
.ops-content footer {padding:7px 0 25px;font-size:10px;color:#828e70;}
|
||||
.ops-panel.is-stale .ops-live {color:#dba18e;}.ops-panel.is-stale .ops-live::before {background:#dba18e;}
|
||||
@keyframes ops-served {from{box-shadow:0 0 0 3px #ffe13512;}to{box-shadow:0 0 0 0 #ffe13500;}}
|
||||
@media(min-width:1500px){.ops-services{grid-template-columns:repeat(6,minmax(0,1fr));}.ops-service{grid-template-columns:1fr;}.ops-service>svg{grid-row:auto;}.ops-service-status,.ops-service strong,.ops-service small{grid-column:1;}.ops-api-nodes .ops-service{grid-template-columns:30px 1fr;}.ops-api-nodes .ops-service>svg{grid-row:1/4;}.ops-api-nodes .ops-service-status,.ops-api-nodes .ops-service strong,.ops-api-nodes .ops-service small{grid-column:2;}}
|
||||
@media(max-width:1100px){.ops-shell{grid-template-columns:170px minmax(0,1fr);}.ops-rail{padding:28px 12px 18px;}.ops-content{padding:0 22px;}.ops-bottom{grid-template-columns:1fr;}.ops-flow{gap:10px;}.ops-arrow{flex-basis:20px;}.ops-node{padding:14px;}.ops-services{grid-template-columns:repeat(2,minmax(0,1fr));}.ops-metrics article{padding:18px;}.ops-metrics svg{right:12px;width:20px;}.ops-metrics span{font-size:10px;}}
|
||||
@media(max-width:720px){.ops-shell{display:block;}.ops-rail{position:sticky;top:0;z-index:3;height:auto;padding:9px 12px;border:0;border-bottom:1px solid #ffffff0d;}.ops-brand,.ops-rail-art,.ops-close{display:none!important;}.ops-rail nav{display:flex;gap:4px;margin:0;overflow:auto;scrollbar-width:none;}.ops-rail nav button{padding:10px;font-size:10px;white-space:nowrap;gap:6px;}.ops-rail nav button svg{width:15px;height:15px;}.ops-content{padding:0 14px;}.ops-header{padding:20px 0 15px;gap:12px;}.ops-header h1{font-size:21px;}.ops-live{font-size:9px;}.ops-panel .ops-mobile-close{display:block;padding:6px 12px;font-size:20px;}.ops-panel .ops-refresh{display:none;}.ops-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:4px 0 14px;}.ops-metrics article{padding:16px;gap:11px;}.ops-metrics strong{font-size:30px;}.ops-box{padding:17px;scroll-margin-top:70px;}.ops-section-head{margin-bottom:18px;}.ops-flow{flex-wrap:wrap;gap:10px;}.ops-node{flex-basis:calc(50% - 25px);padding:15px;}.ops-arrow{flex-basis:20px;}.ops-arrow:nth-of-type(4){display:none;}.ops-api-nodes{flex-basis:100%;grid-template-columns:repeat(2,minmax(0,1fr));}.ops-api-nodes .ops-service{display:flex;flex-direction:column;padding:12px;gap:6px;}.ops-api-nodes .ops-service>svg{display:none;}.ops-services{gap:8px;}.ops-service{padding:13px;grid-template-columns:22px 1fr;gap:5px 8px;}.ops-service>svg{width:22px;height:22px;}.ops-service strong{font-size:11px;}.ops-service small{font-size:9px;}.ops-service-status{font-size:8px;}.ops-pipeline{gap:7px;justify-content:flex-start;}.ops-pipeline span{font-size:9px;padding:4px 7px;}.ops-charts{grid-template-columns:1fr;gap:14px;margin-top:14px;scroll-margin-top:70px;}.ops-bottom{gap:14px;margin-top:14px;}.ops-job{flex-wrap:wrap;}.ops-job button{margin-left:auto;}.ops-metrics{scroll-margin-top:70px;}}
|
||||
@media(prefers-reduced-motion:reduce){.ops-panel{scroll-behavior:auto;}.ops-service.served{animation:none;}.ops-panel button,.ops-service{transition:none;}}
|
||||
.ops-arrow i {position:absolute;width:5px;height:5px;border-radius:50%;top:-2px;left:0;background:#ffe135;opacity:0;box-shadow:0 0 7px #ffe13544;}
|
||||
|
||||
@@ -1,33 +1,70 @@
|
||||
let token=null, epoch=0, panel, timer, abort, samples=[];
|
||||
let token=null, epoch=0, panel, timer, abort, samples=[], knownInstances=new Set();
|
||||
const $=selector=>panel.querySelector(selector);
|
||||
const labels={queued:'В очереди',processing:'Обработка',ready:'Готово',failed:'Ошибка'};
|
||||
const eventLabels={accepted:'Файл принят',published:'В очереди RabbitMQ',processing:'Обработчик начал работу',ready:'Результаты сохранены',retry_scheduled:'Назначен повтор',failed:'Ошибка обработки',lease_recovered:'Восстановлено после остановки',operator_replay:'Повторный запуск'};
|
||||
function node(tag,text,cls){const e=document.createElement(tag);if(text!==undefined)e.textContent=text;if(cls)e.className=cls;return e;}
|
||||
export async function operationsSession(value){
|
||||
token=value;epoch++;panel?.close();clearTimeout(timer);abort?.abort();samples=[];
|
||||
token=value;epoch++;panel?.close();clearTimeout(timer);abort?.abort();samples=[];knownInstances.clear();
|
||||
const button=document.getElementById('open-operations');button.hidden=true;
|
||||
const version=epoch;if(!value)return;
|
||||
try {const response=await fetch('/api/ui/operator',{headers:{Authorization:'Bearer '+value},cache:'no-store',signal:AbortSignal.timeout(8000)});const data=await response.json();if(version===epoch)button.hidden=!response.ok||!data.enabled;}catch{}
|
||||
}
|
||||
function icon(name){
|
||||
const svg=document.createElementNS('http://www.w3.org/2000/svg','svg');svg.setAttribute('viewBox','0 0 48 48');svg.setAttribute('aria-hidden','true');
|
||||
const use=document.createElementNS(svg.namespaceURI,'use');use.setAttribute('href','/assets/system-icons.svg#'+name);svg.append(use);return svg;
|
||||
}
|
||||
function init(){
|
||||
panel=node('dialog',undefined,'ops-panel');panel.setAttribute('aria-label','Система мессенджера');
|
||||
panel.innerHTML=`<div class="ops-shell"><header class="ops-header"><a href="#" class="ops-brand">n1k0der<span> / Система</span></a><span class="ops-live">● Обновление каждые 3 с</span><button class="ops-close" type="button">Закрыть ×</button></header>
|
||||
<main>
|
||||
<p class="ops-notice" role="status"></p><section class="ops-metrics" aria-label="Задания"></section>
|
||||
<section class="ops-box ops-architecture"><div class="ops-section-head"><div><h2>Архитектура</h2></div><span class="ops-checked">Проверяем…</span></div><div class="ops-flow"><div class="ops-node"><span>01 / клиент</span><strong>Браузер</strong><small>Сообщения и изображения</small></div><div class="ops-arrow">→</div><div class="ops-node" data-service="proxy"><span>02 / вход</span><strong>HAProxy</strong><small>Запрос прошёл через этот адрес</small></div><div class="ops-arrow">→</div><div class="ops-api-nodes"></div></div><div class="ops-services"></div><div class="ops-pipeline"><span>Загрузка</span><i>→</i><span>PostgreSQL + outbox</span><i>→</i><span>Dispatcher</span><i>→</i><span>RabbitMQ</span><i>→</i><span>Worker</span><i>→</i><span>S3: готовые файлы</span></div><p class="ops-footnote">API, worker и dispatcher: heartbeat. Redis, S3 и RabbitMQ: проверка соединения. HAProxy: доступность текущего адреса, без отдельной проверки процесса.</p></section>
|
||||
<section class="ops-charts"><article class="ops-box"><div class="ops-section-head"><div><h2>Задания в работе</h2></div><strong class="ops-queue-value">0</strong></div><div class="ops-queue-chart"></div><p class="ops-footnote">Ожидающие и выполняющиеся задания · последние 60 замеров.</p></article><article class="ops-box"><div class="ops-section-head"><div><h2>Время проверки системы</h2></div><strong class="ops-latency-value">…</strong></div><div class="ops-latency-chart"></div><p class="ops-footnote">Время запроса с проверкой зависимостей.</p></article></section>
|
||||
<section class="ops-bottom"><article class="ops-box"><div class="ops-section-head"><div><h2>Последние задания</h2></div><button class="ops-refresh" type="button">Обновить</button></div><div class="ops-jobs"></div></article><article class="ops-box"><h2>События</h2><ol class="ops-events"></ol></article></section></main><footer><span class="ops-cycle"></span></footer></div>`;
|
||||
document.body.append(panel);$('.ops-close').onclick=()=>panel.close();$('.ops-brand').onclick=e=>e.preventDefault();$('.ops-refresh').onclick=()=>{clearTimeout(timer);void refresh();};
|
||||
panel.innerHTML=`<div class="ops-shell">
|
||||
<aside class="ops-rail"><a href="#" class="ops-brand">n1k0der<span>Система</span></a>
|
||||
<nav aria-label="Разделы панели"><button data-section="ops-overview" class="is-active">Обзор</button><button data-section="ops-architecture">Архитектура</button><button data-section="ops-charts">Графики</button><button data-section="ops-jobs">Задания</button><button data-section="ops-events">События</button></nav>
|
||||
<div class="ops-rail-art"><img src="/assets/kolovertysh-message-320.webp" width="320" height="242" alt="" loading="lazy" decoding="async"></div>
|
||||
<button class="ops-close" type="button">← В мессенджер</button>
|
||||
</aside><div class="ops-content"><header class="ops-header"><div><h1>Система</h1><span class="ops-checked">Подключение…</span></div><span class="ops-live">Обновление каждые 3 с</span><button class="ops-refresh" type="button" aria-label="Обновить состояние">↻</button><button class="ops-mobile-close" type="button" aria-label="Закрыть панель">×</button></header>
|
||||
<main><p class="ops-notice" role="status"></p><section id="ops-overview" class="ops-metrics" aria-label="Задания"></section>
|
||||
<section id="ops-architecture" class="ops-box ops-architecture"><div class="ops-section-head"><h2>Архитектура</h2><span class="ops-topology-count">API</span></div>
|
||||
<div class="ops-flow"><div class="ops-node" data-icon="browser"><strong>Браузер</strong><small>HTTP / Bearer</small></div><div class="ops-arrow" aria-hidden="true"><i></i></div><div class="ops-node" data-icon="proxy"><strong>HAProxy</strong><small>Балансировка запросов</small></div><div class="ops-arrow" aria-hidden="true"><i></i></div><div class="ops-api-nodes"></div></div>
|
||||
<div class="ops-services"></div><details class="ops-legend"><summary>Как проверяются состояния</summary><p>API: heartbeat Redis. Worker и dispatcher: heartbeat PostgreSQL за последние 10 с. S3 и RabbitMQ: прямой запрос. Ответ панели подтверждает доступность HTTP-входа.</p></details>
|
||||
<div class="ops-pipeline"><span>Файл</span><i>→</i><span>Outbox</span><i>→</i><span>Dispatcher</span><i>→</i><span>RabbitMQ</span><i>→</i><span>Worker</span><i>→</i><span>S3</span></div>
|
||||
</section>
|
||||
<section id="ops-charts" class="ops-charts"><article class="ops-box"><div class="ops-section-head"><h2>Активные задания</h2><strong class="ops-queue-value">0</strong></div><div class="ops-chart-legend"><i></i>В очереди и в обработке</div><div class="ops-queue-chart"></div><p class="ops-footnote">Последние 60 замеров открытой панели</p></article><article class="ops-box"><div class="ops-section-head"><h2>Отклик системы</h2><strong class="ops-latency-value">…</strong></div><div class="ops-chart-legend secondary"><i></i>Запрос с проверкой зависимостей</div><div class="ops-latency-chart"></div><p class="ops-footnote">Миллисекунды · наведите на точку для деталей</p></article></section>
|
||||
<section class="ops-bottom"><article id="ops-jobs" class="ops-box"><div class="ops-section-head"><h2>Последние задания</h2><span class="ops-job-count"></span></div><div class="ops-job-heading"><span>Файл</span><span>Состояние</span></div><div class="ops-jobs"></div></article><article id="ops-events" class="ops-box"><div class="ops-section-head"><h2>События</h2><span class="ops-event-dot" aria-hidden="true"></span></div><ol class="ops-events"></ol></article></section>
|
||||
</main><footer><span class="ops-cycle"></span></footer></div></div>`;
|
||||
document.body.append(panel);$('.ops-close').onclick=()=>panel.close();$('.ops-mobile-close').onclick=()=>panel.close();$('.ops-brand').onclick=e=>e.preventDefault();$('.ops-refresh').onclick=()=>{clearTimeout(timer);void refresh();};
|
||||
const navIcons=['overview','proxy','activity','image','clock'];
|
||||
panel.querySelectorAll('[data-section]').forEach((button,index)=>{button.prepend(icon(navIcons[index]));button.type='button';button.onclick=()=>{
|
||||
panel.querySelectorAll('[data-section]').forEach(b=>b.classList.toggle('is-active',b===button));
|
||||
$('#'+button.dataset.section).scrollIntoView({behavior:matchMedia('(prefers-reduced-motion: reduce)').matches?'instant':'smooth',block:'start'});
|
||||
};});
|
||||
panel.querySelectorAll('[data-icon]').forEach(card=>card.prepend(icon(card.dataset.icon)));
|
||||
panel.addEventListener('close',()=>{clearTimeout(timer);abort?.abort();});
|
||||
}
|
||||
function chart(target,key,color){
|
||||
const host=$(target);host.replaceChildren();const ns='http://www.w3.org/2000/svg';const svg=document.createElementNS(ns,'svg');svg.setAttribute('viewBox','0 0 600 150');svg.setAttribute('role','img');svg.setAttribute('aria-label',samples.length<2?'Ожидаем второй замер':'График последних '+samples.length+' замеров');
|
||||
const values=samples.map(s=>s[key]),max=Math.max(1,...values);for(let i=0;i<4;i++){const line=document.createElementNS(ns,'path');line.setAttribute('d',`M0 ${10+i*40}H600`);line.setAttribute('stroke','#ffffff10');svg.append(line);}
|
||||
const path=document.createElementNS(ns,'polyline');path.setAttribute('points',values.map((v,i)=>`${i*600/Math.max(1,values.length-1)},${135-v/max*120}`).join(' '));path.setAttribute('stroke',color);path.setAttribute('stroke-width','3');path.setAttribute('fill','none');svg.append(path);host.append(svg);
|
||||
const caption=node('div',undefined,'ops-chart-caption');caption.append(node('span',samples.length?new Date(samples[0].at).toLocaleTimeString():'…'),node('span','Макс. '+Math.round(Math.max(0,...values))),node('span',samples.length?new Date(samples.at(-1).at).toLocaleTimeString():'…'));host.append(caption);
|
||||
const host=$(target);host.replaceChildren();const ns='http://www.w3.org/2000/svg';
|
||||
const svg=document.createElementNS(ns,'svg');svg.setAttribute('viewBox','0 0 600 180');svg.setAttribute('role','img');
|
||||
svg.setAttribute('aria-label',samples.length<2?'Ожидаем второй замер':'График последних '+samples.length+' замеров');
|
||||
const values=samples.map(s=>s[key]),max=key==='queue'?Math.max(3,Math.ceil(Math.max(0,...values)/3)*3):Math.max(1,...values),points=values.map((v,i)=>[40+i*550/Math.max(1,values.length-1),145-v/max*125]);
|
||||
function shape(tag,attributes){const item=document.createElementNS(ns,tag);for(const [name,value] of Object.entries(attributes))item.setAttribute(name,value);return item;}
|
||||
const defs=shape('defs',{}),gradient=shape('linearGradient',{id:'ops-gradient-'+key,x1:0,y1:0,x2:0,y2:1});
|
||||
gradient.append(shape('stop',{offset:'0%','stop-color':color,'stop-opacity':'.2'}),shape('stop',{offset:'100%','stop-color':color,'stop-opacity':'0'}));defs.append(gradient);svg.append(defs);
|
||||
for(let i=0;i<4;i++){
|
||||
const y=20+i*125/3;svg.append(shape('path',{d:`M40 ${y}H590`,stroke:'#ffffff0d','stroke-dasharray':'3 5'}));
|
||||
const label=shape('text',{x:0,y:y+4,fill:'#85877e','font-size':10});label.textContent=String(Math.round(max*(1-i/3)));svg.append(label);
|
||||
}
|
||||
if(points.length){
|
||||
const line=points.map(p=>p.join(',')).join(' ');
|
||||
svg.append(shape('polygon',{points:`40,145 ${line} ${points.at(-1)[0]},145`,fill:`url(#ops-gradient-${key})`}));
|
||||
svg.append(shape('polyline',{points:line,stroke:color,'stroke-width':2.5,fill:'none','stroke-linejoin':'round','stroke-linecap':'round'}));
|
||||
for(let i=0;i<points.length;i++){
|
||||
const circle=shape('circle',{cx:points[i][0],cy:points[i][1],r:i===points.length-1?4:7,fill:i===points.length-1?color:'transparent',class:'ops-chart-point'});
|
||||
const title=shape('title',{});title.textContent=`${new Date(samples[i].at).toLocaleTimeString()} · ${values[i]}${key==='latency'?' мс':' заданий'}`;circle.append(title);svg.append(circle);
|
||||
}
|
||||
}
|
||||
host.append(svg);const caption=node('div',undefined,'ops-chart-caption');caption.append(node('span',samples.length?new Date(samples[0].at).toLocaleTimeString():'…'),node('span','Макс. '+Math.round(Math.max(0,...values))),node('span',samples.length?new Date(samples.at(-1).at).toLocaleTimeString():'…'));host.append(caption);
|
||||
}
|
||||
function service(name,up,detail){const card=node('div',undefined,'ops-service');card.dataset.state=up?'up':'down';card.append(node('span',up?'● На связи':'● Нет свежего ответа'),node('strong',name),node('small',detail));return card;}
|
||||
function stale(message){$('.ops-notice').textContent=message;panel.classList.add('is-stale');$('.ops-live').textContent='● Нет свежих данных';for(const item of panel.querySelectorAll('[data-state]'))item.dataset.state='unknown';}
|
||||
const serviceIcons={PostgreSQL:'database',Redis:'cache',S3:'storage',RabbitMQ:'queue',Dispatcher:'dispatcher',Worker:'worker'};
|
||||
function service(name,up,detail){const card=node('div',undefined,'ops-service');card.dataset.state=up?'up':'down';card.append(icon(serviceIcons[name]||'api'),node('span',up?'На связи':'Нет ответа','ops-service-status'),node('strong',name),node('small',detail));return card;}
|
||||
function stale(message){$('.ops-notice').textContent=message;panel.classList.add('is-stale');$('.ops-live').textContent='Нет свежих данных';for(const item of panel.querySelectorAll('[data-state]'))item.dataset.state='unknown';for(const label of panel.querySelectorAll('.ops-service-status'))label.textContent='Нет данных';}
|
||||
async function refresh(){
|
||||
if(!panel?.open||!token)return;if(document.hidden){timer=setTimeout(refresh,3000);return;}
|
||||
if(abort&&!abort.signal.aborted)abort.abort();abort=new AbortController();const version=epoch,session=token,signal=abort.signal;const started=performance.now();
|
||||
@@ -36,15 +73,22 @@ async function refresh(){
|
||||
if(!response.ok)throw new Error(response.status===404?'Нет доступа к управлению системой':response.status===401?'Войдите снова':'Сервер временно не отвечает');const data=await response.json();
|
||||
if(version!==epoch||!panel.open||signal.aborted)return;
|
||||
const elapsed=Math.round(performance.now()-started);samples.push({queue:data.counts.queued+data.counts.processing,latency:elapsed,at:Date.now()});if(samples.length>60)samples.shift();
|
||||
panel.classList.remove('is-stale');$('.ops-live').textContent='● Данные обновлены';$('.ops-notice').textContent='';$('.ops-checked').textContent='Проверено '+new Date(data.checked_at).toLocaleTimeString();
|
||||
$('.ops-metrics').replaceChildren(...Object.entries(labels).map(([key,label])=>{const card=node('article');card.dataset.kind=key;card.append(node('span',label),node('strong',String(data.counts[key])));return card;}));
|
||||
const apis=$('.ops-api-nodes');apis.replaceChildren(...data.instances.filter(n=>n.ready).map(n=>service('API · '+n.id.slice(0,8),true,'Heartbeat · '+new Date(n.last_seen).toLocaleTimeString())));if(!apis.childNodes.length)apis.append(service('API',false,'Нет свежего heartbeat'));
|
||||
panel.classList.remove('is-stale');$('.ops-live').textContent='Данные обновлены';$('.ops-notice').textContent='';
|
||||
if(!matchMedia('(prefers-reduced-motion: reduce)').matches)panel.querySelectorAll('.ops-arrow').forEach((arrow,index)=>arrow.querySelector('i')?.animate([{opacity:0,transform:'translateX(0)'},{opacity:1,offset:.25},{opacity:0,transform:`translateX(${arrow.clientWidth-5}px)`}],{duration:850,delay:index*170,easing:'ease-in-out'}));
|
||||
$('.ops-checked').textContent='Проверено '+new Date(data.checked_at).toLocaleTimeString();
|
||||
$('.ops-metrics').replaceChildren(...Object.entries(labels).map(([key,label])=>{const card=node('article');card.dataset.kind=key;card.append(icon({queued:'clock',processing:'worker',ready:'check',failed:'error'}[key]),node('span',label),node('strong',String(data.counts[key])));return card;}));
|
||||
const apis=$('.ops-api-nodes');data.instances.filter(n=>n.ready).forEach(n=>knownInstances.add(n.id));
|
||||
const instances=data.instances.filter(n=>n.ready||knownInstances.has(n.id));
|
||||
apis.replaceChildren(...instances.map(n=>service('API · '+n.id.slice(0,8),n.ready,'Heartbeat · '+new Date(n.last_seen).toLocaleTimeString())));
|
||||
if(!apis.childNodes.length)apis.append(service('API',false,'Нет свежего heartbeat'));
|
||||
$('.ops-topology-count').textContent=instances.filter(n=>n.ready).length+' API на связи';
|
||||
const current=response.headers.get('X-Instance-Id');for(const card of apis.children)card.classList.toggle('served',card.textContent.includes(current?.slice(0,8)||'never'));
|
||||
const s=data.services;$('.ops-services').replaceChildren(service('PostgreSQL',s.postgres,'Пользователи, чаты, задания'),service('Redis',s.redis,'Кэш и heartbeat API'),service('S3',s.s3,'Оригиналы и варианты'),service('RabbitMQ',s.broker,`Сообщений: ${data.broker_messages??'?'} · подписчиков: ${data.broker_consumers??'?'}`),service('Dispatcher',s.dispatcher,'Доставка outbox в очередь'),service('Worker',s.worker,'Обработка изображений'));
|
||||
$('.ops-queue-value').textContent=String(samples.at(-1).queue);$('.ops-latency-value').textContent=elapsed+' мс';chart('.ops-queue-chart','queue','#ffe135');chart('.ops-latency-chart','latency','#a6cf9a');
|
||||
$('.ops-cycle').textContent=`Outbox: ${data.pending_outbox} · Средний цикл за 15 мин: ${data.average_cycle_seconds===null?'нет завершённых заданий':data.average_cycle_seconds.toFixed(2)+' с'}`;
|
||||
const jobs=$('.ops-jobs');jobs.replaceChildren();if(!data.jobs.length)jobs.append(node('p','Загрузите изображение в чат. Здесь появится его задание.','ops-empty'));
|
||||
for(const job of data.jobs){const row=node('div',undefined,'ops-job');const info=node('div');info.append(node('strong',job.filename),node('small',`${labels[job.state]} · попыток ${job.attempts}${job.error_code?' · '+job.error_code:''}`));row.append(info);if(job.can_replay){const button=node('button','Повторить');button.type='button';button.onclick=()=>replay(job.attachment_id,button);row.append(button);}jobs.append(row);}
|
||||
$('.ops-job-count').textContent='Последние '+data.jobs.length;
|
||||
const jobs=$('.ops-jobs');const jobSignature=JSON.stringify(data.jobs);if(jobs.dataset.signature!==jobSignature){jobs.dataset.signature=jobSignature;jobs.replaceChildren();if(!data.jobs.length)jobs.append(node('p','Загрузите изображение в чат. Здесь появится его задание.','ops-empty'));
|
||||
for(const job of data.jobs){const row=node('div',undefined,'ops-job');const info=node('div');info.append(node('strong',job.filename),node('small',`${labels[job.state]} · попыток ${job.attempts}${job.error_code?' · '+job.error_code:''}`));info.querySelector('small').textContent=`Попыток: ${job.attempts}${job.error_code?' · '+job.error_code:''}`;row.append(icon('image'),info,node('span',labels[job.state],'ops-job-state '+job.state));if(job.can_replay){const button=node('button','Повторить');button.type='button';button.onclick=()=>replay(job.attachment_id,button);row.append(button);}jobs.append(row);}}
|
||||
const list=$('.ops-events');list.replaceChildren();for(const event of data.events){const item=node('li');item.append(node('time',new Date(event.at).toLocaleTimeString()),node('strong',eventLabels[event.name]||event.name),node('span',event.filename));list.append(item);}if(!data.events.length)list.append(node('li','Событий пока нет'));
|
||||
}catch(error){if(version===epoch&&panel.open&&!signal.aborted)stale(error.message);}finally{if(version===epoch&&panel?.open){clearTimeout(timer);timer=setTimeout(refresh,3000);}}
|
||||
}
|
||||
|
||||