Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 809ebca

Browse files
committed
Hide PR count when list is loading.
1 parent 7598d20 commit 809ebca

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

src/GitHub.App/SampleData/PullRequestListViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public PullRequestListViewModelDesigner()
5959
public IReadOnlyList<IRepositoryModel> Forks { get; }
6060
public string SearchQuery { get; set; }
6161
public string SelectedState { get; set; }
62+
public string StateCaption { get; set; }
6263
public IReadOnlyList<string> States { get; }
6364
public Uri WebUrl => null;
6465
public ReactiveCommand<object> CreatePullRequest { get; }

src/GitHub.App/ViewModels/GitHubPane/IssueListViewModelBase.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public abstract class IssueListViewModelBase : PanePageViewModelBase, IIssueList
3030
IReadOnlyList<IRepositoryModel> forks;
3131
string searchQuery;
3232
string selectedState;
33+
ObservableAsPropertyHelper<string> stateCaption;
3334
string stringFilter;
3435
int numberFilter;
3536
IUserFilterViewModel authorFilter;
@@ -42,6 +43,13 @@ public IssueListViewModelBase(IRepositoryService repositoryService)
4243
{
4344
this.repositoryService = repositoryService;
4445
OpenItem = ReactiveCommand.CreateAsyncTask(OpenItemImpl);
46+
stateCaption = this.WhenAnyValue(
47+
x => x.Items.Count,
48+
x => x.SelectedState,
49+
x => x.IsBusy,
50+
x => x.IsLoading,
51+
(count, state, busy, loading) => busy || loading ? state : count + " " + state)
52+
.ToProperty(this, x => x.StateCaption);
4553
}
4654

4755
/// <inheritdoc/>
@@ -106,6 +114,9 @@ public string SelectedState
106114
/// <inheritdoc/>
107115
public abstract IReadOnlyList<string> States { get; }
108116

117+
/// <inheritdoc/>
118+
public string StateCaption => stateCaption.Value;
119+
109120
/// <inheritdoc/>
110121
public ReactiveCommand<Unit> OpenItem { get; }
111122

src/GitHub.Exports.Reactive/ViewModels/GitHubPane/IIssueListViewModelBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public interface IIssueListViewModelBase : ISearchablePageViewModel
8989
/// </summary>
9090
IReadOnlyList<string> States { get; }
9191

92+
/// <summary>
93+
/// Gets the caption to display as the header on the <see cref="States"/> dropdown.
94+
/// </summary>
95+
string StateCaption { get; }
96+
9297
/// <summary>
9398
/// Gets a command which opens the item passed as a parameter.
9499
/// </summary>

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestListView.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"
1212
AutomationProperties.AutomationId="{x:Static ghfvs:AutomationIDs.PullRequestListViewCustom}">
1313
<d:DesignProperties.DataContext>
14-
<ghfvs:PullRequestListViewModelDesigner Message="None"/>
14+
<ghfvs:PullRequestListViewModelDesigner Message="None" StateCaption="3 Open"/>
1515
</d:DesignProperties.DataContext>
1616

1717
<UserControl.Resources>
@@ -40,8 +40,7 @@
4040
</ghfvs:DropDownButton.DropDownContent>
4141
<TextBlock>
4242
<Hyperlink Foreground="{DynamicResource GitHubActionLinkItemBrush}">
43-
<Run Text="{Binding Items.Count, Mode=OneWay}"/>
44-
<Run Text="{Binding SelectedState, Mode=OneWay}"/>
43+
<Run Text="{Binding StateCaption, Mode=OneWay}"/>
4544
</Hyperlink>
4645
</TextBlock>
4746
</ghfvs:DropDownButton>

0 commit comments

Comments
 (0)