тест 10

This commit is contained in:
2026-08-24 18:49:48 +03:00
parent 10a65e4d47
commit 9ab53ac8d5
4 changed files with 82 additions and 10 deletions

View File

@@ -2205,13 +2205,22 @@
const profiles = state.mappingProfiles?.profiles || [];
const profile = state.mappingActiveProfile;
const usableDevices = devices.filter((item) => item.project_fingerprint);
const deviceRows = devices.length ? devices.map((item) => `
const deviceRows = devices.length ? devices.map((item) => {
const agentVersion = String(item.agent_version || "").trim();
const tooOldForMapping = Boolean(agentVersion && item.mapping_supported === false);
const mappingState = tooOldForMapping
? `<b style="color:#f59e0b">Agent ${escapeHtml(agentVersion)} слишком старый для Mapping · нужен 1.3.0+</b>`
: (item.mapping
? `Mapping: <b>${escapeHtml(item.mapping.name)}</b> · v${Number(item.mapping.version || 1)}`
: (item.project_fingerprint ? "Mapping не назначен" : "Ожидание структуры vMix"));
return `
<article class="hockey-mapping-device ${item.online ? "is-online" : ""}">
<div><strong>${escapeHtml(item.name || item.device_id)}</strong><code>${escapeHtml(item.device_id)}</code></div>
<span>${item.vmix_connected ? "vMix подключён" : "vMix не найден"}</span>
<span>${item.vmix_connected ? "vMix подключён" : "vMix не найден"}${agentVersion ? ` · Agent ${escapeHtml(agentVersion)}` : ""}</span>
<span>${Number(item.input_count || 0)} Inputs · ${Number(item.field_count || 0)} полей</span>
<span>${item.mapping ? `Mapping: <b>${escapeHtml(item.mapping.name)}</b> · v${Number(item.mapping.version || 1)}` : (item.project_fingerprint ? "Mapping не назначен" : "Ожидание структуры vMix")}</span>
</article>`).join("") : `<div class="hockey-directory-empty">Agent пока не передал структуру ни одного vMix.</div>`;
<span>${mappingState}</span>
</article>`;
}).join("") : `<div class="hockey-directory-empty">Agent пока не передал структуру ни одного vMix.</div>`;
const selectedDeviceId = String(localStorage.getItem("hockey.vmix.selected_device") || "").trim();
const selectedDevice = devices.find((item) => String(item.device_id || "") === selectedDeviceId) || null;
@@ -2242,7 +2251,14 @@
editor = `<div class="hockey-directory-empty">Выберите профиль слева или создайте новый из подключённого vMix.</div>`;
} else {
const currentInput = mappingCurrentInput(profile);
const matchingDevices = devices.filter((item) => item.project_fingerprint && item.project_fingerprint === profile.project_fingerprint && item.online && item.vmix_connected);
const profileId = Number(profile.id || 0);
const matchingDevices = devices.filter((item) => {
if (!item.online || !item.vmix_connected || item.mapping_supported === false) return false;
const exactFingerprint = Boolean(item.project_fingerprint && item.project_fingerprint === profile.project_fingerprint);
const resolvedProfileId = Number(item.mapping?.source_profile_id || item.mapping?.id || 0);
return exactFingerprint || (profileId > 0 && resolvedProfileId === profileId);
});
const onlineOldAgents = devices.filter((item) => item.online && item.vmix_connected && item.mapping_supported === false);
if (!state.mappingTestDeviceId || !matchingDevices.some((item) => item.device_id === state.mappingTestDeviceId)) state.mappingTestDeviceId = matchingDevices[0]?.device_id || "";
const catalog = mappingDataCatalog();
const gameReady = Boolean(catalog.game && (catalog.game.external_id || catalog.game.id));
@@ -2260,7 +2276,7 @@
</div>
<div class="hockey-map-livebar ${gameReady ? "is-ready" : ""}">
<div><span>${gameReady ? "● ЖИВОЙ ПРИМЕР" : "○ НЕТ ТЕСТОВОГО МАТЧА"}</span><strong>${escapeHtml(catalog.gameLabel)}</strong><small>${gameReady ? "Значения получены через SQL Data Sources из PostgreSQL." : "Выберите матч; системный context game_id заполнится автоматически."}</small></div>
<label>Тестовый Agent<select data-map-test-device><option value="">— нет подходящего online Agent —</option>${matchingDevices.map((item) => `<option value="${escapeHtml(item.device_id)}" ${item.device_id === state.mappingTestDeviceId ? "selected" : ""}>${escapeHtml(item.name || item.device_id)}</option>`).join("")}</select></label>
<label>Тестовый Agent<select data-map-test-device><option value="">${onlineOldAgents.length ? `— Agent ${escapeHtml(onlineOldAgents[0].agent_version || "")} слишком старый, нужен 1.3.0+ —` : "— нет подходящего online Agent —"}</option>${matchingDevices.map((item) => `<option value="${escapeHtml(item.device_id)}" ${item.device_id === state.mappingTestDeviceId ? "selected" : ""}>${escapeHtml(item.name || item.device_id)}${item.agent_version ? ` · v${escapeHtml(item.agent_version)}` : ""}</option>`).join("")}</select></label>
</div>
<div class="hockey-map-visual-workspace">
${mappingDataBrowser(profile, currentInput)}