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

Commit 98ff88f

Browse files
authored
Merge pull request #338 from github/fixes/325-create-pr-cancel-button
Enable "Cancel" button in PR creation view
2 parents 70613f3 + 1fae823 commit 98ff88f

17 files changed

+36
-37
lines changed

src/GitHub.App/SampleData/LoggedOutViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace GitHub.SampleData
1010
{
1111
[ExcludeFromCodeCoverage]
12-
public class LoggedOutViewModelDesigner : BaseViewModelDesigner, IViewModel
12+
public class LoggedOutViewModelDesigner : BaseViewModel, IViewModel
1313
{
1414
public LoggedOutViewModelDesigner()
1515
{

src/GitHub.App/SampleData/PullRequestCreationViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace GitHub.SampleData
66
{
77
[ExcludeFromCodeCoverage]
8-
public class PullRequestCreationViewModelDesigner : BaseViewModelDesigner, IPullRequestCreationViewModel
8+
public class PullRequestCreationViewModelDesigner : BaseViewModel, IPullRequestCreationViewModel
99
{
1010
public PullRequestCreationViewModelDesigner()
1111
{

src/GitHub.App/SampleData/PullRequestDetailViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace GitHub.SampleData
55
{
66
[ExcludeFromCodeCoverage]
7-
public class PullRequestDetailViewModelDesigner : BaseViewModelDesigner, IPullRequestDetailViewModel
7+
public class PullRequestDetailViewModelDesigner : BaseViewModel, IPullRequestDetailViewModel
88
{
99
public PullRequestDetailViewModelDesigner()
1010
{

src/GitHub.App/SampleData/PullRequestListViewModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace GitHub.SampleData
1414
{
1515
[ExcludeFromCodeCoverage]
16-
public class PullRequestListViewModelDesigner : BaseViewModelDesigner, IPullRequestListViewModel
16+
public class PullRequestListViewModelDesigner : BaseViewModel, IPullRequestListViewModel
1717
{
1818
public PullRequestListViewModelDesigner()
1919
{

src/GitHub.App/SampleData/SampleViewModels.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,7 @@
2222
namespace GitHub.SampleData
2323
{
2424
[ExcludeFromCodeCoverage]
25-
public class BaseViewModelDesigner : ReactiveObject, IViewModel
26-
{
27-
public ICommand Cancel { get; set; }
28-
public bool IsShowing { get; set; }
29-
public string Title { get; set; }
30-
31-
public void Initialize(ViewWithData data)
32-
{ }
33-
}
34-
35-
[ExcludeFromCodeCoverage]
36-
public class RepositoryCreationViewModelDesigner : BaseViewModelDesigner, IRepositoryCreationViewModel
25+
public class RepositoryCreationViewModelDesigner : BaseViewModel, IRepositoryCreationViewModel
3726
{
3827
public RepositoryCreationViewModelDesigner()
3928
{
@@ -366,7 +355,7 @@ public UriString GenerateUrl(string path = null, int startLine = -1, int endLine
366355
public void Refresh() { }
367356
}
368357

369-
public class RepositoryCloneViewModelDesigner : BaseViewModelDesigner, IRepositoryCloneViewModel
358+
public class RepositoryCloneViewModelDesigner : BaseViewModel, IRepositoryCloneViewModel
370359
{
371360
public RepositoryCloneViewModelDesigner()
372361
{

src/GitHub.App/ViewModels/BaseViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@
55

66
namespace GitHub.ViewModels
77
{
8-
public class BaseViewModel : ReactiveObject, IViewModel
8+
public class BaseViewModel : ReactiveObject, IReactiveViewModel
99
{
1010
protected ObservableAsPropertyHelper<bool> isShowing;
1111

12+
public BaseViewModel()
13+
{
14+
CancelCommand = ReactiveCommand.Create();
15+
}
16+
1217
public ReactiveCommand<object> CancelCommand { get; protected set; }
1318
public ICommand Cancel { get { return CancelCommand; } }
1419

src/GitHub.App/ViewModels/LoginControlViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public LoginControlViewModel(
4848
AuthenticationResults = Observable.Merge(
4949
loginToGitHubViewModel.Login,
5050
EnterpriseLogin.Login);
51-
CancelCommand = ReactiveCommand.Create();
5251
}
5352

5453
ILoginToGitHubViewModel github;

src/GitHub.App/ViewModels/PullRequestCreationViewModel.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
using GitHub.Exports;
2-
using NullGuard;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.ComponentModel.Composition;
6-
using System.Globalization;
7-
using System.Linq;
8-
using System.Text;
9-
using System.Threading.Tasks;
1+
using System.ComponentModel.Composition;
2+
using GitHub.Exports;
103

114
namespace GitHub.ViewModels
125
{

src/GitHub.App/ViewModels/PullRequestListViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public PullRequestListViewModel(IRepositoryHost repositoryHost, ISimpleRepositor
4141
this.repositoryHost = repositoryHost;
4242
this.repository = repository;
4343

44-
CancelCommand = ReactiveCommand.Create();
4544
openPullRequestCommand = ReactiveCommand.Create();
4645
openPullRequestCommand.Subscribe(_ =>
4746
{

src/GitHub.App/ViewModels/TwoFactorDialogViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public TwoFactorDialogViewModel(
4242
(code, busy) => !string.IsNullOrEmpty(code.Value) && code.Value.Length == 6 && !busy.Value);
4343

4444
OkCommand = ReactiveCommand.Create(canVerify);
45-
CancelCommand = ReactiveCommand.Create();
4645
NavigateLearnMore = ReactiveCommand.Create();
4746
NavigateLearnMore.Subscribe(x => browser.OpenUrl(GitHubUrls.TwoFactorLearnMore));
4847
//TODO: ShowHelpCommand.Subscribe(x => browser.OpenUrl(twoFactorHelpUri));

0 commit comments

Comments
 (0)