Upload 6 files
Browse files- web/static/app.js +1 -1
- web/static/runs.js +16 -4
web/static/app.js
CHANGED
|
@@ -73,7 +73,7 @@ function artifactUrl(runId,bucketSource){if(!runId||!bucketSource)return'';retur
|
|
| 73 |
function normalizeLinks(links={}){const out={...links};const bucket=out.bucket_source||state.bucketSource;const run=out.run_id||state.runId;if(!out.artifacts_url&&bucket&&run)out.artifacts_url=artifactUrl(run,bucket);if(!out.job_url){const jobId=out.job_id||out.jobId;const owner=out.job_owner||out.owner||out.username||state.user?.username;if(jobId&&owner)out.job_url=`https://huggingface.co/jobs/${owner}/${jobId}`;}return out}
|
| 74 |
function setQuickLinks(links={}){links=normalizeLinks(links||{});state.activeLinks=links;setLink('openJob',links.job_url);setLink('openSpace',links.target_space_url);setLink('openSettings',links.target_space_settings_url||links.target_space_url&&links.target_space_url+'/settings');setLink('openArtifacts',links.artifacts_url);setLink('manualOpenSettings',links.target_space_settings_url||links.target_space_url&&links.target_space_url+'/settings');renderManualAction({links})}
|
| 75 |
function setBuildModeNew(){const panel=$('buildModePanel');if(panel){panel.classList.remove('inspecting');panel.innerHTML='<strong>Preparing a new build</strong><p>This form always starts a fresh private Space build. Selecting a run in Live progress only changes the progress and detail panels.</p>'}setText('progressTitle','Live job progress');setText('progressStatus','Idle')}
|
| 76 |
-
function setBuildModeInspecting(runId){const panel=$('buildModePanel');if(panel){panel.classList.add('inspecting');panel.innerHTML=`<strong>Inspecting selected run</strong><p>You are viewing run <code>${escapeHtml(runId||'')}</code>. The build form is unchanged. Open
|
| 77 |
function resetRunDetails(){
|
| 78 |
for(const [id,value] of [['detailRunId','—'],['detailJobStatus','—'],['detailGateStatus','—'],['detailSpace','—'],['detailHardware','—'],['detailTraces','—'],['homeRunDetailStatus','No run']])setText(id,value);
|
| 79 |
setQuickLinks({});
|
|
|
|
| 73 |
function normalizeLinks(links={}){const out={...links};const bucket=out.bucket_source||state.bucketSource;const run=out.run_id||state.runId;if(!out.artifacts_url&&bucket&&run)out.artifacts_url=artifactUrl(run,bucket);if(!out.job_url){const jobId=out.job_id||out.jobId;const owner=out.job_owner||out.owner||out.username||state.user?.username;if(jobId&&owner)out.job_url=`https://huggingface.co/jobs/${owner}/${jobId}`;}return out}
|
| 74 |
function setQuickLinks(links={}){links=normalizeLinks(links||{});state.activeLinks=links;setLink('openJob',links.job_url);setLink('openSpace',links.target_space_url);setLink('openSettings',links.target_space_settings_url||links.target_space_url&&links.target_space_url+'/settings');setLink('openArtifacts',links.artifacts_url);setLink('manualOpenSettings',links.target_space_settings_url||links.target_space_url&&links.target_space_url+'/settings');renderManualAction({links})}
|
| 75 |
function setBuildModeNew(){const panel=$('buildModePanel');if(panel){panel.classList.remove('inspecting');panel.innerHTML='<strong>Preparing a new build</strong><p>This form always starts a fresh private Space build. Selecting a run in Live progress only changes the progress and detail panels.</p>'}setText('progressTitle','Live job progress');setText('progressStatus','Idle')}
|
| 76 |
+
function setBuildModeInspecting(runId){const panel=$('buildModePanel');if(panel){panel.classList.add('inspecting');panel.innerHTML=`<strong>Inspecting selected run</strong><p>You are viewing run <code>${escapeHtml(runId||'')}</code>. The build form is unchanged. Open New Build and click “Prepare new build” to clear the run context.</p>`}}
|
| 77 |
function resetRunDetails(){
|
| 78 |
for(const [id,value] of [['detailRunId','—'],['detailJobStatus','—'],['detailGateStatus','—'],['detailSpace','—'],['detailHardware','—'],['detailTraces','—'],['homeRunDetailStatus','No run']])setText(id,value);
|
| 79 |
setQuickLinks({});
|
web/static/runs.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
| 1 |
function statusClass(status){status=String(status||'unknown');if(status.includes('success'))return'success';if(status.includes('manual'))return'warn';if(status.includes('blocker')||status.includes('failed'))return'error';if(status.includes('running')||status==='RUNNING')return'running';return''}
|
| 2 |
function shortText(value,max=42){value=String(value||'—');return value.length>max?value.slice(0,max-1)+'…':value}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
function runMatchesStatus(run,status){
|
| 4 |
const s=String(run.status||'unknown').toLowerCase();
|
| 5 |
if(!status||status==='all')return true;
|
|
@@ -36,10 +46,12 @@ function renderRunStats(){
|
|
| 36 |
});
|
| 37 |
}
|
| 38 |
function renderSelectedLinks(summary={}){
|
| 39 |
-
const
|
| 40 |
-
const
|
|
|
|
| 41 |
const artifacts=summary.artifacts_url||(typeof artifactUrl==='function'?artifactUrl(runId,bucket):'');
|
| 42 |
-
|
|
|
|
| 43 |
setLink('selectedOpenSpace',summary.target_space_url);
|
| 44 |
setLink('selectedOpenSettings',summary.target_space_url?summary.target_space_url+'/settings':'');
|
| 45 |
setLink('selectedOpenArtifacts',artifacts);
|
|
@@ -114,7 +126,7 @@ function renderRunDetail(detail){
|
|
| 114 |
const artifactRoot=document.getElementById('artifactList');if(artifactRoot){const interesting=files.filter(f=>!/traces\//.test(f.path||'')).slice(0,18);artifactRoot.innerHTML=interesting.length?interesting.map(f=>`<a href="${f.url}" target="_blank"><span>${f.path}</span><em>${f.size?Math.round(Number(f.size)/1024)+' KB':''}</em></a>`).join(''):'No artifacts indexed yet.'}
|
| 115 |
const reportText=(detail.report||'No report available.').slice(0,5000);const report=document.getElementById('reportPreview');if(report)report.textContent=reportText;
|
| 116 |
const homeReport=document.getElementById('homeReportPreview');if(homeReport){const firstLine=reportText.split('\n').find(Boolean)||'No report available yet.';homeReport.innerHTML=`<span class="status-dot ${statusClass(summary.status)==='error'?'amber-dot':'green'}"></span><strong>${escapeHtml((detail.inference_gate||{}).status||summary.status||'Run selected')}</strong><p>${escapeHtml(shortText(firstLine,180))}</p>`}
|
| 117 |
-
setQuickLinks({job_url:summary
|
| 118 |
renderSelectedLinks({...summary,bucket_source:detail.bucket_source});renderBlockers(detail);
|
| 119 |
const homeBtn=document.getElementById('homeValidateBtn');if(homeBtn){homeBtn.disabled=!summary.target_space;homeBtn.onclick=prepareValidationFromActiveRun}
|
| 120 |
}
|
|
|
|
| 1 |
function statusClass(status){status=String(status||'unknown');if(status.includes('success'))return'success';if(status.includes('manual'))return'warn';if(status.includes('blocker')||status.includes('failed'))return'error';if(status.includes('running')||status==='RUNNING')return'running';return''}
|
| 2 |
function shortText(value,max=42){value=String(value||'—');return value.length>max?value.slice(0,max-1)+'…':value}
|
| 3 |
+
|
| 4 |
+
function inferredJobUrl(summary={}, detail={}){
|
| 5 |
+
if(summary.job_url)return summary.job_url;
|
| 6 |
+
const launch=detail.launch||{};
|
| 7 |
+
if(launch.job_url)return launch.job_url;
|
| 8 |
+
const jobId=summary.job_id||launch.job_id||detail.state?.job_id;
|
| 9 |
+
const owner=launch.created_by||detail.state?.created_by||state.user?.username;
|
| 10 |
+
return jobId&&owner?`https://huggingface.co/jobs/${owner}/${jobId}`:'';
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
function runMatchesStatus(run,status){
|
| 14 |
const s=String(run.status||'unknown').toLowerCase();
|
| 15 |
if(!status||status==='all')return true;
|
|
|
|
| 46 |
});
|
| 47 |
}
|
| 48 |
function renderSelectedLinks(summary={}){
|
| 49 |
+
const detail=state.selectedRunDetail||{};
|
| 50 |
+
const runId=summary.run_id||detail.run_id;
|
| 51 |
+
const bucket=summary.bucket_source||detail.bucket_source||state.bucketSource;
|
| 52 |
const artifacts=summary.artifacts_url||(typeof artifactUrl==='function'?artifactUrl(runId,bucket):'');
|
| 53 |
+
const jobUrl=inferredJobUrl(summary,detail);
|
| 54 |
+
setLink('selectedOpenJob',jobUrl);
|
| 55 |
setLink('selectedOpenSpace',summary.target_space_url);
|
| 56 |
setLink('selectedOpenSettings',summary.target_space_url?summary.target_space_url+'/settings':'');
|
| 57 |
setLink('selectedOpenArtifacts',artifacts);
|
|
|
|
| 126 |
const artifactRoot=document.getElementById('artifactList');if(artifactRoot){const interesting=files.filter(f=>!/traces\//.test(f.path||'')).slice(0,18);artifactRoot.innerHTML=interesting.length?interesting.map(f=>`<a href="${f.url}" target="_blank"><span>${f.path}</span><em>${f.size?Math.round(Number(f.size)/1024)+' KB':''}</em></a>`).join(''):'No artifacts indexed yet.'}
|
| 127 |
const reportText=(detail.report||'No report available.').slice(0,5000);const report=document.getElementById('reportPreview');if(report)report.textContent=reportText;
|
| 128 |
const homeReport=document.getElementById('homeReportPreview');if(homeReport){const firstLine=reportText.split('\n').find(Boolean)||'No report available yet.';homeReport.innerHTML=`<span class="status-dot ${statusClass(summary.status)==='error'?'amber-dot':'green'}"></span><strong>${escapeHtml((detail.inference_gate||{}).status||summary.status||'Run selected')}</strong><p>${escapeHtml(shortText(firstLine,180))}</p>`}
|
| 129 |
+
setQuickLinks({job_url:inferredJobUrl(summary,detail),target_space_url:summary.target_space_url,target_space_settings_url:summary.target_space_url?summary.target_space_url+'/settings':'',artifacts_url:summary.artifacts_url,bucket_source:detail.bucket_source,run_id:summary.run_id||detail.run_id});
|
| 130 |
renderSelectedLinks({...summary,bucket_source:detail.bucket_source});renderBlockers(detail);
|
| 131 |
const homeBtn=document.getElementById('homeValidateBtn');if(homeBtn){homeBtn.disabled=!summary.target_space;homeBtn.onclick=prepareValidationFromActiveRun}
|
| 132 |
}
|