diff --git a/main.js b/main.js index c247acd..7939127 100644 --- a/main.js +++ b/main.js @@ -431,93 +431,19 @@ function getUserUuid() { return uuid; } -// Multi-run progress polling -async function pollSuiteStatus(suiteId, totalRuns) { - const pollInterval = setInterval(async () => { - try { - const response = await fetch(`/api/suite-status/${suiteId}`); - const suite = await response.json(); - - // Update progress - const progress = (suite.completed_runs / suite.run_count) * 100; - document.getElementById('progress-fill').style.width = `${progress}%`; - document.getElementById('progress-text').textContent = - `Run ${suite.completed_runs} of ${suite.run_count} completed...`; - - // Check if complete - if (suite.status === 'completed') { - clearInterval(pollInterval); - document.getElementById('progress-text').textContent = 'Calculating statistics...'; - - // Display multi-run results - displayMultiRunResults(suite); - document.getElementById('multi-run-progress').style.display = 'none'; - } else if (suite.status === 'failed') { - clearInterval(pollInterval); - throw new Error('Some test runs failed'); - } - } catch (error) { - clearInterval(pollInterval); - console.error('Polling error:', error); - document.getElementById('error-msg').textContent = 'Error tracking progress: ' + error.message; - document.getElementById('error-msg').style.display = 'block'; - document.getElementById('multi-run-progress').style.display = 'none'; - } - }, 2000); // Poll every 2 seconds + +// ============================================================================ +// Identity Management +// ============================================================================ +function getUserUuid() { + let uuid = localStorage.getItem('user-uuid'); + if (!uuid) { + uuid = 'user_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9); + localStorage.setItem('user-uuid', uuid); + } + return uuid; } -function displayMultiRunResults(suite) { - // Show statistics summary - const statsHtml = ` -
-
-
${suite.median_performance_score?.toFixed(0) || 'N/A'}
-
Median Performance
-
-
-
${suite.avg_performance_score?.toFixed(0) || 'N/A'}
-
Average Performance
-
-
-
±${suite.stddev_performance_score?.toFixed(1) || 'N/A'}
-
Std Deviation
-
-
- -

Individual Runs

-
- - - - - - - - - - - - - ${suite.runs?.map(run => ` - - - - - - - - - `).join('') || ''} - -
RunPerformanceLCP (ms)CLSTBT (ms)Actions
#${run.run_number} ${run.is_median ? '⭐ Median' : ''}---- - View Details -
No run data available
-
- `; - - document.getElementById('results-area').innerHTML = statsHtml; - document.getElementById('results-area').style.display = 'block'; -} function getUserUuid() { let uuid = localStorage.getItem('user_uuid');