я косяк, поправил веб. Капитан, работайте!
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -72,11 +72,36 @@
|
||||
|
||||
function load(root, enterpriseId) {
|
||||
root.innerHTML = '<p class="text-muted small">Загрузка конфликтов…</p>';
|
||||
const orch = global.__WESP_ORCH__ || {};
|
||||
if (orch.configured === false) {
|
||||
root.innerHTML =
|
||||
'<p class="text-muted small">Orchestrator не настроен. Укажите upstream, hub_site_id и api_key в админке.</p>';
|
||||
return;
|
||||
}
|
||||
if (orch.reachable === false) {
|
||||
const host = orch.upstream ? ` (${orch.upstream})` : "";
|
||||
root.innerHTML =
|
||||
`<p class="text-warning small">Orchestrator недоступен${escapeHtml(host)}. Проверьте upstream URL и что сервис запущен.</p>`;
|
||||
return;
|
||||
}
|
||||
fetch(`${API}?enterprise_id=${encodeURIComponent(enterpriseId)}`)
|
||||
.then((r) => r.json())
|
||||
.then((items) => renderList(root, items || [], enterpriseId))
|
||||
.catch(() => {
|
||||
root.innerHTML = '<p class="text-danger small">Не удалось загрузить конфликты.</p>';
|
||||
.then((r) => {
|
||||
if (!r.ok) {
|
||||
return r.json().catch(() => ({})).then((body) => {
|
||||
throw new Error(body.message || `HTTP ${r.status}`);
|
||||
});
|
||||
}
|
||||
return r.json();
|
||||
})
|
||||
.then((items) => {
|
||||
if (items && items.error) {
|
||||
throw new Error(items.message || "Orchestrator error");
|
||||
}
|
||||
renderList(root, Array.isArray(items) ? items : [], enterpriseId);
|
||||
})
|
||||
.catch((err) => {
|
||||
const msg = err && err.message ? err.message : "Не удалось загрузить конфликты.";
|
||||
root.innerHTML = `<p class="text-danger small">${escapeHtml(msg)}</p>`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user