Skip to content

Commit a8ed5ff

Browse files
MDA2AVclaude
andcommitted
Replace summary badges with ranked bar chart
TechEmpower-style horizontal bars sorted best to worst, with rank number, server name, bar, score, and percentage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3413d80 commit a8ed5ff

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

docs/static/probe/render.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,32 @@ window.ProbeRender = (function () {
4141
var pb = sb.passed / (sb.scored || sb.total || 1);
4242
return pb - pa || a.name.localeCompare(b.name);
4343
});
44-
var html = '<div style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;">';
45-
sorted.forEach(function (sv) {
44+
var maxScored = sorted[0] ? (sorted[0].summary.scored || sorted[0].summary.total) : 1;
45+
var topPassed = sorted[0] ? sorted[0].summary.passed : 1;
46+
47+
var html = '<div style="display:flex;flex-direction:column;gap:6px;max-width:700px;">';
48+
sorted.forEach(function (sv, i) {
4649
var s = sv.summary;
4750
var scored = s.scored || s.total;
48-
var pct = Math.round((s.passed / scored) * 100);
49-
var bg = pct >= 85 ? '#1a7f37' : pct >= 60 ? '#9a6700' : pct >= 20 ? '#cf222e' : '#82071e';
50-
html += '<div style="background:' + bg + ';color:#fff;border-radius:6px;padding:6px 12px;text-align:center;line-height:1.3;">';
51-
html += '<div style="font-weight:700;font-size:12px;">' + sv.name + '</div>';
52-
html += '<div style="font-size:16px;font-weight:800;">' + s.passed + '/' + scored + '</div>';
51+
var pct = s.passed / scored;
52+
var barPct = (s.passed / topPassed) * 100;
53+
var displayPct = Math.round(pct * 100);
54+
var bg = pct >= 0.85 ? '#1a7f37' : pct >= 0.6 ? '#9a6700' : pct >= 0.2 ? '#cf222e' : '#82071e';
55+
var rank = i + 1;
56+
57+
html += '<div style="display:flex;align-items:center;gap:10px;">';
58+
html += '<div style="min-width:24px;text-align:right;font-size:13px;font-weight:600;color:#656d76;">' + rank + '</div>';
59+
html += '<div style="min-width:110px;font-size:13px;font-weight:600;white-space:nowrap;">' + sv.name + '</div>';
60+
html += '<div style="flex:1;height:22px;background:#f0f0f0;border-radius:3px;overflow:hidden;position:relative;">';
61+
html += '<div style="height:100%;width:' + barPct + '%;background:' + bg + ';border-radius:3px;transition:width 0.3s;"></div>';
62+
html += '</div>';
63+
html += '<div style="min-width:72px;text-align:right;font-size:13px;font-weight:700;">' + s.passed + '/' + scored + '</div>';
64+
html += '<div style="min-width:40px;text-align:right;font-size:12px;color:#656d76;">' + displayPct + '%</div>';
5365
html += '</div>';
5466
});
5567
html += '</div>';
5668
if (data.commit) {
57-
html += '<p style="margin-top:8px;font-size:0.85em;color:#656d76;">Commit: <code>' + data.commit.id.substring(0, 7) + '</code> &mdash; ' + (data.commit.message || '') + '</p>';
69+
html += '<p style="margin-top:12px;font-size:0.85em;color:#656d76;">Commit: <code>' + data.commit.id.substring(0, 7) + '</code> &mdash; ' + (data.commit.message || '') + '</p>';
5870
}
5971
el.innerHTML = html;
6072
}

0 commit comments

Comments
 (0)