Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit 6d5eaac

Browse files
author
Jim Przybylinski
authored
Merge pull request #1071 from ILMTitan/include_last_2.0.0_commits
Include last 2.0.0 commits
2 parents 32a030d + 708d0f0 commit 6d5eaac

File tree

15 files changed

+212
-59
lines changed

15 files changed

+212
-59
lines changed

GoogleCloudExtension/GoogleCloudExtension/CloudExplorer/CloudExplorerToolWindowControl.xaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
x:Class="GoogleCloudExtension.CloudExplorer.CloudExplorerToolWindowControl"
1010
xmlns:ext="clr-namespace:GoogleCloudExtension"
1111
xmlns:consoleLinks="clr-namespace:GoogleCloudExtension.CloudExplorerSources.CloudConsoleLinks"
12+
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
13+
xmlns:catalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog"
1214
Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}"
1315
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.WindowTextKey}}"
1416
mc:Ignorable="d"
@@ -90,8 +92,17 @@
9092
<Hyperlink Focusable="False"
9193
Command="{Binding NavigateCommand}"
9294
Style="{DynamicResource {x:Static vsshell:VsResourceKeys.ThemedDialogHyperlinkStyleKey}}">
93-
<TextBlock Focusable="False" Text="{Binding Caption}" />
95+
<Run Focusable="False" Text="{Binding Caption}" />
9496
</Hyperlink>
97+
98+
<TextBlock Focusable="False"
99+
Visibility="{Binding InfoLinkInfo, Converter={utils:NullEmptyInvisibleConverter}}">
100+
<Hyperlink Command="{Binding NavigateInfoCommand}" TextDecorations="None">
101+
<imaging:CrispImage Moniker="{x:Static catalog:KnownMonikers.StatusInformation}"
102+
Width="12"
103+
ToolTip="{Binding InfoLinkInfo.Caption}"/>
104+
</Hyperlink>
105+
</TextBlock>
95106
</TextBlock>
96107
</DataTemplate>
97108

GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/CloudConsoleLinks/ConsoleLink.cs

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// limitations under the License.
1414

1515
using GoogleCloudExtension.CloudExplorer;
16+
using GoogleCloudExtension.Services;
1617
using GoogleCloudExtension.Utils;
1718
using System;
18-
using System.Diagnostics;
1919

2020
namespace GoogleCloudExtension.CloudExplorerSources.CloudConsoleLinks
2121
{
@@ -26,46 +26,59 @@ public class ConsoleLink : TreeLeaf
2626
{
2727
private readonly LinkInfo _linkFormatInfo;
2828
private readonly ICloudSourceContext _context;
29-
private readonly Func<string, Process> _startProcess;
29+
private readonly Lazy<IBrowserService> _browserService =
30+
GoogleCloudExtensionPackage.Instance.GetMefServiceLazy<IBrowserService>();
3031

3132
/// <summary>
3233
/// The command to execute when the link is pressed.
3334
/// </summary>
3435
public ProtectedCommand NavigateCommand { get; }
3536

37+
/// <summary>
38+
/// The link info for the help link, if any.
39+
/// </summary>
40+
public LinkInfo InfoLinkInfo { get; }
41+
42+
/// <summary>
43+
/// The command to navigate to the info link.
44+
/// </summary>
45+
public ProtectedCommand NavigateInfoCommand { get; }
46+
47+
private IBrowserService BrowserService => _browserService.Value;
48+
3649
/// <summary>
3750
/// Creates a new Console Link tree leaf node.
3851
/// </summary>
52+
/// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
3953
/// <param name="linkFormatInfo">
4054
/// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
4155
/// </param>
42-
/// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
43-
public ConsoleLink(LinkInfo linkFormatInfo, ICloudSourceContext context) : this(
44-
linkFormatInfo, context, Process.Start)
45-
{ }
56+
/// <param name="infoLinkInfo">The link info for the help section of the console link.</param>
57+
public ConsoleLink(ICloudSourceContext context, LinkInfo linkFormatInfo, LinkInfo infoLinkInfo) : this(context, linkFormatInfo)
58+
{
59+
InfoLinkInfo = infoLinkInfo;
60+
NavigateInfoCommand.CanExecuteCommand = true;
61+
}
4662

4763
/// <summary>
48-
/// Internal constructor for testing.
64+
/// Creates a new Console Link tree leaf node.
4965
/// </summary>
66+
/// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
5067
/// <param name="linkFormatInfo">
5168
/// The link info with the caption and the <see cref="string.Format(string,object[])"/> ready url format.
5269
/// </param>
53-
/// <param name="context">The <see cref="ICloudSourceContext"/>.</param>
54-
/// <param name="startProcess">
55-
/// Dependency injecion of the static function <see cref="Process.Start(string)"/>.
56-
/// </param>
57-
internal ConsoleLink(LinkInfo linkFormatInfo, ICloudSourceContext context, Func<string, Process> startProcess)
70+
public ConsoleLink(ICloudSourceContext context, LinkInfo linkFormatInfo)
5871
{
59-
_startProcess = startProcess;
6072
_context = context;
6173
_linkFormatInfo = linkFormatInfo;
6274
Caption = _linkFormatInfo.Caption;
6375
NavigateCommand = new ProtectedCommand(OnNavigateCommand);
76+
NavigateInfoCommand = new ProtectedCommand(OnNavigateHelpCommand, false);
6477
}
6578

66-
private void OnNavigateCommand()
67-
{
68-
_startProcess(string.Format(_linkFormatInfo.NavigateUrl, _context.CurrentProject?.ProjectId));
69-
}
79+
private void OnNavigateCommand() => BrowserService.OpenBrowser(
80+
string.Format(_linkFormatInfo.NavigateUrl, _context.CurrentProject?.ProjectId));
81+
82+
private void OnNavigateHelpCommand() => BrowserService.OpenBrowser(InfoLinkInfo.NavigateUrl);
7083
}
7184
}

GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/CloudConsoleLinks/ConsoleLinkGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace GoogleCloudExtension.CloudExplorerSources.CloudConsoleLinks
2222
public class ConsoleLinkGroup : TreeHierarchy
2323
{
2424
public ConsoleLinkGroup(string caption, ICloudSourceContext context, IEnumerable<LinkInfo> groupLinks) : base(
25-
groupLinks.Select(l => new ConsoleLink(l, context)))
25+
groupLinks.Select(l => new ConsoleLink(context, l)))
2626
{
2727
Caption = caption;
2828
}

GoogleCloudExtension/GoogleCloudExtension/CloudExplorerSources/CloudConsoleLinks/ConsoleLinksRoot.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ public class ConsoleLinksRoot : TreeHierarchy, ISourceRootViewModelBase
6161
private const string PubSubPath = "cloudpubsub";
6262
private const string MachineLearningEnginePath = "mlengine";
6363

64+
private const string KubernetesCodelabLink =
65+
"https://codelabs.developers.google.com/codelabs/cloud-kubernetes-aspnetcore/";
66+
6467
internal static readonly LinkInfo s_consoleHomeFormatInfo = new LinkInfo(
6568
HomeUrl, Resources.CloudExplorerConsoleLinkCaption);
6669

67-
private static readonly IReadOnlyList<(string, string)> s_primaryConsoleLinkPaths = new[]
70+
private static readonly IReadOnlyList<(string path, string caption)> s_primaryConsoleLinkPaths = new[]
6871
{
6972
(AppEnginePath, Resources.CloudLinkAppEngineCaption),
7073
(ComputeEnginePath, Resources.CloudLinkComputeEngineCaption),
@@ -129,6 +132,11 @@ public class ConsoleLinksRoot : TreeHierarchy, ISourceRootViewModelBase
129132
})
130133
};
131134

135+
private static readonly IReadOnlyDictionary<string, LinkInfo> s_helpLinks = new Dictionary<string, LinkInfo>
136+
{
137+
[KubernetesEnginePath] = new LinkInfo(KubernetesCodelabLink, Resources.ConsoleLinksKubernetesInfoTooltip)
138+
};
139+
132140
private readonly Func<string, Process> _startProcess;
133141

134142
private readonly ICloudSourceContext _context;
@@ -163,9 +171,14 @@ internal ConsoleLinksRoot(ICloudSourceContext context, Func<string, Process> sta
163171
Caption = s_consoleHomeFormatInfo.Caption;
164172
NavigateCommand = new ProtectedCommand(OnNavigateCommand);
165173

166-
foreach (LinkInfo formatLinkInfo in PrimaryConsoleLinkFormats)
174+
foreach ((string path, string caption) tuple in s_primaryConsoleLinkPaths)
167175
{
168-
Children.Add(new ConsoleLink(formatLinkInfo, _context));
176+
LinkInfo linkInfo = PathTupleToLinkInfo(tuple);
177+
ConsoleLink consoleLink = s_helpLinks.ContainsKey(tuple.path) ?
178+
new ConsoleLink(_context, linkInfo, s_helpLinks[tuple.path]) :
179+
new ConsoleLink(_context, linkInfo);
180+
181+
Children.Add(consoleLink);
169182
}
170183

171184
foreach ((string groupCaption, IEnumerable<LinkInfo> linkInfos) in GroupedConsoleLinkFormats)

GoogleCloudExtension/GoogleCloudExtension/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
// This version number matches the version in the .vsixmanifest. Please update both versions at the
3737
// same time.
38-
[assembly: AssemblyVersion("2.0.1.0")]
39-
[assembly: AssemblyFileVersion("2.0.1.0")]
38+
[assembly: AssemblyVersion("2.0.2.0")]
39+
[assembly: AssemblyFileVersion("2.0.2.0")]
4040

4141
[assembly: InternalsVisibleTo(
4242
"GoogleCloudExtensionUnitTests," +

GoogleCloudExtension/GoogleCloudExtension/PublishDialog/Steps/CoreGceWarning/CoreGceWarningStepContent.xaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
d:DesignHeight="247"
2929
d:DesignWidth="476"
3030
d:DataContext="{d:DesignInstance local:CoreGceWarningStepViewModel}">
31-
<DockPanel VerticalAlignment="Stretch" Margin="36,0,36,0">
31+
<DockPanel VerticalAlignment="Stretch" Margin="24,0,24,0">
3232
<CheckBox DockPanel.Dock="Bottom"
3333
IsChecked="{Binding Options.DoNotShowAspNetCoreGceWarning}"
3434
HorizontalAlignment="Right"
@@ -45,18 +45,30 @@
4545

4646
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center">
4747
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine1}" />
48-
49-
<LineBreak/>
50-
<LineBreak/>
48+
<LineBreak />
49+
<LineBreak />
5150

5251
<wpf:WhitespaceDiscardingSpan>
5352
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine2BeforeLink}" />
5453

54+
<Hyperlink Command="{Binding BrowseAspNetMarketplaceImage}">
55+
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine2MarketplaceLink}" />
56+
</Hyperlink>
57+
58+
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine2AfterLink}" />
59+
</wpf:WhitespaceDiscardingSpan>
60+
61+
<LineBreak />
62+
<LineBreak />
63+
64+
<wpf:WhitespaceDiscardingSpan>
65+
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine3BeforeLink}" />
66+
5567
<Hyperlink Command="{Binding BrowseAspNetCoreIisDocs}">
56-
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine2HyperLink}" />
68+
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine3DocsLink}" />
5769
</Hyperlink>
5870

59-
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine2AfterLink}"/>
71+
<Run Text="{x:Static ext:Resources.PublishGceWarningStepLine3AfterLink}" />
6072
</wpf:WhitespaceDiscardingSpan>
6173
</TextBlock>
6274
</DockPanel>

GoogleCloudExtension/GoogleCloudExtension/PublishDialog/Steps/CoreGceWarning/CoreGceWarningStepViewModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public class CoreGceWarningStepViewModel : ValidatingViewModelBase, IPublishDial
2727
{
2828
public const string AspNetCoreIisDocsLink = "https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/";
2929

30+
public const string AspNetMarketplaceImageLink =
31+
"https://console.cloud.google.com/marketplace/details/click-to-deploy-images/aspnet";
32+
3033
private readonly IPublishDialog _publishDialog;
3134
private readonly GceStepContent _nextStepContent;
3235
private readonly Lazy<IBrowserService> _browserService;
@@ -57,16 +60,22 @@ public class CoreGceWarningStepViewModel : ValidatingViewModelBase, IPublishDial
5760
public ProtectedCommand BrowseAspNetCoreIisDocs { get; }
5861
private IBrowserService BrowserService => _browserService.Value;
5962

63+
public ProtectedCommand BrowseAspNetMarketplaceImage { get; }
64+
6065
public CoreGceWarningStepViewModel(IPublishDialog publishDialog)
6166
{
6267
_publishDialog = publishDialog;
6368
BrowseAspNetCoreIisDocs = new ProtectedCommand(OnBrowseAspNetCoreIisDocs);
69+
BrowseAspNetMarketplaceImage = new ProtectedCommand(OnBrowseAspNeMarketplaceImage);
6470
Title = string.Format(Resources.GcePublishStepTitle, publishDialog.Project.Name);
6571
ActionCommand = new ProtectedCommand(OnNextCommand);
6672
_nextStepContent = new GceStepContent(_publishDialog);
6773
_browserService = GoogleCloudExtensionPackage.Instance.GetMefServiceLazy<IBrowserService>();
6874
}
6975

76+
private void OnBrowseAspNeMarketplaceImage() =>
77+
BrowserService.OpenBrowser(AspNetMarketplaceImageLink);
78+
7079
private void OnBrowseAspNetCoreIisDocs() =>
7180
BrowserService.OpenBrowser(AspNetCoreIisDocsLink);
7281

GoogleCloudExtension/GoogleCloudExtension/Resources.Designer.cs

Lines changed: 39 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GoogleCloudExtension/GoogleCloudExtension/Resources.resx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,14 +2489,26 @@ Delete corrupted file?</value>
24892489
<comment>The first line of the ASP.NET Core on GCE warning dialog.</comment>
24902490
</data>
24912491
<data name="PublishGceWarningStepLine2BeforeLink" xml:space="preserve">
2492-
<value>Hosting ASP.NET Core applications on Compute Engine requires </value>
2492+
<value>Hosting ASP.NET Core applications on Compute Engine should use the </value>
24932493
<comment>The first part of the second line of the ASP.NET Core on GCE warning dialog.</comment>
24942494
</data>
2495-
<data name="PublishGceWarningStepLine2HyperLink" xml:space="preserve">
2495+
<data name="PublishGceWarningStepLine2MarketplaceLink" xml:space="preserve">
2496+
<value>ASP.NET Framework Marketplace Image</value>
2497+
<comment>The text of the link to the ASP.NET Framework Marketplace </comment>
2498+
</data>
2499+
<data name="PublishGceWarningStepLine2AfterLink" xml:space="preserve">
2500+
<value>.</value>
2501+
<comment>The text after the link of the second line of the ASP.NET Core on GCE warning dialog.</comment>
2502+
</data>
2503+
<data name="PublishGceWarningStepLine3BeforeLink" xml:space="preserve">
2504+
<value>The default windows image will require </value>
2505+
<comment>The part between the links of the second line of the ASP.NET Core on GCE warning dialog.</comment>
2506+
</data>
2507+
<data name="PublishGceWarningStepLine3DocsLink" xml:space="preserve">
24962508
<value>manual configuration of IIS</value>
24972509
<comment>The text of the hyperlink on the ASP.NET Core on GCE Warning dialog.</comment>
24982510
</data>
2499-
<data name="PublishGceWarningStepLine2AfterLink" xml:space="preserve">
2511+
<data name="PublishGceWarningStepLine3AfterLink" xml:space="preserve">
25002512
<value>.</value>
25012513
<comment>The end part of the second line of the ASP.NET Core on GCE warning dialog.</comment>
25022514
</data>
@@ -2507,4 +2519,8 @@ Delete corrupted file?</value>
25072519
<data name="UiDontShowWarningAgain" xml:space="preserve">
25082520
<value>Don't show this warning again</value>
25092521
</data>
2522+
<data name="ConsoleLinksKubernetesInfoTooltip" xml:space="preserve">
2523+
<value>Kubernetes Engine Code Lab</value>
2524+
<comment>The tooltip of the info link of the kubernetes console link.</comment>
2525+
</data>
25102526
</root>

GoogleCloudExtension/GoogleCloudExtension/source.extension.vsixmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The Version attribute of the Identity element *must* match the version number in Properties\AssemblyInfo.cs, to ensure
66
accurate metrics.
77
-->
8-
<Identity Id="GoogleAppEngine.Google.d3d3eeb8-3710-4bd9-97ba-1401bf2acd22" Version="2.0.1.0" Language="en-US" Publisher="Google Inc." />
8+
<Identity Id="GoogleAppEngine.Google.d3d3eeb8-3710-4bd9-97ba-1401bf2acd22" Version="2.0.2.0" Language="en-US" Publisher="Google Inc." />
99
<DisplayName>Google Cloud Tools for Visual Studio</DisplayName>
1010
<Description xml:space="preserve">Tools to develop applications for Google Cloud Platform.</Description>
1111
<MoreInfo>https://cloud.google.com/visual-studio/</MoreInfo>

0 commit comments

Comments
 (0)