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

Commit 0d81d7c

Browse files
Adding additional Check Run fields
1 parent cb3e082 commit 0d81d7c

File tree

6 files changed

+59
-8
lines changed

6 files changed

+59
-8
lines changed

src/GitHub.App/SampleData/PullRequestAnnotationsViewModelDesigner.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using GitHub.Models;
66
using GitHub.ViewModels.GitHubPane;
77
using ReactiveUI;
8-
using ReactiveUI.Legacy;
98

109
namespace GitHub.SampleData
1110
{
@@ -19,6 +18,9 @@ public sealed class PullRequestAnnotationsViewModelDesigner : PanePageViewModelB
1918
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; }
2019
public string PullRequestTitle { get; } = "Fixing stuff in this PR";
2120
public string CheckSuiteName { get; } = "Awesome Check Suite";
21+
public string CheckRunSummary { get; } = "Awesome Check Run Summary";
22+
public string CheckRunText { get; } = "Awesome Check Run Text";
23+
2224
public IReadOnlyDictionary<string, IPullRequestAnnotationItemViewModel[]> AnnotationsDictionary { get; }
2325
= new Dictionary<string, IPullRequestAnnotationItemViewModel[]>
2426
{

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class PullRequestAnnotationsViewModel : PanePageViewModelBase, IPullReque
2222
string checkSuiteName;
2323
string checkRunName;
2424
IReadOnlyDictionary<string, IPullRequestAnnotationItemViewModel[]> annotationsDictionary;
25+
string checkRunSummary;
26+
string checkRunText;
2527

2628
/// <summary>
2729
/// Initializes a new instance of the <see cref="PullRequestAnnotationsViewModel"/> class.
@@ -99,6 +101,21 @@ public string CheckRunName
99101
private set { this.RaiseAndSetIfChanged(ref checkRunName, value); }
100102
}
101103

104+
/// <inheritdoc/>
105+
public string CheckRunSummary
106+
{
107+
get { return checkRunSummary; }
108+
private set { this.RaiseAndSetIfChanged(ref checkRunSummary, value); }
109+
}
110+
111+
/// <inheritdoc/>
112+
public string CheckRunText
113+
{
114+
get { return checkRunText; }
115+
private set { this.RaiseAndSetIfChanged(ref checkRunText, value); }
116+
}
117+
118+
/// <inheritdoc/>
102119
public IReadOnlyDictionary<string, IPullRequestAnnotationItemViewModel[]> AnnotationsDictionary
103120
{
104121
get { return annotationsDictionary; }
@@ -120,6 +137,8 @@ void Load(PullRequestDetailModel pullRequest)
120137

121138
CheckSuiteName = checkSuiteRun.checkSuite.ApplicationName;
122139
CheckRunName = checkSuiteRun.checkRun.Name;
140+
CheckRunSummary = checkSuiteRun.checkRun.Summary;
141+
CheckRunText = checkSuiteRun.checkRun.Text;
123142

124143
var changedFiles = new HashSet<string>(session.PullRequest.ChangedFiles.Select(model => model.FileName));
125144

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ public interface IPullRequestAnnotationsViewModel : IPanePageViewModel
5656
/// </summary>
5757
string CheckSuiteName { get; }
5858

59+
/// <summary>
60+
/// Summary of the Check Run
61+
/// </summary>
62+
string CheckRunSummary { get; }
63+
64+
/// <summary>
65+
/// Text of the Check Run
66+
/// </summary>
67+
string CheckRunText { get; }
68+
5969
/// <summary>
6070
/// Gets a dictionary of annotations by file path.
6171
/// </summary>

src/GitHub.Exports/Models/CheckRunModel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ namespace GitHub.Models
88
/// </summary>
99
public class CheckRunModel
1010
{
11+
/// <summary>
12+
/// The id of a Check Run.
13+
/// </summary>
14+
public string Id { get; set; }
15+
1116
/// <summary>
1217
/// The conclusion of the check run.
1318
/// </summary>
@@ -44,8 +49,8 @@ public class CheckRunModel
4449
public string Summary { get; set; }
4550

4651
/// <summary>
47-
/// The database id of a Check Run.
52+
/// The detail of a Check Run.
4853
/// </summary>
49-
public string Id { get; set; }
54+
public string Text { get; set; }
5055
}
5156
}

src/GitHub.InlineReviews/Services/PullRequestSessionService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,7 @@ async Task<LastCommitAdapter> GetPullRequestLastCommitAdapter(HostAddress addres
785785
Name = run.Name,
786786
DetailsUrl = run.Permalink,
787787
Summary = run.Summary,
788+
Text = run.Text,
788789
Annotations = run.Annotations(null, null, null, null).AllPages()
789790
.Select(annotation => new CheckRunAnnotationModel
790791
{

src/GitHub.VisualStudio.UI/Views/GitHubPane/PullRequestAnnotationsView.xaml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@
4545
Margin="0"
4646
Text="{Binding PullRequestTitle}"
4747
TextWrapping="Wrap"/>
48+
49+
<markdig:MarkdownViewer FontFamily="Consolas"
50+
Visibility="{Binding CheckRunSummary, Converter={ghfvs:NullOrWhitespaceToVisibilityConverter}}"
51+
Markdown="{Binding CheckRunSummary}" />
52+
53+
<TextBlock FontFamily="Consolas"
54+
Foreground="{DynamicResource VsBrush.GrayText}"
55+
Visibility="{Binding CheckRunText, Converter={ghfvs:NullOrWhitespaceToVisibilityConverter}}">
56+
<Run Text="{Binding CheckRunText, Mode=OneWay}"/>
57+
</TextBlock>
58+
4859
<Rectangle Fill="{DynamicResource GitHubHeaderSeparatorBrush}" Height="1" Margin="-8 4"/>
4960

5061
<ItemsControl Margin="-4 0" ItemsSource="{Binding AnnotationsDictionary}">
@@ -72,24 +83,27 @@
7283
</StackPanel>
7384

7485
<StackPanel Margin="8,0,0,0" Grid.Column="1">
75-
<TextBlock FontWeight="SemiBold" Grid.Row="0">
86+
<TextBlock FontWeight="SemiBold">
7687
<Run Text="{Binding Annotation.Title, Mode=OneWay}"/>
7788
</TextBlock>
7889

79-
<TextBlock FontFamily="Consolas" Foreground="{DynamicResource VsBrush.GrayText}" Grid.Row="1" Visibility="{Binding IsFileInPullRequest, Converter={ghfvs:BooleanToVisibilityConverter}}">
90+
<TextBlock FontFamily="Consolas"
91+
Foreground="{DynamicResource VsBrush.GrayText}"
92+
Visibility="{Binding IsFileInPullRequest, Converter={ghfvs:BooleanToVisibilityConverter}}">
8093
<Hyperlink Command="{Binding OpenAnnotation}">
8194
<Run Text="Line" />
8295
<Run Text="{Binding LineDescription, Mode=OneWay}"/>
8396
</Hyperlink>
8497
</TextBlock>
8598

86-
<TextBlock FontFamily="Consolas" Foreground="{DynamicResource VsBrush.GrayText}" Grid.Row="1" Visibility="{Binding IsFileInPullRequest, Converter={ghfvs:BooleanToInverseVisibilityConverter}}">
99+
<TextBlock FontFamily="Consolas"
100+
Foreground="{DynamicResource VsBrush.GrayText}"
101+
Visibility="{Binding IsFileInPullRequest, Converter={ghfvs:BooleanToInverseVisibilityConverter}}">
87102
<Run Text="Line" />
88103
<Run Text="{Binding LineDescription, Mode=OneWay}"/>
89104
</TextBlock>
90105

91-
<markdig:MarkdownViewer Grid.Column="1" Grid.Row="2"
92-
FontFamily="Consolas" Markdown="{Binding Annotation.Message}" />
106+
<markdig:MarkdownViewer FontFamily="Consolas" Markdown="{Binding Annotation.Message}" />
93107
</StackPanel>
94108
</Grid>
95109
</DataTemplate>

0 commit comments

Comments
 (0)