Skip to content

Commit 9b8252e

Browse files
Collapsible Wait Stats section (#215 E12) (#271)
Wait Stats card now uses <details>/<summary> and defaults to closed so it doesn't push improvement items below the fold on 1080p monitors. - Web viewer (Index.razor): insight-card switches to <details> element. app.css styles .insight-card > summary the same as h4, hides the native disclosure marker, and shows ▸ / ▾ chevrons tied to the [open] attribute. - HTML export (HtmlExporter.cs): same pattern on the .card.waits card. Keeps the chart as a complementary view (Joe's earlier preference) — just out of the way by default. Click the header to expand. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 40ade29 commit 9b8252e

3 files changed

Lines changed: 34 additions & 11 deletions

File tree

‎src/PlanViewer.Core/Output/HtmlExporter.cs‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,15 @@ .statement h2 {
109109
/* Insights grid */
110110
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
111111
.card { border-radius: 6px; border: 1px solid var(--border); overflow: hidden; }
112-
.card h3 {
112+
.card h3, .card > summary {
113113
padding: 0.4rem 0.75rem; font-size: 0.8rem; font-weight: 500;
114114
border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem;
115+
list-style: none; cursor: pointer;
115116
}
117+
.card > summary::-webkit-details-marker { display: none; }
118+
.card > summary::before { content: ""\25B8""; font-size: 0.7rem; color: var(--text-muted); width: 0.7rem; }
119+
details.card[open] > summary::before { content: ""\25BE""; }
120+
.card.waits summary { color: #2a4365; }
116121
.card-body { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
117122
.card.runtime { background: var(--card-runtime); border-color: var(--card-runtime-border); }
118123
.card.runtime h3 { color: #2c5282; }
@@ -432,11 +437,12 @@ private static void WriteParametersCard(StringBuilder sb, StatementResult stmt)
432437

433438
private static void WriteWaitStatsCard(StringBuilder sb, StatementResult stmt, bool hasActualStats)
434439
{
435-
sb.AppendLine("<div class=\"card waits\">");
436-
sb.Append("<h3>Wait Stats");
440+
// Collapsible (#215 E12): default-closed so improvement items aren't pushed below the fold.
441+
sb.AppendLine("<details class=\"card waits\">");
442+
sb.Append("<summary>Wait Stats");
437443
if (stmt.WaitStats.Count > 0)
438444
sb.Append($" <span class=\"card-count\">{stmt.WaitStats.Sum(w => w.WaitTimeMs):N0} ms</span>");
439-
sb.AppendLine("</h3>");
445+
sb.AppendLine("</summary>");
440446
sb.AppendLine("<div class=\"card-body\">");
441447
if (stmt.WaitStats.Count > 0)
442448
{
@@ -464,7 +470,7 @@ private static void WriteWaitStatsCard(StringBuilder sb, StatementResult stmt, b
464470
sb.AppendLine($"<div class=\"card-empty\">{(hasActualStats ? "No waits recorded" : "Estimated plan — no wait stats")}</div>");
465471
}
466472
sb.AppendLine("</div>");
467-
sb.AppendLine("</div>");
473+
sb.AppendLine("</details>");
468474
}
469475

470476
private static void WriteWarnings(StringBuilder sb, StatementResult stmt)

‎src/PlanViewer.Web/Pages/Index.razor‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ else
299299
</div>
300300
</div>
301301

302-
@* Wait Stats *@
303-
<div class="insight-card waits @(ActiveStmt!.WaitStats.Count > 0 ? "has-items" : "")">
304-
<h4>Wait Stats
302+
@* Wait Stats — collapsible (#215 E12): default-closed so it doesn't push improvement items below the fold *@
303+
<details class="insight-card waits @(ActiveStmt!.WaitStats.Count > 0 ? "has-items" : "")">
304+
<summary>Wait Stats
305305
@if (ActiveStmt!.WaitStats.Count > 0)
306306
{
307307
<span class="insight-count">@ActiveStmt!.WaitStats.Sum(w => w.WaitTimeMs).ToString("N0") ms</span>
308308
}
309-
</h4>
309+
</summary>
310310
<div class="insight-body">
311311
@if (ActiveStmt!.WaitStats.Count > 0)
312312
{
@@ -336,7 +336,7 @@ else
336336
<div class="insight-empty">@(result.Summary.HasActualStats ? "No waits recorded" : "Estimated plan — no wait stats")</div>
337337
}
338338
</div>
339-
</div>
339+
</details>
340340
</div>
341341

342342
@* Warnings strip *@

‎src/PlanViewer.Web/wwwroot/css/app.css‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,16 +541,33 @@ textarea::placeholder {
541541
overflow: hidden;
542542
}
543543

544-
.insight-card h4 {
544+
.insight-card h4,
545+
.insight-card > summary {
545546
padding: 0.4rem 0.75rem;
546547
font-size: 0.8rem;
547548
font-weight: 500;
548549
border-bottom: 1px solid var(--border);
549550
display: flex;
550551
align-items: center;
551552
gap: 0.5rem;
553+
list-style: none;
554+
cursor: pointer;
555+
}
556+
557+
.insight-card > summary::-webkit-details-marker { display: none; }
558+
559+
.insight-card > summary::before {
560+
content: "\25B8";
561+
font-size: 0.7rem;
562+
color: var(--text-muted);
563+
transition: transform 0.15s ease;
564+
width: 0.7rem;
552565
}
553566

567+
.insight-card[open] > summary::before { content: "\25BE"; }
568+
569+
details.insight-card:not([open]) { border-bottom: 1px solid var(--border); }
570+
554571
.insight-body {
555572
padding: 0.5rem 0.75rem;
556573
font-size: 0.8rem;

0 commit comments

Comments
 (0)