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

Conversation

@StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Jul 19, 2018

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

  • The icon will display the icon of the user that integrated the app, not the icon of the app itself
    • There is a bug in the GraphQL API where it is not possible to get the correct Application icon for Statuses. I thought I did everything for MEF to like me, but VisualStudioBrowser remains null.
    • We are waiting for API changes to make this data available
  • Trouble opening the Hyperlink from PullRequestCheckRunView
    [Import]
    IVisualStudioBrowser VisualStudioBrowser { get; set; }
    void DoOpenDetailsUrl()
    {
    var browser = VisualStudioBrowser;
    browser.OpenUrl(ViewModel.DetailsUrl);
    }

New Metrics

  • NumberOfPRDetailsOpenInGitHub: The number of times the "View on GitHub" link is clicked from a pull request detail view
  • NumberOfPRCheckStatusesOpenInGitHub: The number of times a Status API "Details" link is clicked

TODO

  • Need designs for the Checks dropdown on the PullRequestDetailsView (@donokuda)

User Interfaces

image

image

@StanleyGoldman StanleyGoldman force-pushed the stanley/check-suites-pull-request-model-1 branch from c883707 to ae00f33 Compare July 19, 2018 23:40
@StanleyGoldman StanleyGoldman changed the title Pull Requests w/ Checks & Suites WIP: Pull Requests w/ Checks & Suites Jul 20, 2018
@StanleyGoldman StanleyGoldman changed the title WIP: Pull Requests w/ Checks & Suites Pull Requests w/ Statuses Jul 24, 2018
@StanleyGoldman StanleyGoldman force-pushed the stanley/check-suites-pull-request-model-1 branch from 3ca835c to 68c0064 Compare July 24, 2018 18:27
@StanleyGoldman StanleyGoldman force-pushed the stanley/check-suites-pull-request-model-1 branch from 68c0064 to b086078 Compare July 24, 2018 18:29
@StanleyGoldman StanleyGoldman force-pushed the stanley/check-suites-pull-request-model-1 branch from 722abbf to bade798 Compare July 24, 2018 18:35
Copy link
Contributor

@grokys grokys left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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); }
Copy link
Contributor

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.

Copy link
Contributor Author

@StanleyGoldman StanleyGoldman Aug 7, 2018

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...

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);

Copy link
Contributor Author

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/>
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor

@grokys grokys left a 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;
Copy link
Contributor

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 ;)

Copy link
Contributor Author

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
Copy link
Contributor

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 />
Copy link
Contributor

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"
Copy link
Contributor

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; }
Copy link
Contributor

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
Copy link
Contributor

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; }
Copy link
Contributor

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 />
Copy link
Contributor

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.

@grokys grokys merged commit c3acc5d into master Aug 9, 2018
@StanleyGoldman StanleyGoldman deleted the stanley/check-suites-pull-request-model-1 branch December 13, 2018 14:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants