-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Pull Requests w/ Statuses #1788
Conversation
# Conflicts: # src/GitHub.VisualStudio/Views/GitHubPane/PullRequestListItemView.xaml
c883707 to
ae00f33
Compare
3ca835c to
68c0064
Compare
68c0064 to
b086078
Compare
722abbf to
bade798
Compare
Attempting to use the view locator correctly
grokys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great so far! A few comments.
| } | ||
|
|
||
| PullRequestChecksEnum checks; | ||
| public PullRequestChecksEnum Checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this actually needs to be added to PullRequestModel - this class is now obsolete (I should really have added an [Obsolete] attribute to it) and is only used in the PR creation view, from where I hope to soon remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see...
| Merged, | ||
| } | ||
|
|
||
| public enum PullRequestChecksEnum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be called PullRequestCheckState - the Enum suffix on PullRequestStateEnum was a hack and is only still present because I'm in the process of removing PullRequestModel.
| } | ||
| } | ||
|
|
||
| public class StatusSummaryModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this model class is only used within PullRequestService then it should be a private inner class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| { | ||
| return pullRequest.Statuses?.Select(model => | ||
| { | ||
| var statusStateEnum = model.State; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the additional variable here? It's only used once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
| mc:Ignorable="d" d:DesignWidth="600"> | ||
|
|
||
| <d:DesignData.DataContext> | ||
| <vm:PullRequestCheckViewModel Title="continuous-integration/appveyor/branch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting an error here:
The type "PullRequestCheckViewModel" does not include any accessible constructors.
Probably need a PullRequestCheckViewModelDesigner class.
| @@ -0,0 +1,11 @@ | |||
| namespace GitHub.Models | |||
| { | |||
| public enum StatusStateEnum | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the Enum suffix isn't needed.
| ReactiveCommand<object> OpenDetailsUrl { get; } | ||
| } | ||
|
|
||
| public enum PullRequestCheckStatusEnum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the Enum suffix isn't necessary.
| public string Title | ||
| { | ||
| get { return title; } | ||
| set { this.RaiseAndSetIfChanged(ref title, value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these properties change? If not then they shouldn't be settable and don't need to raise property changed events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't change, but they are being set here...
VisualStudio/src/GitHub.App/ViewModels/GitHubPane/PullRequestCheckViewModel.cs
Lines 54 to 62 in 14d5eca
| var pullRequestCheckViewModel = viewViewModelFactory.CreateViewModel<IPullRequestCheckViewModel>(); | |
| pullRequestCheckViewModel.Title = model.Context; | |
| pullRequestCheckViewModel.Description = model.Description; | |
| pullRequestCheckViewModel.Status = checkStatus; | |
| pullRequestCheckViewModel.DetailsUrl = new Uri(model.TargetUrl); | |
| pullRequestCheckViewModel.AvatarUrl = model.AvatarUrl ?? DefaultAvatar; | |
| pullRequestCheckViewModel.Avatar = model.AvatarUrl != null | |
| ? new BitmapImage(new Uri(model.AvatarUrl)) | |
| : AvatarProvider.CreateBitmapImage(DefaultAvatar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, but I see the point..
| /// <inheritdoc/> | ||
| public IActorViewModel Author { get; protected set; } | ||
|
|
||
| /// <inheritdoc/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not sure why I made these properties protected set - I think that was a mistake... I think I initially wrote this as a base class for both issues and PRs and then decided not to do that.
| bool refreshOnActivate; | ||
| Uri webUrl; | ||
| IDisposable sessionSubscription; | ||
| IViewViewModelFactory viewViewModelFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be readonly and placed at the top with the other services.
…s-pull-request-model-1
grokys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much there! I'm mainly nitpicking at this point ;) Also, some XML documentation might be nice for the new classes?
| using GitHub.Primitives; | ||
| using GitHub.VisualStudio.Helpers; | ||
| using System.Diagnostics; | ||
| using System.Collections.Generic; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Would be nice to completely remove the changes to these unchanged files to give a cleaner diff ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😸
| using GitHub.ViewModels.GitHubPane; | ||
| using ReactiveUI; | ||
|
|
||
| namespace GitHub.App.SampleData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace for this should simply be GitHub.SampleData.
| mc:Ignorable="d" d:DesignWidth="600"> | ||
|
|
||
| <d:DesignData.DataContext> | ||
| <sampleData1:PullRequestCheckViewModelDesigner /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If namespace for this class is changed as per previous comment you can use ghfvs: XML namespace.
| xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI" | ||
| xmlns:vm="clr-namespace:GitHub.ViewModels.GitHubPane;assembly=GitHub.App" | ||
| xmlns:cache="clr-namespace:GitHub.UI.Helpers;assembly=GitHub.UI" | ||
| xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this namespace isn't used.
|
|
||
| // Nullable for compatibility with old caches. | ||
| public PullRequestStateEnum? State { get; set; } | ||
| public PullRequestChecksState? Checks { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't used any more.
| @@ -0,0 +1,11 @@ | |||
| namespace GitHub.Models | |||
| { | |||
| public enum StatusState | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You renamed the enum but the filename is still StatusStateEnum.
|
|
||
| /// <inheritdoc/> | ||
| public int Number { get; protected set; } | ||
| public int Number { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing these :D
| mc:Ignorable="d" d:DesignWidth="600"> | ||
|
|
||
| <d:DesignData.DataContext> | ||
| <ghvs:PullRequestCheckViewModelDesigner /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood me here: I meant you should be able to use the existing ghfvs namespace for this.
Initially we set out to implement both the Statuses API and the Checks API, but OAuth applications do not currently have access to the Checks API and there are no major projects making use of the Statuses API.
Since Statuses are simpler Check Runs, we can implement Statuses with the anticipation of adding Check Runs.
https://developer.github.com/v3/repos/statuses/
Known issues
VisualStudioBrowserremainsnull.PullRequestCheckRunViewVisualStudio/src/GitHub.VisualStudio/Views/GitHubPane/PullRequestCheckView.xaml.cs
Lines 27 to 34 in 2f3e739
New Metrics
TODO
PullRequestDetailsView(@donokuda)User Interfaces