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

Commit 09580ef

Browse files
committed
Remove the URL tab
1 parent 2a7d2fc commit 09580ef

File tree

8 files changed

+8
-123
lines changed

8 files changed

+8
-123
lines changed

src/GitHub.App/SampleData/Dialog/Clone/RepositoryCloneViewModelDesigner.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public RepositoryCloneViewModelDesigner()
2323
public IObservable<object> Done => null;
2424
public IRepositorySelectViewModel GitHubTab { get; }
2525
public IRepositorySelectViewModel EnterpriseTab { get; }
26-
public IRepositoryUrlViewModel UrlTab { get; }
2726
public ReactiveCommand<Unit, Unit> Browse { get; }
2827
public ReactiveCommand<Unit, CloneDialogResult> Clone { get; }
2928

src/GitHub.App/Services/DialogService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, str
5151
var viewModel = factory.CreateViewModel<IRepositoryCloneViewModel>();
5252
if (url != null)
5353
{
54-
viewModel.UrlTab.Url = url;
54+
viewModel.GitHubTab.Filter = url;
55+
viewModel.EnterpriseTab.Filter = url;
5556
}
5657

5758
if (connection != null)

src/GitHub.App/ViewModels/Dialog/Clone/RepositoryCloneViewModel.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ public RepositoryCloneViewModel(
4242
IUsageService usageService,
4343
IUsageTracker usageTracker,
4444
IRepositorySelectViewModel gitHubTab,
45-
IRepositorySelectViewModel enterpriseTab,
46-
IRepositoryUrlViewModel urlTab)
45+
IRepositorySelectViewModel enterpriseTab)
4746
{
4847
this.os = os;
4948
this.connectionManager = connectionManager;
@@ -54,8 +53,7 @@ public RepositoryCloneViewModel(
5453

5554
GitHubTab = gitHubTab;
5655
EnterpriseTab = enterpriseTab;
57-
UrlTab = urlTab;
58-
tabs = new IRepositoryCloneTabViewModel[] { GitHubTab, EnterpriseTab, UrlTab };
56+
tabs = new IRepositoryCloneTabViewModel[] { GitHubTab, EnterpriseTab };
5957

6058
var repository = this.WhenAnyValue(x => x.SelectedTabIndex)
6159
.SelectMany(x => tabs[x].WhenAnyValue(tab => tab.Repository));
@@ -88,7 +86,6 @@ public RepositoryCloneViewModel(
8886

8987
public IRepositorySelectViewModel GitHubTab { get; }
9088
public IRepositorySelectViewModel EnterpriseTab { get; }
91-
public IRepositoryUrlViewModel UrlTab { get; }
9289

9390
public string Path
9491
{
@@ -137,12 +134,6 @@ public async Task InitializeAsync(IConnection connection)
137134

138135
this.WhenAnyValue(x => x.SelectedTabIndex).Subscribe(x => tabs[x].Activate().Forget());
139136

140-
// When a clipboard URL has been set, show the URL tab by default
141-
if (!string.IsNullOrEmpty(UrlTab.Url))
142-
{
143-
SelectedTabIndex = 2;
144-
}
145-
146137
switch (SelectedTabIndex)
147138
{
148139
case 0:

src/GitHub.App/ViewModels/Dialog/Clone/RepositoryUrlViewModel.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositoryCloneViewModel.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ public interface IRepositoryCloneViewModel : IDialogContentViewModel, IConnectio
2020
/// </summary>
2121
IRepositorySelectViewModel EnterpriseTab { get; }
2222

23-
/// <summary>
24-
/// Gets the view model for the URL tab.
25-
/// </summary>
26-
IRepositoryUrlViewModel UrlTab { get; }
27-
2823
/// <summary>
2924
/// Gets the path to clone the repository to.
3025
/// </summary>

src/GitHub.Exports.Reactive/ViewModels/Dialog/Clone/IRepositoryUrlViewModel.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/GitHub.VisualStudio.UI/Views/Dialog/Clone/RepositoryCloneView.xaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<d:DesignData.DataContext>
1111
<ghfvs:RepositoryCloneViewModelDesigner/>
1212
</d:DesignData.DataContext>
13-
13+
1414
<UserControl.Resources>
1515
<ResourceDictionary>
1616
<ResourceDictionary.MergedDictionaries>
@@ -70,21 +70,6 @@
7070
Visibility="{Binding EnterpriseTab.IsEnabled, Converter={ghfvs:BooleanToVisibilityConverter}}">
7171
<local:SelectPageView DataContext="{Binding EnterpriseTab}"/>
7272
</TabItem>
73-
<TabItem Header="URL" Style="{DynamicResource LightModalViewTabItem}">
74-
<DockPanel DataContext="{Binding UrlTab}"
75-
LastChildFill="False"
76-
Margin="8">
77-
<TextBlock DockPanel.Dock="Top">
78-
Repository URL or GitHub username and repository
79-
<LineBreak/>
80-
(<Run Background="#66d3d3d3" FontFamily="Consolas">hubot/cool-repo</Run>)
81-
</TextBlock>
82-
<ghfvs:PromptTextBox DockPanel.Dock="Top"
83-
Margin="0 4"
84-
PromptText="URL or username/repository"
85-
Text="{Binding Url, UpdateSourceTrigger=PropertyChanged}"/>
86-
</DockPanel>
87-
</TabItem>
8873
</TabControl>
8974
</DockPanel>
9075
</UserControl>

test/GitHub.App.UnitTests/ViewModels/Dialog/Clone/RepositoryCloneViewModelTests.cs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ public async Task GitHubPage_Is_Initialized()
3939
[TestCase("https://enterprise.com", null, false, 1)]
4040
[TestCase("https://github.com", null, true, 0, Description = "Show URL tab for GitHub connections")]
4141
[TestCase("https://enterprise.com", null, true, 1, Description = "Show URL tab for Enterprise connections")]
42-
[TestCase("https://github.com", "https://github.com/github/visualstudio", false, 2)]
43-
[TestCase("https://enterprise.com", "https://enterprise.com/owner/repo", false, 2)]
42+
[TestCase("https://github.com", "https://github.com/github/visualstudio", false, 0)]
43+
[TestCase("https://enterprise.com", "https://enterprise.com/owner/repo", false, 1)]
4444
public async Task Default_SelectedTabIndex_For_Group(string address, string clipboardUrl, bool isGroupA, int expectTabIndex)
4545
{
4646
var cm = CreateConnectionManager(address);
4747
var connection = cm.Connections[0];
4848
var usageService = CreateUsageService(isGroupA);
4949
var target = CreateTarget(connectionManager: cm, usageService: usageService);
50-
target.UrlTab.Url = clipboardUrl;
5150

5251
await target.InitializeAsync(connection);
5352

@@ -404,7 +403,6 @@ static RepositoryCloneViewModel CreateTarget(
404403
IRepositorySelectViewModel gitHubTab = null,
405404
IRepositorySelectViewModel enterpriseTab = null,
406405
IGitService gitService = null,
407-
IRepositoryUrlViewModel urlTab = null,
408406
string defaultClonePath = defaultPath)
409407
{
410408
os = os ?? Substitute.For<IOperatingSystem>();
@@ -415,7 +413,6 @@ static RepositoryCloneViewModel CreateTarget(
415413
gitHubTab = gitHubTab ?? CreateSelectViewModel();
416414
enterpriseTab = enterpriseTab ?? CreateSelectViewModel();
417415
gitService = gitService ?? CreateGitService(true, "https://github.com/owner/repo");
418-
urlTab = urlTab ?? CreateRepositoryUrlViewModel();
419416

420417
return new RepositoryCloneViewModel(
421418
os,
@@ -425,8 +422,7 @@ static RepositoryCloneViewModel CreateTarget(
425422
usageService,
426423
usageTracker,
427424
gitHubTab,
428-
enterpriseTab,
429-
urlTab);
425+
enterpriseTab);
430426
}
431427

432428
private static IGitService CreateGitService(bool repositoryExists, UriString remoteUrl)
@@ -471,13 +467,5 @@ static UriString CreateGitHubUrl(string owner, string repo)
471467
{
472468
return new UriString($"https://github.com/{owner}/{repo}");
473469
}
474-
475-
static IRepositoryUrlViewModel CreateRepositoryUrlViewModel()
476-
{
477-
var repositoryUrlViewModel = Substitute.For<IRepositoryUrlViewModel>();
478-
repositoryUrlViewModel.Repository.Returns(null as RepositoryModel);
479-
repositoryUrlViewModel.Url.Returns(string.Empty);
480-
return repositoryUrlViewModel;
481-
}
482470
}
483471
}

0 commit comments

Comments
 (0)