Dashboard performance/UX changes#55
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Dashboard to improve perceived performance and UX by loading the incident timeline and response time trends asynchronously via HTMX, and includes a small query optimization in CheckQueryService.
Changes:
- Add a lightweight
GetDashboardMessageAsyncquery to avoid fetching full workspace details just to render the dashboard message. - Optimize timeline/trends aggregation by pre-grouping results by
CheckIdto avoid repeated filtering. - Split dashboard chart loading into HTMX partial handlers (
Timeline/Trends) and update chart partials to support a loading state.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SAMA.Web/Services/Queries/WorkspaceQueryService.cs | Adds a focused query to fetch only the dashboard message. |
| SAMA.Web/Services/Queries/CheckQueryService.cs | Uses a Lookup to reduce repeated Where filtering when aggregating results. |
| SAMA.Web/Pages/Dashboard/Index.cshtml.cs | Splits chart loading into separate HTMX handlers and loads dashboard message via new query. |
| SAMA.Web/Pages/Dashboard/Index.cshtml | Switches charts to initial “loading” models and triggers HTMX fetches on load/interval. |
| SAMA.Web/Pages/Dashboard/_ResponseTimeTrendsChart.cshtml | Adds loading/no-data behavior and initializes chart on OOB swaps. |
| SAMA.Web/Pages/Dashboard/_IncidentTimelineChart.cshtml | Adds loading behavior and initializes chart on OOB swaps. |
| SAMA.Tests.Unit/Web/Pages/Dashboard/IndexModelTests.cs | Updates mocks for the new dashboard message query and adds handler tests for partial endpoints. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the Dashboard to improve perceived performance/UX by decoupling chart rendering from the main page load and reducing some repeated in-memory filtering in check timeline/trend queries.
Changes:
- Added a targeted workspace query to fetch only the dashboard message.
- Updated dashboard to load Incident Timeline and Response Time Trends via HTMX handlers/partials (with OOB JSON swaps) instead of in the main page model.
- Optimized check result processing by grouping results per check (
ToLookup) to reduce repeated filtering.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| SAMA.Web/Services/Queries/WorkspaceQueryService.cs | Adds GetDashboardMessageAsync to fetch only the dashboard message field. |
| SAMA.Web/Services/Queries/CheckQueryService.cs | Uses ToLookup to group results by check for timeline/trend processing. |
| SAMA.Web/Pages/Dashboard/Index.cshtml.cs | Splits dashboard into main page + two HTMX handlers returning partials for timeline/trends. |
| SAMA.Web/Pages/Dashboard/Index.cshtml | Updates markup to render placeholder chart shells and trigger HTMX refreshes. |
| SAMA.Web/Pages/Dashboard/_ResponseTimeTrendsChart.cshtml | Adjusts loading/no-data behavior and relies on OOB JSON swap events to (re)initialize charts. |
| SAMA.Web/Pages/Dashboard/_IncidentTimelineChart.cshtml | Same as trends: loading/no-data behavior + OOB JSON swap-driven chart init/update. |
| SAMA.Tests.Unit/Web/Pages/Dashboard/IndexModelTests.cs | Updates mocks and adds unit coverage for the new timeline/trends handlers. |
There was a problem hiding this comment.
Pull request overview
This PR improves the Dashboard’s perceived performance and refresh behavior by splitting expensive chart data loading into separate HTMX endpoints and reducing repeated in-memory scanning in query logic.
Changes:
- Added a lightweight
GetDashboardMessageAsyncquery to avoid loading full workspace details just to render the dashboard message. - Optimized dashboard query computations by grouping check results via
ToLookupto avoid repeated filtering over the full results set. - Changed the Dashboard page to load incident timeline and response time trends via dedicated HTMX handlers that return OOB-updated JSON script tags; added unit tests for the new handlers.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SAMA.Web/Services/Queries/WorkspaceQueryService.cs | Adds a focused query for dashboard message retrieval. |
| SAMA.Web/Services/Queries/CheckQueryService.cs | Improves timeline/trends computations by indexing results per check ID. |
| SAMA.Web/Pages/Dashboard/Index.cshtml.cs | Adds OnGetTimelineAsync / OnGetTrendsAsync handlers and uses lightweight dashboard message query. |
| SAMA.Web/Pages/Dashboard/Index.cshtml | Updates page to render chart shells and fetch chart data via HTMX polling/OOB swaps. |
| SAMA.Web/Pages/Dashboard/_IncidentTimelineChart.cshtml | Adjusts initialization to run on HTMX OOB swaps and improves loading/no-data behavior. |
| SAMA.Web/Pages/Dashboard/_ResponseTimeTrendsChart.cshtml | Adjusts initialization to run on HTMX OOB swaps and improves loading/no-data behavior. |
| SAMA.Tests.Unit/Web/Pages/Dashboard/IndexModelTests.cs | Updates mocks and adds tests for new timeline/trends handlers. |
| <div class="d-none" | ||
| hx-get="/Dashboard/Index?handler=Timeline&workspaceId=@Model.WorkspaceId&timelineHours=@Model.TimelineHours" | ||
| hx-trigger="load, every @(Model.RefreshIntervalSeconds)s" | ||
| hx-swap="none"></div> |
| <div class="d-none" | ||
| hx-get="/Dashboard/Index?handler=Trends&workspaceId=@Model.WorkspaceId&trendsHours=@Model.TrendsHours" | ||
| hx-trigger="load, every @(Model.RefreshIntervalSeconds)s" | ||
| hx-swap="none"></div> |
No description provided.