Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lite/Controls/FinOpsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
AlternatingRowBackground="{DynamicResource DataGridAlternatingRowBrush}">
<DataGrid.Columns>
<DataGridTextColumn Header="Category" Binding="{Binding Category}" MinWidth="120" Width="Auto"/>
<DataGridTextColumn Header="Severity" Binding="{Binding Severity}" MinWidth="80" Width="Auto">
<DataGridTextColumn Header="Severity" Binding="{Binding Severity}" MinWidth="80" Width="Auto" SortMemberPath="SeveritySort">
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SortMemberPath="SeveritySort" here makes header-click sort match initial order — good. Note the same column exists in Dashboard at Dashboard/Controls/FinOpsContent.xaml:93 without a SortMemberPath, so the Dashboard FinOps Recommendations tab still has the original #872 bug (alphabetical: High, Low, Medium).


Generated by Claude Code

<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Style.Triggers>
Expand Down
9 changes: 8 additions & 1 deletion Lite/Services/LocalDataService.FinOps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2176,7 +2176,7 @@ FROM cpu_utilization_stats
AppLogger.Error("FinOps", $"Recommendation check failed (Reserved capacity): {ex.Message}");
}

return recommendations;
return recommendations.OrderBy(r => r.SeveritySort).ToList();
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a tiebreaker within the same severity, e.g. .OrderBy(r => r.SeveritySort).ThenByDescending(r => r.EstMonthlySavings ?? 0m). Without it, within-severity order is insertion order (category/scan order), which is incidental and not user-meaningful. Low priority — the primary fix is what #872 asked for.


Generated by Claude Code

}

private static string FormatDuration(long seconds)
Expand Down Expand Up @@ -2578,6 +2578,13 @@ public class RecommendationRow
public string Detail { get; set; } = "";
public decimal? EstMonthlySavings { get; set; }
public string EstMonthlySavingsDisplay => EstMonthlySavings.HasValue ? $"${EstMonthlySavings.Value:N0}" : "";
public int SeveritySort => Severity switch
{
"High" => 1,
"Medium" => 2,
"Low" => 3,
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _ => 4 fallback silently sinks any unexpected severity string (typo, case mismatch, future value) to the bottom with no signal. All known call sites set "High"/"Medium"/"Low" literally, so it's not a live bug, but if a new severity is ever introduced it will be sorted wrong without any compile-time help. Converting Severity to an enum would make the switch exhaustive; not a blocker for this PR.


Generated by Claude Code

_ => 4
};
}

/// <summary>
Expand Down
Loading