debug: add step-by-step diagnostic banner to analysis tab
Adds a visible orange banner that updates at each step of loadAnalysis (fetch → got data → renderAnalysis called → complete / error). This definitively shows whether the view is reached and where it fails. Remove after root cause is confirmed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
407f8a6b46
commit
1b5e6d6868
1 changed files with 9 additions and 0 deletions
|
|
@ -303,6 +303,7 @@
|
|||
</div>
|
||||
</div><!-- end view-dashboard -->
|
||||
<div data-view="analysis" id="view-analysis" style="display:none">
|
||||
<div id="a-dbg" style="display:none;background:var(--coral);color:#fff;padding:10px 16px;border-radius:12px;margin-bottom:12px;font-size:.78rem;font-family:'Geist Mono',monospace"></div>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:14px">
|
||||
<span style="font-size:.7rem;color:var(--text3)" id="a-asof-top"></span>
|
||||
<button class="ibtn" id="a-refresh-btn" onclick="forceRefreshAnalysis()" style="font-size:.72rem;padding:5px 12px;border-radius:9px;border:1px solid var(--border2)">↻ Refresh</button>
|
||||
|
|
@ -874,19 +875,27 @@ async function loadAnalysis(){
|
|||
var tbody=document.getElementById('a-class-body');
|
||||
var rBody=document.getElementById('a-risk-body');
|
||||
var sBody=document.getElementById('a-scen-body');
|
||||
var dbg=document.getElementById('a-dbg');
|
||||
function dbgSet(msg){if(dbg){dbg.textContent=msg;dbg.style.display='block';}}
|
||||
dbgSet('Step 1: loadAnalysis called, fetching /api/analysis…');
|
||||
if(tbody)tbody.innerHTML='<tr><td colspan="8" style="text-align:center;padding:36px;color:var(--text3)">Loading analysis…</td></tr>';
|
||||
if(rBody)rBody.innerHTML='<div style="color:var(--text3);font-size:.8rem;padding:14px 20px">Loading…</div>';
|
||||
if(sBody)sBody.innerHTML='<div style="color:var(--text3);font-size:.8rem;padding:14px 20px">Loading…</div>';
|
||||
try{
|
||||
var res=await fetch('/api/analysis').then(function(r){return r.json();});
|
||||
dbgSet('Step 2: fetch OK — ok='+res.ok+' hasData='+(!!res.data)+' classified='+(res.data&&res.data.classified?res.data.classified.length:'n/a'));
|
||||
if(!res||!res.ok||!res.data){
|
||||
dbgSet('Step 2b: no data — res.ok='+res.ok+' res.data='+JSON.stringify(res.data).slice(0,60));
|
||||
if(tbody)tbody.innerHTML='<tr><td colspan="8" style="text-align:center;padding:36px;color:var(--text3)">No analysis data yet — click ↻ Refresh above to trigger a poll</td></tr>';
|
||||
if(rBody)rBody.innerHTML='<div style="color:var(--text3);font-size:.8rem;padding:14px 20px">No data yet</div>';
|
||||
if(sBody)sBody.innerHTML='<div style="color:var(--text3);font-size:.8rem;padding:14px 20px">No data yet</div>';
|
||||
return;
|
||||
}
|
||||
dbgSet('Step 3: calling renderAnalysis with '+res.data.classified.length+' positions…');
|
||||
renderAnalysis(res.data,res.asOf);
|
||||
dbgSet('Step 4: renderAnalysis complete — '+res.data.classified.length+' positions rendered. Risk='+res.data.risk.riskLevel);
|
||||
}catch(e){
|
||||
dbgSet('ERROR: '+(e&&e.message?e.message:String(e)));
|
||||
console.error('loadAnalysis:',e);
|
||||
if(tbody)tbody.innerHTML='<tr><td colspan="8" style="text-align:center;padding:36px;color:var(--red)">Error: '+(e&&e.message?e.message:String(e))+'</td></tr>';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue