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

Commit bb87286

Browse files
Functionality to add CheckSuite Name to annotations view
1 parent 5c8e649 commit bb87286

File tree

17 files changed

+53
-28
lines changed

17 files changed

+53
-28
lines changed
201 KB
Binary file not shown.

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
<ItemGroup>
2929
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.1" />
3030
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
31-
<PackageReference Include="Octokit.GraphQL" Version="0.1.1-beta" />
31+
<PackageReference Include="Octokit.GraphQL" Version="0.1.2-beta" />
3232
</ItemGroup>
3333
</Project>

src/GitHub.App/GitHub.App.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<PackageReference Include="Microsoft.VisualStudio.SDK.EmbedInteropTypes" Version="15.0.17" />
6060
<PackageReference Include="Microsoft.VisualStudio.Shell.14.0" Version="14.3.25407" />
6161
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
62-
<PackageReference Include="Octokit.GraphQL" Version="0.1.1-beta" />
62+
<PackageReference Include="Octokit.GraphQL" Version="0.1.2-beta" />
6363
<PackageReference Include="Rothko" Version="0.0.3-ghfvs" />
6464
<PackageReference Include="Rx-Main" Version="2.2.5-custom" targetFramework="net45" />
6565
<PackageReference Include="Serilog" Version="2.5.0" />

src/GitHub.App/SampleData/PullRequestAnnotationsViewModelDesigner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Diagnostics.CodeAnalysis;
33
using System.Threading.Tasks;
44
using GitHub.App.ViewModels.GitHubPane;
@@ -17,6 +17,7 @@ public sealed class PullRequestAnnotationsViewModelDesigner : PanePageViewModelB
1717
public int CheckRunId { get; set; }
1818
public ReactiveCommand<object> NavigateToPullRequest { get; }
1919
public string PullRequestTitle { get; } = "Fixing stuff in this PR";
20+
public string CheckSuiteName { get; } = "Awesome Check Suite";
2021
public string CheckRunName { get; } = "Psuedo Check Run";
2122
public IReadOnlyList<IPullRequestAnnotationItemViewModel> Annotations { get; } = new[]
2223
{

src/GitHub.App/SampleData/PullRequestCheckViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Windows.Media.Imaging;
33
using GitHub.Models;
44
using GitHub.ViewModels;

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ public async Task<Page<PullRequestListItemModel>> ReadPullRequests(
115115
{
116116
Conclusion = run.Conclusion.FromGraphQl(),
117117
Status = run.Status.FromGraphQl()
118-
}).ToList()
118+
}).ToList(),
119+
ApplicationName = suite.App.Name,
119120
}).ToList(),
120121
Statuses = commit.Commit.Status
121122
.Select(context =>
@@ -1020,6 +1021,8 @@ class LastCommitSummaryAdapter
10201021
class CheckSuiteSummaryModel
10211022
{
10221023
public List<CheckRunSummaryModel> CheckRuns { get; set; }
1024+
1025+
public string ApplicationName { get; set; }
10231026
}
10241027

10251028
class CheckRunSummaryModel

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel.Composition;
44
using System.Linq;
@@ -19,6 +19,7 @@ public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullReque
1919

2020
IPullRequestSession session;
2121
string title;
22+
string checkSuiteName;
2223
string checkRunName;
2324
IReadOnlyList<IPullRequestAnnotationItemViewModel> annotations;
2425

@@ -82,6 +83,13 @@ public string PullRequestTitle
8283
private set { this.RaiseAndSetIfChanged(ref title, value); }
8384
}
8485

86+
/// <inheritdoc/>
87+
public string CheckSuiteName
88+
{
89+
get { return checkSuiteName; }
90+
private set { this.RaiseAndSetIfChanged(ref checkSuiteName, value); }
91+
}
92+
8593
/// <inheritdoc/>
8694
public string CheckRunName
8795
{
@@ -105,13 +113,15 @@ async Task Load(PullRequestDetailModel pullRequest)
105113
await Task.Delay(0);
106114
PullRequestTitle = pullRequest.Title;
107115

108-
var checkRunModel = pullRequest
109-
.CheckSuites.SelectMany(model => model.CheckRuns)
110-
.First(model => model.DatabaseId == CheckRunId);
116+
var checkSuiteRun = pullRequest
117+
.CheckSuites.SelectMany(checkSuite => checkSuite.CheckRuns
118+
.Select(checkRun => new{checkSuite, checkRun}))
119+
.First(arg => arg.checkRun.DatabaseId == CheckRunId);
111120

112-
CheckRunName = checkRunModel.Name;
113-
Annotations = checkRunModel.Annotations
114-
.Select(model => new PullRequestAnnotationItemViewModel(model))
121+
CheckSuiteName = checkSuiteRun.checkSuite.ApplicationName;
122+
CheckRunName = checkSuiteRun.checkRun.Name;
123+
Annotations = checkSuiteRun.checkRun.Annotations
124+
.Select(annotation => new PullRequestAnnotationItemViewModel(annotation))
115125
.ToArray();
116126
}
117127
finally

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel.Composition;
44
using System.Linq;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Threading.Tasks;
33
using GitHub.Models;
44
using ReactiveUI;
@@ -54,6 +54,11 @@ public interface IPullRequestAnnotationsViewModel : IPanePageViewModel
5454
/// </summary>
5555
IReadOnlyList<IPullRequestAnnotationItemViewModel> Annotations { get; }
5656

57+
/// <summary>
58+
/// Name of the Check Suite.
59+
/// </summary>
60+
string CheckSuiteName { get; }
61+
5762
/// <summary>
5863
/// Initializes the view model.
5964
/// </summary>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Windows.Media.Imaging;
33
using GitHub.Models;
44
using ReactiveUI;

0 commit comments

Comments
 (0)