-
Notifications
You must be signed in to change notification settings - Fork 462
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
Generate resource type filters from data #1221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,21 +9,28 @@ | |
<FluentToolbar Orientation="Orientation.Horizontal"> | ||
<h1 slot="label">Resources</h1> | ||
<FluentButton id="typeFilterButton" slot="end" | ||
Appearance="@(AreAllTypesVisible ? Appearance.Stealth : Appearance.Accent)" | ||
Appearance="@(AreAllTypesVisible is true ? Appearance.Stealth : Appearance.Accent)" | ||
IconEnd="@(new Icons.Regular.Size24.Filter())" | ||
@onclick="() => _isTypeFilterVisible = !_isTypeFilterVisible" | ||
Title="@(AreAllTypesVisible ? "Type Filter: All Types Visible" : "Type Filter: Filtered")" | ||
aria-label="@(AreAllTypesVisible ? "Type Filter: All Types Visible" : "Type Filter: Filtered")" /> | ||
Title="@(AreAllTypesVisible is true ? "Type Filter: All Types Visible" : "Type Filter: Filtered")" | ||
aria-label="@(AreAllTypesVisible is true ? "Type Filter: All Types Visible" : "Type Filter: Filtered")" /> | ||
<FluentPopover AnchorId="typeFilterButton" @bind-Open="_isTypeFilterVisible"> | ||
<Header>Resource Types</Header> | ||
<Body> | ||
<FluentStack Orientation="Orientation.Vertical"> | ||
<FluentCheckbox Label="All" CheckStateChanged="HandleTypeFilterShowAllChanged" | ||
ThreeState="true" ShowIndeterminate="false" | ||
CheckState="_allTypesVisible" /> | ||
<FluentCheckbox @bind-Value="_areProjectsVisible" Label="Projects" @bind-Value:after="HandleTypeFilterTypeChanged" /> | ||
<FluentCheckbox @bind-Value="_areContainersVisible" Label="Containers" @bind-Value:after="HandleTypeFilterTypeChanged" /> | ||
<FluentCheckbox @bind-Value="_areExecutablesVisible" Label="Executables" @bind-Value:after="HandleTypeFilterTypeChanged" /> | ||
<FluentCheckbox | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you got rid of the indeterminate (i.e. "some are checked some are not") state? Was that an intentional change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had the impression it wasn't actually showing intederminate state in the previous code because of I will reinstate the indeterminate state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, the naming is a little confusing. You can see some docs and examples here if it helps: https://www.fluentui-blazor.net/Checkbox#fluentcheckbox-class_properties There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify the existing behavior: The "All" checkbox would automatically toggle to checked (if all other checkboxes were checked), unchecked (if no other checkboxes were checked) or indeterminate (any other combination of checks). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I think it'll be straightforward to restore this behaviour. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I played around with this for a while and am can't tell why it wouldn't work. Sticking a breakpoint in the property getter the |
||
Label="All" | ||
ThreeState="true" | ||
ShowIndeterminate="false" | ||
@bind-CheckState="AreAllTypesVisible" /> | ||
@foreach (string resourceType in _allResourceTypes) { | ||
bool isChecked = _visibleResourceTypes.Contains(resourceType); | ||
<FluentCheckbox | ||
Label="@resourceType" | ||
@bind-Value:get="isChecked" | ||
@bind-Value:set="c => OnResourceTypeVisibilityChanged(resourceType, c)" | ||
/> | ||
} | ||
</FluentStack> | ||
</Body> | ||
</FluentPopover> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace Aspire.Dashboard.Extensions; | ||
|
||
internal static class StringComparers | ||
{ | ||
public static StringComparer ResourceType => StringComparer.Ordinal; | ||
} | ||
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a convention I've seen used in a few places, giving semantic names to different domains of strings, ensuring they're compared in a uniform way. |
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 current code doesn't seem to respond to clicking the All checkbox as expected, but I think its because of the ShowIndeterminate parameter in my other comment and not because of the changes from
CheckState
/CheckStateChanged
to@bind-CheckState
. I think when it is checked and you click it, it goes to indeterminate state, but then immediately gets flipped back to true because nothing changed with the other checkboxes.