Skip to content

Add time display picker (Local/UTC/Server) and parameterize SQL#120

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/time-display-picker
Mar 20, 2026
Merged

Add time display picker (Local/UTC/Server) and parameterize SQL#120
erikdarlingdata merged 1 commit into
devfrom
feature/time-display-picker

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

@erikdarlingdata erikdarlingdata commented Mar 20, 2026

Summary

  • Time display picker on Query Store toolbar: switch between Local, UTC, and Server time
  • All timestamps update live across the grid, time-range slicer, and history drill-down window
  • Server UTC offset fetched on connect (DATEDIFF(MINUTE, GETUTCDATE(), GETDATE()))
  • Parameterized hoursBack and daysBack in QueryStoreService SQL (previously string-interpolated)

Test plan

  • Build: 0 errors
  • Switch time modes — grid, slicer labels, and slicer X-axis all update
  • History drill-down chart and grid respect the selected mode
  • Server mode shows correct offset from UTC
  • No crash on QS tab open (IsInitialized guard)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added time display mode selector allowing users to view query execution times in Local, UTC, or Server time zones.
  • Improvements

    • Enhanced time formatting consistency across query result displays and history charts.

- Time display ComboBox on QS grid toolbar: Local, UTC, Server modes
- TimeDisplayHelper shared across grid, slicer, and history window
- Server UTC offset fetched on connect via DATEDIFF(MINUTE, GETUTCDATE(), GETDATE())
- All timestamps update live when switching modes
- Parameterized hoursBack and daysBack in QueryStoreService SQL queries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 21c2b7a into dev Mar 20, 2026
2 of 3 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f8056b8f-80a1-41eb-b6a9-1b7a971ac730

📥 Commits

Reviewing files that changed from the base of the PR and between 94b36cc and 8699104.

📒 Files selected for processing (8)
  • src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs
  • src/PlanViewer.App/Controls/QueryStoreGridControl.axaml
  • src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
  • src/PlanViewer.App/Controls/TimeRangeSlicerControl.axaml.cs
  • src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml.cs
  • src/PlanViewer.Core/Models/QueryStoreHistoryRow.cs
  • src/PlanViewer.Core/Services/QueryStoreService.cs
  • src/PlanViewer.Core/Services/TimeDisplayHelper.cs

📝 Walkthrough

Walkthrough

The PR introduces a time display mode selector allowing users to view timestamps in Local, UTC, or Server time zones. A new TimeDisplayHelper service centralizes timestamp conversion and formatting logic. A UI dropdown is added to QueryStoreGridControl, server UTC offset is fetched upon connection, and multiple display locations are updated to use the helper instead of inline conversions.

Changes

Cohort / File(s) Summary
Time Display Helper & Core Service
src/PlanViewer.Core/Services/TimeDisplayHelper.cs, src/PlanViewer.Core/Services/QueryStoreService.cs
New TimeDisplayHelper utility class with TimeDisplayMode enum and methods for converting/formatting timestamps. SQL queries in QueryStoreService updated to use parameterized queries for @hoursBack and @daysBack instead of string interpolation.
UI Time Display Selection
src/PlanViewer.App/Controls/QueryStoreGridControl.axaml, src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
Added ComboBox dropdown ("Time display" toolbar) with Local/UTC/Server options. Handler refreshes grid, notifies rows of display mode change, and redraws time range slicer. QueryStoreRow.LastExecutedLocal now uses helper formatting; added NotifyTimeDisplayChanged() method.
Server Offset Fetching
src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs
New FetchServerUtcOffset() method executes SELECT DATEDIFF(MINUTE, GETUTCDATE(), GETDATE()) on successful connection and assigns result to TimeDisplayHelper.ServerUtcOffsetMinutes.
Time Display Conversions in Views
src/PlanViewer.Core/Models/QueryStoreHistoryRow.cs, src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml.cs
Replaced inline ToLocalTime() formatting with TimeDisplayHelper.FormatForDisplay() and ConvertForDisplay() calls for consistency.
Slicer Control Updates
src/PlanViewer.App/Controls/TimeRangeSlicerControl.axaml.cs
Changed Redraw() visibility from private to public. Updated chart X-axis labels and selection range text to use TimeDisplayHelper.ConvertForDisplay() instead of direct ToLocalTime().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add Query Store history drill-down with multi-plan charting #98: Modifies the same time-display conversion logic in QueryStoreHistoryWindow and QueryStoreHistoryRow, directly related to this PR's refactoring of inline time conversions.
  • Feature/query store timeslicer #114: Touches QueryStoreGridControl and TimeRangeSlicerControl time-slicer integration; this PR adjusts parameterization in QueryStoreService.FetchTimeSliceDataAsync potentially introduced by that PR.
  • v1.2.0 Release #100: Modifies QuerySessionControl and introduces time-display infrastructure in the same QueryStore/UI flow as this PR.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/time-display-picker
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@erikdarlingdata erikdarlingdata mentioned this pull request Mar 20, 2026
@erikdarlingdata erikdarlingdata deleted the feature/time-display-picker branch April 19, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant