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

Commit 321d51e

Browse files
Adding CheckRunName
1 parent 3eddd4c commit 321d51e

File tree

6 files changed

+58
-29
lines changed

6 files changed

+58
-29
lines changed

src/GitHub.Exports.Reactive/Models/IInlineAnnotationModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public interface IInlineAnnotationModel
1212
string Message { get; }
1313
string FileName { get; }
1414
string LineDescription { get; }
15+
string CheckRunName { get; }
1516
}
1617
}

src/GitHub.Exports.Reactive/Models/InlineAnnotationModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public InlineAnnotationModel(CheckRunModel checkRun, CheckRunAnnotationModel ann
2323

2424
public int EndLine => annotation.EndLine;
2525

26+
public string CheckRunName => checkRun.Name;
27+
2628
public string Title => annotation.Title;
2729

2830
public CheckAnnotationLevel AnnotationLevel => annotation.AnnotationLevel.Value;

src/GitHub.Exports/Models/CheckRunModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CheckRunModel
2525

2626
/// <summary>The check run's annotations.</summary>
2727
public List<CheckRunAnnotationModel> Annotations { get; set; }
28-
28+
2929
/// <summary>The name of the check for this check run.</summary>
3030
public string Name { get; set; }
3131

src/GitHub.InlineReviews/SampleData/InlineReviewViewModelDesigner.cs

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,57 @@ class InlineReviewViewModelDesigner : IInlineReviewViewModel
1515
{
1616
public InlineReviewViewModelDesigner()
1717
{
18-
var checkRunModel = new CheckRunModel()
18+
19+
var checkRunAnnotationModel1 = new CheckRunAnnotationModel
20+
{
21+
AnnotationLevel = CheckAnnotationLevel.Failure,
22+
Filename = "SomeFile.cs",
23+
EndLine = 12,
24+
StartLine = 12,
25+
Message = "CS12345: ; expected",
26+
Title = "CS12345"
27+
};
28+
29+
var checkRunAnnotationModel2 = new CheckRunAnnotationModel
1930
{
20-
31+
AnnotationLevel = CheckAnnotationLevel.Warning,
32+
Filename = "SomeFile.cs",
33+
EndLine = 12,
34+
StartLine = 12,
35+
Message = "CS12345: ; expected",
36+
Title = "CS12345"
2137
};
2238

39+
var checkRunAnnotationModel3 = new CheckRunAnnotationModel
40+
{
41+
AnnotationLevel = CheckAnnotationLevel.Notice,
42+
Filename = "SomeFile.cs",
43+
EndLine = 12,
44+
StartLine = 12,
45+
Message = "CS12345: ; expected",
46+
Title = "CS12345"
47+
};
48+
49+
var checkRunModel =
50+
new CheckRunModel
51+
{
52+
Annotations = new List<CheckRunAnnotationModel> { checkRunAnnotationModel1, checkRunAnnotationModel2 },
53+
Name = "MSBuildLog Analyzer"
54+
};
55+
2356
Annotations = new[]
2457
{
25-
new InlineAnnotationViewModel(new InlineAnnotationModel(checkRunModel, new CheckRunAnnotationModel{ }))
58+
new InlineAnnotationViewModel(new InlineAnnotationModel(checkRunModel, checkRunAnnotationModel1)),
59+
new InlineAnnotationViewModel(new InlineAnnotationModel(checkRunModel, checkRunAnnotationModel2)),
60+
new InlineAnnotationViewModel(new InlineAnnotationModel(checkRunModel, checkRunAnnotationModel3)),
2661
};
62+
63+
Comments = new ObservableCollection<ICommentViewModel>(){new CommentViewModelDesigner()
64+
{
65+
Author = new ActorViewModel{ Login = "shana"},
66+
Body = "You can use a `CompositeDisposable` type here, it's designed to handle disposables in an optimal way (you can just call `Dispose()` on it and it will handle disposing everything it holds)."
67+
}};
68+
2769
}
2870

2971
public ObservableCollection<ICommentViewModel> Comments { get; }

src/GitHub.InlineReviews/Views/InlineAnnotationView.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
<ghfvs:OcticonImage Margin="0 0 0 0" MinWidth="20" Icon="search" Foreground="CornflowerBlue" Visibility="{Binding Model.AnnotationLevel, Converter={ghfvs:EqualsToVisibilityConverter Notice}}"/>
1919
<ghfvs:OcticonImage Margin="0 0 0 0" MinWidth="20" Icon="alert" Foreground="#f1c647" Visibility="{Binding Model.AnnotationLevel, Converter={ghfvs:EqualsToVisibilityConverter Warning}}"/>
2020
<ghfvs:OcticonImage Margin="0 0 0 0" MinWidth="20" Icon="x" Foreground="#cb2431" Visibility="{Binding Model.AnnotationLevel, Converter={ghfvs:EqualsToVisibilityConverter Failure}}"/>
21-
<TextBlock FontWeight="SemiBold" Margin="2 0">
22-
<Run Text="{Binding Model.Title, Mode=OneWay}"/>
23-
</TextBlock>
2421
</StackPanel>
22+
<TextBlock FontWeight="SemiBold" Margin="2 0">
23+
<Run Text="{Binding Model.CheckRunName, Mode=OneWay}"/>
24+
</TextBlock>
25+
<TextBlock FontWeight="SemiBold" Margin="2 0">
26+
<Run Text="{Binding Model.Title, Mode=OneWay}"/>
27+
</TextBlock>
2528
<TextBlock Margin="5 4 0 0">
2629
<Run Text="{Binding Model.FileName, Mode=OneWay}"/>
2730
<Run FontWeight="SemiBold" Text="{Binding Model.LineDescription, Mode=OneWay}"/>

src/GitHub.InlineReviews/Views/InlineReviewView.xaml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,9 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="clr-namespace:GitHub.InlineReviews.Views"
77
xmlns:sample="clr-namespace:GitHub.InlineReviews.SampleData"
8-
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
8+
mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="500">
99
<d:DesignProperties.DataContext>
10-
<x:Array Type="{x:Type sample:InlineReviewViewModelDesigner}">
11-
<sample:InlineReviewViewModelDesigner>
12-
<!-- <sample:CommentThreadViewModelDesigner.Comments>
13-
<sample:CommentViewModelDesigner>
14-
<sample:CommentViewModelDesigner.Body>
15-
I assume this doesn't do anything if our message isn't showing?
16-
</sample:CommentViewModelDesigner.Body>
17-
</sample:CommentViewModelDesigner>
18-
<sample:CommentViewModelDesigner>
19-
<sample:CommentViewModelDesigner.Body>
20-
Nope, does nothing! Also checked the logs.
21-
</sample:CommentViewModelDesigner.Body>
22-
</sample:CommentViewModelDesigner>
23-
<sample:CommentViewModelDesigner EditState="Placeholder">
24-
<sample:CommentViewModelDesigner.Body>
25-
Reply...
26-
</sample:CommentViewModelDesigner.Body>
27-
</sample:CommentViewModelDesigner>
28-
</sample:CommentThreadViewModelDesigner.Comments> -->
29-
</sample:InlineReviewViewModelDesigner>
30-
</x:Array>
10+
<sample:InlineReviewViewModelDesigner />
3111
</d:DesignProperties.DataContext>
3212

3313
<StackPanel Orientation="Vertical">
@@ -48,3 +28,4 @@
4828
</ItemsControl>
4929
</StackPanel>
5030
</UserControl>
31+

0 commit comments

Comments
 (0)