-
Notifications
You must be signed in to change notification settings - Fork 642
Add "Collapse All"/"Expand All" buttons in the trace page #9474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
@danmoseley main has fixes for these failing tests. |
…nto copilot/fix-9434
Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
I've uncommented the two tests and fixed the compilation issues. Both Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds "Collapse All" and "Expand All" functionality on the trace detail page to allow users to easily manage large trace hierarchies.
- New tests for collapsing and expanding all spans
- New localized resource entries for "Collapse All" and "Expand All" in multiple languages
- New menu button items and corresponding internal methods added to handle the expand/collapse actions
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/Aspire.Dashboard.Components.Tests/Pages/TraceDetailsTests.cs | Adds tests for both collapse-all and expand-all actions via simulated menu item clicks |
src/Aspire.Dashboard/Resources/*.xlf | Adds new translation entries for "Collapse All" and "Expand All" |
src/Aspire.Dashboard/Resources/ControlsStrings.resx | Adds new resource entries for "Collapse All" and "Expand All" |
src/Aspire.Dashboard/Components/Pages/TraceDetail.razor.cs | Implements new menu items and internal methods for expanding and collapsing spans |
src/Aspire.Dashboard/Components/Pages/TraceDetail.razor | Inserts the new dropdown menu button in the page header |
.github/copilot-instructions.md | Documentation update regarding test guidelines |
|
||
_traceActionsMenuItems.Add(new MenuButtonItem | ||
{ | ||
Text = "Expand All", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider replacing the hard-coded action text with a localized resource lookup to keep the UI consistent with the rest of the application.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed @copilot please make sure Expand All, Collapse All, and Actions are being pulled from resources so they're localized
tests/Aspire.Dashboard.Components.Tests/Pages/TraceDetailsTests.cs
Outdated
Show resolved
Hide resolved
…s.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
||
_traceActionsMenuItems.Add(new MenuButtonItem | ||
{ | ||
Text = "Collapse All", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also needs to come from resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 4aa3b14. Both "Collapse All" and "Expand All" strings now use localized resources via ControlsLoc[nameof(ControlsStrings.CollapseAllSpansText)] and ControlsLoc[nameof(ControlsStrings.ExpandAllSpansText)].
…zed resources Co-authored-by: danmoseley <6385855+danmoseley@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
||
_traceActionsMenuItems.Add(new MenuButtonItem | ||
{ | ||
Id = "expand-all", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed unused ID property (commit 91db72a).
|
||
_traceActionsMenuItems.Add(new MenuButtonItem | ||
{ | ||
Id = "collapse-all", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this id, it's unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed unused ID property (commit 91db72a).
@@ -333,6 +362,46 @@ private async Task ClearSelectedSpanAsync(bool causedByUserAction = false) | |||
_elementIdBeforeDetailsViewOpened = null; | |||
} | |||
|
|||
// Internal for testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't tested anywhere, it shouldn't be internal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed method from internal to private since it's not tested directly - tests now access it through the menu item (commit 91db72a).
} | ||
|
||
_collapsedSpanIds.Clear(); | ||
foreach (var viewModel in _spanWaterfallViewModels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be using OnToggleCollapse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to follow the same state management pattern as OnToggleCollapse - manually updating both viewModel.IsCollapsed and _collapsedSpanIds list (commit 91db72a).
} | ||
|
||
_collapsedSpanIds.Clear(); | ||
foreach (var viewModel in _spanWaterfallViewModels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be using OnToggleCollapse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to follow the same state management pattern as OnToggleCollapse - manually updating both viewModel.IsCollapsed and _collapsedSpanIds list (commit 91db72a).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, extract this logic and the logic in OnToggleCollapse into a helper function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted the common logic into helper functions SetSpanCollapsedState
and RefreshSpanViewAsync
. All three methods now use the shared logic to avoid duplication (commit 90020cf).
{ | ||
_traceActionsMenuItems.Clear(); | ||
|
||
_traceActionsMenuItems.Add(new MenuButtonItem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expand all button should only be enabled when there is a trace span that is collapsed. Likewise, the collapse all button should only be enabled if there is a trace span that is NOT collapsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented conditional enabling: "Expand All" is only enabled when there are collapsed spans, and "Collapse All" is only enabled when there are spans that can be collapsed (have children and are not already collapsed). The menu state updates dynamically as spans are toggled (commit 91db72a).
…, use proper state management, add conditional enabling Co-authored-by: adamint <20359921+adamint@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:If you need me to access, download, or install something from one of these locations, you can either:
|
} | ||
|
||
_collapsedSpanIds.Clear(); | ||
foreach (var viewModel in _spanWaterfallViewModels) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, extract this logic and the logic in OnToggleCollapse into a helper function
Co-authored-by: adamint <20359921+adamint@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:If you need me to access, download, or install something from one of these locations, you can either:
|
@adamint I think it has done what you asked. I didn't pull it down this time to try it. |
This PR adds "Collapse All" and "Expand All" functionality to the trace detail page to help users manage large trace hierarchies more efficiently.
Changes
ControlsStrings.resx
ArrowExpandAll
icon)ArrowCollapseAll
icon)Implementation Details
_collapsedSpanIds
list which is used to track collapsed state between rendersScreenshot
Fixes #9434.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
dnceng.pkgs.visualstudio.com
/home/REDACTED/work/aspire/aspire/.dotnet/dotnet build src/Aspire.Dashboard/Aspire.Dashboard.csproj
(dns block)/home/REDACTED/work/aspire/aspire/.dotnet/dotnet build src/Aspire.Dashboard/Aspire.Dashboard.csproj --no-incremental
(dns block)/home/REDACTED/work/aspire/aspire/.dotnet/dotnet test tests/Aspire.Dashboard.Components.Tests/Aspire.Dashboard.Components.Tests.csproj
(dns block)pkgs.dev.azure.com
/home/REDACTED/work/aspire/aspire/.dotnet/dotnet build src/Aspire.Dashboard/Aspire.Dashboard.csproj
(dns block)/home/REDACTED/work/aspire/aspire/.dotnet/dotnet build src/Aspire.Dashboard/Aspire.Dashboard.csproj --no-incremental
(dns block)/home/REDACTED/work/aspire/aspire/.dotnet/dotnet test tests/Aspire.Dashboard.Components.Tests/Pages/TraceDetailsTests.cs
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.