Skip to content

Commit 3d717e7

Browse files
Render benefit % and actionable fix in all warning surfaces (#247)
Web viewer warnings strip was dropping both MaxBenefitPercent and ActionableFix — data made it through ResultMapper into the JSON but the strip only rendered Severity/Type/Message. Joe caught this on v1.7.0 (wait stat benefit missing from the rendered warning). While in the area, closed the same ActionableFix gap in the other surfaces that already render benefit: - Web viewer (Index.razor + app.css): add .warn-benefit badge + .warning-fix italic block. Sort strip by benefit desc, then severity, then type to match HTML export / Avalonia ordering. - HtmlExporter: append .warn-fix block after .warn-msg, style added. - PlanViewerControl (Avalonia): italic TextBlock under the message when ActionableFix is present. - TextFormatter: indented "Fix:" line after each warning. Version bump 1.7.0 -> 1.7.1. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d37ecac commit 3d717e7

6 files changed

Lines changed: 50 additions & 2 deletions

File tree

src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,18 @@ private void ShowPropertiesPanel(PlanNode node)
17541754
TextWrapping = TextWrapping.Wrap,
17551755
Margin = new Thickness(16, 0, 0, 0)
17561756
});
1757+
if (!string.IsNullOrEmpty(w.ActionableFix))
1758+
{
1759+
warnPanel.Children.Add(new TextBlock
1760+
{
1761+
Text = w.ActionableFix,
1762+
FontSize = 11,
1763+
FontStyle = FontStyle.Italic,
1764+
Foreground = TooltipFgBrush,
1765+
TextWrapping = TextWrapping.Wrap,
1766+
Margin = new Thickness(16, 2, 0, 0)
1767+
});
1768+
}
17571769
planWarningsPanel.Children.Add(warnPanel);
17581770
}
17591771

src/PlanViewer.App/PlanViewer.App.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ApplicationManifest>app.manifest</ApplicationManifest>
77
<ApplicationIcon>EDD.ico</ApplicationIcon>
88
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
9-
<Version>1.7.0</Version>
9+
<Version>1.7.1</Version>
1010
<Authors>Erik Darling</Authors>
1111
<Company>Darling Data LLC</Company>
1212
<Product>Performance Studio</Product>

src/PlanViewer.Core/Output/HtmlExporter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ .card h3 {
187187
.warn-type { font-size: 0.75rem; font-weight: 600; }
188188
.warn-benefit { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); padding: 0.05rem 0.3rem; border-radius: 3px; background: rgba(0,0,0,0.04); }
189189
.warn-msg { font-size: 0.8rem; color: var(--text); flex-basis: 100%; }
190+
.warn-fix { font-size: 0.75rem; color: var(--text-secondary); font-style: italic; flex-basis: 100%; border-left: 2px solid var(--border); padding-left: 0.5rem; margin-top: 0.15rem; }
190191
191192
/* Query text */
192193
details { margin-bottom: 0.75rem; }
@@ -459,6 +460,8 @@ private static void WriteWarnings(StringBuilder sb, StatementResult stmt)
459460
if (w.MaxBenefitPercent.HasValue)
460461
sb.AppendLine($"<span class=\"warn-benefit\">up to {w.MaxBenefitPercent:N0}% benefit</span>");
461462
sb.AppendLine($"<span class=\"warn-msg\">{Encode(w.Message)}</span>");
463+
if (!string.IsNullOrEmpty(w.ActionableFix))
464+
sb.AppendLine($"<span class=\"warn-fix\">{Encode(w.ActionableFix)}</span>");
462465
sb.AppendLine("</div>");
463466
}
464467
sb.AppendLine("</div>");

src/PlanViewer.Core/Output/TextFormatter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ public static void WriteText(AnalysisResult result, TextWriter writer)
172172
? $" (up to {w.MaxBenefitPercent:N0}% benefit)"
173173
: "";
174174
writer.WriteLine($" [{w.Severity}] {w.Type}{benefitTag}: {EscapeNewlines(w.Message)}");
175+
if (!string.IsNullOrEmpty(w.ActionableFix))
176+
writer.WriteLine($" Fix: {EscapeNewlines(w.ActionableFix)}");
175177
}
176178
}
177179

src/PlanViewer.Web/Pages/Index.razor

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ else
332332
@if (infoCount > 0) { <span class="warn-count-badge info">@infoCount</span> }
333333
</h4>
334334
<div class="warnings-list">
335-
@foreach (var w in GetAllWarnings(ActiveStmt!))
335+
@foreach (var w in GetAllWarnings(ActiveStmt!)
336+
.OrderByDescending(x => x.MaxBenefitPercent ?? -1)
337+
.ThenByDescending(x => x.Severity == "Critical" ? 3 : x.Severity == "Warning" ? 2 : 1)
338+
.ThenBy(x => x.Type))
336339
{
337340
<div class="warning @w.Severity.ToLower()">
338341
<span class="severity">@w.Severity</span>
@@ -341,7 +344,15 @@ else
341344
<span class="warning-op">@w.Operator</span>
342345
}
343346
<span class="warning-type">@w.Type</span>
347+
@if (w.MaxBenefitPercent.HasValue)
348+
{
349+
<span class="warn-benefit">up to @w.MaxBenefitPercent.Value.ToString("N0")% benefit</span>
350+
}
344351
<span class="warning-msg">@w.Message</span>
352+
@if (!string.IsNullOrEmpty(w.ActionableFix))
353+
{
354+
<span class="warning-fix">@w.ActionableFix</span>
355+
}
345356
</div>
346357
}
347358
</div>

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,26 @@ textarea::placeholder {
807807
font-size: 0.75rem;
808808
}
809809

810+
.warn-benefit {
811+
font-size: 0.7rem;
812+
font-weight: 600;
813+
color: var(--text-muted);
814+
padding: 0.05rem 0.35rem;
815+
border-radius: 3px;
816+
background: rgba(0, 0, 0, 0.05);
817+
margin-right: 0.4rem;
818+
}
819+
820+
.warning-fix {
821+
color: var(--text-secondary);
822+
display: block;
823+
margin-top: 0.25rem;
824+
font-size: 0.75rem;
825+
font-style: italic;
826+
border-left: 2px solid var(--border);
827+
padding-left: 0.5rem;
828+
}
829+
810830
/* === Query Text === */
811831
.stmt-text-section {
812832
margin-bottom: 0.75rem;

0 commit comments

Comments
 (0)