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

Commit 380cb56

Browse files
authored
Merge pull request #451 from github/fixes/450-disable-pr-list-filters
Disable PR list filters when loading.
2 parents b74a115 + e565664 commit 380cb56

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/GitHub.App/ViewModels/PullRequestListViewModel.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public class PullRequestListViewModel : BaseViewModel, IPullRequestListViewModel
2929
readonly TrackingCollection<IAccount> trackingAssignees;
3030
readonly IPackageSettings settings;
3131
readonly PullRequestListUIState listSettings;
32-
bool pullRequestsLoaded;
3332

3433
[ImportingConstructor]
3534
PullRequestListViewModel(
@@ -84,11 +83,11 @@ public PullRequestListViewModel(
8483
.Subscribe(s => UpdateFilter(s, SelectedAssignee, SelectedAuthor));
8584

8685
this.WhenAny(x => x.SelectedAssignee, x => x.Value)
87-
.Where(x => PullRequests != null && x != EmptyUser && pullRequestsLoaded)
86+
.Where(x => PullRequests != null && x != EmptyUser && IsLoaded)
8887
.Subscribe(a => UpdateFilter(SelectedState, a, SelectedAuthor));
8988

9089
this.WhenAny(x => x.SelectedAuthor, x => x.Value)
91-
.Where(x => PullRequests != null && x != EmptyUser && pullRequestsLoaded)
90+
.Where(x => PullRequests != null && x != EmptyUser && IsLoaded)
9291
.Subscribe(a => UpdateFilter(SelectedState, SelectedAssignee, a));
9392

9493
SelectedState = States.FirstOrDefault(x => x.Name == listSettings.SelectedState) ?? States[0];
@@ -98,7 +97,7 @@ public override void Initialize([AllowNull] ViewWithData data)
9897
{
9998
base.Initialize(data);
10099

101-
pullRequestsLoaded = false;
100+
IsLoaded = false;
102101

103102
PullRequests = repositoryHost.ModelService.GetPullRequests(repository, pullRequests);
104103
pullRequests.Subscribe(pr =>
@@ -121,7 +120,7 @@ public override void Initialize([AllowNull] ViewWithData data)
121120
SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee);
122121
}
123122

124-
pullRequestsLoaded = true;
123+
IsLoaded = true;
125124
UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor);
126125
});
127126
}
@@ -136,6 +135,13 @@ void UpdateFilter(PullRequestState state, [AllowNull]IAccount ass, [AllowNull]IA
136135
(aut == null || aut.Equals(pr.Author));
137136
}
138137

138+
bool isLoaded;
139+
public bool IsLoaded
140+
{
141+
get { return isLoaded; }
142+
private set { this.RaiseAndSetIfChanged(ref isLoaded, value); }
143+
}
144+
139145
ITrackingCollection<IPullRequestModel> pullRequests;
140146
public ITrackingCollection<IPullRequestModel> PullRequests
141147
{

src/GitHub.VisualStudio.UI/Styles/LinkDropDown.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
<Setter Property="FrameworkElement.Cursor" Value="Hand"/>
2727
</MultiDataTrigger.Setters>
2828
</MultiDataTrigger>
29+
<Trigger Property="IsEnabled" Value="False">
30+
<Setter Property="Foreground" Value="{StaticResource GHBlueLinkButtonDisabledBrush}"/>
31+
</Trigger>
2932
<DataTrigger Binding="{Binding Path=IsPressed, RelativeSource={RelativeSource TemplatedParent}}" Value="true">
3033
<Setter Property="TextDecorations" Value="Underline"/>
3134
<Setter Property="FrameworkElement.Cursor" Value="Hand"/>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,21 @@
100100

101101
<WrapPanel Grid.Column="0" HorizontalAlignment="Stretch">
102102

103-
<ui:LinkDropDown ItemsSource="{Binding States}"
103+
<ui:LinkDropDown IsEnabled="{Binding IsLoaded}"
104+
ItemsSource="{Binding States}"
104105
SelectedItem="{Binding SelectedState}"/>
105106

106107
<Separator Style="{StaticResource VerticalSeparator}" />
107108

108109
<ui:LinkDropDown Header="Assignee"
110+
IsEnabled="{Binding IsLoaded}"
109111
ItemsSource="{Binding Assignees}"
110112
SelectedItem="{Binding SelectedAssignee}"/>
111113

112114
<Separator Style="{StaticResource VerticalSeparator}" />
113115

114116
<ui:LinkDropDown Header="Author"
117+
IsEnabled="{Binding IsLoaded}"
115118
ItemsSource="{Binding Authors}"
116119
SelectedItem="{Binding SelectedAuthor}"/>
117120
</WrapPanel>

0 commit comments

Comments
 (0)