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

Commit 9c8a4d8

Browse files
Code cleanup
1 parent 2a9e4dd commit 9c8a4d8

File tree

7 files changed

+67
-7
lines changed

7 files changed

+67
-7
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/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
@@ -5,6 +5,9 @@
55

66
namespace GitHub.App.ViewModels.GitHubPane
77
{
8+
/// <summary>
9+
/// The viewmodel for a single annotation item in a list
10+
/// </summary>
811
public class PullRequestAnnotationItemViewModel : ViewModelBase, IPullRequestAnnotationItemViewModel
912
{
1013
bool isExpanded;
@@ -14,10 +17,19 @@ public PullRequestAnnotationItemViewModel(CheckRunAnnotationModel annotation)
1417
this.Annotation = annotation;
1518
}
1619

20+
/// <summary>
21+
/// Gets the annotation model.
22+
/// </summary>
1723
public CheckRunAnnotationModel Annotation { get; }
1824

25+
/// <summary>
26+
/// Gets a formatted descriptor of the line(s) the annotation is about.
27+
/// </summary>
1928
public string LineDescription => $"{Annotation.StartLine}:{Annotation.EndLine}";
2029

30+
/// <summary>
31+
/// Gets or sets a flag to control the expanded state.
32+
/// </summary>
2133
public bool IsExpanded
2234
{
2335
get { return isExpanded; }

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

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

1111
namespace GitHub.App.ViewModels.GitHubPane
1212
{
13+
/// <summary>
14+
/// A viewmodel which displays a list of annotations for a pull request's check run.
15+
/// </summary>
1316
[Export(typeof(IPullRequestAnnotationsViewModel))]
1417
[PartCreationPolicy(CreationPolicy.NonShared)]
1518
public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullRequestAnnotationsViewModel
@@ -21,6 +24,10 @@ public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullReque
2124
string checkRunName;
2225
IReadOnlyList<IPullRequestAnnotationItemViewModel> annotations;
2326

27+
/// <summary>
28+
/// Initializes a new instance of the <see cref="PullRequestAnnotationsViewModel"/> class.
29+
/// </summary>
30+
/// <param name="sessionManager">The pull request session manager.</param>
2431
[ImportingConstructor]
2532
public PullRequestAnnotationsViewModel(IPullRequestSessionManager sessionManager)
2633
{
@@ -29,9 +36,9 @@ public PullRequestAnnotationsViewModel(IPullRequestSessionManager sessionManager
2936
NavigateTo(FormattableString.Invariant($"{LocalRepository.Owner}/{LocalRepository.Name}/pull/{PullRequestNumber}")));
3037
}
3138

39+
/// <inheritdoc/>
3240
public async Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner,
33-
string repo,
34-
int pullRequestNumber, int checkRunId)
41+
string repo, int pullRequestNumber, int checkRunId)
3542
{
3643
if (repo != localRepository.Name)
3744
{

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

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,40 @@ public interface IPullRequestAnnotationsViewModel : IPanePageViewModel
2626
/// </summary>
2727
int PullRequestNumber { get; }
2828

29-
int CheckRunId { get; }
30-
ReactiveCommand<object> NavigateToPullRequest { get; }
29+
/// <summary>
30+
/// Gets the title of the pull request.
31+
/// </summary>
3132
string PullRequestTitle { get; }
33+
34+
/// <summary>
35+
/// Gets the id of the check run.
36+
/// </summary>
37+
int CheckRunId { get; }
38+
39+
/// <summary>
40+
/// Gets the name of the check run.
41+
/// </summary>
3242
string CheckRunName { get; }
43+
44+
/// <summary>
45+
/// Gets a command which navigates to the parent pull request.
46+
/// </summary>
47+
ReactiveCommand<object> NavigateToPullRequest { get; }
48+
49+
/// <summary>
50+
/// Gets the list of annotations.
51+
/// </summary>
3352
IReadOnlyList<IPullRequestAnnotationItemViewModel> Annotations { get; }
3453

54+
/// <summary>
55+
/// Initializes the view model.
56+
/// </summary>
57+
/// <param name="localRepository">The local repository.</param>
58+
/// <param name="connection">The connection to the repository host.</param>
59+
/// <param name="owner">The pull request's repository owner.</param>
60+
/// <param name="repo">The pull request's repository name.</param>
61+
/// <param name="pullRequestNumber">The pull request's number.</param>
62+
/// <param name="checkRunId">The pull request's check run id.</param>
3563
Task InitializeAsync(
3664
ILocalRepositoryModel localRepository,
3765
IConnection connection,

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,13 @@ public interface IPullRequestDetailViewModel : IPanePageViewModel, IOpenInBrowse
175175
/// </summary>
176176
ReactiveCommand<object> ShowReview { get; }
177177

178+
/// <summary>
179+
/// Gets a command that navigates to a pull request's check run annotation list.
180+
/// </summary>
178181
ReactiveCommand<object> ShowAnnotations { get; }
179182

180183
/// <summary>
181-
/// Gets the latest pull request Checks & Statuses
184+
/// Gets the latest pull request checks & statuses.
182185
/// </summary>
183186
IReadOnlyList<IPullRequestCheckViewModel> Checks { get; }
184187

src/GitHub.Exports/ViewModels/GitHubPane/IGitHubPaneViewModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ public interface IGitHubPaneViewModel : IViewModel
9191
/// <param name="number">The pull rqeuest number.</param>
9292
Task ShowPullRequest(string owner, string repo, int number);
9393

94+
/// <summary>
95+
/// Shows the details for a pull request's check run in the GitHub pane.
96+
/// </summary>
97+
/// <param name="owner">The repository owner.</param>
98+
/// <param name="repo">The repository name.</param>
99+
/// <param name="number">The pull rqeuest number.</param>
100+
/// <param name="checkRunId">The check run number.</param>
101+
Task ShowPullRequestCheckRun(string owner, string repo, int number, int checkRunId);
102+
94103
/// <summary>
95104
/// Shows the pull requests reviews authored by a user.
96105
/// </summary>

0 commit comments

Comments
 (0)