[PRISM] Restore Matrix compatibility tab in current studio UI

This commit is contained in:
root committed 2026-11-23 16:43:28 +03:00
1 parent eaf4264ebb
commit 75672ead73
1 file changed
+48
+48
View File
@@ -53,6 +53,7 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v
<button class="nav" data-v="materials">Материалы</button>
<button class="nav" data-v="quality">Качество</button>
<button class="nav" data-v="heat">Покрытие</button>
<button class="nav" data-v="matrix">Матрица</button>
<button class="nav" data-v="inbox">Разбор</button>
<button class="nav" data-v="archive">Архив</button>
</nav>
@@ -136,6 +137,18 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v
</div>
</section>
<section id="v-matrix" class="view">
<div class="card">
<h3>Матрица совместимости</h3>
<div class="muted" style="margin-bottom:10px">Строки — хосты, столбцы — аксессуары. Значение показывает поддержку; точные порты — в карточке.</div>
<div class="bar">
<input id="mq" type="search" placeholder="Фильтр по хосту или аксессуару…" oninput="renderMatrix()">
<span id="matrixcount" class="muted tiny"></span>
</div>
<div id="matrixbox" style="overflow:auto;max-height:65vh"><span class="muted">загрузка…</span></div>
</div>
</section>
<section id="v-inbox" class="view">
<div class="card">
<h3>Разбор LLM-извлечения</h3>
@@ -175,6 +188,7 @@ const dl=v=>DL[v]||v||'—', cl=v=>CL[v]||String(v||'—').replace(/\./g,' · ')
const $ = s => document.querySelector(s);
const esc = s => String(s ?? '').replace(/[<>&"]/g, c => ({'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c]));
const api = async p => { const r = await fetch(p); return r.json(); };
let MATRIX = null;
const post = async (p, b) => (await fetch(p,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(b)})).json();
function setView(v){
@@ -186,6 +200,7 @@ function setView(v){
if(v==='materials') loadMaterials();
if(v==='quality') loadCoverage();
if(v==='heat') loadHeat();
if(v==='matrix') loadMatrix();
if(v==='inbox') loadInbox();
if(v==='archive') loadArchive();
if(v==='room') loadRoomOptions();
@@ -240,6 +255,39 @@ async function drawHeat(){
if(!pickup&&!fov) notes.push('Недостаточно подтверждённых specs — карта условная.');
$('#heatnote').innerHTML=notes.map(esc).join(' · ');
}
async function loadMatrix(){
const box = $('#matrixbox');
if(!MATRIX){
box.innerHTML = '<span class="muted">загрузка…</span>';
MATRIX = await api('/api/matrix');
}
renderMatrix();
}
function renderMatrix(){
if(!MATRIX) return;
const f = ($('#mq')?.value || '').toLowerCase().trim();
const accs = (MATRIX.accessories || []).filter(a => a.toLowerCase().includes(f));
const rows = (MATRIX.rows || []).filter(r => r.host.toLowerCase().includes(f));
const rowsBy = {};
rows.forEach(r => rowsBy[r.host] = r);
let h = '<table class="bom" style="font-size:11px"><thead><tr><th>Хост</th><th>in</th><th>out</th>';
accs.forEach(a => h += `<th style="writing-mode:vertical-rl;transform:rotate(180deg);height:110px">${esc(a).slice(0,28)}</th>`);
h += '</tr></thead><tbody>';
rows.forEach(r => {
h += `<tr><td><b>${esc(r.host)}</b></td><td class="muted">${esc((r.ports?.in || []).join(', '))}</td><td class="muted">${esc((r.ports?.out || []).join(', '))}</td>`;
const cells = r.cells || {};
accs.forEach(a => {
const k = a.toLowerCase().replace(/[^a-z0-9]/g, '');
const v = cells[k];
h += `<td style="text-align:center;color:${v ? '#43d17a' : '#30363d'}" title="${esc(a)}">${v ? (v > 1 ? v : '✓') : '·'}</td>`;
});
h += '</tr>';
});
h += '</tbody></table>';
$('#matrixbox').innerHTML = h;
$('#matrixcount').textContent = `${rows.length} хостов × ${accs.length} аксессуаров`;
}
async function loadInbox(){
$('#inboxbox').innerHTML='<span class="muted">загрузка…</span>';
const r=await api('/api/staging'); const xs=r.items||[]; const es=r.edges||[];