Skip to content

Commit 29e24aa

Browse files
authored
Fix sorting on the tracked pull requests page (#4272)
1 parent c22671e commit 29e24aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ProductConstructionService/ProductConstructionService.BarViz/Pages/PullRequests.razor

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
@using Microsoft.DotNet.ProductConstructionService.Client
44
@using Microsoft.DotNet.ProductConstructionService.Client.Models;
5+
@using System.Linq.Expressions
56
@inject IProductConstructionServiceApi api
67

78
<PageTitle>Tracked Pull Requests</PageTitle>
89

910
<GridViewTemplate Title="Pull Requests" ShowSkeleton="TrackedPullRequests == null">
1011
<Content>
1112
<FluentDataGrid Id="pullRequestsGrid" Items="@TrackedPullRequests" GridTemplateColumns="2fr 1fr 1fr" TGridItem=TrackedPullRequest Style="width: 100%">
12-
<TemplateColumn Sortable="true" Align="Align.Start" Title="Pull request">
13+
<TemplateColumn Sortable="true" SortBy="SortBy(pr => pr.Url)" Align="Align.Start" Title="Pull request">
1314
<FluentAnchor Href="@context.Url" Target="_blank" Appearance="Appearance.Hypertext">@context.Url</FluentAnchor>
1415
</TemplateColumn>
15-
<TemplateColumn Sortable="true" Align="Align.Center" Title="Channel">
16+
<TemplateColumn Sortable="true" SortBy="SortBy(pr => pr.Channel)" Align="Align.Center" Title="Channel">
1617
@if (context.Channel != null)
1718
{
1819
<FluentLabel>@context.Channel</FluentLabel>
@@ -26,7 +27,7 @@
2627
</FluentLabel>
2728
}
2829
</TemplateColumn>
29-
<TemplateColumn Sortable="true" Align="Align.Center" Title="Target branch">
30+
<TemplateColumn Sortable="true" SortBy="SortBy(pr => pr.TargetBranch)" Align="Align.Center" Title="Target branch">
3031
@if (context.TargetBranch != null)
3132
{
3233
<FluentLabel>@context.TargetBranch</FluentLabel>
@@ -47,6 +48,8 @@
4748
@code {
4849
IQueryable<TrackedPullRequest>? TrackedPullRequests = null;
4950
Timer? _timer;
51+
GridSort<TrackedPullRequest> SortBy(Expression<Func<TrackedPullRequest, string>> sorter)
52+
=> GridSort<TrackedPullRequest>.ByAscending(sorter);
5053

5154
protected override async Task OnInitializedAsync()
5255
{

0 commit comments

Comments
 (0)