отправка данных для mapping с агентом
This commit is contained in:
@@ -114,6 +114,20 @@
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||
}
|
||||
|
||||
function mappingApplyTransportSummary(result) {
|
||||
const chunksTotal = Number(result?.batch_chunks_total || 0);
|
||||
const chunksApplied = Number(result?.batch_chunks_applied || 0);
|
||||
const retries = Number(result?.batch_retries || 0);
|
||||
const fallback = Number(result?.fallback_commands || 0);
|
||||
const inputs = Number(result?.input_groups || 0);
|
||||
const parts = [];
|
||||
if (inputs) parts.push(`Input: ${inputs}`);
|
||||
if (chunksTotal) parts.push(`пакетов ${chunksApplied}/${chunksTotal}`);
|
||||
if (retries) parts.push(`повторов ${retries}`);
|
||||
if (fallback) parts.push(`одиночных ${fallback}`);
|
||||
return parts.length ? ` · ${parts.join(" · ")}` : "";
|
||||
}
|
||||
|
||||
function mappingTransferReport(result, action = "Mapping перенесён") {
|
||||
const report = result?.report || {};
|
||||
const mapped = Number(report.mapped || 0);
|
||||
@@ -2846,7 +2860,7 @@
|
||||
if (!commands.length) return setStatus("У текущего Input нет настроенных связей с доступными данными.", true), renderMapping();
|
||||
try {
|
||||
const result = await request("/api/hockey/admin/vmix-mapping/test-batch", { method: "POST", body: JSON.stringify({ device_id: deviceId, commands }) });
|
||||
const tail = `${missing.length ? ` · нет данных ${missing.length}` : ""}${result.errors?.length ? ` · ошибок ${result.errors.length}` : ""}`;
|
||||
const tail = `${missing.length ? ` · нет данных ${missing.length}` : ""}${result.errors?.length ? ` · ошибок ${result.errors.length}` : ""}${mappingApplyTransportSummary(result)}`;
|
||||
setStatus(`Input ${input?.number ? `#${input.number} ` : ""}${input?.title || ""}: отправлено ${Number(result.applied || 0)} из ${Number(result.total || commands.length)} полей${tail}.`, Boolean(result.errors?.length));
|
||||
} catch (error) { setStatus(error.message, true); }
|
||||
renderMapping();
|
||||
@@ -2886,8 +2900,8 @@
|
||||
if (!deviceId) return setStatus("Выберите online Agent для применения Mapping.", true), renderMapping();
|
||||
try {
|
||||
const result = await request(`/api/hockey/admin/vmix-mapping/apply/${encodeURIComponent(deviceId)}`, { method: "POST" });
|
||||
const suffix = result.errors?.length ? ` · ошибок ${result.errors.length}` : "";
|
||||
setStatus(`Mapping применён: ${Number(result.applied || 0)} из ${Number(result.total || 0)} связей${suffix}.`);
|
||||
const suffix = `${result.errors?.length ? ` · ошибок ${result.errors.length}` : ""}${mappingApplyTransportSummary(result)}`;
|
||||
setStatus(`Mapping применён: ${Number(result.applied || 0)} из ${Number(result.total || 0)} связей${suffix}.`, Boolean(result.errors?.length));
|
||||
} catch (error) { setStatus(error.message, true); }
|
||||
renderMapping();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user