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

Functionality to support Check Suites API #1798

Merged
merged 28 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c2d2cee
Revert "Removing functionality to read CheckSuites"
StanleyGoldman Jul 24, 2018
949591a
Merge remote-tracking branch 'origin/master' into features/check-suites
StanleyGoldman Aug 10, 2018
955a23f
Updating Octokit.GraphQL and making adjustments
StanleyGoldman Aug 10, 2018
b16b5ea
Fixing Checks API support
StanleyGoldman Aug 10, 2018
ba64302
Updating link
StanleyGoldman Aug 13, 2018
f3978a9
Adding comments
StanleyGoldman Aug 13, 2018
ec9cfd5
Merge branch 'master' into features/check-suites
StanleyGoldman Aug 13, 2018
34c719a
Tying in metrics
StanleyGoldman Aug 13, 2018
8450327
Merge remote-tracking branch 'origin/master' into features/check-suites
StanleyGoldman Aug 13, 2018
74e96f3
Merge branch 'master' into features/check-suites
StanleyGoldman Aug 14, 2018
b8345d9
Fixing nits
StanleyGoldman Aug 14, 2018
2603075
Using CheckRuns to compute pull request status
StanleyGoldman Aug 15, 2018
363f32a
Adding methods to convert enumerations
StanleyGoldman Aug 15, 2018
8e40df8
Adding an additional status state check
StanleyGoldman Aug 15, 2018
866992f
FromGraphQlExtensions class
StanleyGoldman Aug 15, 2018
0036c62
Fixing error that occurs if there are no statuses configured
StanleyGoldman Aug 15, 2018
8cb7edc
Fixing display
StanleyGoldman Aug 16, 2018
3a82548
Fixing column indexes
StanleyGoldman Aug 16, 2018
1d09284
Conditonally loading CheckSuites for only github.com
StanleyGoldman Aug 16, 2018
93975e7
DetailsUrl can be null
StanleyGoldman Aug 20, 2018
d938211
Caching the enterprise query correctly
StanleyGoldman Aug 20, 2018
42a2a80
Fixing DetailsUrl
StanleyGoldman Aug 20, 2018
132ac15
Removing AvatarUrl
StanleyGoldman Aug 20, 2018
f0390f6
Didn't completely remove AvatarUrl
StanleyGoldman Aug 20, 2018
812b292
Missing null check
StanleyGoldman Aug 21, 2018
26a00c1
Removing unused property
StanleyGoldman Aug 21, 2018
c6a8474
Merge branch 'master' into features/check-suites
StanleyGoldman Aug 21, 2018
caaf122
Merge branch 'master' into features/check-suites
StanleyGoldman Aug 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added lib/Octokit.GraphQL.0.1.1-beta.nupkg
Binary file not shown.
8 changes: 4 additions & 4 deletions src/GitHub.Api/GitHub.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Octokit.GraphQL, Version=0.1.0.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.0-beta\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
<Reference Include="Octokit.GraphQL, Version=0.1.1.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.1-beta\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
</Reference>
<Reference Include="Octokit.GraphQL.Core, Version=0.1.0.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.0-beta\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
<Reference Include="Octokit.GraphQL.Core, Version=0.1.1.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.1-beta\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\..\packages\Serilog.2.5.0\lib\net46\Serilog.dll</HintPath>
Expand Down
3 changes: 2 additions & 1 deletion src/GitHub.Api/GraphQLKeychainCredentialStore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using GitHub.Extensions;
using GitHub.Primitives;
Expand All @@ -23,7 +24,7 @@ public GraphQLKeychainCredentialStore(IKeychain keychain, HostAddress address)
this.address = address;
}

public async Task<string> GetCredentials()
public async Task<string> GetCredentials(CancellationToken cancellationToken = default)
{
var userPass = await keychain.Load(address).ConfigureAwait(false);
return userPass?.Item2;
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.Api/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="Octokit.GraphQL" version="0.1.0-beta" targetFramework="net461" />
<package id="Octokit.GraphQL" version="0.1.1-beta" targetFramework="net461" />
<package id="Serilog" version="2.5.0" targetFramework="net461" />
</packages>
14 changes: 8 additions & 6 deletions src/GitHub.App/GitHub.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Octokit.GraphQL, Version=0.1.0.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.0-beta\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
<Reference Include="Octokit.GraphQL, Version=0.1.1.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.1-beta\lib\netstandard1.1\Octokit.GraphQL.dll</HintPath>
</Reference>
<Reference Include="Octokit.GraphQL.Core, Version=0.1.0.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.0-beta\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
<Reference Include="Octokit.GraphQL.Core, Version=0.1.1.0, Culture=neutral, PublicKeyToken=0be8860aee462442, processorArchitecture=MSIL">
<HintPath>..\..\packages\Octokit.GraphQL.0.1.1-beta\lib\netstandard1.1\Octokit.GraphQL.Core.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down Expand Up @@ -229,6 +229,7 @@
<Compile Include="SampleData\PullRequestUserReviewsViewModelDesigner.cs" />
<Compile Include="SampleData\UserFilterViewModelDesigner.cs" />
<Compile Include="Services\EnterpriseCapabilitiesService.cs" />
<Compile Include="Services\FromGraphQlExtensions.cs" />
<Compile Include="Services\GitHubContextService.cs" />
<Compile Include="Services\GlobalConnection.cs" />
<Compile Include="Services\RepositoryForkService.cs" />
Expand Down Expand Up @@ -259,6 +260,7 @@
<Compile Include="ViewModels\GitHubPane\NavigationViewModel.cs" />
<Compile Include="ViewModels\GitHubPane\GitHubPaneViewModel.cs" />
<Compile Include="SampleData\PullRequestCheckViewModelDesigner.cs" />
<Compile Include="ViewModels\GitHubPane\PullRequestCheckType.cs" />
<Compile Include="ViewModels\GitHubPane\PullRequestFilesViewModel.cs" />
<Compile Include="ViewModels\GitHubPane\PullRequestListItemViewModel.cs" />
<Compile Include="ViewModels\GitHubPane\PullRequestListViewModel.cs" />
Expand Down Expand Up @@ -416,8 +418,8 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.en-US.resx">
<DependentUpon>Resources.resx</DependentUpon>
</EmbeddedResource>
<DependentUpon>Resources.resx</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public sealed class PullRequestCheckViewModelDesigner : ViewModelBase, IPullRequ

public Uri DetailsUrl { get; set; } = new Uri("http://github.com");

public string AvatarUrl { get; set; } = "https://avatars1.githubusercontent.com/u/417571?s=88&v=4";

public BitmapImage Avatar { get; set; } = null;

public ReactiveCommand<object> OpenDetailsUrl { get; set; } = null;
}
}
105 changes: 105 additions & 0 deletions src/GitHub.App/Services/FromGraphQlExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using System;
using GitHub.Models;
using Octokit.GraphQL.Model;
using CheckConclusionState = GitHub.Models.CheckConclusionState;
using CheckStatusState = GitHub.Models.CheckStatusState;
using PullRequestReviewState = GitHub.Models.PullRequestReviewState;
using StatusState = GitHub.Models.StatusState;

namespace GitHub.Services
{
public static class FromGraphQlExtensions
{
public static CheckConclusionState? FromGraphQl(this Octokit.GraphQL.Model.CheckConclusionState? value)
{
switch (value)
{
case null:
return null;
case Octokit.GraphQL.Model.CheckConclusionState.ActionRequired:
return CheckConclusionState.ActionRequired;
case Octokit.GraphQL.Model.CheckConclusionState.TimedOut:
return CheckConclusionState.TimedOut;
case Octokit.GraphQL.Model.CheckConclusionState.Cancelled:
return CheckConclusionState.Cancelled;
case Octokit.GraphQL.Model.CheckConclusionState.Failure:
return CheckConclusionState.Failure;
case Octokit.GraphQL.Model.CheckConclusionState.Success:
return CheckConclusionState.Success;
case Octokit.GraphQL.Model.CheckConclusionState.Neutral:
return CheckConclusionState.Neutral;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}

public static PullRequestStateEnum FromGraphQl(this PullRequestState value)
{
switch (value)
{
case PullRequestState.Open:
return PullRequestStateEnum.Open;
case PullRequestState.Closed:
return PullRequestStateEnum.Closed;
case PullRequestState.Merged:
return PullRequestStateEnum.Merged;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}

public static StatusState FromGraphQl(this Octokit.GraphQL.Model.StatusState value)
{
switch (value)
{
case Octokit.GraphQL.Model.StatusState.Expected:
return StatusState.Expected;
case Octokit.GraphQL.Model.StatusState.Error:
return StatusState.Error;
case Octokit.GraphQL.Model.StatusState.Failure:
return StatusState.Failure;
case Octokit.GraphQL.Model.StatusState.Pending:
return StatusState.Pending;
case Octokit.GraphQL.Model.StatusState.Success:
return StatusState.Success;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}

public static CheckStatusState FromGraphQl(this Octokit.GraphQL.Model.CheckStatusState value)
{
switch (value)
{
case Octokit.GraphQL.Model.CheckStatusState.Queued:
return CheckStatusState.Queued;
case Octokit.GraphQL.Model.CheckStatusState.InProgress:
return CheckStatusState.InProgress;
case Octokit.GraphQL.Model.CheckStatusState.Completed:
return CheckStatusState.Completed;
case Octokit.GraphQL.Model.CheckStatusState.Requested:
return CheckStatusState.Requested;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}

public static GitHub.Models.PullRequestReviewState FromGraphQl(this Octokit.GraphQL.Model.PullRequestReviewState value)
{
switch (value) {
case Octokit.GraphQL.Model.PullRequestReviewState.Pending:
return PullRequestReviewState.Pending;
case Octokit.GraphQL.Model.PullRequestReviewState.Commented:
return PullRequestReviewState.Commented;
case Octokit.GraphQL.Model.PullRequestReviewState.Approved:
return PullRequestReviewState.Approved;
case Octokit.GraphQL.Model.PullRequestReviewState.ChangesRequested:
return PullRequestReviewState.ChangesRequested;
case Octokit.GraphQL.Model.PullRequestReviewState.Dismissed:
return PullRequestReviewState.Dismissed;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
}
Loading