Dashboard Masticationpedia: differenze tra le versioni
Nessun oggetto della modifica |
Nessun oggetto della modifica |
||
| Riga 7: | Riga 7: | ||
<button class="dashboard-toggle" onclick="toggleDashboardBox('api-settings')">⚙️ Connessione API</button> | <button class="dashboard-toggle" onclick="toggleDashboardBox('api-settings')">⚙️ Connessione API</button> | ||
<button class="dashboard-toggle" onclick="toggleDashboardBox('project-status')">📊 Stato Progetti</button> | <button class="dashboard-toggle" onclick="toggleDashboardBox('project-status')">📊 Stato Progetti</button> | ||
<button class="dashboard-toggle" | <button class="dashboard-toggle" onclick="toggleDashboardBox('chatgpt-plus')">🤖 ChatGPT plus</button> | ||
<button class="dashboard-toggle" onclick="toggleDashboardBox('test-tools')">🧪 Strumenti di Test</button> | <button class="dashboard-toggle" onclick="toggleDashboardBox('test-tools')">🧪 Strumenti di Test</button> | ||
<button class="dashboard-toggle" onclick="toggleDashboardBox('activity-log')">📘 Registro Attività</button> | <button class="dashboard-toggle" onclick="toggleDashboardBox('activity-log')">📘 Registro Attività</button> | ||
<button class="dashboard-toggle" onclick="uploadToOpenAI()">📄 Carica in OpenAI</button> | <button class="dashboard-toggle" onclick="uploadToOpenAI()">📄 Carica in OpenAI</button> | ||
</div> | </div> | ||
<!-- 📦 Connessione API (via server, nessuna key lato client) --> | <!-- 📦 Connessione API (via server, nessuna key lato client) --> | ||
| Riga 33: | Riga 30: | ||
<pre id="api-result" style="background:#f0f0f0; padding:1rem; border:1px solid #ccc; margin-top:1rem; white-space:pre-wrap;"></pre> | <pre id="api-result" style="background:#f0f0f0; padding:1rem; border:1px solid #ccc; margin-top:1rem; white-space:pre-wrap;"></pre> | ||
</div> | </div> | ||
<!-- 📊 Stato Progetti --> | <!-- 📊 Stato Progetti --> | ||
| Riga 52: | Riga 47: | ||
<thead> | <thead> | ||
<tr style="background:#eaeaea;"> | <tr style="background:#eaeaea;"> | ||
<th>🧱 Modulo</th><th>📊 Stato</th><th>🗓️ Data</th><th>🔍 Note</th><th>🗑️</th> | |||
</tr> | </tr> | ||
</thead> | </thead> | ||
| Riga 112: | Riga 107: | ||
<div id="mpChatAnswer" style="min-height:220px; border:1px solid #ddd; background:#fff; border-radius:8px; padding:10px; white-space:pre-wrap;"></div> | <div id="mpChatAnswer" style="min-height:220px; border:1px solid #ddd; background:#fff; border-radius:8px; padding:10px; white-space:pre-wrap;"></div> | ||
<!-- Explorer semplice dei file salvati --> | <!-- Explorer semplice dei file salvati --> | ||
<div style="margin-top:10px; border-top:1px dashed #ddd; padding-top:10px;"> | <div style="margin-top:10px; border-top:1px dashed #ddd; padding-top:10px;"> | ||
<div style="display:flex; align-items:center; gap:8px; margin-bottom:6px;"> | |||
<strong>🗂️ File salvati (output/)</strong> | |||
<button id="mpChatRefresh" title="Aggiorna elenco">Aggiorna</button> | |||
</div> | |||
<div id="mpSavedList" style="max-height:180px; overflow:auto; border:1px solid #eee; background:#fff; border-radius:8px; padding:6px; font-family:monospace; font-size:12px;"> | |||
<em style="color:#777;">Nessun file elencato. Clicca “Aggiorna”.</em> | |||
</div> | |||
</div> | </div> | ||
<!-- Azioni --> | <!-- Azioni --> | ||
| Riga 132: | Riga 125: | ||
</div> | </div> | ||
</div> | </div> | ||
<!-- 📁 Importa file dal server (semplificata) --> | <!-- 📁 Importa file dal server (semplificata) --> | ||
| Riga 144: | Riga 136: | ||
</div> | </div> | ||
</div> | </div> | ||
<!-- 📁 Caricamento File GPT --> | <!-- 📁 Caricamento File GPT --> | ||
| Riga 196: | Riga 163: | ||
</div> | </div> | ||
<!-- ✅ Carica | <!-- ✅ Carica JS esterno (se lo usi) --> | ||
<script src="/dashboard/api/dashboard.js?v=20250907a"></script> | <script src="/dashboard/api/dashboard.js?v=20250907a"></script> | ||
<!-- Mini-script | <!-- ✅ Mini-script che POPOLA l’elenco e gestisce “Apri” --> | ||
<script> | <script> | ||
// | document.addEventListener('DOMContentLoaded', () => { | ||
const refreshBtn = document.getElementById('mpChatRefresh'); | |||
const listBox = document.getElementById('mpSavedList'); | |||
const answerBox = document.getElementById('mpChatAnswer'); | |||
const projectSel = document.getElementById('mpChatProject'); | |||
function currentProject(){ | |||
return (projectSel?.value || 'Generazione_capitoli').trim(); | |||
} | |||
async function refreshList(){ | |||
if (!listBox) return; | |||
listBox.innerHTML = '<em style="color:#777;">Aggiorno…</em>'; | |||
const prj = currentProject(); | |||
try { | |||
const r = await fetch('/dashboard/api/list_saved_output.php?project=' + encodeURIComponent(prj) + '&sub=output', { cache:'no-store' }); | |||
const txt = await r.text(); | |||
let j; | |||
try { j = JSON.parse(txt); } | |||
catch(e){ | |||
listBox.innerHTML = '<span style="color:#c00;">Risposta non-JSON</span><pre style="white-space:pre-wrap">'+txt.substring(0,400)+'</pre>'; | |||
console.error('list_saved_output NON JSON:', txt); | |||
return; | |||
} | |||
if (!j.ok) { listBox.textContent = 'Errore: ' + (j.error || ''); return; } | |||
if (!j.files || !j.files.length) { listBox.innerHTML = '<em style="color:#777;">Nessun file salvato.</em>'; return; } | |||
listBox.innerHTML = j.files.map(f => ` | |||
<div style="display:flex;justify-content:space-between;gap:8px;border-bottom:1px dashed #eee;padding:4px 0;"> | |||
<span>${f.name} <span style="color:#888;">(${f.size} B)</span></span> | |||
<button class="mpOpen" data-name="${f.name}">Apri</button> | |||
</div> | |||
`).join(''); | |||
listBox.querySelectorAll('.mpOpen').forEach(btn => { | |||
btn.addEventListener('click', async () => { | |||
const name = btn.getAttribute('data-name'); | |||
try { | |||
const rr = await fetch('/dashboard/api/read_saved_output.php', { | |||
method:'POST', | |||
headers:{'Content-Type':'application/json'}, | |||
body: JSON.stringify({ project: prj, file: name }) | |||
}); | |||
const jj = await rr.json(); | |||
if (!jj.ok) { alert('Errore lettura: ' + (jj.error||'')); return; } | |||
if (answerBox) answerBox.textContent = jj.content || ''; | |||
} catch (e) { | |||
alert('Errore apertura file: ' + e.message); | |||
} | |||
}); | |||
}); | |||
} catch (e) { | |||
listBox.textContent = 'Errore JS: ' + e.message; | |||
console.error(e); | |||
} | |||
} | |||
refreshBtn && refreshBtn.addEventListener('click', refreshList); | |||
// carica subito l'elenco alla prima apertura | |||
refreshList(); | |||
}); | |||
</script> | </script> | ||
</html> | </html> | ||
Versione delle 10:27, 7 set 2025
🔧 Dashboard Operativa – Masticationpedia
Centro di comando per progetti, API, file e backup