Skip to content

Commit

Permalink
Add nullable type switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobjmarks committed May 1, 2024
1 parent f27866d commit f1f0fb5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Client/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
</TitleContent>
<ChildContent>
<MudStack>
<MudSwitch @bind-Value="@includeNullableTypes" Color="Color.Primary">
Include nullable types
</MudSwitch>
<MudSwitch @bind-Value="@showErroneous" Color="Color.Primary">
Show erroneous bindings
<MudText Typo="Typo.caption" Class="d-block mud-text-secondary">
Expand All @@ -51,7 +54,7 @@
</MudExpansionPanels>

<MudTable Items="@bindingResults" Dense="true" Breakpoint="Breakpoint.None" Loading="@isLoading"
Filter="@(r => showErroneous ? true : !r.AllErroneous)">
Filter="ResultTableFilter">
<HeaderContent>
<MudTh>Parameter Type</MudTh>
<MudTh>Binding Result</MudTh>
Expand Down
13 changes: 13 additions & 0 deletions Client/Pages/Home.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public sealed partial class Home : IDisposable
private bool isLoading = false;

private IEnumerable<BindingResults> bindingResults = [];

private bool includeNullableTypes = false;
private bool showErroneous = false;
private bool showDetailedErrorMessages = false;

Expand Down Expand Up @@ -67,6 +69,17 @@ private async Task GetBindingResultsAsync(string inputValue)
bindingResults = results.OrderBy(r => r.Results.Count(r => r.Value.IsErroneous));
}

private bool ResultTableFilter(BindingResults r)
{
if (!includeNullableTypes && r.Type.EndsWith('?'))
return false;

if (!showErroneous && r.AllErroneous)
return false;

return true;
}

private async Task GetSharableLink()
{
var shareLink = NavigationManager.BaseUri + "?qs=" + Uri.EscapeDataString(_input.Value);
Expand Down

0 comments on commit f1f0fb5

Please sign in to comment.