Skip to content
Merged
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
14 changes: 8 additions & 6 deletions src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ private async void Fetch_Click(object? sender, RoutedEventArgs e)

try
{
// Load slicer data first — LoadData sets a default 24h selection and
// fires RangeChanged which triggers FetchPlansForRangeAsync.
await LoadTimeSlicerDataAsync(orderBy, ct);
// Load slicer data, preserving the current selection if one exists.
// Without this, LoadData defaults to last 24h and the user's range is lost.
await LoadTimeSlicerDataAsync(orderBy, ct, _slicerStartUtc, _slicerEndUtc);
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -195,7 +195,7 @@ private async System.Threading.Tasks.Task FetchPlansForRangeAsync()
try
{
var plans = await QueryStoreService.FetchTopPlansAsync(
_connectionString, topN, orderBy, ct: ct,
_connectionString, topN, orderBy, filter: filter, ct: ct,
startUtc: _slicerStartUtc, endUtc: _slicerEndUtc);

GridLoadingOverlay.IsVisible = false;
Expand Down Expand Up @@ -363,15 +363,17 @@ private void ClearSearch_Click(object? sender, RoutedEventArgs e)
SearchValueBox.Text = "";
}

private async System.Threading.Tasks.Task LoadTimeSlicerDataAsync(string metric, CancellationToken ct)
private async System.Threading.Tasks.Task LoadTimeSlicerDataAsync(
string metric, CancellationToken ct,
DateTime? preserveStart = null, DateTime? preserveEnd = null)
{
try
{
var sliceData = await QueryStoreService.FetchTimeSliceDataAsync(
_connectionString, metric, _slicerDaysBack, ct);
if (ct.IsCancellationRequested) return;
if (sliceData.Count > 0)
TimeRangeSlicer.LoadData(sliceData, metric);
TimeRangeSlicer.LoadData(sliceData, metric, preserveStart, preserveEnd);
else
StatusText.Text = "No time-slicer data available.";
}
Expand Down
Loading