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

Commit af51110

Browse files
Merge branch 'features/check-suite-annotations' into features/check-suite-annotations-inline
# Conflicts: # src/GitHub.App/SampleData/PullRequestAnnotationItemViewModelDesigner.cs # src/GitHub.App/SampleData/PullRequestAnnotationsViewModelDesigner.cs # src/GitHub.App/ViewModels/GitHubPane/PullRequestAnnotationItemViewModel.cs # src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs # src/GitHub.Exports.Reactive/Models/IInlineAnnotationModel.cs # src/GitHub.Exports.Reactive/Models/InlineAnnotationModel.cs # src/GitHub.InlineReviews/Services/PullRequestSessionService.cs
2 parents 726de83 + 2865433 commit af51110

16 files changed

+172
-117
lines changed

src/GitHub.App/SampleData/PullRequestCheckViewModelDesigner.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public sealed class PullRequestCheckViewModelDesigner : ViewModelBase, IPullRequ
1919

2020
public ReactiveCommand<object> OpenDetailsUrl { get; set; } = null;
2121

22-
public PullRequestCheckType CheckType { get; }
22+
public PullRequestCheckType CheckType { get; set; } = PullRequestCheckType.ChecksApi;
2323

24-
public int CheckRunId { get; }
24+
public int CheckRunId { get; set; }
2525

2626
public bool HasAnnotations { get; } = true;
2727
}

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public PullRequestDetailViewModelDesigner()
122122
public ReactiveCommand<Unit> Checkout { get; }
123123
public ReactiveCommand<Unit> Pull { get; }
124124
public ReactiveCommand<Unit> Push { get; }
125+
public ReactiveCommand<Unit> SyncSubmodules { get; }
125126
public ReactiveCommand<object> OpenOnGitHub { get; }
126127
public ReactiveCommand<object> ShowReview { get; }
127128
public ReactiveCommand<object> ShowAnnotations { get; }

src/GitHub.App/Services/FromGraphQlExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,10 @@ public static PullRequestReviewState FromGraphQl(this Octokit.GraphQL.Model.Pull
103103
}
104104
}
105105

106-
public static CheckAnnotationLevel? FromGraphQl(this Octokit.GraphQL.Model.CheckAnnotationLevel? value)
106+
public static CheckAnnotationLevel FromGraphQl(this Octokit.GraphQL.Model.CheckAnnotationLevel value)
107107
{
108108
switch (value)
109109
{
110-
case null:
111-
return null;
112110
case Octokit.GraphQL.Model.CheckAnnotationLevel.Failure:
113111
return CheckAnnotationLevel.Failure;
114112
case Octokit.GraphQL.Model.CheckAnnotationLevel.Notice:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ public Task ShowPullRequestReviews(string owner, string repo, int number, string
328328
x.User.Login == login);
329329
}
330330

331+
/// <inheritdoc/>
331332
public Task ShowPullRequestCheckRun(string owner, string repo, int number, int checkRunId)
332333
{
333334
Guard.ArgumentNotNull(owner, nameof(owner));

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
namespace GitHub.App.ViewModels.GitHubPane
1111
{
12+
/// <summary>
13+
/// The viewmodel for a single annotation item in a list
14+
/// </summary>
1215
public class PullRequestAnnotationItemViewModel : ViewModelBase, IPullRequestAnnotationItemViewModel
1316
{
1417
readonly CheckSuiteModel checkSuite;
@@ -40,12 +43,21 @@ public PullRequestAnnotationItemViewModel(CheckSuiteModel checkSuite,
4043

4144
public bool IsFileInPullRequest { get; }
4245

46+
/// <summary>
47+
/// Gets the annotation model.
48+
/// </summary>
4349
public CheckRunAnnotationModel Annotation { get; }
4450

51+
/// <summary>
52+
/// Gets a formatted descriptor of the line(s) the annotation is about.
53+
/// </summary>
4554
public string LineDescription => $"{Annotation.StartLine}:{Annotation.EndLine}";
4655

4756
public ReactiveCommand<Unit> OpenAnnotation { get; }
4857

58+
/// <summary>
59+
/// Gets or sets a flag to control the expanded state.
60+
/// </summary>
4961
public bool IsExpanded
5062
{
5163
get { return isExpanded; }

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace GitHub.App.ViewModels.GitHubPane
1212
{
13+
/// <inheritdoc cref="IPullRequestAnnotationsViewModel"/>
1314
[Export(typeof(IPullRequestAnnotationsViewModel))]
1415
[PartCreationPolicy(CreationPolicy.NonShared)]
1516
public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullRequestAnnotationsViewModel
@@ -22,6 +23,10 @@ public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullReque
2223
string checkRunName;
2324
IReadOnlyList<IPullRequestAnnotationItemViewModel> annotations;
2425

26+
/// <summary>
27+
/// Initializes a new instance of the <see cref="PullRequestAnnotationsViewModel"/> class.
28+
/// </summary>
29+
/// <param name="sessionManager">The pull request session manager.</param>
2530
[ImportingConstructor]
2631
public PullRequestAnnotationsViewModel(IPullRequestSessionManager sessionManager, IPullRequestEditorService pullRequestEditorService)
2732
{
@@ -31,9 +36,9 @@ public PullRequestAnnotationsViewModel(IPullRequestSessionManager sessionManager
3136
NavigateTo(FormattableString.Invariant($"{LocalRepository.Owner}/{LocalRepository.Name}/pull/{PullRequestNumber}")));
3237
}
3338

39+
/// <inheritdoc/>
3440
public async Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner,
35-
string repo,
36-
int pullRequestNumber, int checkRunId)
41+
string repo, int pullRequestNumber, int checkRunId)
3742
{
3843
if (repo != localRepository.Name)
3944
{
@@ -57,28 +62,36 @@ public async Task InitializeAsync(ILocalRepositoryModel localRepository, IConnec
5762
}
5863
}
5964

65+
/// <inheritdoc/>
6066
public ILocalRepositoryModel LocalRepository { get; private set; }
6167

68+
/// <inheritdoc/>
6269
public string RemoteRepositoryOwner { get; private set; }
6370

71+
/// <inheritdoc/>
6472
public int PullRequestNumber { get; private set; }
6573

74+
/// <inheritdoc/>
6675
public int CheckRunId { get; private set; }
6776

77+
/// <inheritdoc/>
6878
public ReactiveCommand<object> NavigateToPullRequest { get; private set; }
6979

80+
/// <inheritdoc/>
7081
public string PullRequestTitle
7182
{
7283
get { return title; }
7384
private set { this.RaiseAndSetIfChanged(ref title, value); }
7485
}
7586

87+
/// <inheritdoc/>
7688
public string CheckRunName
7789
{
7890
get { return checkRunName; }
7991
private set { this.RaiseAndSetIfChanged(ref checkRunName, value); }
8092
}
8193

94+
/// <inheritdoc/>
8295
public IReadOnlyList<IPullRequestAnnotationItemViewModel> Annotations
8396
{
8497
get { return annotations; }

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using System.ComponentModel.Composition;
44
using System.Linq;
55
using System.Linq.Expressions;
6-
using System.Reactive;
7-
using System.Reactive.Linq;
8-
using System.Windows.Media.Imaging;
96
using GitHub.Extensions;
107
using GitHub.Factories;
118
using GitHub.Models;
@@ -14,13 +11,18 @@
1411

1512
namespace GitHub.ViewModels.GitHubPane
1613
{
14+
/// <inheritdoc cref="IPullRequestCheckViewModel"/>
1715
[Export(typeof(IPullRequestCheckViewModel))]
1816
[PartCreationPolicy(CreationPolicy.NonShared)]
1917
public class PullRequestCheckViewModel: ViewModelBase, IPullRequestCheckViewModel
2018
{
2119
private readonly IUsageTracker usageTracker;
22-
const string DefaultAvatar = "pack://application:,,,/GitHub.App;component/Images/default_user_avatar.png";
2320

21+
/// <summary>
22+
/// Factory method to create a <see cref="PullRequestCheckViewModel"/>.
23+
/// </summary>
24+
/// <param name="viewViewModelFactory">A viewviewmodel factory.</param>
25+
/// <param name="pullRequest">The pull request.</param>
2426
public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactory viewViewModelFactory, PullRequestDetailModel pullRequest)
2527
{
2628
var statuses = pullRequest.Statuses?.Select(statusModel =>
@@ -51,7 +53,7 @@ public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactor
5153
pullRequestCheckViewModel.DetailsUrl = !string.IsNullOrEmpty(statusModel.TargetUrl) ? new Uri(statusModel.TargetUrl) : null;
5254

5355
return pullRequestCheckViewModel;
54-
}) ?? new PullRequestCheckViewModel[0];
56+
}) ?? Array.Empty<PullRequestCheckViewModel>();
5557

5658
var checks = pullRequest.CheckSuites?.SelectMany(checkSuiteModel => checkSuiteModel.CheckRuns)
5759
.Select(checkRunModel =>
@@ -99,11 +101,15 @@ public static IEnumerable<IPullRequestCheckViewModel> Build(IViewViewModelFactor
99101
pullRequestCheckViewModel.DetailsUrl = new Uri(checkRunModel.DetailsUrl);
100102

101103
return pullRequestCheckViewModel;
102-
}) ?? new PullRequestCheckViewModel[0];
104+
}) ?? Array.Empty<PullRequestCheckViewModel>();
103105

104106
return statuses.Concat(checks).OrderBy(model => model.Title);
105107
}
106108

109+
/// <summary>
110+
/// Initializes a new instance of <see cref="PullRequestCheckViewModel"/>.
111+
/// </summary>
112+
/// <param name="usageTracker">The usage tracker.</param>
107113
[ImportingConstructor]
108114
public PullRequestCheckViewModel(IUsageTracker usageTracker)
109115
{
@@ -125,21 +131,29 @@ private void DoOpenDetailsUrl(object obj)
125131

126132
usageTracker.IncrementCounter(expression).Forget();
127133
}
128-
134+
135+
/// <inheritdoc/>
129136
public string Title { get; private set; }
130137

138+
/// <inheritdoc/>
131139
public string Description { get; private set; }
132140

141+
/// <inheritdoc/>
133142
public PullRequestCheckType CheckType { get; private set; }
134143

144+
/// <inheritdoc/>
135145
public int CheckRunId { get; private set; }
136146

147+
/// <inheritdoc/>
137148
public bool HasAnnotations { get; private set; }
138149

150+
/// <inheritdoc/>
139151
public PullRequestCheckStatus Status{ get; private set; }
140152

153+
/// <inheritdoc/>
141154
public Uri DetailsUrl { get; private set; }
142155

156+
/// <inheritdoc/>
143157
public ReactiveCommand<object> OpenDetailsUrl { get; }
144158
}
145159
}

0 commit comments

Comments
 (0)