Skip to content

Conversation

@adamint
Copy link
Member

@adamint adamint commented Mar 17, 2025

Description

This PR removes the current horizontal filter view, moving the filters into a fluent menu with a counter badge to hint at the number of filters set.

image

Inside the menu, set filters are presented first, then a divider and a clear all filters item. Maybe we could think of icons to set for each of the filter types?
image

If no filters are present, "No filters" continues to be shown.
image

Fixes #5673

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copy link
Contributor

Copilot AI left a 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 refactors the filter UI on the Structured Logs page by moving filters into a Fluent menu and adding a “remove all filters” option.

  • Introduces a new helper method (GetFilterMenuItems) to generate menu items for existing filters and the clear-all option.
  • Adds a new DisableIcon parameter to the AspireMenuButton to allow conditional rendering of the icon.
  • Updates the StructuredLogs view to wrap the new menu button in a counter badge indicating the number of active filters.

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor.cs Added GetFilterMenuItems method to generate filter menu items, including a clear-all option.
src/Aspire.Dashboard/Components/Controls/AspireMenuButton.razor.cs Introduced DisableIcon parameter to offer control over icon rendering.
src/Aspire.Dashboard/Components/Controls/AspireMenuButton.razor Updated rendering logic to conditionally include the icon based on DisableIcon.
src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor Replaced inline filtering buttons with a counter badge wrapping a menu button.
Files not reviewed (1)
  • src/Aspire.Dashboard/wwwroot/css/app.css: Language not supported
Comments suppressed due to low confidence (1)

src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor:80

  • Consider adding unit tests to cover the new filter menu functionality and its interactions, ensuring that the filtering and clear-all behavior work as expected.
<AspireMenuButton DisableIcon="true" Text="@FilterLoc[nameof(StructuredFiltering.Filters)]" Items="@GetFilterMenuItems()" />

<FluentButton slot="end" Appearance="Appearance.Outline" OnClick="() => OpenFilterAsync(filter)" class="telemetry-filter-button" title="@filter.GetDisplayText(FilterLoc)">@filter.GetDisplayText(FilterLoc)</FluentButton>
}
<div slot="end">
<FluentCounterBadge HorizontalPosition="70" Count="@(ViewModel.Filters.Count)" Appearance="Appearance.Accent">
Copy link
Member Author

Choose a reason for hiding this comment

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

setting slot=end onto counter badge doesn't work, maybe a bug in the component? I can check

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is a bug in that component

Copy link
Member Author

Choose a reason for hiding this comment

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

@mitchdenny
Copy link
Member

The placement of Filters and No filters seems strange to me. I think maybe its the fact that it changes from Filters to No filters that is putting me off. I wonder if when no filters are set it still says Filters, but doesn't have the badge.

I'm no UX expert though.

@mitchdenny
Copy link
Member

Actually, the fact that a badge is being used is also a bit odd I think. Perhaps changing the colour of the button itself?

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

A long name or value overflows the menu item. A very long name here should be trimmed with ....

image

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

I'm guessing there's no limit on the height or the menu:

image

It might be a problem, but realistically there aren't going to be that many filters added so lets not worry right now.

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

Refreshing the page while there is a filter causes the badge number to move.

Add a new filter:
image

Refresh the page:
image

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

Traces page has the same filters. They're not updated.

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

Remove all just updates the filter UI. It doesn't remove the filters from the query string or update the page:

filters-remove-all

@JamesNK
Copy link
Member

JamesNK commented Mar 18, 2025

Actually, the fact that a badge is being used is also a bit odd I think. Perhaps changing the colour of the button itself?

I think it's ok. Lets you know how many filters there are.

@adamint
Copy link
Member Author

adamint commented Mar 19, 2025

Refreshing the page while there is a filter causes the badge number to move.

Add a new filter: image

Refresh the page: image

This is due to a fluentui-blazor bug that was fixed on 3/10 and will be included in the next release. The 'true' positioning is the former (what you see after adding a filter)

@adamint
Copy link
Member Author

adamint commented Mar 19, 2025

The placement of Filters and No filters seems strange to me. I think maybe its the fact that it changes from Filters to No filters that is putting me off. I wonder if when no filters are set it still says Filters, but doesn't have the badge.

I'm no UX expert though.

@JamesNK?

@adamint adamint requested a review from JamesNK March 19, 2025 15:53
if (i > 0)
{
await Task.Delay((i + 1) * (i + 1) * 10);
await Task.Delay((i + 1) * (i + 1) * 10 * 5);
Copy link
Member

Choose a reason for hiding this comment

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

What caused this to timeout?

@JamesNK
Copy link
Member

JamesNK commented Mar 20, 2025

The placement of Filters and No filters seems strange to me. I think maybe its the fact that it changes from Filters to No filters that is putting me off. I wonder if when no filters are set it still says Filters, but doesn't have the badge.
I'm no UX expert though.

@JamesNK?

I think it is Good Enough(tm) to merge. Nothing stops it changing later. People can use and give feedback.

@JamesNK JamesNK merged commit 358405c into dotnet:main Mar 20, 2025
166 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

3 participants