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

Commit ce036dd

Browse files
authored
Merge branch 'master' into spike/zero-impact-2019
2 parents be97369 + ba38028 commit ce036dd

File tree

48 files changed

+294
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+294
-108
lines changed

docs/getting-started/authenticating-to-github.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
1. In Visual Studio, select **Team Explorer** from the **View** menu.
66
<a href="images/view_team_explorer.png?raw=true" target="_blank"><div><img src="images/view_team_explorer.png" alt="Team Explorer in the view menu" width="500px"/></div></a>
7-
1. In the Team Explorer pane, click the **Manage Connectios** toolbar icon.
7+
1. In the Team Explorer pane, click the **Manage Connections** toolbar icon.
88
<a href="images/manage_connections.png?raw=true" target="_blank"><div><img src="images/manage_connections.png" alt="Manage connections toolbar icon in the Team Explorer pane" width="500px"/></div></a>
99
1. Click the **Connect** link in the GitHub section.
1010
<a href="images/sign-in-to-github-provider.png?raw=true" target="_blank"><div><img src="images/sign-in-to-github-provider.png" alt="Connect to GitHub" height="300px"/></div></a>
539 KB
Binary file not shown.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public RepositoryCloneViewModelDesigner()
2727
public IRepositorySelectViewModel EnterpriseTab { get; }
2828
public ReactiveCommand<Unit, Unit> Browse { get; }
2929
public ReactiveCommand<Unit, CloneDialogResult> Clone { get; }
30+
public ReactiveCommand<Unit, Unit> LoginAsDifferentUser { get; }
3031

3132
public Task InitializeAsync(IConnection connection)
3233
{

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

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class RepositoryCloneViewModel : ViewModelBase, IRepositoryCloneViewModel
2626
readonly IRepositoryCloneService service;
2727
readonly IGitService gitService;
2828
readonly IUsageTracker usageTracker;
29+
readonly IDialogService dialogService;
2930
readonly IReadOnlyList<IRepositoryCloneTabViewModel> tabs;
3031
string path;
3132
UriString url;
@@ -40,6 +41,7 @@ public RepositoryCloneViewModel(
4041
IRepositoryCloneService service,
4142
IGitService gitService,
4243
IUsageTracker usageTracker,
44+
IDialogService dialogService,
4345
IRepositorySelectViewModel gitHubTab,
4446
IRepositorySelectViewModel enterpriseTab)
4547
{
@@ -48,6 +50,7 @@ public RepositoryCloneViewModel(
4850
this.service = service;
4951
this.gitService = gitService;
5052
this.usageTracker = usageTracker;
53+
this.dialogService = dialogService;
5154

5255
GitHubTab = gitHubTab;
5356
EnterpriseTab = enterpriseTab;
@@ -82,6 +85,8 @@ public RepositoryCloneViewModel(
8285
Open = ReactiveCommand.CreateFromObservable(
8386
() => repository.Select(x => new CloneDialogResult(Path, x?.CloneUrl)),
8487
canOpen);
88+
89+
LoginAsDifferentUser = ReactiveCommand.CreateFromTask(LoginAsDifferentUserAsync);
8590
}
8691

8792
public IRepositorySelectViewModel GitHubTab { get; }
@@ -111,6 +116,8 @@ public int SelectedTabIndex
111116

112117
public IObservable<object> Done => Observable.Merge(Clone, Open);
113118

119+
public ReactiveCommand<Unit, Unit> LoginAsDifferentUser { get; }
120+
114121
public ReactiveCommand<Unit, Unit> Browse { get; }
115122

116123
public ReactiveCommand<Unit, CloneDialogResult> Clone { get; }
@@ -133,7 +140,11 @@ public async Task InitializeAsync(IConnection connection)
133140
EnterpriseTab.Initialize(enterpriseConnection);
134141
}
135142

136-
if (connection == enterpriseConnection)
143+
if (connection == gitHubConnection)
144+
{
145+
SelectedTabIndex = 0;
146+
}
147+
else if (connection == enterpriseConnection)
137148
{
138149
SelectedTabIndex = 1;
139150
}
@@ -155,6 +166,28 @@ public async Task InitializeAsync(IConnection connection)
155166
this.WhenAnyValue(x => x.SelectedTabIndex).Subscribe(x => tabs[x].Activate().Forget());
156167
}
157168

169+
async Task LoginAsDifferentUserAsync()
170+
{
171+
if (await dialogService.ShowLoginDialog() is IConnection connection)
172+
{
173+
var connections = await connectionManager.GetLoadedConnections();
174+
var gitHubConnection = connections.FirstOrDefault(x => x.HostAddress.IsGitHubDotCom());
175+
176+
if (connection == gitHubConnection)
177+
{
178+
SelectedTabIndex = 0;
179+
GitHubTab.Initialize(connection);
180+
GitHubTab.Activate().Forget();
181+
}
182+
else
183+
{
184+
SelectedTabIndex = 1;
185+
EnterpriseTab.Initialize(connection);
186+
EnterpriseTab.Activate().Forget();
187+
}
188+
}
189+
}
190+
158191
void BrowseForDirectory()
159192
{
160193
var result = os.Dialog.BrowseForDirectory(Path, Resources.BrowseForDirectory);

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static string GroupName(KeyValuePair<string, IReadOnlyList<RepositoryListItemMod
129129

130130
async Task LoadItems(bool refresh)
131131
{
132-
if (connection == null && !IsLoading) return;
132+
if (connection == null || IsLoading) return;
133133

134134
Error = null;
135135
IsLoading = true;
@@ -186,22 +186,23 @@ async Task LoadItems(bool refresh)
186186

187187
bool FilterItem(object obj)
188188
{
189-
if (obj is IRepositoryItemViewModel item && !string.IsNullOrWhiteSpace(Filter))
189+
var trimedFilter = Filter?.Trim();
190+
if (obj is IRepositoryItemViewModel item && !string.IsNullOrEmpty(trimedFilter))
190191
{
191-
if (new UriString(Filter).IsHypertextTransferProtocol)
192+
if (new UriString(trimedFilter).IsHypertextTransferProtocol)
192193
{
193194
var urlString = item.Url.ToString();
194195
var urlStringWithGit = urlString + ".git";
195196
var urlStringWithSlash = urlString + "/";
196197
return
197-
urlString.Contains(Filter, StringComparison.OrdinalIgnoreCase) ||
198-
urlStringWithGit.Contains(Filter, StringComparison.OrdinalIgnoreCase) ||
199-
urlStringWithSlash.Contains(Filter, StringComparison.OrdinalIgnoreCase);
198+
urlString.Contains(trimedFilter, StringComparison.OrdinalIgnoreCase) ||
199+
urlStringWithGit.Contains(trimedFilter, StringComparison.OrdinalIgnoreCase) ||
200+
urlStringWithSlash.Contains(trimedFilter, StringComparison.OrdinalIgnoreCase);
200201
}
201202
else
202203
{
203204
return
204-
item.Caption.Contains(Filter, StringComparison.CurrentCultureIgnoreCase);
205+
item.Caption.Contains(trimedFilter, StringComparison.CurrentCultureIgnoreCase);
205206
}
206207
}
207208

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ public interface IRepositoryCloneViewModel : IDialogContentViewModel, IConnectio
5353
/// Gets the command executed when the user clicks "Clone".
5454
/// </summary>
5555
ReactiveCommand<Unit, CloneDialogResult> Clone { get; }
56+
57+
ReactiveCommand<Unit, Unit> LoginAsDifferentUser { get; }
5658
}
5759
}

src/GitHub.Resources/Resources.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.Resources/Resources.cs-CZ.resx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,16 @@ https://git-scm.com/download/win</value>
879879
<value>Přidáno do úložišť</value>
880880
</data>
881881
<data name="OpenFromGitHubSearchOrEnterAUrl" xml:space="preserve">
882-
<value>Search or enter a URL</value>
882+
<value>Vyhledejte nebo zadejte adresu URL.</value>
883+
883884
</data>
884885
<data name="OpenFromGitHubBrowse" xml:space="preserve">
885-
<value>Browse...</value>
886+
<value>Procházet...</value>
886887
</data>
887888
<data name="OpenFromGitHubClone" xml:space="preserve">
888-
<value>Clone</value>
889+
<value>Klon</value>
890+
</data>
891+
<data name="AddChangeAccounts" xml:space="preserve">
892+
<value>Add/Change Accounts</value>
889893
</data>
890894
</root>

src/GitHub.Resources/Resources.de-DE.resx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,16 @@ https://git-scm.com/download/win</value>
879879
<value>Beitrag zu Repositorys</value>
880880
</data>
881881
<data name="OpenFromGitHubSearchOrEnterAUrl" xml:space="preserve">
882-
<value>Search or enter a URL</value>
882+
<value>URL suchen oder eingeben</value>
883+
883884
</data>
884885
<data name="OpenFromGitHubBrowse" xml:space="preserve">
885-
<value>Browse...</value>
886+
<value>Durchsuchen...</value>
886887
</data>
887888
<data name="OpenFromGitHubClone" xml:space="preserve">
888-
<value>Clone</value>
889+
<value>Klonen</value>
890+
</data>
891+
<data name="AddChangeAccounts" xml:space="preserve">
892+
<value>Add/Change Accounts</value>
889893
</data>
890894
</root>

src/GitHub.Resources/Resources.es-ES.resx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,12 +879,16 @@ https://git-scm.com/download/win</value>
879879
<value>Contribución a los repositorios</value>
880880
</data>
881881
<data name="OpenFromGitHubSearchOrEnterAUrl" xml:space="preserve">
882-
<value>Search or enter a URL</value>
882+
<value>Buscar o escribir una dirección URL</value>
883+
883884
</data>
884885
<data name="OpenFromGitHubBrowse" xml:space="preserve">
885-
<value>Browse...</value>
886+
<value>Examinar...</value>
886887
</data>
887888
<data name="OpenFromGitHubClone" xml:space="preserve">
888-
<value>Clone</value>
889+
<value>Clonar</value>
890+
</data>
891+
<data name="AddChangeAccounts" xml:space="preserve">
892+
<value>Add/Change Accounts</value>
889893
</data>
890894
</root>

0 commit comments

Comments
 (0)