Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 12 additions & 2 deletions AxialSqlTools/AxialSqlTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</Compile>
<Compile Include="Modules\ExcelImport.cs" />
<Compile Include="Modules\TsqlFormatterCommentInterleaver.cs" />
<Compile Include="Commands\FormatQueryDialog\FormatOptionsDialog.xaml.cs">
<Compile Include="Commands\Dialogs\FormatOptionsDialog.xaml.cs">
<DependentUpon>FormatOptionsDialog.xaml</DependentUpon>
</Compile>
<Compile Include="SchemaCompare\SchemaCompareWindow.cs" />
Expand All @@ -80,6 +80,9 @@
<Compile Include="Commands\ExportGridToGoogleSheetCommand.cs" />
<Compile Include="Commands\ExportGridToExcelCommand.cs" />
<Compile Include="Commands\FormatQueryCommand.cs" />
<Compile Include="Commands\Dialogs\GoogleSheetsExportSuccessDialog.xaml.cs">
<DependentUpon>GoogleSheetsExportSuccessDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Commands\CopyQueryAsHtmlCommand.cs" />
<Compile Include="Commands\OpenTemplatesFolderCommand.cs" />
<Compile Include="Commands\RefreshTemplatesCommand.cs" />
Expand Down Expand Up @@ -234,6 +237,9 @@
<PackageReference Include="NLog">
<Version>6.0.6</Version>
</PackageReference>
<PackageReference Include="MySqlConnector">
<Version>2.5.0</Version>
</PackageReference>
<PackageReference Include="Npgsql">
<Version>8.0.7</Version>
</PackageReference>
Expand Down Expand Up @@ -285,7 +291,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Commands\FormatQueryDialog\FormatOptionsDialog.xaml">
<Page Include="Commands\Dialogs\FormatOptionsDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Commands\Dialogs\GoogleSheetsExportSuccessDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
8 changes: 4 additions & 4 deletions AxialSqlTools/AxialSqlToolsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ namespace AxialSqlTools
[ProvideToolWindow(typeof(AboutWindow))]
[ProvideToolWindow(typeof(ToolWindowGridToEmail))]
[ProvideToolWindow(typeof(HealthDashboard_Server))]
[ProvideToolWindow(typeof(HealthDashboard_Servers))]
//[ProvideToolWindow(typeof(HealthDashboard_Servers))]
[ProvideToolWindow(typeof(DataTransferWindow))]
[ProvideToolWindow(typeof(AskChatGptWindow))]
//[ProvideToolWindow(typeof(AskChatGptWindow))]
[ProvideToolWindow(typeof(SqlServerBuildsWindow))]
[ProvideToolWindow(typeof(QueryHistoryWindow))]
[ProvideToolWindow(typeof(DatabaseScripterToolWindow))]
Expand Down Expand Up @@ -283,13 +283,13 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
await ExportGridToAsInsertsCommand.InitializeAsync(this);
await ToolWindowGridToEmailCommand.InitializeAsync(this);
await HealthDashboard_ServerCommand.InitializeAsync(this);
await HealthDashboard_ServersCommand.InitializeAsync(this);
//await HealthDashboard_ServersCommand.InitializeAsync(this);
await CopyQueryAsHtmlCommand.InitializeAsync(this);
await DataTransferWindowCommand.InitializeAsync(this);
await DataImportWindowCommand.InitializeAsync(this);
await CheckAddinVersionCommand.InitializeAsync(this);
await ResultGridCopyAsInsertCommand.InitializeAsync(this);
await AskChatGptCommand.InitializeAsync(this);
//await AskChatGptCommand.InitializeAsync(this);
await SqlServerBuildsWindowCommand.InitializeAsync(this);
await QueryHistoryWindowCommand.InitializeAsync(this);
await DatabaseScripterToolWindowCommand.InitializeAsync(this);
Expand Down
11 changes: 6 additions & 5 deletions AxialSqlTools/AxialSqlToolsPackage.vsct
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
<LocCanonicalName>AxialSqlTools.ScriptSelectedObject</LocCanonicalName>
</Strings>
</Button>
<!--
<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialFindObjectInObjectExplorer" priority="0x0000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_Script" />
<CommandFlag>IconAndText</CommandFlag>
Expand All @@ -193,7 +194,7 @@
<Strings>
<ButtonText>Script Result Into a New Window - TODO</ButtonText>
</Strings>
</Button>
</Button>-->

<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialQueryHistoryCommand" priority="0x0000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_Script" />
Expand All @@ -211,14 +212,14 @@
<ButtonText>Health Dashboard - Server</ButtonText>
</Strings>
</Button>
<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialHealthDashboardServersCommand" priority="0x0000" type="Button">
<!--<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialHealthDashboardServersCommand" priority="0x0000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_Health" />
<Icon guid="guidServerHealth" id="bmpServerHealth" />
<CommandFlag>DefaultInvisible</CommandFlag>
<Strings>
<ButtonText>Health Dashboard - Group of Servers</ButtonText>
</Strings>
</Button>
</Button>-->
<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialSqlServerBuildsCommand" priority="0x3000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_Health" />
<Icon guid="guidSqlBuildInfo" id="bmpSqlBuildInfo" />
Expand Down Expand Up @@ -267,7 +268,7 @@
</Strings>
</Button>

<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialAskChatGptCommand" priority="0x0000" type="Button">
<!--<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialAskChatGptCommand" priority="0x0000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_AI" />
<Icon guid="guidChat" id="bmpChat" />
<CommandFlag>DefaultInvisible</CommandFlag>
Expand All @@ -276,7 +277,7 @@
</Strings>
</Button>

<!--<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialBackupTimelineCommand" priority="0x0000" type="Button">
<Button guid="guidAxialSqlToolsPackageCmdSet" id="AxialBackupTimelineCommand" priority="0x0000" type="Button">
<Parent guid="guidAxialSqlToolsPackageCmdSet" id="AxialToolsSubMenuGroup_Timelines" />
<Icon guid="guidDataTransfer" id="bmpDataTransfer" />
<CommandFlag>DefaultInvisible</CommandFlag>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Window x:Class="AxialSqlTools.GoogleSheetsExportSuccessDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Title="Export Complete"
Height="170"
Width="420"
ResizeMode="NoResize"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False">
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="The data has been exported to Google Sheets." TextWrapping="Wrap" />
<TextBlock Grid.Row="1" Margin="0,12,0,0" TextWrapping="Wrap">
<Hyperlink x:Name="SpreadsheetLink" RequestNavigate="SpreadsheetLink_RequestNavigate">
<Run x:Name="SpreadsheetLinkText" />
</Hyperlink>
</TextBlock>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
<Button Width="75" Click="OkButton_Click">OK</Button>
</StackPanel>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Navigation;

namespace AxialSqlTools
{
public partial class GoogleSheetsExportSuccessDialog : Window
{
private readonly string spreadsheetUrl;

public GoogleSheetsExportSuccessDialog(string spreadsheetUrl, string spreadsheetTitle)
{
InitializeComponent();

this.spreadsheetUrl = spreadsheetUrl ?? string.Empty;
SpreadsheetLinkText.Text = string.IsNullOrWhiteSpace(spreadsheetTitle) ? spreadsheetUrl : spreadsheetTitle;

Uri uri;
if (Uri.TryCreate(spreadsheetUrl, UriKind.Absolute, out uri))
{
SpreadsheetLink.NavigateUri = uri;
}
}

private void SpreadsheetLink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
if (!string.IsNullOrWhiteSpace(spreadsheetUrl))
{
try
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = spreadsheetUrl,
UseShellExecute = true
};
Process.Start(psi);
}
catch
{
// Swallow exceptions from launching the browser to keep the dialog responsive.
}
}

e.Handled = true;
}

private void OkButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}
26 changes: 16 additions & 10 deletions AxialSqlTools/Commands/ExportGridToGoogleSheetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,25 @@ private async Task ExecuteAsync()
{
var result = await GoogleSheetsExport.ExportToNewSpreadsheetAsync(dataTables, settings, isShiftPressed, CancellationToken.None);

string message = "The data has been exported to Google Sheets.";
if (!string.IsNullOrEmpty(result.SpreadsheetUrl))
if (string.IsNullOrEmpty(result.SpreadsheetUrl))
{
message += $"\n\n{result.SpreadsheetUrl}";
VsShellUtilities.ShowMessageBox(
this.package,
"The data has been exported to Google Sheets.",
"Export Complete",
OLEMSGICON.OLEMSGICON_INFO,
OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
}
else
{
var dialog = new GoogleSheetsExportSuccessDialog(result.SpreadsheetUrl, result.SpreadsheetTitle)
{
Owner = System.Windows.Application.Current?.MainWindow
};

VsShellUtilities.ShowMessageBox(
this.package,
message,
"Export Complete",
OLEMSGICON.OLEMSGICON_INFO,
OLEMSGBUTTON.OLEMSGBUTTON_OK,
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
dialog.ShowDialog();
}
}
catch (Exception ex)
{
Expand Down
Loading